Index: src/shared/vmap/VMapManager.cpp =================================================================== --- src/shared/vmap/VMapManager.cpp (revision 5230) +++ src/shared/vmap/VMapManager.cpp (working copy) @@ -19,6 +19,8 @@ #include "VMapManager.h" #include "VMapDefinitions.h" +using namespace G3D; + namespace VMAP { Index: src/shared/vmap/BaseModel.h =================================================================== --- src/shared/vmap/BaseModel.h (revision 5230) +++ src/shared/vmap/BaseModel.h (working copy) @@ -45,7 +45,7 @@ TreeNode *iTreeNodes; unsigned int iNTriangles; unsigned int iNNodes; - Vector3 iBasePosition; + G3D::Vector3 iBasePosition; public: BaseModel() { iNTriangles = 0; iNNodes = 0; iTriangles = 0; iTreeNodes = 0;}; BaseModel(unsigned int pNNodes , TreeNode* pTreeNode, unsigned int pNTriangles, TriangleBox* pTriangleBox) @@ -60,7 +60,7 @@ void free(); void init(unsigned int pNNodes, unsigned int pNTriangles); - void getMember(Array& pMembers); + void getMember(G3D::Array& pMembers); inline const TriangleBox& getTriangle(int pPos) const { return(iTriangles[pPos]); } inline TriangleBox& getTriangle(int pPos) { return(iTriangles[pPos]); } @@ -72,9 +72,9 @@ inline const void setTreeNode(const TreeNode& pTreeNode, int pPos) { getTreeNodes()[pPos] = pTreeNode; } - inline const void setBasePosition(const Vector3& pBasePosition) { iBasePosition = pBasePosition; } + inline const void setBasePosition(const G3D::Vector3& pBasePosition) { iBasePosition = pBasePosition; } - inline const Vector3& getBasePosition() const { return(iBasePosition); } + inline const G3D::Vector3& getBasePosition() const { return(iBasePosition); } inline unsigned int getNNodes() const { return(iNNodes); } inline unsigned int getNTriangles() const { return(iNTriangles); } Index: src/shared/vmap/TileAssembler.h =================================================================== --- src/shared/vmap/TileAssembler.h (revision 5230) +++ src/shared/vmap/TileAssembler.h (working copy) @@ -39,24 +39,24 @@ class ModelPosition { private: - Matrix3 ixMatrix; - Matrix3 iyMatrix; - Matrix3 izMatrix; + G3D::Matrix3 ixMatrix; + G3D::Matrix3 iyMatrix; + G3D::Matrix3 izMatrix; public: - Vector3 iPos; - Vector3 iDir; + G3D::Vector3 iPos; + G3D::Vector3 iDir; float iScale; void init() { // Swap x and y the raw data uses the axis differently - ixMatrix = Matrix3::fromAxisAngle(Vector3::UNIT_Y,-(G3D_PI*iDir.x/180.0)); - iyMatrix = Matrix3::fromAxisAngle(Vector3::UNIT_X,-(G3D_PI*iDir.y/180.0)); - izMatrix = Matrix3::fromAxisAngle(Vector3::UNIT_Z,-(G3D_PI*iDir.z/180.0)); + ixMatrix = G3D::Matrix3::fromAxisAngle(G3D::Vector3::UNIT_Y,-(G3D_PI*iDir.x/180.0)); + iyMatrix = G3D::Matrix3::fromAxisAngle(G3D::Vector3::UNIT_X,-(G3D_PI*iDir.y/180.0)); + izMatrix = G3D::Matrix3::fromAxisAngle(G3D::Vector3::UNIT_Z,-(G3D_PI*iDir.z/180.0)); } - Vector3 transform(const Vector3& pIn) const; - void moveToBasePos(const Vector3& pBasePos) { iPos -= pBasePos; } + G3D::Vector3 transform(const G3D::Vector3& pIn) const; + void moveToBasePos(const G3D::Vector3& pBasePos) { iPos -= pBasePos; } }; //=============================================== @@ -67,22 +67,22 @@ std::string iDestDir; std::string iSrcDir; bool (*iFilterMethod)(char *pName); - Table iUniqueNameIds; + G3D::Table iUniqueNameIds; unsigned int iCurrentUniqueNameId; public: TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName); virtual ~TileAssembler(); - bool fillModelContainerArray(const std::string& pDirFileName, unsigned int pMapId, int pXPos, int pYPos, Array& pMC); - ModelContainer* processNames(const Array& pPosFileNames, const char* pDestFileName); + bool fillModelContainerArray(const std::string& pDirFileName, unsigned int pMapId, int pXPos, int pYPos, G3D::Array& pMC); + ModelContainer* processNames(const G3D::Array& pPosFileNames, const char* pDestFileName); void init(); bool convertWorld(); - bool fillModelIntoTree(AABSPTree *pMainTree, const Vector3& pBasePos, std::string& pPosFilename, std::string& pModelFilename); + bool fillModelIntoTree(G3D::AABSPTree *pMainTree, const G3D::Vector3& pBasePos, std::string& pPosFilename, std::string& pModelFilename); void getModelPosition(std::string& pPosString, ModelPosition& pModelPosition); - bool readRawFile(std::string& pModelFilename, ModelPosition& pModelPosition, AABSPTree *pMainTree); + bool readRawFile(std::string& pModelFilename, ModelPosition& pModelPosition, G3D::AABSPTree *pMainTree); void addWorldAreaMapId(unsigned int pMapId) { iCoordModelMapping->addWorldAreaMap(pMapId); } void setModelNameFilterMethod(bool (*pFilterMethod)(char *pName)) { iFilterMethod = pFilterMethod; } std::string getDirEntryNameFromModName(unsigned int pMapId, const std::string& pModPosName); Index: src/shared/vmap/RayIntersectionIterator.h =================================================================== --- src/shared/vmap/RayIntersectionIterator.h (revision 5230) +++ src/shared/vmap/RayIntersectionIterator.h (working copy) @@ -24,8 +24,6 @@ #include "NodeValueAccess.h" -using namespace G3D; - /** The Class is mainly taken from G3D/AABSPTree.h but modified to be able to use our internal data structure. This is an iterator that helps us analysing the BSP-Trees. @@ -39,21 +37,21 @@ { public: static bool collisionLocationForMovingPointFixedAABox( - const Vector3& origin, - const Vector3& dir, - const AABox& box, - Vector3& location, + const G3D::Vector3& origin, + const G3D::Vector3& dir, + const G3D::AABox& box, + G3D::Vector3& location, bool& Inside, - Vector3& normal) + G3D::Vector3& normal) { // Integer representation of a floating-point value. - #define IR(x) ((uint32&)x) + #define IR(x) ((G3D::uint32&)x) Inside = true; - const Vector3& MinB = box.low(); - const Vector3& MaxB = box.high(); - Vector3 MaxT(-1.0f, -1.0f, -1.0f); + const G3D::Vector3& MinB = box.low(); + const G3D::Vector3& MaxB = box.high(); + G3D::Vector3 MaxT(-1.0f, -1.0f, -1.0f); // Find candidate planes. for (int i = 0; i < 3; ++i) @@ -124,7 +122,7 @@ } // Choose the normal to be the plane normal facing into the ray - normal = Vector3::zero(); + normal = G3D::Vector3::zero(); normal[WhichPlane] = (dir[WhichPlane] > 0) ? -1.0 : 1.0; return true; @@ -134,8 +132,8 @@ }; #ifdef _DEBUG_VMAPS - extern Vector3 p1,p2,p3,p4,p5,p6,p7; - extern ArraygBoxArray; + extern G3D::Vector3 p1,p2,p3,p4,p5,p6,p7; + extern G3D::ArraygBoxArray; extern int gCount1, gCount2, gCount3, gCount4; extern bool myfound; #endif @@ -174,16 +172,16 @@ /** cache intersection values when they're checked on the preSide, split so they don't need to be checked again after the split. */ - Array intersectionCache; + G3D::Array intersectionCache; NodeValueAccess* iNodeValueAccess; - void init(NodeValueAccess* pNodeValueAccess, const TNode* inNode, const Ray& ray, float inMinTime, float inMaxTime) + void init(NodeValueAccess* pNodeValueAccess, const TNode* inNode, const G3D::Ray& ray, float inMinTime, float inMaxTime) { node = inNode; minTime = inMinTime; maxTime = inMaxTime; - minTime2 = square(minTime); + minTime2 = G3D::square(minTime); valIndex = -1; iNodeValueAccess = pNodeValueAccess; @@ -193,7 +191,7 @@ { startTime = minTime; endTime = maxTime; - endTime2 = square(maxTime); + endTime2 = G3D::square(maxTime); nextChild = -1; return; } @@ -215,15 +213,15 @@ t2 = inf(); } } - double inMaxTime2 = square(inMaxTime); + double inMaxTime2 = G3D::square(inMaxTime); if(t2 > inMaxTime2 || t2 < -inMaxTime2) { // The box is too far of to be hit valIndex = INT_MAX-1; } */ - Vector3::Axis splitAxis = node->getSplitAxis(); - double splitLocation = node->getSplitLocation(); + G3D::Vector3::Axis splitAxis = node->getSplitAxis(); + double splitLocation = node->getSplitLocation(); // this is the time along the ray until the split. // could be negative if the split is behind. @@ -239,12 +237,12 @@ // the correct child is gone too. if (splitTime <= minTime) { - splitTime = inf(); + splitTime = G3D::inf(); } startTime = minTime; - endTime = min((double)maxTime, splitTime); - endTime2 = square(endTime); + endTime = G3D::min((double)maxTime, splitTime); + endTime2 = G3D::square(endTime); double rayLocation = ray.origin[splitAxis] + ray.direction[splitAxis] * minTime; @@ -297,11 +295,11 @@ int debugCounter; private: - Ray ray; - Ray reverseRay; + G3D::Ray ray; + G3D::Ray reverseRay; bool isEnd; - Array stack; + G3D::Array stack; int stackLength; int stackIndex; int breakFrameIndex; @@ -311,15 +309,15 @@ double boxMaxDist; public: - RayIntersectionIterator(const NodeValueAccess pNodeValueAccess, const Ray& r, const TNode* root, double pMaxTime, bool skip) - : minDistance(0), maxDistance(inf()), debugCounter(0), + RayIntersectionIterator(const NodeValueAccess pNodeValueAccess, const G3D::Ray& r, const TNode* root, double pMaxTime, bool skip) + : minDistance(0), maxDistance(G3D::inf()), debugCounter(0), ray(r), isEnd(root == NULL), stackLength(20), stackIndex(0), breakFrameIndex(-1), skipAABoxTests(skip) { iNodeValueAccess = pNodeValueAccess; stack.resize(stackLength); - stack[stackIndex].init(&iNodeValueAccess, root, ray, 0, inf()); + stack[stackIndex].init(&iNodeValueAccess, root, ray, 0, G3D::inf()); //stack[stackIndex].init(&iNodeValueAccess, root, ray, 0, pMaxTime); boxMaxDist2 = pMaxTime*pMaxTime; boxMaxDist = pMaxTime; @@ -414,7 +412,7 @@ s->valIndex = -1; s->startTime = s->endTime; s->endTime = s->maxTime; - s->endTime2 = square(s->maxTime); + s->endTime2 = G3D::square(s->maxTime); s->nextChild = (s->nextChild >= 0) ? (1 - s->nextChild) : -1; // this could be changed somehow, @@ -481,15 +479,15 @@ if (s->startTime == s->minTime) { bool insiteOk; - Vector3 mynormal; - Vector3 location; + G3D::Vector3 mynormal; + G3D::Vector3 location; TValue currValue = iNodeValueAccess.getValue(s->valIndex+ s->node->getStartPosition()); #ifdef _DEBUG_VMAPS if(gCount2 >= gCount1) { - AABox testbox = currValue.getAABoxBounds(); - gBoxArray.append(AABox(testbox.low() + currValue.getBasePosition(), testbox.high() + currValue.getBasePosition())); + G3D::AABox testbox = currValue.getAABoxBounds(); + gBoxArray.append(G3D::AABox(testbox.low() + currValue.getBasePosition(), testbox.high() + currValue.getBasePosition())); } ++gCount2; #endif @@ -506,10 +504,10 @@ } else { - t2 = inf(); + t2 = G3D::inf(); } if(t2 > boxMaxDist2) - t2=inf(); // too far off + t2=G3D::inf(); // too far off s->intersectionCache[s->valIndex] = t2; ++debugCounter; } Index: src/shared/vmap/ModelContainer.cpp =================================================================== --- src/shared/vmap/ModelContainer.cpp (revision 5230) +++ src/shared/vmap/ModelContainer.cpp (working copy) @@ -24,6 +24,8 @@ #include "ModelContainer.h" #include "VMapDefinitions.h" +using namespace G3D; + namespace VMAP { //========================================================== Index: src/shared/vmap/CoordModelMapping.cpp =================================================================== --- src/shared/vmap/CoordModelMapping.cpp (revision 5230) +++ src/shared/vmap/CoordModelMapping.cpp (working copy) @@ -20,6 +20,8 @@ #include +using namespace G3D; + namespace VMAP { Index: src/shared/vmap/VMapManager.h =================================================================== --- src/shared/vmap/VMapManager.h (revision 5230) +++ src/shared/vmap/VMapManager.h (working copy) @@ -53,7 +53,7 @@ { private: int iRefCount; - Array iFiles; + G3D::Array iFiles; public: FilesInDir() { iRefCount = 0; } @@ -61,7 +61,7 @@ void incRefCount() { iRefCount++; } void decRefCount() { if(iRefCount > 0) iRefCount--; } int getRefCount() { return iRefCount; } - const Array& getFiles() const { return iFiles; } + const G3D::Array& getFiles() const { return iFiles; } }; //=========================================================== @@ -72,24 +72,24 @@ class MapTree { private: - AABSPTree *iTree; + G3D::AABSPTree *iTree; // Key: filename, value ModelContainer - Table iLoadedModelContainer; + G3D::Table iLoadedModelContainer; // Key: dir file name, value FilesInDir - Table iLoadedDirFiles; + G3D::Table iLoadedDirFiles; // Store all the map tile idents that are loaded for that map // some maps are not splitted into tiles and we have to make sure, not removing the map before all tiles are removed - Table iLoadedMapTiles; + G3D::Table iLoadedMapTiles; std::string iBasePath; private: - float getIntersectionTime(const Ray& pRay, float pMaxDist, bool pStopAtFirstHit); + float getIntersectionTime(const G3D::Ray& pRay, float pMaxDist, bool pStopAtFirstHit); bool isAlreadyLoaded(const std::string& pName) { return(iLoadedModelContainer.containsKey(pName)); } - RayIntersectionIterator::Node, ModelContainer*> beginRayIntersection(const Ray& ray, bool skipAABoxTests = false) const; - RayIntersectionIterator::Node, ModelContainer*> endRayIntersection() const; + RayIntersectionIterator::Node, ModelContainer*> beginRayIntersection(const G3D::Ray& ray, bool skipAABoxTests = false) const; + RayIntersectionIterator::Node, ModelContainer*> endRayIntersection() const; void setLoadedMapTile(unsigned int pTileIdent) { iLoadedMapTiles.set(pTileIdent, true); } void removeLoadedMapTile(unsigned int pTileIdent) { iLoadedMapTiles.remove(pTileIdent); } bool hasLoadedMapTiles() { return(iLoadedMapTiles.size() > 0); } @@ -102,15 +102,15 @@ MapTree(const char *pBasePath); ~MapTree(); - bool isInLineOfSight(const Vector3& pos1, const Vector3& pos2); - bool getObjectHitPos(const Vector3& pos1, const Vector3& pos2, Vector3& pResultHitPos, float pModifyDist); - float getHeight(const Vector3& pPos); + bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2); + bool getObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist); + float getHeight(const G3D::Vector3& pPos); bool loadMap(const std::string& pDirFileName, unsigned int pMapTileIdent); void addModelConatiner(const std::string& pName, ManagedModelContainer *pMc); void unloadMap(const std::string& dirFileName, unsigned int pMapTileIdent, bool pForce=false); - void getModelContainer(Array& pArray ) { iTree->getMembers(pArray); } + void getModelContainer(G3D::Array& pArray ) { iTree->getMembers(pArray); } const void addDirFile(const std::string& pDirName, const FilesInDir& pFilesInDir) { iLoadedDirFiles.set(pDirName, pFilesInDir); } int size() { return(iTree->size()); } }; @@ -128,9 +128,9 @@ { private: // Tree to check collision - Table iInstanceMapTrees; - Table iMapsSplitIntoTiles; - Table iIgnoreMapIds; + G3D::Table iInstanceMapTrees; + G3D::Table iMapsSplitIntoTiles; + G3D::Table iIgnoreMapIds; CommandFileRW iCommandLogger; private: @@ -140,8 +140,8 @@ public: // public for debug - Vector3 convertPositionToInternalRep(float x, float y, float z) const; - Vector3 convertPositionToMangosRep(float x, float y, float z) const; + G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const; + G3D::Vector3 convertPositionToMangosRep(float x, float y, float z) const; std::string getDirFileName(unsigned int pMapId) const; std::string getDirFileName(unsigned int pMapId, int x, int y) const; MapTree* getInstanceMapTree(int pMapId) { return(iInstanceMapTrees.get(pMapId)); } Index: src/shared/vmap/TreeNode.cpp =================================================================== --- src/shared/vmap/TreeNode.cpp (revision 5230) +++ src/shared/vmap/TreeNode.cpp (working copy) @@ -18,6 +18,8 @@ #include "TreeNode.h" +using namespace G3D; + namespace VMAP { Index: src/shared/vmap/ModelContainer.h =================================================================== --- src/shared/vmap/ModelContainer.h (revision 5230) +++ src/shared/vmap/ModelContainer.h (working copy) @@ -51,7 +51,7 @@ unsigned int iNSubModel; SubModel *iSubModel; //Vector3 iDirection; - AABox iBox; + G3D::AABox iBox; public: ModelContainer() : BaseModel() { iNSubModel =0; iSubModel = 0; }; @@ -59,11 +59,11 @@ // for the mainnode ModelContainer(unsigned int pNTriangles, unsigned int pNNodes, unsigned int pNSubModel); - ModelContainer(AABSPTree *pTree); + ModelContainer(G3D::AABSPTree *pTree); ~ModelContainer(void); - RayIntersectionIterator beginRayIntersection(const Ray& ray, double pMaxTime, bool skipAABoxTests = false) const; + RayIntersectionIterator beginRayIntersection(const G3D::Ray& ray, double pMaxTime, bool skipAABoxTests = false) const; RayIntersectionIterator endRayIntersection() const; @@ -73,17 +73,17 @@ inline unsigned int getNSubModel() const { return(iNSubModel); } - RealTime getIntersectionTime(const Ray&, bool pExitAtFirst, float pMaxDist) const; + G3D::RealTime getIntersectionTime(const G3D::Ray&, bool pExitAtFirst, float pMaxDist) const; - void countSubModelsAndNodesAndTriangles(AABSPTree::Node& pNode, int& nSubModels, int& nNodes, int& nTriangles); + void countSubModelsAndNodesAndTriangles(G3D::AABSPTree::Node& pNode, int& nSubModels, int& nNodes, int& nTriangles); - void fillContainer(const AABSPTree::Node& pNode, int &pSubModelPos, int &pTreeNodePos, int &pTrianglePos, Vector3& pLo, Vector3& pHi, Vector3& pFinalLo, Vector3& pFinalHi); + void fillContainer(const G3D::AABSPTree::Node& pNode, int &pSubModelPos, int &pTreeNodePos, int &pTrianglePos, G3D::Vector3& pLo, G3D::Vector3& pHi, G3D::Vector3& pFinalLo, G3D::Vector3& pFinalHi); bool readRawFile(const char *name); - inline const AABox& getAABoxBounds() const { return(iBox); } + inline const G3D::AABox& getAABoxBounds() const { return(iBox); } - inline void setBounds(const Vector3& lo, const Vector3& hi) { iBox.set(lo,hi); } + inline void setBounds(const G3D::Vector3& lo, const G3D::Vector3& hi) { iBox.set(lo,hi); } bool writeFile(const char *filename); Index: src/shared/vmap/CoordModelMapping.h =================================================================== --- src/shared/vmap/CoordModelMapping.h (revision 5230) +++ src/shared/vmap/CoordModelMapping.h (working copy) @@ -22,8 +22,6 @@ #include #include -using namespace G3D; - /** This Class is a helper Class to convert the raw vector data into BSP-Trees. We read the directory file of the raw data output and build logical groups. @@ -42,8 +40,8 @@ class NameCollection { public: - Array iMainFiles; - Array iSingeFiles; + G3D::Array iMainFiles; + G3D::Array iSingeFiles; void appendToMain(std::string pStr) { iMainFiles.append(pStr); } void appendToSingle(std::string pStr) { iSingeFiles.append(pStr); } @@ -59,7 +57,7 @@ int xPos; int yPos; unsigned int iMapId; - Array iFilenames; + G3D::Array iFilenames; public: CMappingEntry() { }; @@ -72,7 +70,7 @@ void addFilename(char *pName); const std::string getKeyString() const; - inline const Array& getFilenames() const { return(iFilenames); } + inline const G3D::Array& getFilenames() const { return(iFilenames); } static const std::string getKeyString(unsigned int pMapId, int pXPos, int pYPos) { @@ -88,10 +86,10 @@ class CoordModelMapping { private: - Table iMapObjectFiles; - Table iProcesseSingleFiles; - Array iMapIds; - Array iWorldAreaGroups; + G3D::Table iMapObjectFiles; + G3D::Table iProcesseSingleFiles; + G3D::Array iMapIds; + G3D::Array iWorldAreaGroups; bool (*iFilterMethod)(char *pName); inline void addCMappingEntry(CMappingEntry* pCMappingEntry) @@ -127,7 +125,7 @@ return(mapId); } - const Array& getMaps() const { return iMapIds; } + const G3D::Array& getMaps() const { return iMapIds; } inline bool isAlreadyProcessedSingleFile(std::string pName) { return(iProcesseSingleFiles.containsKey(pName)); } inline void addAlreadyProcessedSingleFile(std::string pName) { iProcesseSingleFiles.set(pName,pName); } Index: src/shared/vmap/DebugCmdLogger.cpp =================================================================== --- src/shared/vmap/DebugCmdLogger.cpp (revision 5230) +++ src/shared/vmap/DebugCmdLogger.cpp (working copy) @@ -18,6 +18,8 @@ #include "DebugCmdLogger.h" +using namespace G3D; + namespace VMAP { Index: src/shared/vmap/SubModel.cpp =================================================================== --- src/shared/vmap/SubModel.cpp (revision 5230) +++ src/shared/vmap/SubModel.cpp (working copy) @@ -22,6 +22,8 @@ extern FILE *::g_df; #endif +using namespace G3D; + namespace VMAP { Index: src/shared/vmap/TreeNode.h =================================================================== --- src/shared/vmap/TreeNode.h (revision 5230) +++ src/shared/vmap/TreeNode.h (working copy) @@ -25,8 +25,6 @@ #include #include -using namespace G3D; - namespace VMAP { /** @@ -46,8 +44,8 @@ int iChilds[2]; //Position within the TriangleBox array unsigned int iStartPosition; - Vector3::Axis iSplitAxis; - AABox iBounds; + G3D::Vector3::Axis iSplitAxis; + G3D::AABox iBounds; unsigned short iNumberOfValues; public: TreeNode() {} @@ -65,16 +63,16 @@ // pChildNo = 0 or 1 inline void setChildPos(int pChildNo, int pChildPosInTreeNodeArray) { iChilds[pChildNo] = pChildPosInTreeNodeArray; } - inline Vector3::Axis getSplitAxis() const { return(iSplitAxis); } + inline G3D::Vector3::Axis getSplitAxis() const { return(iSplitAxis); } - inline void setSplitAxis(Vector3::Axis a) { iSplitAxis = a; } + inline void setSplitAxis(G3D::Vector3::Axis a) { iSplitAxis = a; } inline void setSplitLocation(float l) { iSplitLocation = l; } - inline void setBounds(const AABox& pBox) { iBounds = pBox; } + inline void setBounds(const G3D::AABox& pBox) { iBounds = pBox; } - inline void setBounds(const Vector3& lo, const Vector3& hi) { iBounds.set(lo,hi); } + inline void setBounds(const G3D::Vector3& lo, const G3D::Vector3& hi) { iBounds.set(lo,hi); } - inline void getBounds(AABox& pBox) const { pBox.set(iBounds.low(),iBounds.high()); } + inline void getBounds(G3D::AABox& pBox) const { pBox.set(iBounds.low(),iBounds.high()); } inline float getSplitLocation() const { return(iSplitLocation); } Index: src/shared/vmap/AABSPTree.h =================================================================== --- src/shared/vmap/AABSPTree.h (revision 5230) +++ src/shared/vmap/AABSPTree.h (working copy) @@ -1127,7 +1127,7 @@ node = inNode; minTime = inMinTime; maxTime = inMaxTime; - minTime2 = square(minTime); + minTime2 = G3D::square(minTime); valIndex = -1; intersectionCache.resize(node->valueArray.length()); @@ -1135,7 +1135,7 @@ if (node->child[0] == NULL && node->child[1] == NULL) { startTime = minTime; endTime = maxTime; - endTime2 = square(maxTime); + endTime2 = G3D::square(maxTime); nextChild = -1; return; } @@ -1161,7 +1161,7 @@ startTime = minTime; endTime = min((double)maxTime, splitTime); - endTime2 = square(endTime); + endTime2 = G3D::square(endTime); double rayLocation = ray.origin[splitAxis] + ray.direction[splitAxis] * minTime; @@ -1299,7 +1299,7 @@ s->valIndex = -1; s->startTime = s->endTime; s->endTime = s->maxTime; - s->endTime2 = square(s->maxTime); + s->endTime2 = G3D::square(s->maxTime); s->nextChild = (s->nextChild >= 0) ? (1 - s->nextChild) : -1; Index: src/shared/vmap/ShortBox.h =================================================================== --- src/shared/vmap/ShortBox.h (revision 5230) +++ src/shared/vmap/ShortBox.h (working copy) @@ -42,8 +42,8 @@ inline const ShortVector& getHi() const { return(iV2); } inline void setLo(const ShortVector& pV){ iV1 = pV; } inline void setHi(const ShortVector& pV){ iV2 = pV; } - inline void setLo(const Vector3& pV){ iV1 = ShortVector(pV); } - inline void setHi(const Vector3& pV){ iV2 = ShortVector(pV); } + inline void setLo(const G3D::Vector3& pV){ iV1 = ShortVector(pV); } + inline void setHi(const G3D::Vector3& pV){ iV2 = ShortVector(pV); } inline bool operator==(const ShortBox& b) const { @@ -58,7 +58,7 @@ //===================================================================== - static const Vector3 dummyZeroPosition = Vector3(0,0,0); + static const G3D::Vector3 dummyZeroPosition = G3D::Vector3(0,0,0); class TriangleBox { @@ -95,9 +95,9 @@ box.setHi(hi); return(box); } - inline const Vector3& getBasePosition() { return(dummyZeroPosition); } + inline const G3D::Vector3& getBasePosition() { return(dummyZeroPosition); } - inline const AABox getAABoxBounds() const { ShortBox box = getBounds(); return(AABox(box.getLo().getVector3(), box.getHi().getVector3())); } + inline const G3D::AABox getAABoxBounds() const { ShortBox box = getBounds(); return(G3D::AABox(box.getLo().getVector3(), box.getHi().getVector3())); } inline bool operator==(const TriangleBox& t) const { Index: src/shared/vmap/DebugCmdLogger.h =================================================================== --- src/shared/vmap/DebugCmdLogger.h (revision 5230) +++ src/shared/vmap/DebugCmdLogger.h (working copy) @@ -22,8 +22,6 @@ #include #include -using namespace G3D; - /** Class is used for debugging. We log activities into a file. With an external Class we read that log and display the activity in a graphical view. @@ -58,29 +56,29 @@ Command() { iType = STOP; } inline int getType() { return iType; } - inline Vector3 getVector(int pos) { return(Vector3(floats[pos*3+0], floats[pos*3+1], floats[pos*3+2])); } + inline G3D::Vector3 getVector(int pos) { return(G3D::Vector3(floats[pos*3+0], floats[pos*3+1], floats[pos*3+2])); } inline int getInt(int pos) { return(ints[pos]); } inline char* getBuffer() { return(buffer); } void fillStopCmd() { iType = STOP; } void fillStartCmd() { iType = START; } - void fillLoadTileCmd(int x, int y, uint32 pMapId) { iType = LOAD_TILE; ints[0] = x; ints[1] = y; ints[2] = pMapId; } + void fillLoadTileCmd(int x, int y, G3D::uint32 pMapId) { iType = LOAD_TILE; ints[0] = x; ints[1] = y; ints[2] = pMapId; } //void fillLoadTileCmd(int x,int y) { iType = LOAD_TILE; ints[0] = x; ints[1] = y; } - void fillUnloadTileCmd(uint32 pMapId) { iType = UNLOAD_INSTANCE; ints[0] = pMapId; } + void fillUnloadTileCmd(G3D::uint32 pMapId) { iType = UNLOAD_INSTANCE; ints[0] = pMapId; } void fillUnloadTileCmd(unsigned int pMapId, int x,int y) { iType = UNLOAD_TILE; ints[0] = x; ints[1] = y; ints[0]=pMapId; } - void fillSetPosCmd(Vector3 pPos) { iType = SET_POS; floats[0] = pPos.x; floats[1]=pPos.y; floats[2]=pPos.z; } - void fillTestVisCmd(int pMapId, Vector3 pPos1, Vector3 pPos2, bool result) + void fillSetPosCmd(G3D::Vector3 pPos) { iType = SET_POS; floats[0] = pPos.x; floats[1]=pPos.y; floats[2]=pPos.z; } + void fillTestVisCmd(int pMapId, G3D::Vector3 pPos1, G3D::Vector3 pPos2, bool result) { iType = TEST_VIS; floats[0] = pPos1.x; floats[1]=pPos1.y; floats[2]=pPos1.z; floats[3] = pPos2.x; floats[4]=pPos2.y; floats[5]=pPos2.z; ints[0] = result; ints[1] = pMapId; } - void fillTestHeightCmd(int pMapId, Vector3 pPos, float result) + void fillTestHeightCmd(int pMapId, G3D::Vector3 pPos, float result) { iType = TEST_HEIGHT; floats[0] = pPos.x; floats[1]=pPos.y; floats[2]=pPos.z; floats[3] = result; ints[0] = pMapId; } - void fillTestObjectHitCmd(int pMapId, Vector3 pPos1, Vector3 pPos2, Vector3 pResultPos, bool result) + void fillTestObjectHitCmd(int pMapId, G3D::Vector3 pPos1, G3D::Vector3 pPos2, G3D::Vector3 pResultPos, bool result) { iType = TEST_OBJECT_HIT; floats[0] = pPos1.x; floats[1]=pPos1.y; floats[2]=pPos1.z; floats[3] = pPos2.x; floats[4]=pPos2.y; floats[5]=pPos2.z; @@ -98,7 +96,7 @@ private: std::string iFileName; long iLastPos; - Array > iCommandArray; + G3D::Array > iCommandArray; bool resetfile; bool iWritingEnabled; public: @@ -107,11 +105,11 @@ void setResetFile() { resetfile = true; } void enableWriting(bool pValue) { iWritingEnabled = pValue; } void setFileName(const std::string& pName) { iFileName = pName; } - bool getNewCommands(Array& commandArray); - const Array >& getFullCommandArray() { return iCommandArray; } + bool getNewCommands(G3D::Array& commandArray); + const G3D::Array >& getFullCommandArray() { return iCommandArray; } bool appendCmd(const Command& pCommand); - bool appendCmds(const Array& pCmdArray); + bool appendCmds(const G3D::Array& pCmdArray); }; } Index: src/shared/vmap/SubModel.h =================================================================== --- src/shared/vmap/SubModel.h (revision 5230) +++ src/shared/vmap/SubModel.h (working copy) @@ -44,34 +44,34 @@ bool iHasInternalMemAlloc; ShortBox iBox; #ifdef _DEBUG_VIEW - Array iDrawBox; + G3D::Array iDrawBox; #endif public: SubModel() : BaseModel(){ }; SubModel(unsigned int pNTriangles, TriangleBox *pTriangles, unsigned int pTrianglesPos, unsigned int pNNodes, TreeNode *pTreeNodes, unsigned int pNodesPos); - SubModel(AABSPTree *pTree); + SubModel(G3D::AABSPTree *pTree); ~SubModel(void); //Gets a 50 byte binary block void initFromBinBlock(void *pBinBlock); - RayIntersectionIterator beginRayIntersection(const Ray& ray, double pMaxTime, bool skipAABoxTests = false) const; + RayIntersectionIterator beginRayIntersection(const G3D::Ray& ray, double pMaxTime, bool skipAABoxTests = false) const; RayIntersectionIterator endRayIntersection() const; - void fillRenderArray(Array &pArray, const TreeNode* pTreeNode); + void fillRenderArray(G3D::Array &pArray, const TreeNode* pTreeNode); - RealTime getIntersectionTime(const Ray& pRay, bool pExitAtFirst, float pMaxDist) const; + G3D::RealTime getIntersectionTime(const G3D::Ray& pRay, bool pExitAtFirst, float pMaxDist) const; - void countNodesAndTriangles(AABSPTree::Node& pNode, int &pNNodes, int &pNTriabgles); + void countNodesAndTriangles(G3D::AABSPTree::Node& pNode, int &pNNodes, int &pNTriabgles); - void fillContainer(const AABSPTree::Node& pNode, int &pTreeNodePos, int &pTrianglePos, Vector3& pLo, Vector3& pHi); + void fillContainer(const G3D::AABSPTree::Node& pNode, int &pTreeNodePos, int &pTrianglePos, G3D::Vector3& pLo, G3D::Vector3& pHi); inline const ShortBox& getReletiveBounds() const { return(iBox); } inline void setReletiveBounds(const ShortVector& lo, const ShortVector& hi) { iBox.setLo(lo); iBox.setHi(hi); } - inline const AABox getAABoxBounds() const { return(AABox(iBox.getLo().getVector3() + getBasePosition(), iBox.getHi().getVector3()+ getBasePosition())); } + inline const G3D::AABox getAABoxBounds() const { return(G3D::AABox(iBox.getLo().getVector3() + getBasePosition(), iBox.getHi().getVector3()+ getBasePosition())); } // get start pos bases on the global array inline TriangleBox const* getTriangles() const { return &BaseModel::getTriangle(iTrianglesPos); } Index: src/shared/vmap/ManagedModelContainer.cpp =================================================================== --- src/shared/vmap/ManagedModelContainer.cpp (revision 5230) +++ src/shared/vmap/ManagedModelContainer.cpp (working copy) @@ -18,6 +18,8 @@ #include "ManagedModelContainer.h" +using namespace G3D; + namespace VMAP { Index: src/shared/vmap/ShortVector.h =================================================================== --- src/shared/vmap/ShortVector.h (revision 5230) +++ src/shared/vmap/ShortVector.h (working copy) @@ -21,7 +21,6 @@ #include -using namespace G3D; namespace VMAP { /** @@ -57,9 +56,9 @@ { float fv; if(sv >= maxvalue) - fv=inf(); + fv=G3D::inf(); else if(sv <= minvalue) - fv=-inf(); + fv=-G3D::inf(); else fv = ((float)sv) / fixpointdiv; return fv; @@ -70,7 +69,7 @@ inline float getFZ() const { return(short2Float(iZ)); } public: inline ShortVector() {} - inline ShortVector(const Vector3& pVector) + inline ShortVector(const G3D::Vector3& pVector) { iX = float2Short(pVector.x); iY = float2Short(pVector.y); @@ -100,7 +99,7 @@ inline float getY() const { return(iY); } inline float getZ() const { return(iZ); } - inline Vector3 getVector3() const { return(Vector3(getFX(), getFY(), getFZ())); } + inline G3D::Vector3 getVector3() const { return(G3D::Vector3(getFX(), getFY(), getFZ())); } inline ShortVector min(const ShortVector pShortVector) { Index: src/shared/vmap/BaseModel.cpp =================================================================== --- src/shared/vmap/BaseModel.cpp (revision 5230) +++ src/shared/vmap/BaseModel.cpp (working copy) @@ -18,6 +18,8 @@ #include "BaseModel.h" +using namespace G3D; + namespace VMAP { //========================================================== Index: src/shared/vmap/TileAssembler.cpp =================================================================== --- src/shared/vmap/TileAssembler.cpp (revision 5230) +++ src/shared/vmap/TileAssembler.cpp (working copy) @@ -29,6 +29,8 @@ FILE *g_df = NULL; #endif +using namespace G3D; + namespace VMAP { //================================================================= @@ -395,12 +397,12 @@ fclose(rf); return(false); } - uint32 groups; + G3D::uint32 groups; char blockId[5]; blockId[4] = 0; int blocksize; - if(fread(&groups, sizeof(uint32), 1, rf) != 1) { fclose(rf); return(false); } + if(fread(&groups, sizeof(G3D::uint32), 1, rf) != 1) { fclose(rf); return(false); } for(int g=0;g<(int)groups;g++) { @@ -410,19 +412,19 @@ AABSPTree *gtree = new AABSPTree(); - uint32 flags; - if(fread(&flags, sizeof(uint32), 1, rf) != 1) { fclose(rf); return(false); } + G3D::uint32 flags; + if(fread(&flags, sizeof(G3D::uint32), 1, rf) != 1) { fclose(rf); return(false); } - uint32 branches; + G3D::uint32 branches; if(fread(&blockId, 4, 1, rf) != 1) { fclose(rf); return(false); } if(strcmp(blockId, "GRP ") != 0) { fclose(rf); return(false); } if(fread(&blocksize, sizeof(int), 1, rf) != 1) { fclose(rf); return(false); } - if(fread(&branches, sizeof(uint32), 1, rf) != 1) { fclose(rf); return(false); } + if(fread(&branches, sizeof(G3D::uint32), 1, rf) != 1) { fclose(rf); return(false); } for(int b=0;b<(int)branches; b++) { - uint32 indexes; + G3D::uint32 indexes; // indexes for each branch (not used jet) - if(fread(&indexes, sizeof(uint32), 1, rf) != 1) { fclose(rf); return(false); } + if(fread(&indexes, sizeof(G3D::uint32), 1, rf) != 1) { fclose(rf); return(false); } } // ---- indexes @@ -430,7 +432,7 @@ if(strcmp(blockId, "INDX") != 0) { fclose(rf); return(false); } if(fread(&blocksize, sizeof(int), 1, rf) != 1) { fclose(rf); return(false); } unsigned int nindexes; - if(fread(&nindexes, sizeof(uint32), 1, rf) != 1) { fclose(rf); return(false); } + if(fread(&nindexes, sizeof(G3D::uint32), 1, rf) != 1) { fclose(rf); return(false); } if(nindexes >0) { unsigned short *indexarray = new unsigned short[nindexes*sizeof(unsigned short)]; Index: src/shared/vmap/VMapFactory.cpp =================================================================== --- src/shared/vmap/VMapFactory.cpp (revision 5230) +++ src/shared/vmap/VMapFactory.cpp (working copy) @@ -20,6 +20,8 @@ #include "VMapFactory.h" #include "VMapManager.h" +using namespace G3D; + namespace VMAP { extern void chompAndTrim(std::string& str);