Ignore:
Timestamp:
02/09/07 14:39:35 (17 years ago)
Author:
mattausch
Message:
 
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__ 
    33 
    44 
     
    77 
    88 
    9 class __declspec(dllexport) IVManualMeshLoader: public Ogre::ManualResourceLoader 
     9class __declspec(dllexport) ObjManualMeshLoader: public Ogre::ManualResourceLoader 
    1010{ 
    1111        public: 
    12                 IVManualMeshLoader(); 
    13                 IVManualMeshLoader(IVMeshData *mData); 
    14                 ~IVManualMeshLoader();  
     12                ObjManualMeshLoader(); 
     13                ObjManualMeshLoader(ObjMeshData *mData); 
     14                ~ObjManualMeshLoader();  
    1515 
    1616                void loadResource(Ogre::Resource *resource); 
     
    1818                Ogre::AxisAlignedBox *getBoundingBox(); 
    1919        private: 
    20                 IVMeshData *data; 
     20                ObjMeshData *data; 
    2121 
    2222}; 
  • 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__ 
    33 
    44 
    55#include <Ogre.h> 
    66 
    7 enum mIVReaderenderOperationType 
     7enum ObjReaderOpType 
    88{ 
    99        IV_ROT_INVALID = -1, 
     
    1313}; 
    1414 
    15 class __declspec(dllexport) IVMeshData 
     15class __declspec(dllexport) ObjMeshData 
    1616{ 
    1717        public:  
    18                 IVMeshData(); 
    19                 ~IVMeshData(); 
     18                ObjMeshData(); 
     19                ~ObjMeshData(); 
    2020 
    21                 IVMeshData *expand(); 
     21                ObjMeshData *expand(); 
    2222 
    2323                void collapse(); 
     
    2525                Ogre::Real *vertices, *normals, *texCoords, *indices, *normalIndices, *texCoordIndices; 
    2626                int vcnt, ncnt, tcnt, icnt, nicnt, ticnt; 
    27                 mIVReaderenderOperationType roType; 
     27                ObjReaderOpType roType; 
    2828                Ogre::AxisAlignedBox *boundingBox; 
    2929 
  • 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__ 
    33 
    44 
     
    66#include <Ogre.h> 
    77 
    8 enum IVType 
     8enum ObjType 
    99{ 
    1010        IV_INVALID = -1, 
     
    1515 
    1616 
    17 class IVField 
     17class ObjField 
    1818{ 
    1919public: 
    20         IVField(); 
    21         ~IVField(); 
     20        ObjField(); 
     21        ~ObjField(); 
    2222 
    2323        char *name; 
    2424        void *value; 
    25         IVType typ; 
     25        ObjType typ; 
    2626        int cnt; 
    27         IVField *next; 
     27        ObjField *next; 
    2828}; 
    2929 
    30 class __declspec(dllexport) IVNode 
     30class __declspec(dllexport) ObjNode 
    3131{ 
    3232        public: 
    33                 IVNode(); 
    34                 IVNode(const char *s); 
    35                 ~IVNode(); 
     33                ObjNode(); 
     34                ObjNode(const char *s); 
     35                ~ObjNode(); 
    3636 
    3737                void print(int ident=0); 
    38                 void attachNode(IVNode *child); 
     38                void attachNode(ObjNode *child); 
    3939                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); 
    4141 
    42                 IVNode *getParent() { return parent; } 
     42                ObjNode *getParent() { return parent; } 
    4343                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); 
    4848 
    4949        private: 
    5050                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; 
    5555 
    56                 IVNode *actual; 
     56                ObjNode *actual; 
    5757}; 
    5858 
  • 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*/ 
    312 
    413 
    5 #include "ObjNode.h" 
    6 #include "ObjMeshData.h" 
    7 #include "ObjManualMeshLoader.h" 
    8 #include "Ogre.h" 
     14namespace GtpVisibilityPreprocessor { 
    915 
    10 #define COMMENTCHAR '#' 
    11 #define BLOCKSIZE 150 
    12 #define BUFFERSIZE 256 
     16struct Triangle3; 
    1317 
     18} 
    1419 
    15 static const int validIVHeaderCnt = 2; 
     20typedef std::vector<GtpVisibilityPreprocessor::Triangle3 *> TriangleContainer; 
    1621 
    17 static const char *validIVHeader[2] = { 
    18     { "#Inventor V2.1 ascii\n" }, 
    19         { "#VRML V1.0 ascii\n" }, 
     22class __declspec(dllexport) ObjReader 
     23{ 
     24public: 
     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 
     33protected: 
     34 
     35        std::vector<Ogre::Entity *> mObjects; 
    2036}; 
    2137 
    22  
    23 enum IVTokenType 
    24 { 
    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,                                       // DEF 
    36         IV_TOKEN_USE = 10,                                      // USE 
    37 }; 
    38  
    39 class __declspec(dllexport) IVMeshListNode 
    40 { 
    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) IVDefListNode 
    57 { 
    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) IVReader 
    75 { 
    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  
    13138#endif 
Note: See TracChangeset for help on using the changeset viewer.