HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_PolyBridge.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: SOP_PolyBridge.h ( SOP Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __SOP_PolyBridge__
12 #define __SOP_PolyBridge__
13 
14 #include "SOP_API.h"
15 #include "SOP_Node.h"
16 #include <UT/UT_StringStream.h>
17 
18 #include <GU/GU_PolyBridge.h>
19 
20 class GU_Decompose;
21 
23 {
24 public:
25 
26  SOP_PolyBridge(OP_Network *net, const char *,
27  OP_Operator *entry);
28 
29  virtual ~SOP_PolyBridge() {}
30 
31  virtual OP_ERROR cookInputGroups(OP_Context &context, int alone = 0);
32  virtual bool updateParmsFlags();
33 
34  static OP_Node *myConstructor(OP_Network *net, const char *name,
35  OP_Operator *entry);
36 
37  static PRM_Template myTemplateList[];
38 
39  static const char *theSrcCentroidAttribName;
40  static const char *theDstCentroidAttribName;
41  static const char *theSrcNormalAttribName;
42  static const char *theDstNormalAttribName;
43 
44 protected:
45  virtual OP_ERROR cookMySop(OP_Context &context);
46  virtual const char *inputLabel(unsigned idx) const;
47 
48  void readPairingsFromParms();
49  void addChainToDegreeMap(GA_OffsetArray &chain,
50  int chain_id,
51  bool is_src);
52 
53  int cacheSrcAndDstChains(GU_Decompose *src_comps,
54  GU_Decompose *dst_comps,
55  bool reverse_src,
56  bool reverse_dst);
57 
58  void removeAmbiguousPairings();
59 
60  void findChainPairings(int src_chain_idx,
61  int dst_chain_idx,
62  UT_Array<std::pair<int, int> > &pairings);
63 
64  void updateAffectedNormals(const GA_PrimitiveGroup *prims);
65 
66 private:
67  void saveEdgeArrayToDetailAttrib(const GA_OffsetArray &offs,
68  const char *attrib_name);
69 
70  void updateAffectedNormals(bool add_vertex_normals,
71  GA_PrimitiveGroup *side_prims,
72  fpreal cusp_angle_degrees,
73  bool cusp_src, bool cusp_dst,
74  GA_EdgeGroup *src_edges,
75  GA_EdgeGroup *dst_edges);
76 
77  static int initExplicitSrcDirStatic(void *, int idx,
78  fpreal t, const PRM_Template *);
79 
80  static int initExplicitDstDirStatic(void *, int idx,
81  fpreal t, const PRM_Template *);
82 
83  int initExplicitSrcDir(fpreal t);
84  int initExplicitDstDir(fpreal t);
85 
86  struct ChainPointInfo
87  {
88  ChainPointInfo() : chain_number(-1), index_in_chain(-1),
89  is_src_chain(false), degree(0)
90  {}
91 
92  ChainPointInfo(int chain, int idx, bool is_src) :
93  chain_number(chain), index_in_chain(idx), is_src_chain(is_src),
94  degree(1)
95  {}
96 
97  void bumpDegree() { degree++; }
98 
99  int chain_number;
100  int index_in_chain;
101  int degree;
102  bool is_src_chain;
103  };
104 
105  typedef UT_Map<GA_Index, ChainPointInfo> ChainPointMap;
106  typedef UT_Map<GA_Index, int> DegreeMap;
107  typedef GA_OffsetArray Chain;
108 
109  typedef UT_Array<Chain> ChainArray;
110 
111  typedef std::pair<GA_Index, GA_Index> IndexPair;
112  UT_Array<IndexPair> myPairList;
113 
114  typedef GU_PolyBridge::SpinePositioning SpinePositioning;
115  typedef GU_PolyBridge::SpineSampleMethod SpineSampleMethod;
116 
117 
118 
119  GU_Detail *myGdp;
120  const GA_EdgeGroup *mySrcEdges;
121  const GA_EdgeGroup *myDstEdges;
122 
123  const GA_EdgeGroup *mySrcSplitEdges;
124  const GA_EdgeGroup *myDstSplitEdges;
125  const GA_PointGroup *mySrcSplitPoints;
126  const GA_PointGroup *myDstSplitPoints;
127 
128 
129  const
130  GA_PrimitiveGroup *mySrcPrims;
131 
132  const
133  GA_PrimitiveGroup *myDstPrims;
134 
135  ChainPointMap myChainPointMap;
136 
137  ChainArray mySrcChains;
138  ChainArray myDstChains;
139 
140  GA_OffsetArray mySrcRefVtxs;
141  GA_OffsetArray myDstRefVtxs;
142 
143  UT_IntArray mySrcChainsClosed;
144  UT_IntArray myDstChainsClosed;
145 
146  UT_IntArray mySrcChainsInnerBoundary;
147  UT_IntArray myDstChainsInnerBoundary;
148 
149  UT_Vector3 myLastSrcLoopNormal;
150  UT_Vector3 myLastDstLoopNormal;
151 
152  UT_StringStream myWarningMessages;
153 
154  GU_DetailGroupPair myDetailGroupPair;
155 
157  *myHip;
158 
159 };
160 
161 #endif
162 
virtual bool updateParmsFlags()
static const char * theDstNormalAttribName
static const char * theSrcCentroidAttribName
virtual const char * inputLabel(unsigned idx) const
UT_ErrorSeverity
Definition: UT_Error.h:25
3D Vector class.
virtual ~SOP_PolyBridge()
An bi-directional stream object that owns its own string buffer storage.
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual OP_ERROR cookInputGroups(OP_Context &context, int alone=0)
static const char * theDstCentroidAttribName
double fpreal
Definition: SYS_Types.h:263
#define SOP_API
Definition: SOP_API.h:10
static const char * theSrcNormalAttribName
virtual OP_ERROR cookMySop(OP_Context &context)=0