HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_Stroke.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 Library (C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __SOP_Stroke_h__
13 #define __SOP_Stroke_h__
14 
15 #include "SOP_API.h"
16 #include <PRM/PRM_Include.h>
17 #include <PRM/PRM_Shared.h>
18 #include <PRM/PRM_Name.h>
19 #include "SOP_Node.h"
20 
21 class SOP_API SOP_Stroke : public SOP_Node
22 {
23 public:
24  struct StrokePoint
25  {
27  {
28  pos = dir = projpos = projuv = 0;
29  projprim = -1;
30  pressure = 1;
31  time = 0;
32  tilt = angle = roll = 0;
33  }
34  UT_Vector3 pos, dir; // Camera location of source
35  UT_Vector3 projpos; // What the state projected to
36  int projprim; // Where it projected
37  UT_Vector3 projuv; // Where it projected
38  bool projsuccess; // Did it hit?
39  float pressure; // 0..1
40  float time; // In seconds since stroke start
41  float tilt, angle, roll; // In Degrees
42  };
43 
45  {
46  public:
49  int tuplesize;
51 
52  template <typename ARCHIVER_T>
53  bool serialize(ARCHIVER_T &archiver);
54  };
55 
56  SOP_Stroke(OP_Network *net, const char *name, OP_Operator *entry);
57  virtual ~SOP_Stroke();
58 
59  virtual bool updateParmsFlags();
60 
61  static bool encodeStroke(UT_String &encoding, const UT_Array<StrokePoint> &pts);
62  static bool decodeStroke(UT_Array<StrokePoint> &pts, const char *encoding);
63 
64  static bool encodeStrokeMeta(UT_String &encoding, const UT_Array<StrokeMetaData> &meta);
65  static bool decodeStrokeMeta(UT_Array<StrokeMetaData> &meta, const char *encoding);
66 
67  static OP_Node *myConstructor (OP_Network *net, const char *name,
68  OP_Operator *entry);
69 
70  virtual int isRefInput (unsigned i) const;
71  static PRM_Template myTemplateList[];
72 
73  int NUMSTROKES(fpreal t) const
74  { return evalInt("stroke_numstrokes", 0, t); }
75 protected:
76  virtual OP_ERROR cookMySop(OP_Context &context);
77  virtual const char *inputLabel(unsigned idx) const;
78 
79 private:
80 };
81 
82 #endif
virtual bool updateParmsFlags()
virtual const char * inputLabel(unsigned idx) const
UT_ErrorSeverity
Definition: UT_Error.h:25
UT_StringHolder value
Definition: SOP_Stroke.h:50
png_uint_32 i
Definition: png.h:2877
UT_StringHolder parmname
Definition: SOP_Stroke.h:47
T angle(const Vec2< T > &v1, const Vec2< T > &v2)
Definition: Vec2.h:480
GLuint const GLchar * name
Definition: glcorearb.h:785
double fpreal
Definition: SYS_Types.h:263
int NUMSTROKES(fpreal t) const
Definition: SOP_Stroke.h:73
#define SOP_API
Definition: SOP_API.h:10
exint evalInt(int pi, int vi, fpreal t) const
UT_StringHolder type
Definition: SOP_Stroke.h:48
virtual OP_ERROR cookMySop(OP_Context &context)=0
virtual int isRefInput(unsigned idx) const