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  void bumpDegree() { degree++; }
85 
86  int chain_number = -1;
87  int index_in_chain = -1;
88  int degree = 0;
89  };
90 
91 
92  using DegreeMap = UT_Map<GA_Index, int>;
93  using Chain = GA_OffsetArray;
94  using ChainArray = UT_Array<Chain>;
95 
96  using SpinePositioning = GU_PolyBridge::SpinePositioning;
97  using SpineSampleMethod = GU_PolyBridge::SpineSampleMethod;
99  using BoolArray = UT_Array<bool>;
100 
101 
102 
103 
104  using BridgeBundleUptr = UT_UniquePtr<BridgeBundle>;
105 
106  UT_StringStream myWarningMessages;
107  GU_DetailGroupPair myDetailGroupPair;
108 
109  const GA_EdgeGroup *mySrcEdges = nullptr;
110  const GA_EdgeGroup *myDstEdges = nullptr;
111 
112  const GA_EdgeGroup *mySrcSplitEdges = nullptr;
113  const GA_EdgeGroup *myDstSplitEdges = nullptr;
114  const GA_PointGroup *mySrcSplitPoints = nullptr;
115  const GA_PointGroup *myDstSplitPoints = nullptr;
116 
117  const
118  GA_PrimitiveGroup *mySrcPrims = nullptr;
119 
120  const
121  GA_PrimitiveGroup *myDstPrims = nullptr;
122 
123  UT_Vector3 myLastSrcLoopNormal = { 0.0, 0.0, 0.0 };
124  UT_Vector3 myLastDstLoopNormal = { 0.0, 0.0, 0.0 };
125 };
126 
127 #endif
128 
virtual bool updateParmsFlags()
GU_Spine::Positioning SpinePositioning
Unsorted map container.
Definition: UT_Map.h:107
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:39
UT_Array< GA_Offset > GA_OffsetArray
Definition: GA_Types.h:694
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)
GLdouble t
Definition: glad.h:2397
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