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(OP_InputIdx idx) const override;
49 
50  void readPairingsFromParms(BridgeBundle &bundle);
51  void readPairingsFromAttrib(BridgeBundle &bundle);
52 
53  void updateAffectedNormals(const GA_PrimitiveGroup *prims);
54 
55 private:
58 
59  void saveEdgeArrayToDetailAttrib(const GA_OffsetArray &offs,
60  const char *attrib_name);
61 
62  void updateAffectedNormals(bool add_vertex_normals,
63  GA_PrimitiveGroup *side_prims,
64  fpreal cusp_angle_degrees,
65  bool cusp_src, bool cusp_dst,
66  GA_EdgeGroup *src_edges,
67  GA_EdgeGroup *dst_edges);
68 
69  static int initExplicitSrcDirStatic(void *, int idx,
70  fpreal t, const PRM_Template *);
71 
72  static int initExplicitDstDirStatic(void *, int idx,
73  fpreal t, const PRM_Template *);
74 
75  int initExplicitSrcDir(fpreal t);
76  int initExplicitDstDir(fpreal t);
77 
78  struct ChainPointInfo
79  {
80  ChainPointInfo() = default;
81  ChainPointInfo(int chain, int idx) :
82  chain_number(chain), index_in_chain(idx), degree(1)
83  {}
84 
85  void bumpDegree() { degree++; }
86 
87  int chain_number = -1;
88  int index_in_chain = -1;
89  int degree = 0;
90  };
91 
92 
93  using DegreeMap = UT_Map<GA_Index, int>;
94  using Chain = GA_OffsetArray;
95  using ChainArray = UT_Array<Chain>;
96 
97  using SpinePositioning = GU_PolyBridge::SpinePositioning;
98  using SpineSampleMethod = GU_PolyBridge::SpineSampleMethod;
100  using BoolArray = UT_Array<bool>;
101 
102 
103 
104 
105  using BridgeBundleUptr = UT_UniquePtr<BridgeBundle>;
106 
107  UT_StringStream myWarningMessages;
108  GU_DetailGroupPair myDetailGroupPair;
109 
110  const GA_EdgeGroup *mySrcEdges = nullptr;
111  const GA_EdgeGroup *myDstEdges = nullptr;
112 
113  const GA_EdgeGroup *mySrcSplitEdges = nullptr;
114  const GA_EdgeGroup *myDstSplitEdges = nullptr;
115  const GA_PointGroup *mySrcSplitPoints = nullptr;
116  const GA_PointGroup *myDstSplitPoints = nullptr;
117 
118  const
119  GA_PrimitiveGroup *mySrcPrims = nullptr;
120 
121  const
122  GA_PrimitiveGroup *myDstPrims = nullptr;
123 
124  UT_Vector3 myLastSrcLoopNormal = { 0.0, 0.0, 0.0 };
125  UT_Vector3 myLastDstLoopNormal = { 0.0, 0.0, 0.0 };
126 };
127 
128 #endif
129 
virtual bool updateParmsFlags()
GU_Spine::Positioning SpinePositioning
Unsorted map container.
Definition: UT_Map.h:109
static const char * theDstNormalAttribName
static const char * theSrcCentroidAttribName
int OP_InputIdx
Definition: OP_DataTypes.h:184
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:39
UT_Array< GA_Offset > GA_OffsetArray
Definition: GA_Types.h:694
virtual const char * inputLabel(OP_InputIdx idx) const
An bi-directional stream object that owns its own string buffer storage.
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual OP_ERROR cookInputGroups(OP_Context &context, int alone=0)
ApexArray< Bool > BoolArray
Definition: APEX_Include.h:91
GLdouble t
Definition: glad.h:2397
static const char * theDstCentroidAttribName
fpreal64 fpreal
Definition: SYS_Types.h:278
#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
virtual OP_ERROR cookMySop(OP_Context &context)=0