00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef __SOP_PolyKnitParser_h__
00035 #define __SOP_PolyKnitParser_h__
00036
00037 #include "SOP_API.h"
00038 #include <UT/UT_IntArray.h>
00039
00040 #include <GOP/GOP_Parser.h>
00041 #include <GU/GU_Detail.h>
00042
00043
00044 #define CHAR_TRIANGLE 't'
00045 #define CHAR_QUAD 'q'
00046 #define CHAR_META_TRIANGLE 'T'
00047 #define CHAR_META_QUAD 'Q'
00048
00049 class SOP_Node;
00050
00051 class SOP_API SOP_PolyKnitParser : public GOP_Parser
00052 {
00053 public:
00054 SOP_PolyKnitParser(UT_String &str, GU_Detail &gdp,
00055 UT_IntArray &ptArray, UT_IntArray &typeArray);
00056 ~SOP_PolyKnitParser() {}
00057
00058 bool haveMetas() const { return myHaveMetas; }
00059
00060
00061 const char *errorToken() const
00062 { return (const char *)myErrorToken; }
00063
00064 protected:
00065 virtual void handleError();
00066
00067 private:
00068 virtual void init();
00069 virtual void finish();
00070 virtual bool dispatch(char c);
00071
00072
00073 virtual void handleStart();
00074
00075 void handleTrianglePoint();
00076 void handleQuadPoint();
00077 void handleMetaTrianglePoint();
00078 void handleMetaQuadPoint();
00079 void handlePoint(int polytype, int numpoints);
00080
00081
00082 void updateCanSwitch();
00083
00084
00085 void switchOutput(int out);
00086
00087 GU_Detail &myGdp;
00088 UT_IntArray &myPtArray;
00089 UT_IntArray &myTypeArray;
00090
00091
00092 int myCurrentPrimPoints;
00093
00094
00095 int myCurrentPolyType;
00096
00097
00098 bool myCanSwitch;
00099
00100
00101 bool myHaveMetas;
00102
00103 UT_String myErrorToken;
00104 int myErrorPoint;
00105 };
00106
00107 #endif
00108