Changeset 2111 for GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include
- Timestamp:
- 02/09/07 14:39:35 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjManualMeshLoader.h
r2110 r2111 1 #ifndef __ IVManualMeshLoader_H__2 #define __ IVManualMeshLoader_H__1 #ifndef __ObjManualMeshLoader_H__ 2 #define __ObjManualMeshLoader_H__ 3 3 4 4 … … 7 7 8 8 9 class __declspec(dllexport) IVManualMeshLoader: public Ogre::ManualResourceLoader9 class __declspec(dllexport) ObjManualMeshLoader: public Ogre::ManualResourceLoader 10 10 { 11 11 public: 12 IVManualMeshLoader();13 IVManualMeshLoader(IVMeshData *mData);14 ~ IVManualMeshLoader();12 ObjManualMeshLoader(); 13 ObjManualMeshLoader(ObjMeshData *mData); 14 ~ObjManualMeshLoader(); 15 15 16 16 void loadResource(Ogre::Resource *resource); … … 18 18 Ogre::AxisAlignedBox *getBoundingBox(); 19 19 private: 20 IVMeshData *data;20 ObjMeshData *data; 21 21 22 22 }; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjMeshData.h
r2109 r2111 1 #ifndef __ IVMeshData_H__2 #define __ IVMeshData_H__1 #ifndef __ObjMeshData_H__ 2 #define __ObjMeshData_H__ 3 3 4 4 5 5 #include <Ogre.h> 6 6 7 enum mIVReaderenderOperationType7 enum ObjReaderOpType 8 8 { 9 9 IV_ROT_INVALID = -1, … … 13 13 }; 14 14 15 class __declspec(dllexport) IVMeshData15 class __declspec(dllexport) ObjMeshData 16 16 { 17 17 public: 18 IVMeshData();19 ~ IVMeshData();18 ObjMeshData(); 19 ~ObjMeshData(); 20 20 21 IVMeshData *expand();21 ObjMeshData *expand(); 22 22 23 23 void collapse(); … … 25 25 Ogre::Real *vertices, *normals, *texCoords, *indices, *normalIndices, *texCoordIndices; 26 26 int vcnt, ncnt, tcnt, icnt, nicnt, ticnt; 27 mIVReaderenderOperationType roType;27 ObjReaderOpType roType; 28 28 Ogre::AxisAlignedBox *boundingBox; 29 29 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjNode.h
r2109 r2111 1 #ifndef __ IVNode_H__2 #define __ IVNode_H__1 #ifndef __ObjNode_H__ 2 #define __ObjNode_H__ 3 3 4 4 … … 6 6 #include <Ogre.h> 7 7 8 enum IVType8 enum ObjType 9 9 { 10 10 IV_INVALID = -1, … … 15 15 16 16 17 class IVField17 class ObjField 18 18 { 19 19 public: 20 IVField();21 ~ IVField();20 ObjField(); 21 ~ObjField(); 22 22 23 23 char *name; 24 24 void *value; 25 IVType typ;25 ObjType typ; 26 26 int cnt; 27 IVField *next;27 ObjField *next; 28 28 }; 29 29 30 class __declspec(dllexport) IVNode30 class __declspec(dllexport) ObjNode 31 31 { 32 32 public: 33 IVNode();34 IVNode(const char *s);35 ~ IVNode();33 ObjNode(); 34 ObjNode(const char *s); 35 ~ObjNode(); 36 36 37 37 void print(int ident=0); 38 void attachNode( IVNode *child);38 void attachNode(ObjNode *child); 39 39 void addField(const char *name, char *value); 40 void addField(const char *name, void *value, int cnt, IVType typ);40 void addField(const char *name, void *value, int cnt, ObjType typ); 41 41 42 IVNode *getParent() { return parent; }42 ObjNode *getParent() { return parent; } 43 43 char *getName() { return name; } 44 IVNode *getNodeRecursive(const char *name);45 IVNode *getNextChildNode(bool reset = false);46 IVField *getField(const char *name);47 void *getField(const char *name, IVType *typ, int *cnt);44 ObjNode *getNodeRecursive(const char *name); 45 ObjNode *getNextChildNode(bool reset = false); 46 ObjField *getField(const char *name); 47 void *getField(const char *name, ObjType *typ, int *cnt); 48 48 49 49 private: 50 50 char *name; 51 IVField *fields;52 IVNode *parent;53 IVNode *children;54 IVNode *next;51 ObjField *fields; 52 ObjNode *parent; 53 ObjNode *children; 54 ObjNode *next; 55 55 56 IVNode *actual;56 ObjNode *actual; 57 57 }; 58 58 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/include/ObjReader.h
r2110 r2111 1 #ifndef __mIVReader_H__ 2 #define __mIVReader_H__ 1 #ifndef __ObjReader_H__ 2 #define __ObjReader_H__ 3 4 //#include <stdlib> 5 #include <string> 6 #include <vector> 7 #include <Ogre.h> 8 /*#include "ObjNode.h" 9 #include "ObjMeshData.h" 10 #include "ObjManualMeshLoader.h" 11 */ 3 12 4 13 5 #include "ObjNode.h" 6 #include "ObjMeshData.h" 7 #include "ObjManualMeshLoader.h" 8 #include "Ogre.h" 14 namespace GtpVisibilityPreprocessor { 9 15 10 #define COMMENTCHAR '#' 11 #define BLOCKSIZE 150 12 #define BUFFERSIZE 256 16 struct Triangle3; 13 17 18 } 14 19 15 static const int validIVHeaderCnt = 2;20 typedef std::vector<GtpVisibilityPreprocessor::Triangle3 *> TriangleContainer; 16 21 17 static const char *validIVHeader[2] = { 18 { "#Inventor V2.1 ascii\n" }, 19 { "#VRML V1.0 ascii\n" }, 22 class __declspec(dllexport) ObjReader 23 { 24 public: 25 ObjReader(); 26 ~ObjReader(); 27 28 bool LoadFile(const std::string &filename, 29 TriangleContainer &triangles) const; 30 31 const std::vector<Ogre::Entity *> &GetObjects() const; 32 33 protected: 34 35 std::vector<Ogre::Entity *> mObjects; 20 36 }; 21 37 22 23 enum IVTokenType24 {25 IV_TOKEN_INVALID = -1,26 IV_TOKEN_STRING = 0,27 IV_TOKEN_INT = 1,28 IV_TOKEN_REAL = 2,29 IV_TOKEN_BRACEOPEN = 3, // {30 IV_TOKEN_BRACECLOSE = 4, // }31 IV_TOKEN_BRACKETOPEN = 5, // [32 IV_TOKEN_BRACKETCLOSE = 6, // ]33 IV_TOKEN_PARENTHESISOPEN = 7, // (34 IV_TOKEN_PARENTHESISCLOSE = 8, // )35 IV_TOKEN_DEF = 9, // DEF36 IV_TOKEN_USE = 10, // USE37 };38 39 class __declspec(dllexport) IVMeshListNode40 {41 public:42 IVMeshListNode(std::string name, IVManualMeshLoader *loader);43 ~IVMeshListNode();44 45 void attachNewNode(std::string name, IVManualMeshLoader *loader);46 47 IVManualMeshLoader *getManualMeshLoader(std::string name);48 49 IVMeshListNode *next;50 51 private:52 std::string name;53 IVManualMeshLoader *loader;54 };55 56 class __declspec(dllexport) IVDefListNode57 {58 public:59 IVDefListNode(std::string name, IVNode *node);60 ~IVDefListNode();61 62 void attachNewNode(std::string name, IVNode *node);63 64 IVNode *getDef(std::string name);65 66 IVDefListNode *next;67 68 private:69 std::string name;70 IVNode *node;71 72 };73 74 class __declspec(dllexport) IVReader75 {76 public:77 IVReader();78 ~IVReader();79 80 void setLog(Ogre::Log *IVLog = NULL);81 82 bool loadFile(const char* filename);83 void print();84 // IVNode *getNode(const char* name);85 86 87 void buildTree(Ogre::SceneManager *sceneMgr, Ogre::SceneNode *sceneNodeRoot);88 89 void collapse();90 91 static std::string intToStr(int num);92 static std::string realToStr(Ogre::Real num);93 94 static Ogre::Log *IVLog;95 96 private:97 bool checkHeader(const char *string);98 char buf[BUFFERSIZE];99 int bufOffset;100 bool getNextElement(char *token, IVTokenType *type);101 void classify(char *token, IVTokenType *type);102 103 bool isSpace(char c);104 bool isNewline(char c);105 bool eof;106 bool isDigit(char c);107 bool isHexDigit(char c);108 109 IVNode *root;110 FILE* infile;111 112 static IVMeshListNode *meshList;113 static void addMeshToList(std::string name, IVManualMeshLoader *loader);114 115 static int instanceCnt;116 117 int treeCnt, nodeCnt, matCnt;118 char *fileName;119 120 Ogre::Entity *createEntity(Ogre::SceneManager* sceneMgr, std::string name, IVMeshData *mData, Ogre::Vector3 *translation = NULL);121 122 void buildTree(Ogre::SceneManager *sceneMgr, Ogre::SceneNode *sceneNodeRoot, IVNode *mIVReaderoot, IVMeshData *mData = NULL, Ogre::Material *material = NULL);123 124 IVDefListNode *defList;125 void addDefToList(std::string name, IVNode *node);126 127 128 };129 130 131 38 #endif
Note: See TracChangeset
for help on using the changeset viewer.