HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_PolyCurveGL3.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_PolyCurveGL3.h ( GR Library, C++)
7  *
8  * COMMENTS:
9  * Polygon curve rendering in GL3.
10  */
11 #ifndef GR_PolyCurveGL3_h
12 #define GR_PolyCurveGL3_h
13 
14 #include "GR_GeoRenderGL.h"
15 #include <GT/GT_DataArray.h>
16 #include <RE/RE_Material.h>
17 
18 class GU_Detail;
19 class RE_VertexArray;
20 class GT_PrimCurveMesh;
21 class RE_Shader;
22 
23 // The non-extruded line connectivity (GL_LINES). All others will
24 // have thickness when in shaded modes (TODO)
25 #define GR_BASIC_WIRE_IDX 1
26 
28 {
29 public:
31  ~GR_PolyCurveGL3() override;
32 
33  void setSubdivisionCurve(bool subdiv);
34 
35  const char *className() const override { return "GR_PolyCurveGL3"; }
36 
38  const GT_PrimitiveHandle &primh,
39  const GR_UpdateParms &parms,
40  const char *cache_name) override;
41 
42  void draw(RE_RenderContext r,
45  GR_DrawParms dp) override;
46 
47  bool supportsInstances() const override { return true; }
48  void geometryUpdated(RE_RenderContext r) override;
49 
50  static GT_PrimitiveHandle getCurveMesh(const GT_PrimitiveHandle &primh,
51  const GR_UpdateParms &parms);
52 
53  void setSplineParms(const void *spline,
54  int nu, int nv,
55  bool uwrap, bool vwrap,
56  int density)
57  { mySpline = spline;
58  myNumU = nu;
59  myNumV = nv;
60  myDensity = density;
61  myWrapU = uwrap;
62  myWrapV = vwrap;
63  }
64 
65  exint getNumGLPrimitives() const override;
66 
67  // fetch LOD parameters for SudD curves based on display options
68  static void getLODParms(const GR_DisplayOption *opt,
69  UT_Vector2F &lod_parms);
70 private:
71 
72  void buildConnectivity(RE_Render *r,
73  const GT_PrimCurveMesh *cmesh,
74  const char *cache_name,
75  RE_CacheVersion geo_version,
76  const RE_MaterialAtlas &mats);
77 
78  void addCurveToElement(RE_Render *r,
79  const GT_PrimCurveMesh *cmesh,
80  int curve_indexi,
81  RE_ElementArray *element,
82  const int curve_vertex_cutoff,
83  UT_IntArray &temp);
84 
85  inline int getNumMaterials() const
86  { return myMaterials.entries(); }
87 
88  void buildPrimInfo(RE_Render *r,
89  const GT_PrimCurveMesh *cmesh,
90  const GR_UpdateParms &parms,
91  RE_CacheVersion geo_version,
92  RE_Geometry *geo);
93 
94  void buildLineConnectivity(RE_Render *r,
95  const GT_PrimCurveMesh *cmesh,
96  const char *cache_name,
98 
100  const GR_DisplayOption *opt,
102  bool support_outline=false) const override;
103 
106  int bpnt_len,
107  const GA_BreakpointGroup *bpnt_sel,
108  bool &init) override;
109 
110  void drawHairShadow(RE_Render *r,
111  const GR_DisplayOption *opt,
112  int num_materials,
113  int instance_group,
114  bool subdiv);
115 
116  void updateFeatherAttribs(RE_Render *r,
117  const GT_PrimCurveMesh *cmesh,
118  RE_CacheVersion &geo_version);
119 
120  struct BarbAttrib
121  {
122  UT_StringRef myName;
123  UT_StringRef myVarName;
124  int myVecSize = 3;
125  RE_VertexArray *myArray = nullptr;
126  exint myPointCount = 0;
127  };
128 
129  struct BarbConfig
130  {
131  int myDrawMode;
132  };
133 
134  RE_VertexArray *myCd;
135  RE_VertexArray *myAlpha;
136  bool myHasDetailCd;
137  bool myHasDetailAlpha;
138  bool myHasPrimAttribs;
139  bool myHasWidthAttrib;
140  bool myHasNormalAttrib;
141  bool myHasTangentAttrib;
142  bool myHasUVAttrib;
143  bool myHasBarbAttribs;
144  bool myHasBarbOrientAttrib;
145  bool myObjectSelectedFlag;
146  UT_Array<BarbAttrib> myBarbAttribs;
147  BarbConfig myBarbConfig;
148  RE_CacheVersion myLastTopVersion;
149  GT_PrimitiveHandle myRefinedBezier;
150  bool myUseFurShaders;
151  bool myHasFurShader;
152  bool myUseSparkShaders;
153  RE_Texture *myRandomTex;
154  RE_Texture *myRandomMaskTex;
155  int myRandomMaskTexSamples;
156 
157  UT_IntArray myMaterials;
158  RE_MaterialPtr myDefaultHairShader;
159 
160  // For splines, such as bezier or NURBS. Defines the isoparm detail for
161  // breakpoint selections.
162  const void *mySpline;
163  int myNumU, myNumV;
164  bool myWrapU, myWrapV;
165  int myDensity;
166 
167  // subd curves
168  bool myIsSubdivisionCurve;
169 
170  int myHairShadowPassID;
171 };
172 #endif
GLbitfield flags
Definition: glcorearb.h:1596
virtual void draw(RE_RenderContext r, GR_RenderMode mode, GR_RenderFlags flags, GR_DrawParms draw_parms)=0
Normal drawing method. Only issue rendering commands.
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
int64 exint
Definition: SYS_Types.h:125
GT_API const UT_StringHolder cache_name
void setSplineParms(const void *spline, int nu, int nv, bool uwrap, bool vwrap, int density)
bool supportsInstances() const override
By default, no instanced drawing support.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T > spline(const Quat< T > &q0, const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &q3, T t) IMATH_NOEXCEPT
Definition: ImathQuat.h:576
Temporary container for either a RV_Render and an RE_Render.
A mesh of curves.
virtual exint getNumGLPrimitives() const =0
set of parameters sent to GR_Primitive::update()
virtual int setupSelection(RE_Render *r, const GR_DisplayOption *opt, GR_RenderFlags flags, bool supports_outline=false) const
GR_RenderMode
Definition: GR_Defines.h:47
vint4 select(const vbool4 &mask, const vint4 &a, const vint4 &b)
Definition: simd.h:4816
#define GR_API
Definition: GR_API.h:10
GR_RenderFlags
Definition: GR_Defines.h:85
virtual void geometryUpdated(RE_RenderContext)
Definition: GR_GeoRender.h:84
GLenum mode
Definition: glcorearb.h:99
GT_API const UT_StringHolder version
virtual GR_SelectMode addToBreakpointSelection(RE_Render *r, RE_VertexArray *select, int bpnt_len, const GA_BreakpointGroup *bps, bool &init)
const char * className() const override
Simple class for a mutli-integer cache tag.
virtual void update(RE_RenderContext r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p, const char *cache_name)=0
GLboolean r
Definition: glcorearb.h:1222
GR_SelectMode
Definition: GR_Defines.h:229