HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_SplitPointParser.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  * Parser for the PolySplit SOP.
10  */
11 
12 #ifndef __SOP_SplitPointParser_h__
13 #define __SOP_SplitPointParser_h__
14 
15 #include "SOP_API.h"
16 #include <GU/GU_EdgeSplit.h>
17 #include <GOP/GOP_Parser.h>
18 #include "SOP_PolySplit2.h"
19 
20 // Parser tokens
21 #define CHAR_EDGE 'e'
22 #define CHAR_VERTEX 'v'
23 #define CHAR_POINT 'p'
24 #define CHAR_FACE_VERTEX 'f'
25 #define CHAR_T ':'
26 #define CHAR_POINT_DELIM '-'
27 #define CHAR_COMMA_DELIM ','
28 
30 {
31 public:
32  SOP_SplitPointParser(UT_String &str, float forcedt, GU_Detail &gdp);
33  ~SOP_SplitPointParser() override {}
34 
35 protected:
36  virtual void addPoint(GU_SplitLoc *slvert) = 0;
37  void handleError() override;
38 
39  int getPrim() const { return myPrim; }
40  int getIndex() const { return myIndex; }
41 
42 private:
43  void init() override;
44  void finish() override;
45  bool dispatch(char c) override;
46 
47  // State handlers
48  void handleStart() override;
49  void handleCollectPrim();
50  void handleCollectVert();
51  void handleCollectEdge();
52  void handleCollectFaceVert();
53  void handleCollectT();
54  void handleCollectU();
55  void handleCollectV();
56  void handleCollectP0();
57  void handleCollectP1();
58  void handleCollectPT();
59 
60  // addSplitLocVert and addSplitLocEdge expect the member variables
61  // to be properly setup before they are called.
62  bool addSplitLocVert();
63  bool addSplitLocEdge();
64  bool addSplitLocFaceVert();
65  bool addSplitLocPoints();
66 
67 
68  GU_Detail &myGdp;
69 
70  float myT; // parametric t
71  float myT2; // parametric t2
72  int myPrim; // prim index
73  int myIndex; // edge or vertex index
74  int myP0; // point index
75  int myP1; // point index
76 
77  float myForcedT;
78 };
79 
80 #endif
81 
virtual bool dispatch(char c)=0
virtual void finish()
virtual void handleError()=0
virtual void init()
#define SOP_API
Definition: SOP_API.h:10
virtual void handleStart()=0