HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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_GeoRender.h"
15 
16 #include <GT/GT_DataArray.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  virtual ~GR_PolyCurveGL3();
32 
33  void setSubdivisionCurve(bool subdiv);
34 
35  virtual const char *className() const { return "GR_PolyCurveGL3"; }
36 
37  virtual void update(RE_Render *r,
38  const GT_PrimitiveHandle &primh,
39  const GR_UpdateParms &parms,
40  const char *cache_name);
41 
42  virtual void draw(RE_Render *r,
45  GR_DrawParms dp);
46 
47  virtual bool supportsInstances() const { return true; }
48  virtual void geometryUpdated(RE_Render *r);
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  virtual exint getNumGLPrimitives() const;
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,
97  RE_CacheVersion version);
98 
99  virtual int setupSelection(RE_Render *r,
100  const GR_DisplayOption *opt,
101  GR_RenderFlags flags) const;
102 
104  RE_VertexArray *select,
105  int bpnt_len,
106  const GA_BreakpointGroup *bpnt_sel,
107  bool &init);
108 
109  void drawHairShadow(RE_Render *r,
110  const GR_DisplayOption *opt,
111  int num_materials,
112  int instance_group,
113  bool subdiv);
114 
115  RE_VertexArray *myCd;
116  RE_VertexArray *myAlpha;
117  bool myHasDetailCd;
118  bool myHasDetailAlpha;
119  bool myHasPrimAttribs;
120  bool myHasWidthAttrib;
121  bool myObjectSelectedFlag;
122  RE_CacheVersion myLastTopVersion;
123  GT_PrimitiveHandle myRefinedBezier;
124  bool myUseFurShaders;
125  RE_Texture *myRandomTex;
126  RE_Texture *myRandomMaskTex;
127  int myRandomMaskTexSamples;
128 
129  UT_IntArray myMaterials;
130 
131  // For splines, such as bezier or NURBS. Defines the isoparm detail for
132  // breakpoint selections.
133  const void *mySpline;
134  int myNumU, myNumV;
135  bool myWrapU, myWrapV;
136  int myDensity;
137 
138  // subd curves
139  bool myIsSubdivisionCurve;
140 
141  int myHairShadowPassID;
142 };
143 #endif
virtual void geometryUpdated(RE_Render *)
Definition: GR_GeoRender.h:91
virtual GR_SelectMode addToBreakpointSelection(RE_Render *r, RE_VertexArray *select, int bpnt_len, const GA_BreakpointGroup *bps, bool &init)
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
void setSplineParms(const void *spline, int nu, int nv, bool uwrap, bool vwrap, int density)
GLbitfield flags
Definition: glcorearb.h:1595
A mesh of curves.
virtual exint getNumGLPrimitives() const =0
set of parameters sent to GR_Primitive::update()
virtual bool supportsInstances() const
By default, no instanced drawing support.
GR_RenderMode
Definition: GR_Defines.h:42
int64 exint
Definition: SYS_Types.h:109
#define GR_API
Definition: GR_API.h:10
GR_RenderFlags
Definition: GR_Defines.h:77
GLenum mode
Definition: glcorearb.h:98
virtual void update(RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p, const char *cache_name)=0
virtual int setupSelection(RE_Render *r, const GR_DisplayOption *opt, GR_RenderFlags flags) const
Simple class for a mutli-integer cache tag.
Quat< T > spline(const Quat< T > &q0, const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &q3, T t)
Definition: ImathQuat.h:545
GLboolean r
Definition: glcorearb.h:1221
virtual const char * className() const
GR_SelectMode
Definition: GR_Defines.h:215
virtual void draw(RE_Render *r, GR_RenderMode mode, GR_RenderFlags flags, GR_DrawParms draw_parms)=0
Normal drawing method. Only issue rendering commands.