Index: src/shared/vmap/VMapManager.cpp =================================================================== --- src/shared/vmap/VMapManager.cpp (Revision 5148) +++ src/shared/vmap/VMapManager.cpp (Arbeitskopie) @@ -34,7 +34,7 @@ VMapManager::~VMapManager(void) { - Array keyArray = iInstanceMapTrees.getKeys(); + G3D::Array keyArray = iInstanceMapTrees.getKeys(); for(int i=0;iisInLineOfSight(pos1, pos2); Command c = Command(); // save the orig vectors - c.fillTestVisCmd(pMapId,Vector3(x1,y1,z1),Vector3(x2,y2,z2),result); + c.fillTestVisCmd(pMapId,G3D::Vector3(x1,y1,z1),G3D::Vector3(x2,y2,z2),result); iCommandLogger.appendCmd(c); } } @@ -396,9 +396,9 @@ { if(iInstanceMapTrees.containsKey(pMapId)) { - Vector3 pos1 = convertPositionToInternalRep(x1,y1,z1); - Vector3 pos2 = convertPositionToInternalRep(x2,y2,z2); - Vector3 resultPos; + G3D::Vector3 pos1 = convertPositionToInternalRep(x1,y1,z1); + G3D::Vector3 pos2 = convertPositionToInternalRep(x2,y2,z2); + G3D::Vector3 resultPos; MapTree* mapTree = iInstanceMapTrees.get(pMapId); result = mapTree->getObjectHitPos(pos1, pos2, resultPos, pModifyDist); resultPos = convertPositionToMangosRep(resultPos.x,resultPos.y,resultPos.z); @@ -424,15 +424,15 @@ float height = VMAP_INVALID_HEIGHT_VALUE; //no height if(isHeightCalcEnabled() && iInstanceMapTrees.containsKey(pMapId)) { - Vector3 pos = convertPositionToInternalRep(x,y,z); + G3D::Vector3 pos = convertPositionToInternalRep(x,y,z); MapTree* mapTree = iInstanceMapTrees.get(pMapId); height = mapTree->getHeight(pos); - if(!(height < inf())) + if(!(height < G3D::inf())) { height = VMAP_INVALID_HEIGHT_VALUE; //no height } Command c = Command(); - c.fillTestHeightCmd(pMapId,Vector3(x,y,z),height); + c.fillTestHeightCmd(pMapId,G3D::Vector3(x,y,z),height); iCommandLogger.appendCmd(c); } return(height); @@ -481,13 +481,13 @@ { iBasePath.append("/"); } - iTree = new AABSPTree(); + iTree = new G3D::AABSPTree(); } //========================================================= MapTree::~MapTree() { - Array mcArray; + G3D::Array mcArray; iTree->getMembers(mcArray); int no = mcArray.size(); while(no >0) @@ -502,22 +502,22 @@ // just for visual debugging with an external debug class #ifdef _DEBUG_VMAPS #ifndef gBoxArray - 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 #endif - typedef AABSPTree::RayIntersectionIterator IT; + typedef G3D::AABSPTree::RayIntersectionIterator IT; //========================================================= /** return dist to hit or inf() if no hit */ - float MapTree::getIntersectionTime(const Ray& pRay, float pMaxDist, bool pStopAtFirstHit) + float MapTree::getIntersectionTime(const G3D::Ray& pRay, float pMaxDist, bool pStopAtFirstHit) { - double firstDistance = inf(); + double firstDistance = G3D::inf(); const IT end = iTree->endRayIntersection(); IT obj = iTree->beginRayIntersection(pRay, pMaxDist); @@ -537,13 +537,13 @@ #ifdef _DEBUG_VMAPS if(gCount3 == gCount1) { - AABox testBox; + G3D::AABox testBox; testBox = model->getAABoxBounds(); gBoxArray.append(testBox); } ++gCount3; #endif - if(t > 0 && t < inf()) + if(t > 0 && t < G3D::inf()) { obj.markBreakNode(); if(firstDistance > t && pMaxDist >= t) @@ -557,13 +557,13 @@ } //========================================================= - bool MapTree::isInLineOfSight(const Vector3& pos1, const Vector3& pos2) + bool MapTree::isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2) { bool result = true; - float maxDist = abs((pos2 - pos1).magnitude()); + float maxDist = G3D::abs((pos2 - pos1).magnitude()); // direction with length of 1 - Ray ray = Ray::fromOriginAndDirection(pos1, (pos2 - pos1)/maxDist); - if(getIntersectionTime(ray, maxDist, true) < inf()) + G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pos1, (pos2 - pos1)/maxDist); + if(getIntersectionTime(ray, maxDist, true) < G3D::inf()) { result = false; } @@ -575,19 +575,19 @@ Return the hit pos or the original dest pos */ - bool MapTree::getObjectHitPos(const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) + bool MapTree::getObjectHitPos(const G3D::Vector3& pPos1, const G3D::Vector3& pPos2, G3D::Vector3& pResultHitPos, float pModifyDist) { bool result; - float maxDist = abs((pPos2 - pPos1).magnitude()); - Vector3 dir = (pPos2 - pPos1)/maxDist; // direction with length of 1 - Ray ray = Ray::fromOriginAndDirection(pPos1, dir); + float maxDist = G3D::abs((pPos2 - pPos1).magnitude()); + G3D::Vector3 dir = (pPos2 - pPos1)/maxDist; // direction with length of 1 + G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pPos1, dir); float dist = getIntersectionTime(ray, maxDist, false); - if(dist < inf()) + if(dist < G3D::inf()) { pResultHitPos = pPos1 + dir * dist; if(pModifyDist < 0) { - if(abs((pResultHitPos - pPos1).magnitude()) > -pModifyDist) + if(G3D::abs((pResultHitPos - pPos1).magnitude()) > -pModifyDist) { pResultHitPos = pResultHitPos + dir*pModifyDist; } @@ -612,14 +612,14 @@ //========================================================= - float MapTree::getHeight(const Vector3& pPos) + float MapTree::getHeight(const G3D::Vector3& pPos) { - float height = inf(); - Vector3 dir = Vector3(0,-1,0); - Ray ray = Ray::fromOriginAndDirection(pPos, dir); // direction with length of 1 + float height = G3D::inf(); + G3D::Vector3 dir = G3D::Vector3(0,-1,0); + G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pPos, dir); // direction with length of 1 float maxDist = VMapDefinitions::getMaxCanFallDistance(); float dist = getIntersectionTime(ray, maxDist, false); - if(dist < inf()) + if(dist < G3D::inf()) { height = (pPos + dir * dist).y; } @@ -714,7 +714,7 @@ filesInDir.decRefCount(); if(filesInDir.getRefCount() <= 0) { - Array fileNames = filesInDir.getFiles(); + G3D::Array fileNames = filesInDir.getFiles(); bool treeChanged = false; for(int i=0; i& 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 5148) +++ src/shared/vmap/TileAssembler.h (Arbeitskopie) @@ -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 5148) +++ src/shared/vmap/RayIntersectionIterator.h (Arbeitskopie) @@ -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 5148) +++ src/shared/vmap/ModelContainer.cpp (Arbeitskopie) @@ -89,7 +89,7 @@ //========================================================== - void ModelContainer::countSubModelsAndNodesAndTriangles(AABSPTree::Node& pNode, int& nSubModels, int& nNodes, int& nTriangles) + void ModelContainer::countSubModelsAndNodesAndTriangles(G3D::AABSPTree::Node& pNode, int& nSubModels, int& nNodes, int& nTriangles) { // For this node we will need a TreeNode as well as for the internal nodes nNodes++; @@ -97,7 +97,7 @@ nSubModels += pNode.valueArray.size(); for(int i=0;i::Handle h= pNode.valueArray[i]; + G3D::AABSPTree::Handle h= pNode.valueArray[i]; SubModel *m = h.value; // add the internal nodes as well nNodes += m->getNNodes(); @@ -115,7 +115,7 @@ } //========================================================== - void ModelContainer::fillContainer(const AABSPTree::Node& pNode, int &pSubModelPos, int &pTreeNodePos, int &pTrianglePos, Vector3& pLo, Vector3& pHi, Vector3& pFinalLo, Vector3& pFinalHi) + void ModelContainer::fillContainer(const G3D::AABSPTree::Node& pNode, int &pSubModelPos, int &pTreeNodePos, int &pTrianglePos, G3D::Vector3& pLo, G3D::Vector3& pHi, G3D::Vector3& pFinalLo, G3D::Vector3& pFinalHi) { // TreeNode for the SubModel TreeNode treeNode = TreeNode(pNode.valueArray.size(), pSubModelPos); @@ -123,12 +123,12 @@ treeNode.setSplitLocation(pNode.splitLocation); int currentTreeNodePos = pTreeNodePos++; - Vector3 lo = Vector3(inf(),inf(),inf()); - Vector3 hi = Vector3(-inf(),-inf(),-inf()); + G3D::Vector3 lo = G3D::Vector3(G3D::inf(),G3D::inf(),G3D::inf()); + G3D::Vector3 hi = G3D::Vector3(-G3D::inf(),-G3D::inf(),-G3D::inf()); for(int i=0;i::Handle h= pNode.valueArray[i]; + G3D::AABSPTree::Handle h= pNode.valueArray[i]; SubModel *m = h.value; memcpy(&getTreeNodes()[pTreeNodePos], &m->getTreeNode(0), sizeof(TreeNode) * m->getNNodes()); @@ -142,7 +142,7 @@ pTreeNodePos += m->getNNodes(); pTrianglePos += m->getNTriangles(); - AABox box = m->getAABoxBounds(); + G3D::AABox box = m->getAABoxBounds(); lo = lo.min(box.low()); hi = hi.max(box.high()); pFinalLo = pFinalLo.min(lo); @@ -180,7 +180,7 @@ Create the structure out of a AABSPTree */ - ModelContainer::ModelContainer(AABSPTree *pTree) + ModelContainer::ModelContainer(G3D::AABSPTree *pTree) { int nSubModels, nNodes, nTriangles; @@ -196,9 +196,9 @@ int subModelPos,treeNodePos, trianglePos; subModelPos = treeNodePos = trianglePos = 0; - Vector3 lo = Vector3(inf(),inf(),inf()); - Vector3 hi = Vector3(-inf(),-inf(),-inf()); - Vector3 finalLo, finalHi; + G3D::Vector3 lo = G3D::Vector3(G3D::inf(),G3D::inf(),G3D::inf()); + G3D::Vector3 hi = G3D::Vector3(-G3D::inf(),-G3D::inf(),-G3D::inf()); + G3D::Vector3 finalLo, finalHi; finalLo = lo; finalHi = hi; @@ -215,7 +215,7 @@ } //========================================================== - RayIntersectionIterator ModelContainer::beginRayIntersection(const Ray& ray, double pMaxTime, bool skipAABoxTests) const + RayIntersectionIterator ModelContainer::beginRayIntersection(const G3D::Ray& ray, double pMaxTime, bool skipAABoxTests) const { NodeValueAccess vna = NodeValueAccess(getTreeNodes(), iSubModel); return RayIntersectionIterator(vna, ray, &getTreeNode(0), pMaxTime, skipAABoxTests); @@ -232,8 +232,8 @@ #ifdef _DEBUG_VMAPS #ifndef gBoxArray - 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 @@ -241,15 +241,15 @@ typedef RayIntersectionIterator IT; - RealTime ModelContainer::getIntersectionTime(const Ray& pRay, bool pExitAtFirst, float pMaxDist) const + G3D::RealTime ModelContainer::getIntersectionTime(const G3D::Ray& pRay, bool pExitAtFirst, float pMaxDist) const { #ifdef _DEBUG_VMAPS for(unsigned int i=0; igetIntersectionTime(pRay, pExitAtFirst, pMaxDist); - if(t > 0 && t < inf()) + G3D::RealTime t = model->getIntersectionTime(pRay, pExitAtFirst, pMaxDist); + if(t > 0 && t < G3D::inf()) { obj.markBreakNode(); if(firstDistance > t && pMaxDist >= t) @@ -314,15 +314,15 @@ if(result && fwrite("POS ",4,1,wf) != 1) result = false; size = sizeof(float)*3; if(result && fwrite(&size,4,1,wf) != 1) result = false; - Vector3 basePos = getBasePosition(); + G3D::Vector3 basePos = getBasePosition(); if(result && fwrite(&basePos,sizeof(float),3,wf) != 3) result = false; if(result && fwrite("BOX ",4,1,wf) != 1) result = false; size = sizeof(float)*6; if(result && fwrite(&size,4,1,wf) != 1) result = false; - Vector3 low = iBox.low(); + G3D::Vector3 low = iBox.low(); if(result && fwrite(&low,sizeof(float),3,wf) != 3) result = false; - Vector3 high = iBox.high(); + G3D::Vector3 high = iBox.high(); if(result && fwrite(&high,sizeof(float),3,wf) != 3) result = false; if(result && fwrite("NODE",4,1,wf) != 1) result = false; @@ -372,14 +372,14 @@ //POS if(result && fread(chunk,4,1,rf) != 1) result = false; if(result && fread(&size,4,1,rf) != 1) result = false; - Vector3 basePos; + G3D::Vector3 basePos; if(result && fread(&basePos,sizeof(float),3,rf) != 3) result = false; setBasePosition(basePos); //---- Box if(result && fread(chunk,4,1,rf) != 1) result = false; if(result && fread(&size,4,1,rf) != 1) result = false; - Vector3 low,high; + G3D::Vector3 low,high; if(result && fread(&low,sizeof(float),3,rf) != 3) result = false; if(result && fread(&high,sizeof(float),3,rf) != 3) result = false; setBounds(low, high); Index: src/shared/vmap/CoordModelMapping.cpp =================================================================== --- src/shared/vmap/CoordModelMapping.cpp (Revision 5148) +++ src/shared/vmap/CoordModelMapping.cpp (Arbeitskopie) @@ -46,7 +46,7 @@ CoordModelMapping::~CoordModelMapping() { - Array keys = iMapObjectFiles.getKeys(); + G3D::Array keys = iMapObjectFiles.getKeys(); for (int k = 0; k < keys.length(); k++) { CMappingEntry *value = getCMappingEntry(keys[k]); @@ -147,7 +147,7 @@ const NameCollection CoordModelMapping::getFilenamesForCoordinate(unsigned int pMapId, int xPos, int yPos) { NameCollection result; - Array rawNames; + G3D::Array rawNames; CMappingEntry *entry = getCMappingEntry(CMappingEntry::getKeyString(pMapId, xPos, yPos)); if(entry != 0) Index: src/shared/vmap/VMapManager.h =================================================================== --- src/shared/vmap/VMapManager.h (Revision 5148) +++ src/shared/vmap/VMapManager.h (Arbeitskopie) @@ -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/ModelContainer.h =================================================================== --- src/shared/vmap/ModelContainer.h (Revision 5148) +++ src/shared/vmap/ModelContainer.h (Arbeitskopie) @@ -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 5148) +++ src/shared/vmap/CoordModelMapping.h (Arbeitskopie) @@ -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 5148) +++ src/shared/vmap/DebugCmdLogger.cpp (Arbeitskopie) @@ -47,7 +47,7 @@ //========================================================= - bool CommandFileRW::appendCmds(const Array& pCmdArray) + bool CommandFileRW::appendCmds(const G3D::Array& pCmdArray) { #ifdef _DEBUG bool result = false; @@ -82,7 +82,7 @@ //========================================================= - bool CommandFileRW::getNewCommands(Array& pCmdArray) + bool CommandFileRW::getNewCommands(G3D::Array& pCmdArray) { bool result = false; FILE* f = fopen(iFileName.c_str(), "rb"); Index: src/shared/vmap/SubModel.cpp =================================================================== --- src/shared/vmap/SubModel.cpp (Revision 5148) +++ src/shared/vmap/SubModel.cpp (Arbeitskopie) @@ -102,7 +102,7 @@ { iNTriangles = *((unsigned int *)(((char *) pBinBlock) + BP_iNTriangles)); iNNodes = *((unsigned int *) (((char *) pBinBlock) + BP_iNNodes)); - iBasePosition = *((Vector3 *) (((char *) pBinBlock) + BP_iBasePosition)); + iBasePosition = *((G3D::Vector3 *) (((char *) pBinBlock) + BP_iBasePosition)); iNodesPos = *((unsigned int *) (((char *) pBinBlock) + BP_iNodesPos)); iTrianglesPos = *((unsigned int *) (((char *) pBinBlock) + BP_iTrianglesPos)); iHasInternalMemAlloc = *((bool *) (((char *) pBinBlock) + BP_iHasInternalMemAlloc)); @@ -111,7 +111,7 @@ //========================================================== - void SubModel::countNodesAndTriangles(AABSPTree::Node& pNode, int &pNNodes, int &pNTriabgles) + void SubModel::countNodesAndTriangles(G3D::AABSPTree::Node& pNode, int &pNNodes, int &pNTriabgles) { pNNodes++; pNTriabgles += pNode.valueArray.size(); @@ -132,7 +132,7 @@ //========================================================== - void SubModel::fillContainer(const AABSPTree::Node& pNode, int &pTreeNodePos, int &pTrianglePos, Vector3& pLo, Vector3& pHi) + void SubModel::fillContainer(const G3D::AABSPTree::Node& pNode, int &pTreeNodePos, int &pTrianglePos, G3D::Vector3& pLo, G3D::Vector3& pHi) { TreeNode treeNode = TreeNode(pNode.valueArray.size(), pTrianglePos); treeNode.setSplitAxis(pNode.splitAxis); @@ -140,13 +140,13 @@ int currentTreeNodePos = pTreeNodePos++; - Vector3 lo = Vector3(inf(),inf(),inf()); - Vector3 hi = Vector3(-inf(),-inf(),-inf()); + G3D::Vector3 lo = G3D::Vector3(G3D::inf(),G3D::inf(),G3D::inf()); + G3D::Vector3 hi = G3D::Vector3(-G3D::inf(),-G3D::inf(),-G3D::inf()); for(int i=0;i::Handle h= pNode.valueArray[i]; - Triangle t = h.value; + G3D::AABSPTree::Handle h= pNode.valueArray[i]; + G3D::Triangle t = h.value; TriangleBox triangleBox = TriangleBox(t.vertex(0),t.vertex(1), t.vertex(2)); lo = lo.min(triangleBox.getBounds().getLo().getVector3()); hi = hi.max(triangleBox.getBounds().getHi().getVector3()); @@ -176,7 +176,7 @@ //========================================================== - SubModel::SubModel(AABSPTree *pTree) + SubModel::SubModel(G3D::AABSPTree *pTree) { int nNodes, nTriangles; nNodes = nTriangles = 0; @@ -190,8 +190,8 @@ int treeNodePos, trianglePos; treeNodePos = trianglePos = 0; - Vector3 lo = Vector3(inf(),inf(),inf()); - Vector3 hi = Vector3(-inf(),-inf(),-inf()); + G3D::Vector3 lo = G3D::Vector3(G3D::inf(),G3D::inf(),G3D::inf()); + G3D::Vector3 hi = G3D::Vector3(-G3D::inf(),-G3D::inf(),-G3D::inf()); fillContainer(*pTree->root, treeNodePos, trianglePos, lo, hi); setReletiveBounds(lo, hi); @@ -199,7 +199,7 @@ //========================================================== - RayIntersectionIterator SubModel::beginRayIntersection(const Ray& ray, double pMaxTime, bool skipAABoxTests) const + RayIntersectionIterator SubModel::beginRayIntersection(const G3D::Ray& ray, double pMaxTime, bool skipAABoxTests) const { NodeValueAccess vna = NodeValueAccess(getTreeNodes(), getTriangles()); return RayIntersectionIterator(vna, ray, &getTreeNode(0), pMaxTime, skipAABoxTests); @@ -214,49 +214,49 @@ typedef RayIntersectionIterator IT; - inline RealTime testIntersectionWithTriangle(const IT& pIterater,const Triangle& pTriangle, const Ray& pRay) + inline G3D::RealTime testIntersectionWithTriangle(const IT& pIterater,const G3D::Triangle& pTriangle, const G3D::Ray& pRay) { static const double epsilon = 0.00001; - RealTime t = pRay.intersectionTime(pTriangle); + G3D::RealTime t = pRay.intersectionTime(pTriangle); /* Often methods like "distanceUntilIntersection" can be made more efficient by providing them with the time at which to start and to give up looking for an intersection; that is, obj.minDistance and iMin(firstDistance, obj.maxDistance). */ - if ((t >= inf()) || + if ((t >= G3D::inf()) || (t > pIterater.maxDistance + epsilon) || (t < pIterater.minDistance - epsilon)) { - t = inf(); + t = G3D::inf(); } return(t); } //========================================================== #ifdef _DEBUG_VMAPS #ifndef gBoxArray - 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 #endif - RealTime SubModel::getIntersectionTime(const Ray& pRay, bool pExitAtFirst, float pMaxDist) const + G3D::RealTime SubModel::getIntersectionTime(const G3D::Ray& pRay, bool pExitAtFirst, float pMaxDist) const { TriangleBox const *firstObject; - double firstDistance = inf(); + double firstDistance = G3D::inf(); #ifdef _DEBUG_VMAPS int debugCount =0; #endif - Ray relativeRay = Ray::fromOriginAndDirection(pRay.origin - getBasePosition(), pRay.direction); + G3D::Ray relativeRay = G3D::Ray::fromOriginAndDirection(pRay.origin - getBasePosition(), pRay.direction); const IT end = endRayIntersection(); IT obj = beginRayIntersection(relativeRay,pMaxDist,false); - Triangle testT; + G3D::Triangle testT; for ( ;obj != end; ++obj) // (preincrement is *much* faster than postincrement!) { /* @@ -266,7 +266,7 @@ */ const TriangleBox *tri = &(*obj); - testT = Triangle(tri->vertex(0).getVector3(),tri->vertex(1).getVector3(),tri->vertex(2).getVector3()); + testT = G3D::Triangle(tri->vertex(0).getVector3(),tri->vertex(1).getVector3(),tri->vertex(2).getVector3()); double t = testIntersectionWithTriangle(obj,testT, relativeRay); #ifdef _DEBUG_VMAPS if(debugCount == 5) @@ -276,7 +276,7 @@ } ++debugCount; #endif - if(t != inf()) + if(t != G3D::inf()) { /* Tell the iterator that we've found at least one @@ -294,9 +294,9 @@ else { // This might the wrong side of the triangle... Turn it and test again - testT = Triangle(tri->vertex(2).getVector3(),tri->vertex(1).getVector3(),tri->vertex(0).getVector3()); + testT = G3D::Triangle(tri->vertex(2).getVector3(),tri->vertex(1).getVector3(),tri->vertex(0).getVector3()); t = testIntersectionWithTriangle(obj, testT,relativeRay); - if(t != inf()) + if(t != G3D::inf()) { obj.markBreakNode(); if(firstDistance > t && pMaxDist >= t) @@ -309,7 +309,7 @@ } } #ifdef _DEBUG_VMAPS - if(firstDistance < inf()) + if(firstDistance < G3D::inf()) { myfound = true; p1 = firstObject->vertex(0).getVector3()+ getBasePosition(); Index: src/shared/vmap/TreeNode.h =================================================================== --- src/shared/vmap/TreeNode.h (Revision 5148) +++ src/shared/vmap/TreeNode.h (Arbeitskopie) @@ -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 5148) +++ src/shared/vmap/AABSPTree.h (Arbeitskopie) @@ -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 5148) +++ src/shared/vmap/ShortBox.h (Arbeitskopie) @@ -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 5148) +++ src/shared/vmap/DebugCmdLogger.h (Arbeitskopie) @@ -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 5148) +++ src/shared/vmap/SubModel.h (Arbeitskopie) @@ -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/ShortVector.h =================================================================== --- src/shared/vmap/ShortVector.h (Revision 5148) +++ src/shared/vmap/ShortVector.h (Arbeitskopie) @@ -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 5148) +++ src/shared/vmap/BaseModel.cpp (Arbeitskopie) @@ -22,7 +22,7 @@ { //========================================================== - void BaseModel::getMember(Array& pMembers) + void BaseModel::getMember(G3D::Array& pMembers) { for(unsigned int i=0; i& mc) + void emptyArray(G3D::Array& mc) { int no=mc.size(); while(no > 0) @@ -153,7 +153,7 @@ iCoordModelMapping->setModelNameFilterMethod(iFilterMethod); iCoordModelMapping->readCoordinateMapping(fname); - Array mapIds = iCoordModelMapping->getMaps(); + G3D::Array mapIds = iCoordModelMapping->getMaps(); if(mapIds.size() == 0) { result = false; @@ -179,7 +179,7 @@ for(int y=0; y<66 && result; ++y) { #endif - Array mc; + G3D::Array mc; std::string dirname; char buffer[100]; if(iCoordModelMapping->isWorldAreaMap(mapId) && x<65 && y<65) @@ -207,7 +207,7 @@ //================================================================= - bool TileAssembler::fillModelContainerArray(const std::string& pDirFileName, unsigned int pMapId, int pXPos, int pYPos, Array& pMC) + bool TileAssembler::fillModelContainerArray(const std::string& pDirFileName, unsigned int pMapId, int pXPos, int pYPos, G3D::Array& pMC) { bool result = true; ModelContainer* modelContainer; @@ -264,7 +264,7 @@ fprintf(dirfile, "%s\n",dirEntryName.c_str()); destFileName.append(dirEntryName); - Array positionarray; + G3D::Array positionarray; positionarray.append(nameCollection.iSingeFiles[pos]); if(!iCoordModelMapping->isAlreadyProcessedSingleFile(nameCollection.iSingeFiles[pos])) @@ -291,9 +291,9 @@ //================================================================= - void removeEntriesFromTree(AABSPTree* pTree) + void removeEntriesFromTree(G3D::AABSPTree* pTree) { - Array submodelArray; + G3D::Array submodelArray; pTree->getMembers(submodelArray); int no = submodelArray.size(); while(no > 0) @@ -305,12 +305,12 @@ //================================================================= - ModelContainer* TileAssembler::processNames(const Array& pPositions, const char* pDestFileName) + ModelContainer* TileAssembler::processNames(const G3D::Array& pPositions, const char* pDestFileName) { ModelContainer *modelContainer = 0; - Vector3 basepos = Vector3(0,0,0); - AABSPTree* mainTree = new AABSPTree(); + G3D::Vector3 basepos = G3D::Vector3(0,0,0); + G3D::AABSPTree* mainTree = new G3D::AABSPTree(); int pos = 0; @@ -341,7 +341,7 @@ } //================================================================= - bool TileAssembler::readRawFile(std::string& pModelFilename, ModelPosition& pModelPosition, AABSPTree *pMainTree) + bool TileAssembler::readRawFile(std::string& pModelFilename, ModelPosition& pModelPosition, G3D::AABSPTree *pMainTree) { bool result = false; @@ -395,34 +395,34 @@ 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++) { // group MUST NOT have more then 65536 indexes !! Array will have a problem with that !! (strange ...) - Array tempIndexArray; - Array tempVertexArray; + G3D::Array tempIndexArray; + G3D::Array tempVertexArray; - AABSPTree *gtree = new AABSPTree(); + G3D::AABSPTree *gtree = new G3D::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 +430,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)]; @@ -467,7 +467,7 @@ for(unsigned int i=0, indexNo=0; indexNo= startgroup && g <= endgroup) @@ -525,7 +525,7 @@ //================================================================= - bool TileAssembler::fillModelIntoTree(AABSPTree *pMainTree, const Vector3& pBasePos, std::string& pPos, std::string& pModelFilename) + bool TileAssembler::fillModelIntoTree(G3D::AABSPTree *pMainTree, const G3D::Vector3& pBasePos, std::string& pPos, std::string& pModelFilename) { bool result = false; ModelPosition modelPosition; @@ -558,8 +558,8 @@ &vdirarray[0],&vdirarray[1],&vdirarray[2], &scale); - pModelPosition.iPos = Vector3(vposarray[0], vposarray[1], vposarray[2]); - pModelPosition.iDir = Vector3(vdirarray[0], vdirarray[1], vdirarray[2]); + pModelPosition.iPos = G3D::Vector3(vposarray[0], vposarray[1], vposarray[2]); + pModelPosition.iDir = G3D::Vector3(vdirarray[0], vdirarray[1], vdirarray[2]); pModelPosition.iScale = scale; } Index: src/shared/vmap/VMapFactory.cpp =================================================================== --- src/shared/vmap/VMapFactory.cpp (Revision 5148) +++ src/shared/vmap/VMapFactory.cpp (Arbeitskopie) @@ -25,7 +25,7 @@ extern void chompAndTrim(std::string& str); VMapManager *gVMapManager = 0; - Table* iIgnoreSpellIds=0; + G3D::Table* iIgnoreSpellIds=0; //=============================================== // result false, if no more id are found @@ -60,7 +60,7 @@ void VMapFactory::preventSpellsFromBeingTestedForLoS(const char* pSpellIdString) { if(!iIgnoreSpellIds) - iIgnoreSpellIds = new Table(); + iIgnoreSpellIds = new G3D::Table(); if(pSpellIdString != NULL) { unsigned int pos =0;