HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUI_GroupData.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GUI_GroupData.h (GUI Library)
7  *
8  * COMMENTS:
9  */
10 #ifndef __GUI_GroupData_h__
11 #define __GUI_GroupData_h__
12 
13 #include "GUI_API.h"
14 #include <GR/GR_Defines.h>
15 #include <GR/GR_TextureRef.h>
16 #include <GU/GU_Selection.h>
17 #include <GU/GU_SelectType.h>
18 #include <GA/GA_Types.h>
19 #include <RE/RE_RenderContext.h>
20 #include <RE/RE_Texture.h>
21 #include <UT/UT_IntrusivePtr.h>
22 
23 class RE_Render;
24 class RE_Geometry;
25 class RE_ShaderHandle;
26 class GUI_GeoRender;
28 class GU_Detail;
29 class UT_Color;
30 
31 class RV_VKImage;
32 class RV_VKBuffer;
33 
34 /// Holds information sbout groups for display in the viewport.
35 class GUI_API GUI_GroupData : public UT_IntrusiveRefCounter<GUI_GroupData>
36 {
37 public:
39  GUI_GeoRender &owner,
40  const GR_CommonDispOption &options,
42  GU_SelectionHandle *selection = nullptr,
43  UT_StringHolder *name = nullptr);
44  ~GUI_GroupData();
45 
46  const UT_StringHolder &groupMask() const;
47  GA_GroupType groupType() const;
48  GR_TextureRef colorTexture() const;
49  bool hasColorTexture() const;
50 
51  // These values are used for drawing primitive groups.
52  RE_Texture *idTexture() const;
53  RV_VKBuffer *idBuffer() const;
54  int minId() const;
55  int maxId() const;
56 
57  // These values are used for drawing point and edge groups.
58  RE_ShaderHandle *shader(bool uv_viewport) const;
59  RE_Geometry *geometry() const;
60 
61  // Returns true if the provided mask specifies an adhoc group
62  // (basically anything that isn't recognized as a connectivity
63  // specifier, attribute range, or group name mask.
64  static bool isAdhocGroupMask(const char *mask);
65 
66  // Returns a magic group name that is used to trigger the use of the
67  // cook selection group from the detail, rather than a named group or
68  // an ad-hoc group.
69  static UT_StringRef cookSelectionGroupMask();
70 
71 private:
72  void createIdTexture(RE_RenderContext r,
73  const int *id_data,
74  int numids);
75  void createColorTexture(RE_RenderContext r,
76  const UT_ValArray<uint8> &color_data);
77 
78  void initializePackedPrimsFromPoints(RE_RenderContext r,
79  const GU_Detail &gdp,
80  const UT_Array<int32> &id_data);
81  void initializeFromConnectivity(RE_RenderContext r);
82  void initializeFromAttrib(RE_RenderContext r);
83  void initializeFromAdhocGroup(RE_RenderContext r);
84 
85  bool initializeFromGroup(
88  const GA_Group *group = nullptr,
89  const UT_StringRef *name = nullptr,
90  const UT_Color *override_color = nullptr);
91  void initializeFromPrimGroups(RE_RenderContext r,
92  const GA_PrimitiveGroup *group = nullptr,
93  const UT_StringRef *name = nullptr,
94  const UT_Color *override_color = nullptr);
95  void initializeFromPointGroups(RE_RenderContext r,
96  const GA_PointGroup *group = nullptr,
97  const UT_StringRef *name = nullptr,
98  const UT_Color *override_color = nullptr);
99  void initializeFromEdgeGroups(RE_RenderContext r,
100  const GA_EdgeGroup *group = nullptr,
101  const UT_StringRef *name = nullptr,
102  const UT_Color *override_color = nullptr);
103  void initializeFromVertexGroups(RE_RenderContext r,
104  const GA_VertexGroup *group = nullptr,
105  const UT_StringRef *name = nullptr,
106  const UT_Color *override_color = nullptr);
107 
108  GUI_GeoRender &myOwnerGeoRender;
109  UT_StringHolder myGroupMask;
110  GA_GroupType myGroupType;
111  UT_StringHolder myAttribName;
112  UT_StringHolder myAttribValueMask;
113  GA_AttributeOwner myAttribOwner;
114  GU_Connectivity myConnectivity;
115  RE_Texture *myColorTextureGL;
116 
117  RE_Texture *myIdTextureGL;
118  int myMinId;
119  int myMaxId;
120 
121  RE_Geometry *myGeometry;
122 
123 #ifdef USE_VULKAN
124  UT_UniquePtr<RV_VKImage> myColorTextureVK;
125  UT_UniquePtr<RV_VKBuffer> myIdBufferVK;
126 #endif
127 };
128 
130 
131 #endif
GT_API const UT_StringHolder selection
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
Holds information sbout groups for display in the viewport.
Definition: GUI_GroupData.h:35
A reference counter base class for use with UT_IntrusivePtr.
Temporary container for either a RV_Render and an RE_Render.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
UT_IntrusivePtr< const GUI_GroupData > GUI_GroupDataHandle
#define GUI_API
Definition: GUI_API.h:10
GU_Connectivity
Definition: GU_SelectType.h:66
GLint GLuint mask
Definition: glcorearb.h:124
GLuint const GLchar * name
Definition: glcorearb.h:786
UT_SharedPtr< GU_Selection > GU_SelectionHandle
GLuint shader
Definition: glcorearb.h:785
GA_AttributeOwner
Definition: GA_Types.h:34
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:160
GLboolean r
Definition: glcorearb.h:1222
A vulkan buffer object.
Definition: RV_VKBuffer.h:80
type
Definition: core.h:1059
Simple interface to building a shader from a .prog file.