HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  virtual ~GU_TrimConvertTesselator();
35 
36  // Prepare for tesselation: (Called after trimming done)
37  virtual void reset();
38 
39  // Add points in counter clockwise order
40  virtual void startPoly();
41  virtual void endPoly();
42  virtual void cancelPoly();
43  virtual void addPolyPoint(GU_TrimBasePoint *point);
44 
45  // Add points two at a time:
46  virtual void startTStrip();
47  virtual void endTStrip();
48  virtual void addTStripPoints(GU_TrimBasePoint *p1,
49  GU_TrimBasePoint *p2);
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  virtual ~GU_TrimConvertPatch();
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) {}
96 
97  GEO_TPSurf *getSurf() const { return mySurf; }
98 
99 private:
100 
101 protected:
102  // Initializes worlddata of given point:
103  virtual void fillPoint(GU_TrimPatchPoint *p);
104 
105  // Calls fill point for all normal curve values
106 // virtual void fillCurvePoints();
107 
108  // Does fwd differencing of corner values:
109  virtual void fillCornerPoints();
110 
111  // Does fwd differencing of edge values (As along isoparms, can
112  // optimize...)
113  virtual void fillEdgePoints();
114 
115 protected:
122  int myCurveEnd; // Index of last curve point
123 
124 private:
125 };
126 #endif
127 
virtual void fillCornerPoints()=0
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:617
virtual void startPoly()=0
A handle to simplify manipulation of multiple attributes.
virtual void refreshCells(GEO_AttributeHandleList *hlist, const GEO_TPSurf *, int, int, int, int)
#define GU_API
Definition: GU_API.h:11
virtual void cancelPoly()=0
virtual void reset()=0
virtual void startTStrip()=0
UT_ValArray< GA_Offset > myPoints
GLuint index
Definition: glcorearb.h:785
UT_IntArray * myPointIndices
virtual void addPolyPoint(GU_TrimBasePoint *point)=0
GA_WorkVertexBuffer * myVertexBuffer