1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright 2019, Blender Foundation.
*/
/** \file
* \ingroup draw_engine
*/
#ifndef __SELECT_PRIVATE_H__
#define __SELECT_PRIVATE_H__
#include "DRW_render.h"
/* GPUViewport.storage
* Is freed everytime the viewport engine changes */
typedef struct SELECTID_StorageList {
struct SELECTID_PrivateData *g_data;
} SELECTID_StorageList;
typedef struct SELECTID_PassList {
struct DRWPass *select_id_face_pass;
struct DRWPass *select_id_edge_pass;
struct DRWPass *select_id_vert_pass;
} SELECTID_PassList;
typedef struct SELECTID_Data {
void *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
SELECTID_PassList *psl;
SELECTID_StorageList *stl;
} SELECTID_Data;
typedef struct SELECTID_Shaders {
/* Depth Pre Pass */
struct GPUShader *select_id_flat;
struct GPUShader *select_id_uniform;
} SELECTID_Shaders;
typedef struct SELECTID_PrivateData {
DRWShadingGroup *shgrp_face_unif;
DRWShadingGroup *shgrp_face_flat;
DRWShadingGroup *shgrp_edge;
DRWShadingGroup *shgrp_vert;
DRWView *view_faces;
DRWView *view_edges;
DRWView *view_verts;
} SELECTID_PrivateData; /* Transient data */
struct BaseOffset {
/* For convenience only. */
union {
uint offset;
uint face_start;
};
union {
uint face;
uint edge_start;
};
union {
uint edge;
uint vert_start;
};
uint vert;
};
struct SELECTID_Context {
struct GPUFrameBuffer *framebuffer_select_id;
struct GPUTexture *texture_u32;
struct BaseOffset *index_offsets;
uint objects_len;
uint last_object_drawn;
/** Total number of items `base_array_index_offsets[bases_len - 1].vert`. */
uint last_index_drawn;
short select_mode;
};
/* select_engine.c */
struct SELECTID_Context *select_context_get(void);
/* select_draw_utils.c */
void draw_select_framebuffer_select_id_setup(struct SELECTID_Context *r_select_ctx);
short select_id_get_object_select_mode(Scene *scene, Object *ob);
void select_id_draw_object(void *vedata,
View3D *v3d,
Object *ob,
short select_mode,
uint initial_offset,
uint *r_vert_offset,
uint *r_edge_offset,
uint *r_face_offset);
#endif /* __SELECT_PRIVATE_H__ */
|