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 <GU/GU_Selection.h>
16 #include <GU/GU_SelectType.h>
17 #include <GA/GA_Types.h>
18 #include <RE/RE_Texture.h>
19 #include <UT/UT_IntrusivePtr.h>
20 
21 class RE_Render;
22 class RE_Geometry;
23 class RE_ShaderHandle;
24 class GUI_GeoRender;
26 class GU_Detail;
27 class UT_Color;
28 
29 /// Holds information sbout groups for display in the viewport.
30 class GUI_API GUI_GroupData : public UT_IntrusiveRefCounter<GUI_GroupData>
31 {
32 public:
34  GUI_GeoRender &owner,
35  const GR_CommonDispOption &options,
36  RE_Render *r,
37  GU_SelectionHandle *selection = nullptr,
38  UT_StringHolder *name = nullptr);
39  ~GUI_GroupData();
40 
41  const UT_StringHolder &groupMask() const;
42  GA_GroupType groupType() const;
43  RE_Texture *colorTexture() const;
44 
45  // These values are used for drawing primitive groups.
46  RE_Texture *idTexture() const;
47  int minId() const;
48  int maxId() const;
49 
50  // These values are used for drawing point and edge groups.
51  RE_ShaderHandle *shader(bool uv_viewport) const;
52  RE_Geometry *geometry() const;
53 
54  // Returns true if the provided mask specifies an adhoc group
55  // (basically anything that isn't recognized as a connectivity
56  // specifier, attribute range, or group name mask.
57  static bool isAdhocGroupMask(const char *mask);
58 
59  // Returns a magic group name that is used to trigger the use of the
60  // cook selection group from the detail, rather than a named group or
61  // an ad-hoc group.
62  static UT_StringRef cookSelectionGroupMask();
63 
64 private:
65  void createIdTexture(RE_Render *r,
66  const int *id_data,
67  int numids);
68  void createColorTexture(RE_Render *r,
69  const UT_ValArray<uint8> &color_data);
70 
71  void initializePackedPrimsFromPoints(RE_Render *r,
72  const GU_Detail &gdp,
73  const UT_Array<int32> &id_data);
74  void initializeFromConnectivity(RE_Render *r);
75  void initializeFromAttrib(RE_Render *r);
76  void initializeFromAdhocGroup(RE_Render *r);
77 
78  bool initializeFromGroup(
79  RE_Render *r,
81  const GA_Group *group = nullptr,
82  const UT_StringRef *name = nullptr,
83  const UT_Color *override_color = nullptr);
84  void initializeFromPrimGroups(RE_Render *r,
85  const GA_PrimitiveGroup *group = nullptr,
86  const UT_StringRef *name = nullptr,
87  const UT_Color *override_color = nullptr);
88  void initializeFromPointGroups(RE_Render *r,
89  const GA_PointGroup *group = nullptr,
90  const UT_StringRef *name = nullptr,
91  const UT_Color *override_color = nullptr);
92  void initializeFromEdgeGroups(RE_Render *r,
93  const GA_EdgeGroup *group = nullptr,
94  const UT_StringRef *name = nullptr,
95  const UT_Color *override_color = nullptr);
96  void initializeFromVertexGroups(RE_Render *r,
97  const GA_VertexGroup *group = nullptr,
98  const UT_StringRef *name = nullptr,
99  const UT_Color *override_color = nullptr);
100 
101  GUI_GeoRender &myOwnerGeoRender;
102  UT_StringHolder myGroupMask;
103  GA_GroupType myGroupType;
104  UT_StringHolder myAttribName;
105  UT_StringHolder myAttribValueMask;
106  GA_AttributeOwner myAttribOwner;
107  GU_Connectivity myConnectivity;
108  RE_Texture *myColorTexture;
109 
110  RE_Texture *myIdTexture;
111  int myMinId;
112  int myMaxId;
113 
114  RE_Geometry *myGeometry;
115 };
116 
118 
119 #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:30
GLuint const GLchar * name
Definition: glcorearb.h:786
A reference counter base class for use with UT_IntrusivePtr.
UT_IntrusivePtr< const GUI_GroupData > GUI_GroupDataHandle
#define GUI_API
Definition: GUI_API.h:10
GLint GLuint mask
Definition: glcorearb.h:124
GU_Connectivity
Definition: GU_SelectType.h:66
UT_SharedPtr< GU_Selection > GU_SelectionHandle
GLuint shader
Definition: glcorearb.h:785
GA_AttributeOwner
Definition: GA_Types.h:33
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:159
GLboolean GLuint group
Definition: glew.h:2750
type
Definition: core.h:1059
GLboolean r
Definition: glcorearb.h:1222
Simple interface to building a shader from a .prog file.