HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_GeoRenderGL.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: GR_GeoRender.h ( GR Library, C++)
7  *
8  * COMMENTS:
9  * Base class for all drawing methds that Houdini is natively capable of
10  * rendering with OpenGL.
11  */
12 #ifndef GR_GeoRenderGL_H
13 #define GR_GeoRenderGL_H
14 
15 #include "GR_GeoRender.h"
16 
17 #include <RE/RE_Types.h>
18 
19 class RE_Render;
20 class RE_ElementArray;
21 class RE_Geometry;
22 class RE_Render;
23 class RE_Shader;
24 class RE_VertexArray;
25 
27 {
28 public:
29  GR_GeoRenderGL(GR_Primitive *parent_prim);
30  ~GR_GeoRenderGL() override;
31 
32  /// add an array to, or update an array in, an instance group. If
33  /// 'instance_group' is -1, RE_VertexArray must specify an instance group
34  /// via setInstanceGroup().
35  virtual void updateInstanceGroupArray(const RE_VertexArray *array,
36  int instance_group = -1,
37  const char *attrib_name = NULL,
40 
41 
42  RE_Geometry *createGeometry(int npoints = 0);
43  RE_Geometry *getGeometry() override { return myGeometry; }
44  void retireGeometry() override;
45 
46  void getPickConnectGroup(unsigned int pick_mode,
47  GR_PickGeometry pick_geo,
48  int &out_connect_start,
49  int &out_connect_num) override;
50 
51  // Creates an RE_OverrideList (or adds to an existing one) for the color
52  // and uv overrides if required. Cleanup will undo any changes to the
53  // state setup made.
54  void setupGeoOverride(
55  RE_Render *r,
56  const GR_DisplayOption *opt,
57  RE_Geometry *geo,
58  UT_UniquePtr<RE_OverrideList> &override_list);
59  void cleanupGeoOverride(
60  RE_Render *r,
61  const GR_DisplayOption *opt,
62  RE_Geometry *geo);
63 
64  static RE_VertexArray *getDirtyAttribArray(
65  RE_Render *r,
66  RE_Geometry *geo,
67  const char *attrib_name,
68  const GT_DataArrayHandle &h,
69  const GR_DisplayOption &opts,
70  RE_ArrayType atype,
71  RE_CacheVersion attr_version);
72 
73  static void fillGeoAttribs(RE_Render *r,
74  const GT_Primitive *prim,
75  const GR_UpdateParms &p,
76  RE_Geometry *geo,
77  bool needs_nml,
78  bool needs_uv,
79  bool needs_tangent,
80  bool need_prim_vert_info,
81  const GT_DataArrayHandle &point_norm,
82  GR_BasePrimType packed_type,
83  bool build_point_id,
84  bool build_prim_id,
85  GR_GeoRenderGL *geo_ren = nullptr,
86  bool *has_detail_prim_id = nullptr,
87  int *detail_prim_id = nullptr,
88  int *num_bone_deform = nullptr);
89 
90 
91 protected:
92  void initLights(RE_Render *r,
93  RE_Shader *sh,
96  const GR_DisplayOption *opt);
97 
98  // For picking, these methods turn the GT __primitive_id, __vertex_id and
99  // points (__vertex_id + vertexlist)
100  void buildPointID(RE_Render *r,
101  const GT_Primitive &prim,
102  const GU_ConstDetailHandle &geo,
103  RE_CacheVersion geo_version);
104  void buildPrimitiveID(RE_Render *r,
105  const GT_Primitive &primh,
106  const GU_ConstDetailHandle &geo,
107  RE_CacheVersion geo_version);
108 
109  // GL32 stuff.
111  const GR_UpdateParms &parms,
112  RE_Geometry &obj,
113  const GT_PrimitiveHandle &primh,
114  const GT_DataArrayHandle &vertexlist);
115 
117  RE_VertexArray *select_array,
118  int length,
119  const GU_Detail &geo,
120  const GT_DataArrayHandle &vh,
121  const GT_DataArrayHandle &vl,
122  const GA_PointGroup *pntsel,
123  bool use_vertex_for_point_select,
124  bool &init);
125 
127  RE_VertexArray *select_array,
128  int length,
129  const GU_Detail &geo,
130  const GT_DataArrayHandle &vh,
131  const GA_VertexGroup *vertsel,
132  bool &init);
133 
135  RE_VertexArray *select_array,
136  int length,
137  const GU_Detail &geo,
138  const GT_DataArrayHandle &vt,
139  const GT_DataArrayHandle &vert_list,
140  const GA_EdgeGroup *edgesel,
141  bool &init);
142 
144  RE_VertexArray *sel_array,
145  const GT_DataArrayHandle &vh,
146  const GA_PrimitiveGroup *primsel,
147  bool &init);
148 
149  virtual GR_SelectMode addToBreakpointSelection(RE_Render *r,
151  int bpnt_len,
152  const GA_BreakpointGroup *bps,
153  bool &init);
154 
155  GR_SelectMode buildInstanceSelection(RE_Render *r,
156  const GR_UpdateParms &p,
157  RE_Geometry &obj);
158 
159  void fillAttributesGL3(RE_Render *r,
160  const GT_Primitive *prim,
161  const GR_UpdateParms &p,
162  RE_Geometry *geo,
163  bool needs_nml,
164  bool needs_uv,
165  bool needs_tangent,
166  bool need_prim_vert_info,
167  const GT_DataArrayHandle &point_norm);
168 
169  /// Set selection uniforms SELECT_MODE and SELECT_INSTANCE. Returns an int
170  /// which should be passed to cleanup selection.
171  virtual int setupSelection(RE_Render *r,
172  const GR_DisplayOption *opt,
174  bool supports_outline = false) const;
175 
176  /// Clean up selection uniforms; much be paired with a setupSelection().
177  virtual void cleanupSelection(RE_Render *r, int key) const;
178 
179  void updateWireColor(RE_Render *r,
180  RE_Geometry *geo,
181  const GR_DisplayOption *opt,
182  int start_draw_idx,
183  int num_draw_idx = 1) const;
184 
185  // Data
187 };
188 
189 #endif
GLbitfield flags
Definition: glcorearb.h:1596
GR_SelectMode addToEdgeSelection(const UT_Span< T > &out_select, const GU_Detail &geo, const GT_DataArrayHandle &vt, const GT_DataArrayHandle &vert_list, const GA_EdgeGroup *edgesel, bool &init)
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
GR_SelectMode addToPrimSelection(const UT_Span< uint8 > &out_select, const GT_DataArrayHandle &vh, const GA_PrimitiveGroup *primsel, bool &init)
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
set of parameters sent to GR_Primitive::update()
RE_GenericAttribID
Definition: RE_Types.h:348
GR_RenderMode
Definition: GR_Defines.h:47
GR_BasePrimType
Definition: GR_Defines.h:352
vint4 select(const vbool4 &mask, const vint4 &a, const vint4 &b)
Definition: simd.h:4816
#define GR_API
Definition: GR_API.h:10
GR_API GR_SelectMode buildSelection(UT_Array< uint8 > &selected, const GR_UpdateParms &p, GT_DataArrayHandle prim_id, GT_DataArrayHandle pnt_id, GT_DataArrayHandle vert_id, bool is_offset, int repeat_count)
GR_RenderFlags
Definition: GR_Defines.h:85
The base class for all GT primitive types.
Definition: GT_Primitive.h:43
GR_SelectMode addToPointSelection(const UT_Span< T > &out_select, const GU_Detail &geo, const GT_DataArrayHandle &vh, const GT_DataArrayHandle &vl, const GA_PointGroup *pntsel, bool use_vertex_for_point_select, bool &init)
RE_Geometry * getGeometry() override
GLenum mode
Definition: glcorearb.h:99
virtual void retireGeometry()
Definition: GR_GeoRender.h:86
virtual void getPickConnectGroup(unsigned int pick_mode, GR_PickGeometry pick_geo, int &out_connect_start, int &out_connect_num)
Definition: GR_GeoRender.h:100
GR_PickGeometry
Definition: GR_PickRecord.h:60
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
RE_ArrayType
Definition: RE_Types.h:337
Simple class for a mutli-integer cache tag.
GLboolean r
Definition: glcorearb.h:1222
GR_SelectMode addToVertexSelection(const UT_Span< uint8 > &out_select, const GU_Detail &geo, const GT_DataArrayHandle &vh, const GA_VertexGroup *vertsel, bool &init)
RE_Geometry * myGeometry
GR_SelectMode
Definition: GR_Defines.h:229