HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OBJ_Rivet.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: OBJ_Rivet.h (Custom Library, C++)
7  *
8  * COMMENTS: An object that attaches itself to another object (i.e.
9  * geometry). Based on three chosen points of the
10  * object, it constructs a local reference frame on the
11  * object's surface, and attaches itself to that frame.
12  * When surface moves, the attached rivet object also
13  * moves with it.
14  *
15  */
16 
17 #ifndef __OBJ_Rivet__
18 #define __OBJ_Rivet__
19 
20 #include "OBJ_API.h"
21 #include <UT/UT_Vector2.h>
22 #include <UT/UT_Vector3Array.h>
23 #include <GU/GU_DetailHandle.h>
24 #include "OBJ_Null.h"
25 
26 // order should correspond to OBJrivetTemplate
28 {
35 
37 };
38 
39 
40 class OBJ_API OBJ_Rivet : public OBJ_Null
41 {
42 public:
43  OBJ_Rivet(OP_Network *net,
44  const char *name,
45  OP_Operator *op);
46  ~OBJ_Rivet() override;
47 
48  OBJ_OBJECT_TYPE getObjectType() const override;
49 
50  static OP_Node *myConstructor(OP_Network *net,
51  const char *name,
52  OP_Operator *entry);
53 
54  static PRM_Template *getTemplateList();
55  OBJ_Rivet *castToOBJRivet() override { return this; }
56 
57 
58  // accessors of the parameters
60  {
61  evalString(str, "rivetsop", 0, t);
62  }
64  {
65  evalString(str, "rivetgroup", 0, t);
66  }
68  {
69  return evalInt("rivetuseattribs", 0, 0.0f);
70  }
72  {
73  evalString(str, "rivetxattrib", 0, t);
74  }
76  {
77  evalString(str, "rivetzattrib", 0, t);
78  }
79 
81  CH_StringMeaning meaning, fpreal t)
82  {
83  setString(str, meaning, "rivetsop", 0, t);
84  }
86  CH_StringMeaning meaning, fpreal t)
87  {
88  setString(str, meaning, "rivetgroup", 0,t);
89  }
90 
91 protected:
92  bool updateParmsFlags() override;
93 
94  // Used to get pointer to indirection indices for each object type
95  int *getIndirect() const override
96  { return rivetIndirect; }
97 
98  OP_ERROR cookMyObj(OP_Context &context) override;
99 
100  GU_DetailHandle getStuckGdp(fpreal t);
101 
102  void buildPointGroupMenu(
103  PRM_Name *menu,
104  int size,
105  const PRM_SpareData *spare,
106  const PRM_Parm *parm) override;
108  {
109  return evalFloat("rivetweights", k, t);
110  }
111 
112 private:
113  // obtains array of points based on which a local surface frame is build
114  // also, for each point, obtains normals (z-axis) and tangents (x-axis)
115  // if the attribute names are provided for them by the rivet parameters
116  void getRivetPoints( OP_Context &context,
117  SOP_Node *sop,
119  UT_Vector3RArray &tangents,
120  UT_Vector3RArray &normals );
121 
122  // obtains the weights for the points
123  void getPointWeights( fpreal t,
124  UT_FprealArray &weights,
125  int point_count);
126 
127 private:
128  static int *rivetIndirect;
129 };
130 
131 #endif
132 
bool updateParmsFlags() override
GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glad.h:2676
void RIVET_GEOPATH(UT_String &str, fpreal t)
Definition: OBJ_Rivet.h:59
OBJ_RivetIndex
Definition: OBJ_Rivet.h:27
static PRM_Template * getTemplateList()
CH_StringMeaning
void RIVET_POINTGROUP(UT_String &str, fpreal t)
Definition: OBJ_Rivet.h:63
void setRIVET_GEOPATH(UT_String &str, CH_StringMeaning meaning, fpreal t)
Definition: OBJ_Rivet.h:80
fpreal evalFloat(int pi, int vi, fpreal t) const
fpreal RIVET_POINTWEIGHT(fpreal t, int k)
Definition: OBJ_Rivet.h:107
UT_ErrorSeverity
Definition: UT_Error.h:25
static void buildPointGroupMenu(void *o, PRM_Name *, int, const PRM_SpareData *, const PRM_Parm *)
static OP_Node * myConstructor(OP_Network *net, const char *name, OP_Operator *entry)
void setString(const UT_StringRef &val, CH_StringMeaning meaning, int parmi, int vectori, fpreal t)
GLfloat f
Definition: glcorearb.h:1926
void evalString(UT_String &val, int pi, int vi, fpreal t) const
virtual OP_ERROR cookMyObj(OP_Context &context)
GLuint const GLchar * name
Definition: glcorearb.h:786
GLdouble t
Definition: glad.h:2397
void RIVET_X_ATTRIB_NAME(UT_String &str, fpreal t)
Definition: OBJ_Rivet.h:71
GLsizeiptr size
Definition: glcorearb.h:664
void setRIVET_POINTGROUP(UT_String &str, CH_StringMeaning meaning, fpreal t)
Definition: OBJ_Rivet.h:85
void RIVET_Z_ATTRIB_NAME(UT_String &str, fpreal t)
Definition: OBJ_Rivet.h:75
int * getIndirect() const override
Definition: OBJ_Rivet.h:95
fpreal64 fpreal
Definition: SYS_Types.h:277
bool RIVET_USE_ATTRIBS()
Definition: OBJ_Rivet.h:67
OBJ_OBJECT_TYPE getObjectType() const override
Definition: OBJ_Null.h:47
exint evalInt(int pi, int vi, fpreal t) const
#define OBJ_API
Definition: OBJ_API.h:10
OBJ_Rivet * castToOBJRivet() override
Definition: OBJ_Rivet.h:55
OBJ_OBJECT_TYPE
Definition: OBJ_Node.h:73