HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 #include <GU/GU_Decompose.h>
20 
22 {
23 public:
24 
25  SOP_PolyBridge(OP_Network *net, const char *,
26  OP_Operator *entry);
27 
28  ~SOP_PolyBridge() override = default;
29 
31  int alone) override;
32  bool updateParmsFlags() override;
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  struct BridgeBundle;
46 
47  OP_ERROR cookMySop(OP_Context &context) override;
48  const char *inputLabel(unsigned idx) const override;
49 
50  void readPairingsFromParms(BridgeBundle &bundle);
51 
52  void updateAffectedNormals(const GA_PrimitiveGroup *prims);
53 
54 private:
57 
58  void saveEdgeArrayToDetailAttrib(const GA_OffsetArray &offs,
59  const char *attrib_name);
60 
61  void updateAffectedNormals(bool add_vertex_normals,
62  GA_PrimitiveGroup *side_prims,
63  fpreal cusp_angle_degrees,
64  bool cusp_src, bool cusp_dst,
65  GA_EdgeGroup *src_edges,
66  GA_EdgeGroup *dst_edges);
67 
68  static int initExplicitSrcDirStatic(void *, int idx,
69  fpreal t, const PRM_Template *);
70 
71  static int initExplicitDstDirStatic(void *, int idx,
72  fpreal t, const PRM_Template *);
73 
74  int initExplicitSrcDir(fpreal t);
75  int initExplicitDstDir(fpreal t);
76 
77  struct ChainPointInfo
78  {
79  ChainPointInfo() = default;
80  ChainPointInfo(int chain, int idx) :
81  chain_number(chain), index_in_chain(idx), degree(1)
82  {}
83 
84  ChainPointInfo(const ChainPointInfo &other) = default;
85 
86  void bumpDegree() { degree++; }
87 
88  int chain_number = -1;
89  int index_in_chain = -1;
90  int degree = 0;
91  };
92 
93 
94  using DegreeMap = UT_Map<GA_Index, int>;
95  using Chain = GA_OffsetArray;
96  using ChainArray = UT_Array<Chain>;
97 
98  using SpinePositioning = GU_PolyBridge::SpinePositioning;
99  using SpineSampleMethod = GU_PolyBridge::SpineSampleMethod;
101  using BoolArray = UT_Array<bool>;
102 
103 
104 
105 
106  using BridgeBundleUptr = UT_UniquePtr<BridgeBundle>;
107 
108  UT_StringStream myWarningMessages;
109  GU_DetailGroupPair myDetailGroupPair;
110 
111  const GA_EdgeGroup *mySrcEdges = nullptr;
112  const GA_EdgeGroup *myDstEdges = nullptr;
113 
114  const GA_EdgeGroup *mySrcSplitEdges = nullptr;
115  const GA_EdgeGroup *myDstSplitEdges = nullptr;
116  const GA_PointGroup *mySrcSplitPoints = nullptr;
117  const GA_PointGroup *myDstSplitPoints = nullptr;
118 
119  const
120  GA_PrimitiveGroup *mySrcPrims = nullptr;
121 
122  const
123  GA_PrimitiveGroup *myDstPrims = nullptr;
124 
125  UT_Vector3 myLastSrcLoopNormal = { 0.0, 0.0, 0.0 };
126  UT_Vector3 myLastDstLoopNormal = { 0.0, 0.0, 0.0 };
127 };
128 
129 #endif
130 
virtual bool updateParmsFlags()
GU_Spine::Positioning SpinePositioning
GLuint const GLchar * name
Definition: glew.h:1814
Unsorted map container.
Definition: UT_Map.h:83
static const char * theDstNormalAttribName
static const char * theSrcCentroidAttribName
virtual const char * inputLabel(unsigned idx) const
UT_ErrorSeverity
Definition: UT_Error.h:25
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:33
An bi-directional stream object that owns its own string buffer storage.
virtual OP_ERROR cookInputGroups(OP_Context &context, int alone=0)
static const char * theDstCentroidAttribName
fpreal64 fpreal
Definition: SYS_Types.h:277
#define SOP_API
Definition: SOP_API.h:10
static const char * theSrcNormalAttribName
GU_Spine::SampleMode SpineSampleMethod
const GEO_DetachedHedgeInterface HedgeInterface
Definition: GU_Decompose.h:54
UT_Array< bool > BoolArray
Definition: GU_Decompose.h:56
virtual OP_ERROR cookMySop(OP_Context &context)=0
UT_ValArray< GA_Offset > GA_OffsetArray
Definition: GA_Types.h:683
GLdouble GLdouble t
Definition: glew.h:1398