Changeset 2111 for GTP/trunk/Lib
- Timestamp:
- 02/09/07 14:39:35 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 4 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBoundingBoxConverter.h
r2097 r2111 8 8 #include "Containers.h" 9 9 #include "IntersectableWrapper.h" 10 //#include "KdTree.h"11 10 12 11 … … 14 13 15 14 #define USE_KD_PVS 1 15 16 16 class Entity; 17 17 class OctreeSceneManager; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r2100 r2111 638 638 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 639 639 <File 640 RelativePath="..\src\OgreBoundingBoxConverter.cpp">641 </File>642 <File643 640 RelativePath="..\src\OgreMeshInstance.cpp"> 644 641 </File> -
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 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjManualMeshLoader.cpp
r2110 r2111 2 2 #include "ObjReader.h" 3 3 4 IVManualMeshLoader::IVManualMeshLoader()4 ObjManualMeshLoader::ObjManualMeshLoader() 5 5 { 6 6 data = NULL; … … 8 8 9 9 10 IVManualMeshLoader::IVManualMeshLoader(IVMeshData *mData) 10 ObjManualMeshLoader::ObjManualMeshLoader(ObjMeshData *mData): 11 data(mData) 11 12 { 12 data = mData;13 /* data = new IVMeshData();14 if ((mData->indices != NULL) && (mData->icnt > 0))15 {16 data->icnt = mData->icnt;17 data->indices = new Ogre::Real[mData->icnt];18 memcpy(data->indices, mData->indices, mData->icnt*sizeof(Ogre::Real));19 }20 if ((mData->vertices != NULL) && (mData->vcnt > 0))21 {22 data->vcnt = mData->vcnt;23 data->vertices = new Ogre::Real[mData->vcnt];24 memcpy(data->vertices, mData->vertices, mData->vcnt*sizeof(Ogre::Real));25 }26 if ((mData->normals != NULL) && (mData->vcnt > 0))27 {28 data->ncnt = mData->ncnt;29 data->normals = new Ogre::Real[mData->ncnt];30 memcpy(data->normals, mData->normals, mData->ncnt*sizeof(Ogre::Real));31 }32 if ((mData->texCoords != NULL) && (mData->tcnt > 0))33 {34 data->tcnt = mData->tcnt;35 data->texCoords = new Ogre::Real[mData->tcnt];36 memcpy(data->texCoords, mData->texCoords, mData->tcnt*sizeof(Ogre::Real));37 }38 */39 13 } 40 14 41 IVManualMeshLoader::~IVManualMeshLoader() 15 16 ObjManualMeshLoader::~ObjManualMeshLoader() 42 17 { 43 /* if (data != NULL)44 {45 if (data->vertices != NULL) delete [] data->vertices;46 if (data->normals != NULL) delete [] data->normals;47 if (data->texCoords != NULL) delete [] data->texCoords;48 if (data->indices != NULL) delete [] data->indices;49 delete data;50 }51 */52 18 if (data != NULL) 53 19 { … … 58 24 59 25 60 Ogre::AxisAlignedBox * IVManualMeshLoader::getBoundingBox()26 Ogre::AxisAlignedBox *ObjManualMeshLoader::getBoundingBox() 61 27 { 62 28 return data->boundingBox; … … 64 30 65 31 66 void IVManualMeshLoader::loadResource(Ogre::Resource *resource)32 void ObjManualMeshLoader::loadResource(Ogre::Resource *resource) 67 33 { 68 34 using namespace Ogre; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjMeshData.cpp
r2110 r2111 3 3 4 4 5 IVMeshData::IVMeshData()5 ObjMeshData::ObjMeshData() 6 6 { 7 7 vertices = normals = texCoords = indices = normalIndices = texCoordIndices = NULL; … … 11 11 } 12 12 13 IVMeshData::~IVMeshData()13 ObjMeshData::~ObjMeshData() 14 14 { 15 15 } 16 16 17 void IVMeshData::collapse()17 void ObjMeshData::collapse() 18 18 { 19 19 if (indices != NULL) delete [] indices; … … 28 28 } 29 29 30 int IVMeshData::getSeparatorCnt(Ogre::Real *data, int end)30 int ObjMeshData::getSeparatorCnt(Ogre::Real *data, int end) 31 31 { 32 32 int cnt = 0; … … 35 35 } 36 36 37 Ogre::AxisAlignedBox * IVMeshData::calcBoundingBox()37 Ogre::AxisAlignedBox *ObjMeshData::calcBoundingBox() 38 38 { 39 39 if ((vertices == NULL) || (vcnt <=0)) … … 58 58 59 59 60 Ogre::Real * IVMeshData::expandTriangleStripIndices(Ogre::Real *indices, int icnt, int *icntOut)60 Ogre::Real *ObjMeshData::expandTriangleStripIndices(Ogre::Real *indices, int icnt, int *icntOut) 61 61 { 62 62 if (indices[icnt-1] >= 0.0) … … 94 94 } 95 95 96 int IVMeshData::getNextFaceSize(int start) 96 97 int ObjMeshData::getNextFaceSize(int start) 97 98 { 98 99 for (int i=start; i < icnt; i++) … … 103 104 } 104 105 105 Ogre::Real *IVMeshData::expandFaceSetIndices(Ogre::Real *indices, int icnt, int *icntOut) 106 107 Ogre::Real *ObjMeshData::expandFaceSetIndices(Ogre::Real *indices, int icnt, int *icntOut) 106 108 { 107 109 if (indices[icnt-1] >= 0.0) … … 126 128 } 127 129 128 IVMeshData *IVMeshData::expand()130 ObjMeshData *ObjMeshData::expand() 129 131 { 130 132 using namespace Ogre; 131 133 132 IVMeshData *mDataOut = new IVMeshData();134 ObjMeshData *mDataOut = new ObjMeshData(); 133 135 134 136 mDataOut->boundingBox = calcBoundingBox(); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjNode.cpp
r2110 r2111 2 2 #include "ObjReader.h" 3 3 4 IVField::IVField()4 ObjField::ObjField() 5 5 { 6 6 next = NULL; … … 9 9 10 10 11 IVField::~IVField()11 ObjField::~ObjField() 12 12 { 13 13 if (value != NULL) free(value); … … 17 17 18 18 19 IVNode::IVNode()19 ObjNode::ObjNode() 20 20 { 21 21 parent = children = next = actual = NULL; … … 25 25 26 26 27 IVNode::IVNode(const char *s)27 ObjNode::ObjNode(const char *s) 28 28 { 29 29 name = new char[strlen(s)+1]; … … 33 33 } 34 34 35 IVNode::~IVNode()35 ObjNode::~ObjNode() 36 36 { 37 37 if (name != NULL) delete[] name; 38 38 if (fields != NULL) 39 39 { 40 IVField *help = fields, *delme = NULL;40 ObjField *help = fields, *delme = NULL; 41 41 while (help->next != NULL) 42 42 { … … 47 47 if (children != NULL) 48 48 { 49 IVNode *help = children, *delme = NULL;49 ObjNode *help = children, *delme = NULL; 50 50 while (help->next != NULL) 51 51 { … … 60 60 61 61 62 void IVNode::attachNode(IVNode *child)62 void ObjNode::attachNode(ObjNode *child) 63 63 { 64 64 if (children == NULL) children = child; 65 65 else 66 66 { 67 IVNode *help = children;67 ObjNode *help = children; 68 68 while (help->next != NULL) help = help->next; 69 69 help->next = child; … … 73 73 74 74 75 void IVNode::print(int ident)75 void ObjNode::print(int ident) 76 76 { 77 77 if (IVReader::IVLog != NULL) … … 85 85 IVReader::IVLog->logMessage(msg); 86 86 87 IVField *help = fields;87 ObjField *help = fields; 88 88 while (help != NULL) 89 89 { … … 128 128 } 129 129 130 void IVNode::addField(const char *name, void *value, int cnt, IVType typ)131 { 132 IVField *newone = new IVField();130 void ObjNode::addField(const char *name, void *value, int cnt, ObjType typ) 131 { 132 ObjField *newone = new ObjField(); 133 133 newone->name = new char[strlen(name)+1]; 134 134 strcpy(newone->name, name); … … 153 153 else 154 154 { 155 IVField *help = fields;155 ObjField *help = fields; 156 156 while (help->next != NULL) help = help->next; 157 157 help->next = newone; … … 160 160 161 161 162 void IVNode::addField(const char *name, char *value)162 void ObjNode::addField(const char *name, char *value) 163 163 { 164 164 addField(name, value, 1, IV_STRING); … … 166 166 167 167 168 IVNode *IVNode::getNodeRecursive(const char *name)168 ObjNode *ObjNode::getNodeRecursive(const char *name) 169 169 { 170 170 if (strcmp(name, this->name) == 0) return this; 171 171 if (this->children != NULL) 172 172 { 173 IVNode *help = this->children->getNodeRecursive(name);173 ObjNode *help = this->children->getNodeRecursive(name); 174 174 if (help != NULL) return help; 175 175 } … … 178 178 179 179 180 IVNode *IVNode::getNextChildNode(bool reset)180 ObjNode *ObjNode::getNextChildNode(bool reset) 181 181 { 182 182 if (reset) actual = this->children; … … 186 186 187 187 188 IVField *IVNode::getField(const char *name)189 { 190 IVField *help = fields;188 ObjField *ObjNode::getField(const char *name) 189 { 190 ObjField *help = fields; 191 191 while (help != NULL) 192 192 { … … 197 197 } 198 198 199 void * IVNode::getField(const char *name, IVType *typ, int *cnt)200 { 201 IVField *help = fields;199 void *ObjNode::getField(const char *name, ObjType *typ, int *cnt) 200 { 201 ObjField *help = fields; 202 202 while (help != NULL) 203 203 { -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.cpp
r2110 r2111 1 1 #include "ObjReader.h" 2 #include <string> 3 #include <stdlib.h> 4 #include <sstream> 5 6 IVMeshListNode *IVReader::meshList = NULL; 7 int IVReader::instanceCnt = 0; 8 Ogre::Log *IVReader::IVLog = NULL; 9 10 11 12 IVMeshListNode::IVMeshListNode(std::string name, IVManualMeshLoader *loader) 13 { 14 this->name = name; 15 this->loader = loader; 16 next = NULL; 17 } 18 19 IVMeshListNode::~IVMeshListNode() 20 { 21 if (loader != NULL) delete loader; 22 } 23 24 void IVMeshListNode::attachNewNode(std::string name, IVManualMeshLoader *loader) 25 { 26 IVMeshListNode *help = this; 27 28 while (help->next != NULL) help = help->next; 29 help->next = new IVMeshListNode(name, loader); 30 } 31 32 IVManualMeshLoader *IVMeshListNode::getManualMeshLoader(std::string name) 33 { 34 IVMeshListNode *help = this; 35 if (help->name == name) return help->loader; 36 while (help->next != NULL) 37 { 38 help = help->next; 39 if (help->name == name) return help->loader; 40 } 41 return NULL; 42 } 43 44 IVDefListNode::IVDefListNode(std::string name, IVNode *node) 45 { 46 this->name = name; 47 this->node = node; 48 next = NULL; 49 } 50 51 IVDefListNode::~IVDefListNode() 52 { 53 } 54 55 void IVDefListNode::attachNewNode(std::string name, IVNode *node) 56 { 57 IVDefListNode *help = this; 58 59 while (help->next != NULL) help = help->next; 60 help->next = new IVDefListNode(name, node); 61 } 62 63 IVNode *IVDefListNode::getDef(std::string name) 64 { 65 IVDefListNode *help = this; 66 if (help->name == name) return help->node; 67 while (help->next != NULL) 68 { 69 help = help->next; 70 if (help->name == name) return help->node; 71 } 72 return NULL; 73 } 74 75 IVReader::IVReader() 76 { 77 root = NULL; meshList = NULL; defList = NULL; fileName = NULL; 78 instanceCnt++; 79 IVLog = NULL; 80 } 81 82 IVReader::~IVReader() 83 { 84 collapse(); 85 86 instanceCnt--; 87 if (instanceCnt == 0) if (meshList != NULL) 88 { 89 IVMeshListNode *help = meshList, *delme = NULL; 90 while (help->next != NULL) 91 { 92 delme = help; help = help->next; delete delme; 93 } 94 delete help; 95 } 96 } 97 98 void IVReader::collapse() 99 { 100 if (root != NULL) { delete root; root = NULL; } 101 if (defList != NULL) 102 { 103 IVDefListNode *help = defList, *delme = NULL; 104 while (help->next != NULL) 105 { 106 delme = help; help = help->next; delete delme; 107 } 108 delete help; 109 defList = NULL; 110 } 111 if (this->fileName != NULL) { delete [] this->fileName; this->fileName = NULL; } 112 113 } 114 115 void IVReader::setLog(Ogre::Log *IVLog) 116 { 117 this->IVLog = IVLog; 118 } 119 120 std::string IVReader::intToStr(int num) 121 { 122 std::ostringstream myStream; 123 myStream << num; 124 myStream.flush(); 125 126 return(myStream.str()); 127 } 128 129 std::string IVReader::realToStr(Ogre::Real num) 130 { 131 std::ostringstream myStream; 132 myStream << num; 133 myStream.flush(); 134 135 return(myStream.str()); 136 } 137 138 bool IVReader::loadFile(const char* fileName) 139 { 140 std::string message = "trying to load "; message = message + fileName + "..."; 141 142 if (IVLog != NULL) 143 IVLog->logMessage(message); 144 145 collapse(); 146 this->fileName = new char[strlen(fileName)+1]; strcpy(this->fileName, fileName); 147 treeCnt = 0; 148 149 infile = fopen(fileName, "r"); root = NULL; 150 151 if (infile == NULL) 152 { 153 message = "! Error loading File "; message = message + fileName + " !"; 154 if (IVLog != NULL) IVLog->logMessage(message); 2 #include "gzstream.h" 3 #include "Triangle3.h" 4 5 6 ObjReader::ObjReader() 7 {} 8 9 ObjReader::~ObjReader() 10 {} 11 12 13 bool ObjReader::LoadFile(const string &filename, 14 TriangleContainer &triangles) const 15 { 16 igzstream samplesIn(filename.c_str()); 17 18 if (!samplesIn.is_open()) 155 19 return false; 156 } 157 158 if ((fgets(buf, BUFFERSIZE, infile) == NULL) && !feof(infile)) 159 { 160 message = "! Error loading File "; message = message + fileName + " !"; 161 if (IVLog != NULL) IVLog->logMessage(message); 162 fclose(infile); 163 return false; 164 } 165 166 if (!checkHeader(buf)) 167 { 168 message = "! Invalid Header !"; 169 if (IVLog != NULL) IVLog->logMessage(message); 170 fclose(infile); 171 return false; 172 } 173 174 IVTokenType tmptyp = IV_TOKEN_INVALID; 175 eof = false; 176 177 bufOffset = 0; 178 char token[BUFFERSIZE] = "\0", oldtoken[BUFFERSIZE] = "\0", fieldtoken[BUFFERSIZE] = "\0"; 179 int level = 0; 180 181 while (getNextElement(token, &tmptyp)) 182 { 183 if (tmptyp == IV_TOKEN_BRACEOPEN) 184 { 185 root = new IVNode(oldtoken); 186 level++; 20 21 // read in triangle size 22 int numTriangles; 23 24 samplesIn.read(reinterpret_cast<char *>(&numTriangles), sizeof(int)); 25 triangles.reserve(numTriangles); 26 27 while (1) 28 { 29 GtpVisibilityPreprocessor::Triangle3 *tri = 30 new GtpVisibilityPreprocessor::Triangle3(); 31 32 samplesIn.read(reinterpret_cast<char *>((*tri).mVertices + 0), 33 sizeof(GtpVisibilityPreprocessor::Vector3)); 34 samplesIn.read(reinterpret_cast<char *>((*tri).mVertices + 1), 35 sizeof(GtpVisibilityPreprocessor::Vector3)); 36 samplesIn.read(reinterpret_cast<char *>((*tri).mVertices + 2), 37 sizeof(GtpVisibilityPreprocessor::Vector3)); 38 39 // end of file reached 40 if (samplesIn.eof()) 187 41 break; 188 } 189 190 strcpy(oldtoken, token); 191 } 192 193 IVNode *actualNode = root, *parent = root, *fieldNode = root, *newNode = NULL; 194 IVTokenType oldtmptyp = tmptyp; 195 bool textfield = false, realfield = false; IVType fieldtyp = IV_INVALID; 196 bool def = false; std::string defLabel; 197 Ogre::Real rblock[BLOCKSIZE]; 198 float *rvalues; 199 int cnt = 0; int blockcnt = 0; 200 while (getNextElement(token, &tmptyp)) 201 { 202 if ((tmptyp == IV_TOKEN_BRACKETOPEN)) 203 if (!getNextElement(token, &tmptyp)) break; 204 if ((tmptyp == IV_TOKEN_INVALID)) 205 if (!getNextElement(token, &tmptyp)) break; 206 if (tmptyp == IV_TOKEN_BRACEOPEN) 207 { 208 actualNode = new IVNode(oldtoken); 209 if (parent == NULL) 210 { 211 message = "Error loading file "; message = message + fileName + "! Invalid tree structure."; 212 if (IVLog != NULL) IVLog->logMessage(message); 213 fclose(infile); 214 return false; 215 } 216 parent->attachNode(actualNode); 217 parent = actualNode; 218 level++; 219 220 if (def) 221 { 222 addDefToList(defLabel, actualNode); 223 def = false; 224 } 225 226 } else 227 if (tmptyp == IV_TOKEN_BRACECLOSE) 228 { 229 if (realfield) 230 { 231 if (blockcnt == 0) rvalues = (Ogre::Real *)malloc((cnt)*sizeof(Ogre::Real)); 232 else rvalues = (Ogre::Real *)realloc(rvalues, (BLOCKSIZE*(blockcnt) + cnt)*sizeof(Ogre::Real)); 233 memcpy((void *)&rvalues[BLOCKSIZE*blockcnt], rblock, cnt*sizeof(Ogre::Real)); 234 fieldNode->addField(fieldtoken, rvalues, BLOCKSIZE*blockcnt+cnt, fieldtyp); 235 realfield = false; 236 // free(rvalues); 237 } 238 239 if (level > 0) 240 { 241 actualNode = parent = actualNode->getParent(); 242 level--; 243 } 244 } else 245 { 246 if (oldtmptyp == IV_TOKEN_DEF) 247 { 248 def = true; defLabel = ""; defLabel = defLabel + token; 249 } else 250 if (oldtmptyp == IV_TOKEN_USE) 251 { 252 newNode = new IVNode("USE"); 253 if (parent == NULL) 254 { 255 message = "Error loading file "; message = message + fileName + "! Invalid tree structure."; 256 if (IVLog != NULL) IVLog->logMessage(message); 257 fclose(infile); 258 return false; 259 } 260 char *s = (char *)malloc(sizeof(char)*(strlen(token)+1)); 261 memcpy(s, token, strlen(token)); 262 s[strlen(token)] = '\0'; 263 newNode->addField("label", s); 264 actualNode->attachNode(newNode); 265 } else 266 if (!def) 267 if (oldtmptyp == IV_TOKEN_STRING) 268 { 269 if (!textfield) 270 { 271 if (tmptyp == IV_TOKEN_STRING) 272 { 273 /* char *s = new char[strlen(token)+1]; 274 strcpy(s, token); 275 */ 276 char *s = (char *)malloc(sizeof(char)*(strlen(token)+1)); 277 memcpy(s, token, strlen(token)); 278 s[strlen(token)] = '\0'; 279 actualNode->addField(oldtoken, s); 280 // delete [] s; 281 } 282 } 283 if (!realfield) 284 { 285 if ((tmptyp == IV_TOKEN_REAL) || (tmptyp == IV_TOKEN_INT)) 286 { 287 cnt = 0; blockcnt = 0; 288 char *stopstring; 289 rblock[0] = strtod(token, &stopstring); 290 cnt++; 291 strcpy(fieldtoken, oldtoken); 292 fieldNode = actualNode; 293 if (tmptyp == IV_TOKEN_REAL) fieldtyp = IV_REAL; 294 if (tmptyp == IV_TOKEN_INT) fieldtyp = IV_INT; 295 realfield = true; 296 } 297 } 298 textfield = !textfield; 299 } 300 else 301 { 302 if (realfield) 303 { 304 if ((tmptyp == IV_TOKEN_REAL) || (tmptyp == IV_TOKEN_INT)) 305 { 306 char *stopstring; 307 if (cnt >= BLOCKSIZE) 308 { 309 if (blockcnt == 0) rvalues = (Ogre::Real *)malloc((BLOCKSIZE)*sizeof(Ogre::Real)); 310 else rvalues = (Ogre::Real *)realloc(rvalues, (BLOCKSIZE*(blockcnt+1))*sizeof(Ogre::Real)); 311 memcpy((void *)&rvalues[BLOCKSIZE*blockcnt], rblock, BLOCKSIZE*sizeof(Ogre::Real)); 312 cnt = 0; 313 blockcnt++; 314 315 } 316 rblock[cnt] = strtod(token, &stopstring); 317 cnt++; 318 if (tmptyp == IV_TOKEN_REAL) fieldtyp = IV_REAL; 319 } 320 else 321 { 322 if (blockcnt == 0) rvalues = (Ogre::Real *)malloc((cnt)*sizeof(Ogre::Real)); 323 else rvalues = (Ogre::Real *)realloc(rvalues, (BLOCKSIZE*(blockcnt) + cnt)*sizeof(Ogre::Real)); 324 memcpy((void *)&rvalues[BLOCKSIZE*blockcnt], rblock, cnt*sizeof(Ogre::Real)); 325 fieldNode->addField(fieldtoken, rvalues, BLOCKSIZE*blockcnt+cnt, fieldtyp); 326 realfield = false; 327 // free(rvalues); 328 } 329 } 330 331 textfield = false; 332 } 333 } 334 335 336 strcpy(oldtoken, token); 337 oldtmptyp = tmptyp; 338 } 339 message = ""; ; message = message + fileName + " loaded."; 340 if (IVLog != NULL) IVLog->logMessage(message); 341 fclose(infile); 342 42 43 triangles.push_back(tri); 44 } 45 343 46 return true; 344 47 } 345 48 346 void IVReader::print() 347 { 348 if (root != NULL) root->print(); 349 } 350 351 bool IVReader::checkHeader(const char *string) 352 { 353 for (int i=0; i < validIVHeaderCnt; i++) 354 if (strcmp(validIVHeader[i], string) == 0) return true; 355 return false; 356 } 357 bool IVReader::isSpace(char c) 358 { 359 if ((c==' ') || (c=='\t')) return true; 360 return false; 361 } 362 bool IVReader::isNewline(char c) 363 { 364 if (c=='\n') return true; 365 return false; 366 } 367 bool IVReader::isDigit(char c) 368 { 369 if ((c>=48) && (c<=57)) return true; 370 return false; 371 } 372 bool IVReader::isHexDigit(char c) 373 { 374 if ( ((c>=48) && (c<=57)) || ((c>=65) && (c<=70)) || ((c>=97) && (c<=102)) ) return true; 375 return false; 376 } 377 378 379 bool IVReader::getNextElement(char *token, IVTokenType *type) 380 { 381 if (eof) return false; 382 bool quoted = false; 383 while (isSpace(buf[bufOffset])) bufOffset++; 384 int i=0; 385 while ((!isSpace(buf[bufOffset])) || (quoted)) 386 { 387 if (!quoted) 388 { 389 if (isNewline(buf[bufOffset]) || (buf[bufOffset] == COMMENTCHAR)) 390 { 391 token[i] = '\0'; 392 classify(token, type); 393 bufOffset = 0; 394 if (fgets(buf, BUFFERSIZE, infile) == NULL) 395 { 396 eof = true; 397 } 398 if (i==0) return getNextElement(token, type); 399 return true; 400 } 401 if ((buf[bufOffset] == ',') || (buf[bufOffset] == ']')) 402 { 403 token[i] = '\0'; 404 bufOffset++; 405 classify(token, type); 406 return true; 407 } 408 409 410 411 } else if (isNewline(buf[bufOffset])) { eof = true; } 412 413 414 token[i] = buf[bufOffset]; 415 i++; 416 if (buf[bufOffset] == '"') 417 { 418 quoted = !quoted; i--; 419 } 420 bufOffset++; 421 422 423 } 424 token[i] = '\0'; 425 classify(token, type); 426 return true; 427 } 428 429 void IVReader::classify(char *token, IVTokenType *type) 430 { 431 bool isInt = true, isReal = true; 432 if (!isDigit(token[0]) && (token[0] != '-') && (token[0] != '+')) 433 { 434 isInt = false; 435 if (token[0] != '.') isReal = false; 436 } 437 int i = 1; 438 while ((token[i] != '\0') && isReal) 439 { 440 if (isInt && (i!=2) && !isHexDigit(token[i])) 441 { 442 isInt = false; 443 } 444 if (isInt && (i==2) && !isHexDigit(token[i]) && (token[i] != 'x') && (token[i] != 'X')) isInt = false; 445 if (isReal && (!isDigit(token[i])) && (token[i] != '.') && (token[i] != 'e') && (token[i] != 'E') && (token[i] != 'd') && (token[i] != 'D') && (token[i] != '-') && (token[i] != '+')) isReal = false; 446 i++; 447 } 448 if (isInt) *type = IV_TOKEN_INT; 449 else if (isReal) *type = IV_TOKEN_REAL; 450 else *type = IV_TOKEN_STRING; 451 452 if (strcmp(token, "DEF") == 0) *type = IV_TOKEN_DEF; 453 if (strcmp(token, "USE") == 0) *type = IV_TOKEN_USE; 454 455 if (token[1] == '\0') 456 { 457 if (token[0] == '{') *type = IV_TOKEN_BRACEOPEN; 458 if (token[0] == '}') *type = IV_TOKEN_BRACECLOSE; 459 if (token[0] == '[') *type = IV_TOKEN_BRACKETOPEN; 460 if (token[0] == ']') *type = IV_TOKEN_BRACKETCLOSE; 461 if (token[0] == '(') *type = IV_TOKEN_PARENTHESISOPEN; 462 if (token[0] == ')') *type = IV_TOKEN_PARENTHESISCLOSE; 463 } 464 if (token[0] == '\0') 465 { 466 *type = IV_TOKEN_INVALID; 467 } 468 469 } 470 471 /* 472 IVNode *IVReader::getNode(const char* name) 473 { 474 return root->getNodeRecursive(name); 475 } 476 */ 477 void IVReader::addMeshToList(std::string name, IVManualMeshLoader *loader) 478 { 479 if (meshList == NULL) 480 { 481 meshList = new IVMeshListNode(name, loader); 482 } 483 else 484 { 485 meshList->attachNewNode(name, loader); 486 } 487 } 488 489 void IVReader::addDefToList(std::string name, IVNode *node) 490 { 491 if (defList == NULL) 492 { 493 defList = new IVDefListNode(name, node); 494 } 495 else 496 { 497 defList->attachNewNode(name, node); 498 } 499 } 500 501 Ogre::Entity *IVReader::createEntity(Ogre::SceneManager* sceneMgr, std::string name, IVMeshData *mData, Ogre::Vector3 *translation) 49 50 const std::vector<Ogre::Entity *> &ObjReader::GetObjects() const 51 { 52 return mObjects; 53 } 54 55 56 #if TODO 57 58 Ogre::Entity *IVReader::createEntity(Ogre::SceneManager* sceneMgr, std::string name, ObjMeshData *mData, Ogre::Vector3 *translation) 502 59 { 503 60 using namespace Ogre; … … 510 67 { 511 68 512 IVMeshData *data = mData->expand();513 514 IVManualMeshLoader *loader = new IVManualMeshLoader(data);69 ObjMeshData *data = mData->expand(); 70 71 ObjManualMeshLoader *loader = new ObjManualMeshLoader(data); 515 72 516 73 if (translation != NULL) *translation = data->boundingBox->getCenter(); … … 544 101 545 102 546 547 void IVReader::buildTree(Ogre::SceneManager* sceneMgr, Ogre::SceneNode *sceneNodeRoot) 103 void IVReader::buildTree(Ogre::SceneManager* sceneMgr, Ogre::SceneNode *sceneNodeRoot) 548 104 { 549 105 using namespace Ogre; … … 575 131 void IVReader::buildTree(Ogre::SceneManager* sceneMgr, 576 132 Ogre::SceneNode *sceneNodeRoot, 577 IVNode *IVReaderoot, IVMeshData *mData,133 ObjNode *IVReaderoot, ObjMeshData *mData, 578 134 Ogre::Material *material) 579 135 { … … 585 141 if (mData == NULL) 586 142 { 587 mData = new IVMeshData();143 mData = new ObjMeshData(); 588 144 meshDataCreated = true; 589 145 } 590 146 591 IVType t; int i;592 593 IVNode *help = IVReaderoot->getNextChildNode(true);147 ObjType t; int i; 148 149 ObjNode *help = IVReaderoot->getNextChildNode(true); 594 150 while (help != NULL) 595 151 { … … 743 299 if (t != IV_INT) mData->texCoordIndices = NULL; 744 300 745 IVNode *n = help->getNextChildNode(true);301 ObjNode *n = help->getNextChildNode(true); 746 302 while ((n != NULL) && (strcmp(help->getName(), "VertexProperty") == 0)) 747 303 { … … 775 331 if (meshDataCreated) if (mData != NULL) delete mData; 776 332 } 777 333 #endif -
GTP/trunk/Lib/Vis/OnlineCullingCHC/ObjReader/src/ObjReader.vcproj
r2110 r2111 72 72 <Tool 73 73 Name="VCCLCompilerTool" 74 AdditionalIncludeDirectories=""$(OGRE_PATH)\ Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\Samples\Common\include";..\include"74 AdditionalIncludeDirectories=""$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\Samples\Common\include";..\include;..\..\..\Preprocessing\src" 75 75 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OBJREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE" 76 76 RuntimeLibrary="2" … … 83 83 <Tool 84 84 Name="VCLinkerTool" 85 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib"86 OutputFile="$(OutDir)/ObjReader.dll" 87 LinkIncremental="1" 88 AdditionalLibraryDirectories=""$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\ Samples\Common\CEGUIRenderer\lib";"..\..\GtpVisibility\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)""85 AdditionalDependencies="OgreMain.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib" 86 OutputFile="$(OutDir)/ObjReader.dll" 87 LinkIncremental="1" 88 AdditionalLibraryDirectories=""$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib" 89 89 GenerateDebugInformation="FALSE" 90 90 SubSystem="2" … … 339 339 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> 340 340 <File 341 RelativePath="..\src\ObjManualMeshLoader.cpp">342 </File>343 <File344 RelativePath="..\src\ObjMeshData.cpp">345 </File>346 <File347 RelativePath="..\src\ObjNode.cpp">348 </File>349 <File350 341 RelativePath="..\src\ObjReader.cpp"> 351 342 </File> … … 356 347 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> 357 348 <File 358 RelativePath="..\include\ObjManualMeshLoader.h">359 </File>360 <File361 RelativePath="..\include\ObjMeshData.h">362 </File>363 <File364 RelativePath="..\include\ObjNode.h">365 </File>366 <File367 349 RelativePath="..\include\ObjReader.h"> 368 350 </File> -
GTP/trunk/Lib/Vis/Preprocessing/manual/integration.aux
r2104 r2111 20 20 \@writefile{toc}{\contentsline {subsection}{\numberline {5.1}Intersectable}{4}} 21 21 \newlabel{sec:intersectable}{{5.1}{4}} 22 \@writefile{toc}{\contentsline {subsection}{\numberline {5.2}Bounding Box Converter}{ 4}}23 \newlabel{sec:Converter}{{5.2}{ 4}}22 \@writefile{toc}{\contentsline {subsection}{\numberline {5.2}Bounding Box Converter}{5}} 23 \newlabel{sec:Converter}{{5.2}{5}} 24 24 \@writefile{toc}{\contentsline {section}{\numberline {6}View Cells Usage}{7}} 25 25 \newlabel{sec:usage}{{6}{7}} 26 26 \@setckpt{integration}{ 27 \setcounter{page}{ 8}27 \setcounter{page}{9} 28 28 \setcounter{equation}{0} 29 29 \setcounter{enumi}{0} -
GTP/trunk/Lib/Vis/Preprocessing/manual/integration.tex
r2104 r2111 148 148 \label{sec:Loading} 149 149 150 A view cells manager is returned from the loading call. It will be used to access and 151 manage the view cells from now on. For example, it can be applied to locate the current view cell. 152 For loading, the user has to provide the filename of the visibility solution, an ObjectContainer 150 The loading function returns a view cells. 151 152 \begin{verbatim} 153 static ViewCellsManager *LoadViewCells(const string &filename, 154 ObjectContainer *objects, 155 bool finalizeViewCells = false, 156 BoundingBoxConverter *bconverter = NULL); 157 \end{verbatim} 158 159 The user has to provide the filename of the visibility solution, an ObjectContainer 153 160 containing all the static entities of the scene, and a bounding box converter. 161 From now on, the view cells manager is used to access and 162 manage the view cells. For example, it can be applied to locate the current view cell. 154 163 After this step the view cells should be loaded and accessable in the engine. 155 164 … … 170 179 171 180 \begin{verbatim} 172 173 181 // a vector of engine entities 174 182 typedef vector<Entity *> EntityContainer; … … 201 209 This is maybe the most tricky part of the integration. The bounding box converter 202 210 is necessary because we have to associate the objects of the visibility solution with 203 the objects from the engine without having unique ids. 204 205 We give an example for a Bounding Box Converter 206 for Ogre. It is templated in order to works with any Ogre SceneManager. 211 the objects from the engine without having unique ids. This is the interface 212 of the {\em BoundingBoxConverter }. 213 214 \begin{verbatim} 215 /** This class assigns unique indices to objects by 216 comparing bounding boxes. 217 */ 218 class BoundingBoxConverter 219 { 220 public: 221 /** Takes a vector of indexed bounding boxes and 222 identify objects with a similar bounding box 223 It will then assign the bounding box id to the objects. 224 The objects are returned in the object container. 225 226 @returns true if conversion was successful 227 */ 228 virtual bool IdentifyObjects( 229 const IndexedBoundingBoxContainer &iboxes, 230 ObjectContainer &objects) const 231 { 232 // default: do nothing as we assume that a unique id is 233 // already assigned to the objects. 234 return true; 235 } 236 }; 237 \end{verbatim} 238 239 We give an example of implementation of a Bounding Box Converter 240 for Ogre3D rendering engine. It is templated in order to works with any Ogre SceneManager. 207 241 Again, the implementation of this interface must be adapted for the requirements 208 242 of the particular engine. 209 243 210 244 \begin{verbatim} 211 212 /** Class which converts preprocessor entites to Ogre3D entities 245 /** This class converts preprocessor entites to Ogre3D entities 213 246 */ 214 247 template<typename T> PlatFormBoundingBoxConverter: … … 216 249 { 217 250 public: 251 /** This constructor takes a scene manager template as parameter. 252 */ 218 253 PlatFormBoundingBoxConverter(T *sm); 219 254 220 /** Takes a vector of indexed bounding boxes and uses it to221 identify objects with a similar bounding box222 and assigns them the proper index (id).223 The objects are returned in the object container.224 225 @returns true if conversion was successful226 */227 255 bool IdentifyObjects(const GtpVisibilityPreprocessor:: 228 256 IndexedBoundingBoxContainer &iboxes, 229 257 GtpVisibilityPreprocessor::ObjectContainer &objects) const; 230 258 231 259 protected: … … 241 269 typedef PlatFormBoundingBoxConverter<OctreeSceneManager> 242 270 OctreeBoundingBoxConverter; 243 244 271 \end{verbatim} 245 272 246 273 This class is inherited from {\em BoundingBoxConverter}. 247 274 {\em BoundingBoxConverters} has only one virtual function {\em IdentifyObjects} that must 248 be implemented. Additionally we 249 use a helper function {\em FindIntersectingObjects} that is responsible for locating the 250 corresponding objects in the scene. Let's now have a look at the 251 implementation of {\em IdentifyObjects} for Ogre3D. 275 be implemented. Additionally we use a helper function {\em FindIntersectingObjects} that 276 is responsible for locating the corresponding objects in the scene. Let's now have a look 277 at the implementation of {\em IdentifyObjects} for Ogre3D. 252 278 253 279 \begin{verbatim} … … 280 306 281 307 The function just loops over the bounding boxes of the PVS entries and finds the entities that 282 are intersected by the bouding boxes. Let's have a look now at the function {\em FindIntersectingObjects}, which 283 is searching the intersections for each individual box. 284 308 are intersected by the bouding boxes. Let's have a look now at the function 309 {\em FindIntersectingObjects}, which is searching the intersections for each individual box. 285 310 286 311 \begin{verbatim} … … 330 355 Note that the implementation of this function is maybe the one that differs the most 331 356 for another engine, as it is highly depending on the particular engine design. 332 For the Ogre3D implementation, we use a two stage approach. First we find the intersecting scene nodes.333 We apply a search function that is optimized for this engine.334 In the Ogre3D case, this is the function {\em findNodesIn}.357 For the Ogre3D implementation, we use a two stage approach. First we find the 358 intersecting scene nodes. We apply a search function that is optimized for this engine. 359 In case of Ogre3D, this is the function {\em findNodesIn}. 335 360 The engine is responsible to provide a function for fast geometric search in the scene, 336 361 in order to quickly find the objects intersecting the bounding box of a PVS entry. … … 342 367 \label{sec:usage} 343 368 344 By now the view cells should be accessible within the target engine. This happens through 345 the view cells manager. In order to query the current view cell, use the following code. 369 By now the view cells should be accessible within the target engine. The 370 view cells manager provides the necessary functionality to handle the view cells. 371 In order to query the current view cell, use the following function of the 372 view cells manager. 373 374 \begin{verbatim} 375 ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const; 376 \end{verbatim} 377 378 In your engine, the function will called like this. 346 379 347 380 \begin{verbatim} 348 381 ViewCell *currentViewCell = viewCellsManager->GetViewCell(viewPoint); 349 350 \end{verbatim} 351 352 where {\em viewPoint} contains the current location of the player. It must be of type 382 \end{verbatim} 383 384 {\em viewPoint} contains the current location of the player. It must be of type 353 385 {\em GtpVisibilityPreprocessor::Vector3}. In order to traverse the PVS of this view cell, we 354 386 apply a PVS iterator, like in the following example. … … 377 409 } 378 410 } 379 380 \end{verbatim} 381 411 \end{verbatim} 412 -
GTP/trunk/Lib/Vis/Preprocessing/manual/manual.ilg
r2068 r2111 1 This is D:\texmf\MiKTeX\bin\makeindex.exe, version 2.14 [02-Oct-2002] (with Thai support).2 Scanning input file D:\svn\gametools\GTP\trunk\Lib\Vis\Preprocessing\manual\manual.idx...done (0 entries accepted, 0 rejected).3 Nothing written in D:\svn\gametools\GTP\trunk\Lib\Vis\Preprocessing\manual\manual.ind.4 Transcript written in D:\svn\gametools\GTP\trunk\Lib\Vis\Preprocessing\manual\manual.ilg.1 This is C:\texmf\MiKTeX\bin\makeindex.exe, version 2.14 [02-Oct-2002] (with Thai support). 2 Scanning input file E:\svn\gametools\GTP\trunk\Lib\Vis\Preprocessing\manual\manual.idx...done (0 entries accepted, 0 rejected). 3 Nothing written in E:\svn\gametools\GTP\trunk\Lib\Vis\Preprocessing\manual\manual.ind. 4 Transcript written in E:\svn\gametools\GTP\trunk\Lib\Vis\Preprocessing\manual\manual.ilg. -
GTP/trunk/Lib/Vis/Preprocessing/manual/manual.log
r2104 r2111 1 This is pdfeTeX, Version 3.141592-1.21a-2.2 (MiKTeX 2.4) (preloaded format=latex 200 5.8.25) 8 FEB 2007 14:021 This is pdfeTeX, Version 3.141592-1.21a-2.2 (MiKTeX 2.4) (preloaded format=latex 2007.1.5) 9 FEB 2007 14:21 2 2 entering extended mode 3 ** D:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/manual/manual.tex4 ( D:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/manual/manual.tex3 **E:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/manual/manual.tex 4 (E:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/manual/manual.tex 5 5 LaTeX2e <2003/12/01> 6 Babel <v3.8g> and hyphenation patterns for english, dumylang, nohyphenation, ge 7 rman, ngerman, french, loaded. 8 (D:\texmf\tex\latex\base\article.cls 6 Babel <v3.8a> and hyphenation patterns for english, french, german, ngerman, dumylang, nohyphenation, loaded. 7 (C:\texmf\tex\latex\base\article.cls 9 8 Document Class: article 2004/02/16 v1.4f Standard LaTeX document class 10 ( D:\texmf\tex\latex\base\size10.clo9 (C:\texmf\tex\latex\base\size10.clo 11 10 File: size10.clo 2004/02/16 v1.4f Standard LaTeX file (size option) 12 11 ) … … 22 21 \belowcaptionskip=\skip42 23 22 \bibindent=\dimen102 24 ) (D:\texmf\tex\latex\psnfss\times.sty 25 Package: times 2005/04/12 PSNFSS-v9.2a (SPQR) 26 ) 27 (D:\texmf\tex\latex\ltxmisc\a4wide.sty 23 ) (C:\texmf\tex\latex\psnfss\times.sty 24 Package: times 2004/09/15 PSNFSS-v9.2 (SPQR) 25 ) (C:\texmf\tex\latex\ltxmisc\a4wide.sty 28 26 Package: a4wide 1994/08/30 29 (D:\texmf\tex\latex\ntgclass\a4.sty 27 28 (C:\texmf\tex\latex\ntgclass\a4.sty 30 29 Package: a4 2004/04/15 v1.2g A4 based page layout 31 )) 32 (D:\texmf\tex\latex\float\float.sty 30 )) (C:\texmf\tex\latex\float\float.sty 33 31 Package: float 2001/11/08 v1.3d Float enhancements (AL) 34 32 \c@float@type=\count87 … … 47 45 \symmathboldr=\mathgroup6 48 46 LaTeX Font Info: Redeclaring math symbol \beta on input line 74. 49 ( D:\texmf\tex\latex\thumbpdf\thumbpdf.sty50 Package: thumbpdf 200 5/07/06 v3.8Inclusion of thumbnails (HO)47 (C:\texmf\tex\latex\thumbpdf\thumbpdf.sty 48 Package: thumbpdf 2004/11/19 v3.7 Inclusion of thumbnails (HO) 51 49 52 50 53 51 Package thumbpdf Warning: Thumbnail data file `manual.tpt' not found. 54 52 55 ) ( D:\texmf\tex\latex\base\alltt.sty53 ) (C:\texmf\tex\latex\base\alltt.sty 56 54 Package: alltt 1997/06/16 v2.0g defines alltt environment 57 ) ( D:\texmf\tex\latex\tools\hhline.sty55 ) (C:\texmf\tex\latex\tools\hhline.sty 58 56 Package: hhline 1994/05/23 v2.03 Table rule package (DPC) 59 ) 60 (multirow.sty 57 ) (multirow.sty 61 58 \bigstrutjot=\dimen103 62 ) (D:\texmf\tex\latex\ltxmisc\url.sty 59 ) 60 (C:\texmf\tex\latex\ltxmisc\url.sty 63 61 \Urlmuskip=\muskip10 64 Package: url 200 5/06/27 ver 3.2Verb mode for urls, etc.62 Package: url 2004/03/15 ver 3.1 Verb mode for urls, etc. 65 63 ) (rotating.sty 66 64 Package: rotating 1997/09/26, v2.13 Rotation package 67 68 (D:\texmf\tex\latex\graphics\graphicx.sty 65 (C:\texmf\tex\latex\graphics\graphicx.sty 69 66 Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) 70 67 71 ( D:\texmf\tex\latex\graphics\keyval.sty68 (C:\texmf\tex\latex\graphics\keyval.sty 72 69 Package: keyval 1999/03/16 v1.13 key=value parser (DPC) 73 70 \KV@toks@=\toks16 74 ) 75 (D:\texmf\tex\latex\graphics\graphics.sty 71 ) (C:\texmf\tex\latex\graphics\graphics.sty 76 72 Package: graphics 2001/07/07 v1.0n Standard LaTeX Graphics (DPC,SPQR) 77 ( D:\texmf\tex\latex\graphics\trig.sty73 (C:\texmf\tex\latex\graphics\trig.sty 78 74 Package: trig 1999/03/16 v1.09 sin cos tan (DPC) 79 ) ( D:\texmf\tex\latex\00miktex\graphics.cfg75 ) (C:\texmf\tex\latex\00miktex\graphics.cfg 80 76 File: graphics.cfg 2003/03/12 v1.1 MiKTeX 'graphics' configuration 81 77 ) 82 78 Package graphics Info: Driver file: pdftex.def on input line 80. 83 84 (D:\texmf\tex\latex\graphics\pdftex.def 85 File: pdftex.def 2005/06/20 v0.03m graphics/color for pdftex 79 (C:\texmf\tex\latex\graphics\pdftex.def 80 File: pdftex.def 2002/06/19 v0.03k graphics/color for pdftex 86 81 \Gread@gobject=\count88 87 82 )) 88 83 \Gin@req@height=\dimen104 89 84 \Gin@req@width=\dimen105 90 ) (D:\texmf\tex\latex\base\ifthen.sty 85 ) 86 (C:\texmf\tex\latex\base\ifthen.sty 91 87 Package: ifthen 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC) 92 88 ) … … 115 111 LaTeX Font Info: ... okay on input line 135. 116 112 LaTeX Font Info: Try loading font information for OT1+ptm on input line 135. 117 118 (D:\texmf\tex\latex\psnfss\ot1ptm.fd 113 (C:\texmf\tex\latex\psnfss\ot1ptm.fd 119 114 File: ot1ptm.fd 2001/06/04 font definitions for OT1/ptm. 120 ) 121 ( D:\texmf\tex\context\base\supp-pdf.tex (D:\texmf\tex\context\base\supp-mis.tex115 ) (C:\texmf\tex\context\base\supp-pdf.tex 116 (C:\texmf\tex\context\base\supp-mis.tex 122 117 loading : Context Support Macros / Miscellaneous (2004.10.26) 123 118 \protectiondepth=\count90 … … 158 153 LaTeX Font Info: External font `cmex10' loaded for size 159 154 (Font) <6> on input line 164. 160 LaTeX Font Info: Try loading font information for OML+cmbrm on input line 16 161 4. 162 (D:\texmf\tex\latex\cmbright\omlcmbrm.fd 163 File: omlcmbrm.fd 2005/04/13 v8.1 (WaS) 155 LaTeX Font Info: Try loading font information for OML+cmbrm on input line 164. 156 (C:\texmf\tex\latex\cmbright\omlcmbrm.fd 157 File: omlcmbrm.fd 1999/05/12 v7.3 (WaS) 164 158 ) 165 159 LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <14.4> not available … … 172 166 [1 173 167 174 {psfonts.map}] 175 (integration.tex 168 {psfonts.map}] (integration.tex 176 169 LaTeX Font Info: Try loading font information for OT1+pcr on input line 27. 177 (D:\texmf\tex\latex\psnfss\ot1pcr.fd 170 171 (C:\texmf\tex\latex\psnfss\ot1pcr.fd 178 172 File: ot1pcr.fd 2001/06/04 font definitions for OT1/pcr. 179 173 ) … … 181 175 (Font) Font shape `OT1/ptm/b/n' tried instead on input line 62. 182 176 LaTeX Font Info: Try loading font information for OMS+ptm on input line 68. 183 184 (D:\texmf\tex\latex\psnfss\omsptm.fd 177 (C:\texmf\tex\latex\psnfss\omsptm.fd 185 178 File: omsptm.fd 186 179 ) … … 190 183 191 184 ] [3] 192 Overfull \hbox (1.41376pt too wide) in paragraph at lines 195--195 193 [] \OT1/pcr/m/n/10 IntersectableWrapper<EntityCo 194 ntainer *>[] 195 [] 196 197 198 Overfull \hbox (19.41376pt too wide) in paragraph at lines 195--195 199 [] \OT1/pcr/m/n/10 EngineIntersectable(EntityContainer *item): GtpVisibilityP 200 reprocessor::[] 201 [] 202 203 [4] 204 Overfull \hbox (31.41376pt too wide) in paragraph at lines 279--279 205 [] \OT1/pcr/m/n/10 const GtpVisibilityPreprocessor::IndexedBoundingBoxCon 206 tainer &iboxes,[] 207 [] 208 209 [5] 210 Overfull \hbox (1.41376pt too wide) in paragraph at lines 279--279 211 [] \OT1/pcr/m/n/10 EngineIntersectable *entry = new EngineIntersectable(entr 212 yObjects);[] 213 [] 214 215 216 Overfull \hbox (1.41376pt too wide) in paragraph at lines 328--328 217 [] \OT1/pcr/m/n/10 for (sit = sceneNodeList.begin(); sit != sceneNodeList.end( 218 ); ++ sit)[] 219 [] 220 221 222 Overfull \hbox (7.41376pt too wide) in paragraph at lines 328--328 223 [] \OT1/pcr/m/n/10 // test for intersection (note: function provided of pr 224 eprocessor)[] 225 [] 226 227 [6]) [7] (manual.aux (integration.aux)) ) 185 Overfull \hbox (1.41376pt too wide) in paragraph at lines 203--203 186 [] \OT1/pcr/m/n/10 IntersectableWrapper<EntityContainer *>[] 187 [] 188 189 190 Overfull \hbox (19.41376pt too wide) in paragraph at lines 203--203 191 [] \OT1/pcr/m/n/10 EngineIntersectable(EntityContainer *item): GtpVisibilityPreprocessor::[] 192 [] 193 194 [4] [5] 195 Overfull \hbox (31.41376pt too wide) in paragraph at lines 305--305 196 [] \OT1/pcr/m/n/10 const GtpVisibilityPreprocessor::IndexedBoundingBoxContainer &iboxes,[] 197 [] 198 199 200 Overfull \hbox (1.41376pt too wide) in paragraph at lines 305--305 201 [] \OT1/pcr/m/n/10 EngineIntersectable *entry = new EngineIntersectable(entryObjects);[] 202 [] 203 204 205 Overfull \hbox (1.41376pt too wide) in paragraph at lines 353--353 206 [] \OT1/pcr/m/n/10 for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(); ++ sit)[] 207 [] 208 209 [6] 210 Overfull \hbox (7.41376pt too wide) in paragraph at lines 353--353 211 [] \OT1/pcr/m/n/10 // test for intersection (note: function provided of preprocessor)[] 212 [] 213 214 215 Overfull \hbox (37.41376pt too wide) in paragraph at lines 376--376 216 []\OT1/pcr/m/n/10 ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const;[] 217 [] 218 219 220 Overfull \hbox (12.43904pt too wide) in paragraph at lines 384--389 221 []\OT1/ptm/m/it/10 viewPoint \OT1/ptm/m/n/10 con-tains the cur-rent lo-ca-tion of the player. It must be of type \OT1/pt 222 m/m/it/10 Gt-pVis-i-bil-i-tyPre-proces-sor::Vector3\OT1/ptm/m/n/10 . 223 [] 224 225 [7]) [8] (manual.aux (integration.aux)) 226 227 LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. 228 229 ) 228 230 Here is how much of TeX's memory you used: 229 1532 strings out of 9551 5230 16 755 string characters out of 1189489231 649 51 words of memory out of 1065662232 450 0multiletter control sequences out of 60000233 21808 words of font info for 49 fonts, out of 1000000 for 2000234 14 hyphenation exceptions out of 4999235 32i,7n,21p,279b,2 39s stack positions out of 5000i,500n,10000p,200000b,32768s231 1532 strings out of 95512 232 16885 string characters out of 1189449 233 64934 words of memory out of 1065638 234 4503 multiletter control sequences out of 60000 235 21808 words of font info for 49 fonts, out of 500000 for 1000 236 14 hyphenation exceptions out of 607 237 32i,7n,21p,279b,241s stack positions out of 1500i,500n,5000p,200000b,32768s 236 238 PDF statistics: 237 38PDF objects out of 300000239 41 PDF objects out of 300000 238 240 0 named destinations out of 300000 239 241 1 words of extra memory for PDF output out of 65536 240 <D:\texmf\fonts\type1\bluesky\cm\cmsy1 241 0.pfb>{8r.enc}<D:\texmf\fonts\type1\urw\urwstd\ucrr8a.pfb><D:\texmf\fonts\type1 242 \urw\urwstd\utmri8a.pfb><D:\texmf\fonts\type1\urw\urwstd\utmb8a.pfb><D:\texmf\f 243 onts\type1\urw\urwstd\utmr8a.pfb> 244 Output written on manual.pdf (7 pages, 82926 bytes). 242 <C:\texmf\fonts\type1\bluesky\cm\cmsy10.pfb>{8r.enc}<C:\texmf\fonts\type1\urw\urwstd\ucrr8a.pfb><C:\texmf\fonts\type1\ 243 urw\urwstd\utmri8a.pfb><C:\texmf\fonts\type1\urw\urwstd\utmb8a.pfb><C:\texmf\fonts\type1\urw\urwstd\utmr8a.pfb> 244 Output written on manual.pdf (8 pages, 84658 bytes). -
GTP/trunk/Lib/Vis/Preprocessing/manual/manual.toc
r2104 r2111 9 9 \contentsline {section}{\numberline {5}Example Implementation}{4} 10 10 \contentsline {subsection}{\numberline {5.1}Intersectable}{4} 11 \contentsline {subsection}{\numberline {5.2}Bounding Box Converter}{ 4}11 \contentsline {subsection}{\numberline {5.2}Bounding Box Converter}{5} 12 12 \contentsline {section}{\numberline {6}View Cells Usage}{7} -
GTP/trunk/Lib/Vis/Preprocessing/src/BoundingBoxConverter.h
r2066 r2111 16 16 }; 17 17 18 /** Class used to assign unique indices to objects using a19 comparison ofbounding boxes.18 /** This class assigns unique indices to objects by 19 comparing bounding boxes. 20 20 */ 21 21 class BoundingBoxConverter -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2076 r2111 265 265 266 266 267 bool Preprocessor::LoadBinaryObj(const string filename,267 bool Preprocessor::LoadBinaryObj(const string &filename, 268 268 SceneGraphNode *root, 269 269 vector<FaceParentInfo> *parents) … … 277 277 cout << "binary obj dump available, loading " << filename.c_str() << endl; 278 278 279 // table for vertices280 VertexContainer vertices;281 282 if (parents)283 cout << "using face parents" << endl;284 else285 cout << "not using face parents" << endl;286 287 279 // read in triangle size 288 280 int numTriangles; … … 309 301 root->mGeometry.push_back(obj); 310 302 311 i ++; 312 313 if (i % 500000 == 499999) 303 if ((i ++) % 500000 == 499999) 314 304 cout<<"\r"<<i<<"/"<<numTriangles<<"\r"; 315 305 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r2105 r2111 260 260 protected: 261 261 262 bool LoadBinaryObj(const string filename,262 bool LoadBinaryObj(const string &filename, 263 263 SceneGraphNode *root, 264 264 vector<FaceParentInfo> *parents); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2105 r2111 286 286 virtual void GetPrVS(const Vector3 &viewPoint, PrVs &prvs, const float filterWidth); 287 287 288 /** Get a viewcell containing the specified point288 /** Get a viewcell containing the specified view point. 289 289 @param active if the active or elementary view cell should be returned. 290 290 */
Note: See TracChangeset
for help on using the changeset viewer.