HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_TrimConvertPatch.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: GU library (C++)
7  *
8  * COMMENTS: Trimmed patch conversion tesselator.
9  *
10  */
11 
12 #ifndef __GU_TrimConvertPatch_h__
13 #define __GU_TrimConvertPatch_h__
14 
15 #include "GU_API.h"
16 #include <UT/UT_Array.h>
17 #include <UT/UT_Vector4Array.h>
18 #include <GA/GA_AttributeRefMap.h>
19 #include <GA/GA_WorkVertexBuffer.h>
20 #include "GU_TrimBasePatch.h"
21 
22 class GU_Detail;
23 class GEO_TPSurf;
24 class GU_PrimPoly;
26 
27 //
28 // Class for tesselating on trim surfaces.
29 //
31 {
32 public:
34  ~GU_TrimConvertTesselator() override;
35 
36  // Prepare for tesselation: (Called after trimming done)
37  void reset() override;
38 
39  // Add points in counter clockwise order
40  void startPoly() override;
41  void endPoly() override;
42  void cancelPoly() override;
43  void addPolyPoint(GU_TrimBasePoint *point) override;
44 
45  // Add points two at a time:
46  void startTStrip() override;
47  void endTStrip() override;
49  GU_TrimBasePoint *p2) override;
50 
51  // Marks whether we want to to preserve groups with newly created
52  // primitives or not.
53  void setPreserveGroups(bool preservegroups)
54  { myPreserveGroups = preservegroups; }
55 
56 private:
57  GA_Offset getPoint(int index);
58 
59  GU_Detail *myGDP;
60  GU_PrimPoly *myPrim; // Current primitive.
61  GA_Offset myP1, myP2; // Prev tstrip points.
62  GU_TrimConvertPatch *myPatch; // Patch being tesselated
63 
64  // First/most recent points on polygon to ensure duplicate
65  // points are avoided.
66  GU_TrimBasePoint *myFirstPolyPoint, *myLastPolyPoint;
67 
68 // We do not own these:
69  GA_WorkVertexBuffer *myVertexBuffer;
70  GA_Offset *myPoints;
71  GA_AttributeRefMap *myHandles;
72  UT_IntArray *myPointIndices;
73  int myCurveEnd; // Index of last curve point
74  bool myPreserveGroups;
75 };
76 
77 
79 {
80 public:
82  ~GU_TrimConvertPatch() override;
83 
84  // Sets all arrays so tesselator can get points directly
85  // without going through extra layer.
86  void getPointArrays(
87  GA_WorkVertexBuffer *&vertices,
88  GA_Offset *&points,
89  UT_IntArray *&ptindices,
90  GA_AttributeRefMap *&hlist,
91  int &curveend);
92 
93  // Updates all points lying in certain cell boundaries.
95  const GEO_TPSurf *, int, int, int, int) override
96  {}
97 
98  GEO_TPSurf *getSurf() const { return mySurf; }
99 
100 private:
101 
102 protected:
103  // Initializes worlddata of given point:
104  void fillPoint(GU_TrimPatchPoint *p) override;
105 
106  // Calls fill point for all normal curve values
107 // virtual void fillCurvePoints();
108 
109  // Does fwd differencing of corner values:
110  void fillCornerPoints() override;
111 
112  // Does fwd differencing of edge values (As along isoparms, can
113  // optimize...)
114  void fillEdgePoints() override;
115 
116 protected:
123  int myCurveEnd; // Index of last curve point
124 
125 private:
126 };
127 #endif
128 
virtual void fillCornerPoints()=0
void refreshCells(GEO_AttributeHandleList *hlist, const GEO_TPSurf *, int, int, int, int) override
GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glad.h:2676
virtual void addTStripPoints(GU_TrimBasePoint *p1, GU_TrimBasePoint *p2)=0
GA_AttributeRefMap myHandles
GEO_TPSurf * getSurf() const
virtual void endTStrip()=0
void setPreserveGroups(bool preservegroups)
virtual void endPoly()=0
virtual void fillPoint(GU_TrimPatchPoint *p)=0
virtual void fillEdgePoints()
GA_Size GA_Offset
Definition: GA_Types.h:646
virtual void startPoly()=0
A handle to simplify manipulation of multiple attributes.
#define GU_API
Definition: GU_API.h:14
virtual void cancelPoly()=0
virtual void reset()=0
virtual void startTStrip()=0
UT_ValArray< GA_Offset > myPoints
GLuint index
Definition: glcorearb.h:786
UT_IntArray * myPointIndices
virtual void addPolyPoint(GU_TrimBasePoint *point)=0
GA_WorkVertexBuffer * myVertexBuffer