HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GOP_VertexGroupParser.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  * COMMENTS: This class contains a parser for the vertex groups.
7  * The doIt() method returns the number of vertices parsed,
8  * or -1 if an error has occured.
9  *
10  */
11 
12 #ifndef __GOP_VertexGroupParser_h__
13 #define __GOP_VertexGroupParser_h__
14 
15 #include "GOP_API.h"
16 #include "GOP_Parser.h"
17 #include <GA/GA_Types.h>
18 
19 class GEO_Detail;
20 class GOP_Manager;
21 class GA_VertexGroup;
22 
24 {
25 public:
26  GOP_VertexGroupParser(GOP_Manager *manager, const GEO_Detail &gdp,
27  const UT_String &str, bool strict = true,
28  GA_Index prim_offset = GA_Index(0));
29 
30  // Build a string that contains the id's of the vertices in a vertex
31  // group. The offset is the amount to add to the ids of the primitives for
32  // each vertex in the group.
33  static void buildGroupToken(const GA_VertexGroup *vtxgrp,
34  UT_String &token,
35  GA_Index offset = GA_Index(0));
36 
37  // Build a string representing a single vertex element. The offset is the
38  // amount to add to the id of the primitive.
39  static void buildElementToken(const GEO_Detail *gdp,
40  GA_Offset vertex, UT_String &token,
41  GA_Index offset = GA_Index(0));
42 
43 private:
44 
45  virtual void init();
46  virtual void finish();
47  virtual bool dispatch(char c);
48 
49  // State Handlers
50  virtual void handleStart();
51  virtual void handleError();
52 
53  void handleCollectPrim();
54  void handleCollectPrim1();
55  void handleCollectName();
56  void handleCollectVertex0();
57  void handleCollectVertex1();
58 
59  // State Variables
60  GA_Index myPrimIndex;
61  GA_Index myPrim1;
62  int myVertex0;
63  int myVertex1;
64 
65  // Vertex Specific Methods
66  bool addVertex();
67  bool addAllPrimVertices(GA_Offset primoff = GA_INVALID_OFFSET);
68  bool addVertexRange(int u0, int u1);
69  bool addPrimGroup(const char *name);
70  bool addVertexGroup(const char *name);
71 
72  // Primitive Specific Methods
73  bool addPrimRange(int u0, int u1);
74 
75  // Utility methods
76  GA_Offset getPrim();
77 
78 
79  const GEO_Detail &myGdp;
80  GA_VertexGroup *myGroup;
81  GOP_Manager *myManager;
82  bool myStrictFlag;
83  GA_Index myPrimOffset;
84 };
85 
86 
87 #endif
GLuint const GLchar * name
Definition: glew.h:1814
GLuint GLdouble u1
Definition: glew.h:3446
virtual bool dispatch(char c)=0
virtual void finish()
#define GA_INVALID_OFFSET
Definition: GA_Types.h:674
#define GOP_API
Definition: GOP_API.h:10
GA_Size GA_Offset
Definition: GA_Types.h:637
virtual void handleError()=0
const GLfloat * c
Definition: glew.h:16296
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:631
virtual void init()
virtual void handleStart()=0
GLintptr offset
Definition: glew.h:1682