HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_FacePointParser.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: Point parser for the curve SOP
9  *
10  */
11 
12 #ifndef __SOP_FacePointParser_h__
13 #define __SOP_FacePointParser_h__
14 
15 #include "SOP_API.h"
16 #include <GOP/GOP_Parser.h>
17 #include <SYS/SYS_Math.h>
18 #include "SOP_Curve.h"
19 
20 
21 // Special Characters recognized by the parser
22 #define CHAR_POINT 'p'
23 #define CHAR_POINTCOPY 'P'
24 #define CHAR_RELATIVE '@'
25 #define CHAR_BREAKPOINT 'b'
26 #define CHAR_BRACKETOPEN '['
27 #define CHAR_BRACKETCLOSE ']'
28 #define CHAR_XYZW_DELIM ','
29 #define CHAR_UV_DELIM ','
30 
32 {
33 public:
34  SOP_FacePointParser(const GU_Detail *gdp, UT_String &str);
35  SOP_FacePointParser(const GU_Detail *gdp, const UT_StringHolder &str);
36 
37  virtual ~SOP_FacePointParser() {}
38 
39  enum RefType
40  {
41  RefTypeNone = -1,
42  RefTypePoint = 0,
43  RefTypeBreakpoint = 1,
44  RefTypeRelative = 2
45  };
46 
47 protected:
48  // The following methods should be handled by the child classes, depending
49  // on how they store the point list.
50  virtual void handleError();
51  virtual void resetPointList() = 0;
52  virtual void addPoint(const UT_Vector4R &v, bool relative,
53  bool use_w, const UT_Vector4R &last,
54  RefType reftype = RefTypeNone,
55  int pid = -1) = 0;
56  virtual void referencePoint(GA_Offset point) = 0;
57 
58  // this is where we know what error occurred, but the actual message error
59  // display happens somewhere else; therefore have an integer which keeps
60  // track of error messages (negative for generic, index of error message
61  // otherwise)
63 
64  const GU_Detail *myRefGdp; // gdp to use for references
65 
66 private:
67  virtual void init();
68  virtual void finish();
69  virtual bool dispatch(char c);
70 
71  // State handlers
72  virtual void handleStart();
73  void handleCollectX();
74  void handleCollectY();
75  void handleCollectZ();
76  void handleCollectW();
77  void handleCollectP();
78  void handleCollectBU();
79  void handleCollectBV();
80 
81  // Puts the position of the breakpoint from primitive at index primidx
82  // specified by u and v. (Set v to -1 for curves).
83  // Returns true if the u and v and primidx are valid, false otherwise
84  bool getPosFromBreakpoint(int u, int v,
85  GA_Index primidx,
86  UT_Vector4R &pos);
87 
88  UT_Vector4R myLastPos;
89  UT_Vector4R myCurrPos;
90 
91  bool myRelative;
92  bool myCopyPoint;
93  bool myAllSpaces;
94  bool myFirstBracket;
95  bool myOpenBracket;
96  bool myZDone;
97  int myIndex;
98  int myU, myV;
99 };
100 
101 #endif
const GLdouble * v
Definition: glcorearb.h:836
virtual bool dispatch(char c)=0
virtual void finish()
GA_Size GA_Offset
Definition: GA_Types.h:617
virtual void handleError()=0
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
virtual void init()
const GU_Detail * myRefGdp
#define SOP_API
Definition: SOP_API.h:10
virtual void handleStart()=0