aboutsummaryrefslogtreecommitdiff
path: root/src/shared/vmap
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-17 16:20:24 -0700
committermaximius <none@none>2009-10-17 16:20:24 -0700
commit3f338cc1c328c7280957583b50598292cd8fb64b (patch)
treeca209c2cd024e3902b7844b3224bceff7c5bb570 /src/shared/vmap
parente585187b248f48b3c6e9247b49fa07c6565d65e5 (diff)
*Massive cleanup redux.
--HG-- branch : trunk
Diffstat (limited to 'src/shared/vmap')
-rw-r--r--src/shared/vmap/AABSPTree.h33
-rw-r--r--src/shared/vmap/BaseModel.cpp2
-rw-r--r--src/shared/vmap/DebugCmdLogger.cpp2
-rw-r--r--src/shared/vmap/ModelContainer.cpp6
-rw-r--r--src/shared/vmap/SubModel.cpp2
-rw-r--r--src/shared/vmap/TileAssembler.cpp21
-rw-r--r--src/shared/vmap/VMapFactory.cpp2
-rw-r--r--src/shared/vmap/VMapManager.cpp6
8 files changed, 21 insertions, 53 deletions
diff --git a/src/shared/vmap/AABSPTree.h b/src/shared/vmap/AABSPTree.h
index ff4335b6774..1a7b17cdaa2 100644
--- a/src/shared/vmap/AABSPTree.h
+++ b/src/shared/vmap/AABSPTree.h
@@ -42,7 +42,6 @@ inline void getBounds(const G3D::Vector3& v, G3D::AABox& out) {
out = G3D::AABox(v);
}
-
inline void getBounds(const G3D::AABox& a, G3D::AABox& out) {
out = a;
}
@@ -51,23 +50,18 @@ inline void getBounds(const G3D::Sphere& s, G3D::AABox& out) {
s.getBounds(out);
}
-
inline void getBounds(const G3D::Box& b, G3D::AABox& out) {
b.getBounds(out);
}
-
inline void getBounds(const G3D::Triangle& t, G3D::AABox& out) {
t.getBounds(out);
}
-
-
inline void getBounds(const G3D::Vector3* v, G3D::AABox& out) {
out = G3D::AABox(*v);
}
-
inline void getBounds(const G3D::AABox* a, G3D::AABox& out) {
getBounds(*a, out);
}
@@ -76,7 +70,6 @@ inline void getBounds(const G3D::Sphere* s, G3D::AABox& out) {
s->getBounds(out);
}
-
inline void getBounds(const G3D::Box* b, G3D::AABox& out) {
b->getBounds(out);
}
@@ -165,7 +158,6 @@ namespace G3D {
you can use the AABSPTree::update method as a shortcut to
insert/remove an object in one step after it has moved.
-
Note: Do not mutate any value once it has been inserted into AABSPTree. Values
are copied interally. All AABSPTree iterators convert to pointers to constant
values to reinforce this.
@@ -258,7 +250,6 @@ template<class T> class AABSPTree {
protected:
public:
-
/** Returns the bounds of the sub array. Used by makeNode. */
static AABox computeBounds(
const Array<_AABSPTree::Handle<T>*>& point,
@@ -297,7 +288,6 @@ public:
}
};
-
/** Compares bounds for strict >, <, or overlap*/
class BoundsComparator {
public:
@@ -319,7 +309,6 @@ public:
}
};
-
/** Compares bounds to the sort location */
class Comparator {
public:
@@ -436,7 +425,6 @@ public:
return (child[0] == NULL) && (child[1] == NULL);
}
-
/**
Recursively appends all handles and children's handles
to the array.
@@ -461,7 +449,7 @@ public:
const AABox& b = valueArray[i]->bounds;
debugAssert(b == boundsArray[i]);
- for(int axis = 0; axis < 3; ++axis) {
+ for (int axis = 0; axis < 3; ++axis) {
debugAssert(b.low()[axis] <= b.high()[axis]);
debugAssert(b.low()[axis] >= lo[axis]);
debugAssert(b.high()[axis] <= hi[axis]);
@@ -545,7 +533,6 @@ public:
return this;
}
-
/** Appends all members that intersect the box.
If useSphere is true, members that pass the box test
face a second test against the sphere. */
@@ -721,7 +708,6 @@ public:
}
};
-
/**
Recursively subdivides the subarray.
@@ -813,7 +799,6 @@ public:
// The Comparator ensures that elements are strictly on the correct side of the split
}
-
# if defined(G3D_DEBUG) && defined(VERIFY_TREE)
debugAssert(lt.size() + node->valueArray.size() + gt.size() == source.size());
// Verify that all objects ended up on the correct side of the split.
@@ -904,12 +889,10 @@ public:
AABSPTree::balance(). */
AABSPTree() : root(NULL) {}
-
AABSPTree(const AABSPTree& src) : root(NULL) {
*this = src;
}
-
AABSPTree& operator=(const AABSPTree& src) {
delete root;
// Clone tree takes care of filling out the memberTable.
@@ -917,7 +900,6 @@ public:
return *this;
}
-
~AABSPTree() {
clear();
}
@@ -1007,7 +989,6 @@ public:
}
}
-
/**
Returns true if this object is in the set, otherwise
returns false. O(1) time.
@@ -1018,7 +999,6 @@ public:
return memberTable.containsKey(Member(&h));
}
-
/**
Removes an object from the set in O(1) time.
It is an error to remove members that are not already
@@ -1066,7 +1046,6 @@ public:
ptr = NULL;
}
-
/**
If the element is in the set, it is removed.
The element is then inserted.
@@ -1085,7 +1064,6 @@ public:
insert(value);
}
-
/**
Rebalances the tree (slow). Call when objects
have moved substantially from their original positions
@@ -1402,7 +1380,6 @@ public:
}
};
-
/**
Iterates through the members that intersect the box
*/
@@ -1426,7 +1403,6 @@ public:
root->getIntersectingMembers(box, Sphere(Vector3::zero(), 0), members, false);
}
-
/**
Invoke a callback for every member along a ray until the closest intersection is found.
@@ -1473,7 +1449,6 @@ public:
scene.intersectRay(camera.worldRay(x, y), intersection, distance);
</pre>
-
@param distance When the method is invoked, this is the maximum distance that the tree should search for an intersection.
On return, this is set to the distance to the first intersection encountered.
@@ -1492,7 +1467,6 @@ public:
}
-
/**
@param members The results are appended to this array.
*/
@@ -1533,7 +1507,6 @@ public:
}
}
-
/**
C++ STL style iterator variable. See begin().
Overloads the -> (dereference) operator, so this acts like a pointer
@@ -1591,7 +1564,6 @@ public:
}
};
-
/**
C++ STL style iterator method. Returns the first member.
Use preincrement (++entry) to get to the next element (iteration
@@ -1602,7 +1574,6 @@ public:
return Iterator(memberTable.begin());
}
-
/**
C++ STL style iterator method. Returns one after the last iterator
element.
@@ -1617,5 +1588,3 @@ public:
#endif
-
-
diff --git a/src/shared/vmap/BaseModel.cpp b/src/shared/vmap/BaseModel.cpp
index 2ffd5672218..94389f683cf 100644
--- a/src/shared/vmap/BaseModel.cpp
+++ b/src/shared/vmap/BaseModel.cpp
@@ -29,7 +29,7 @@ namespace VMAP
void BaseModel::getMember(Array<TriangleBox>& pMembers)
{
- for(unsigned int i=0; i<iNTriangles; i++)
+ for (unsigned int i=0; i<iNTriangles; i++)
{
pMembers.append(iTriangles[i]);
}
diff --git a/src/shared/vmap/DebugCmdLogger.cpp b/src/shared/vmap/DebugCmdLogger.cpp
index c899606045b..461df62843e 100644
--- a/src/shared/vmap/DebugCmdLogger.cpp
+++ b/src/shared/vmap/DebugCmdLogger.cpp
@@ -78,7 +78,7 @@ namespace VMAP
if(f)
{
result = true;
- for(int i=0; i<pCmdArray.size(); ++i)
+ for (int i=0; i<pCmdArray.size(); ++i)
{
if(fwrite(&pCmdArray[i], sizeof(Command), 1, f) != 1) { result = false; break; }
}
diff --git a/src/shared/vmap/ModelContainer.cpp b/src/shared/vmap/ModelContainer.cpp
index 4a722d2585b..d00464880f3 100644
--- a/src/shared/vmap/ModelContainer.cpp
+++ b/src/shared/vmap/ModelContainer.cpp
@@ -66,7 +66,7 @@ namespace VMAP
++nNodes;
nSubModels += pNode.valueArray.size();
- for(int i=0;i<pNode.valueArray.size(); i++)
+ for (int i=0; i<pNode.valueArray.size(); i++)
{
G3D::_AABSPTree::Handle<SubModel*>* h= pNode.valueArray[i];
SubModel *m = h->value;
@@ -97,7 +97,7 @@ namespace VMAP
Vector3 lo = Vector3(inf(),inf(),inf());
Vector3 hi = Vector3(-inf(),-inf(),-inf());
- for(int i=0;i<pNode.valueArray.size(); i++)
+ for (int i=0; i<pNode.valueArray.size(); i++)
{
G3D::_AABSPTree::Handle<SubModel*>* h= pNode.valueArray[i];
SubModel *m = h->value;
@@ -303,7 +303,7 @@ namespace VMAP
if(result)
{
- for(unsigned int i=0;i<iNSubModel && result; ++i)
+ for (unsigned int i=0; i<iNSubModel && result; ++i)
{
unsigned char readBuffer[52]; // this is the size of SubModel on 32 bit systems
if(fread(readBuffer,sizeof(readBuffer),1,rf) != 1) result = false;
diff --git a/src/shared/vmap/SubModel.cpp b/src/shared/vmap/SubModel.cpp
index 370c80062d6..72dbed2a5a1 100644
--- a/src/shared/vmap/SubModel.cpp
+++ b/src/shared/vmap/SubModel.cpp
@@ -148,7 +148,7 @@ namespace VMAP
Vector3 lo = Vector3(inf(),inf(),inf());
Vector3 hi = Vector3(-inf(),-inf(),-inf());
- for(int i=0;i<pNode.valueArray.size(); i++)
+ for (int i=0; i<pNode.valueArray.size(); i++)
{
G3D::_AABSPTree::Handle<Triangle>* h= pNode.valueArray[i];
Triangle t = h->value;
diff --git a/src/shared/vmap/TileAssembler.cpp b/src/shared/vmap/TileAssembler.cpp
index 75997a847a2..5a9b35bb3a1 100644
--- a/src/shared/vmap/TileAssembler.cpp
+++ b/src/shared/vmap/TileAssembler.cpp
@@ -166,25 +166,25 @@ namespace VMAP
return false;
}
- for(int i=0; i<mapIds.size(); ++i)
+ for (int i=0; i<mapIds.size(); ++i)
{
unsigned int mapId = mapIds[i];
#ifdef _ASSEMBLER_DEBUG
if(mapId == 0) // "Azeroth" just for debug
{
- for(int x=28; x<29; ++x) //debug
+ for (int x=28; x<29; ++x) //debug
{
- for(int y=28; y<29; ++y)
+ for (int y=28; y<29; ++y)
{
#else
// ignore DeeprunTram (369) it is too large for short vector and not important
// ignore test (13), Test (29) , development (451)
if(mapId != 369 && mapId != 13 && mapId != 29 && mapId != 451)
{
- for(int x=0; x<66; ++x)
+ for (int x=0; x<66; ++x)
{
- for(int y=0; y<66; ++y)
+ for (int y=0; y<66; ++y)
{
#endif
Array<ModelContainer*> mc;
@@ -423,7 +423,7 @@ namespace VMAP
READ_OR_RETURN(&groups, sizeof(G3D::uint32));
- for(int g=0;g<(int)groups;g++)
+ 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<int> tempIndexArray;
@@ -447,7 +447,7 @@ namespace VMAP
CMP_OR_RETURN(blockId, "GRP ");
READ_OR_RETURN(&blocksize, sizeof(int));
READ_OR_RETURN(&branches, sizeof(G3D::uint32));
- for(int b=0;b<(int)branches; b++)
+ for (int b=0; b<(int)branches; b++)
{
G3D::uint32 indexes;
// indexes for each branch (not used jet)
@@ -464,7 +464,7 @@ namespace VMAP
{
unsigned short *indexarray = new unsigned short[nindexes*sizeof(unsigned short)];
READ_OR_RETURN(indexarray, nindexes*sizeof(unsigned short));
- for(int i=0;i<(int)nindexes; i++)
+ for (int i=0; i<(int)nindexes; i++)
{
unsigned short val = indexarray[i];
tempIndexArray.append(val);
@@ -504,8 +504,7 @@ namespace VMAP
fseek(rf, blocksize, SEEK_CUR);
}
-
- for(unsigned int i=0, indexNo=0; indexNo<nvectors; indexNo++)
+ for (unsigned int i=0, indexNo=0; indexNo<nvectors; indexNo++)
{
Vector3 v = Vector3(vectorarray[i+2], vectorarray[i+1], vectorarray[i+0]);
i+=3;
@@ -525,7 +524,7 @@ namespace VMAP
nindexes -= rest;
}
- for(unsigned int i=0;i<(nindexes);)
+ for (unsigned int i=0; i<(nindexes); )
{
Triangle t = Triangle(tempVertexArray[tempIndexArray[i+2]], tempVertexArray[tempIndexArray[i+1]], tempVertexArray[tempIndexArray[i+0]] );
i+=3;
diff --git a/src/shared/vmap/VMapFactory.cpp b/src/shared/vmap/VMapFactory.cpp
index 5189f79daba..a92e4a1afac 100644
--- a/src/shared/vmap/VMapFactory.cpp
+++ b/src/shared/vmap/VMapFactory.cpp
@@ -38,7 +38,7 @@ namespace VMAP
{
bool result = false;
unsigned int i;
- for(i=pStartPos;i<pString.size(); ++i)
+ for (i=pStartPos; i<pString.size(); ++i)
{
if(pString[i] == ',')
{
diff --git a/src/shared/vmap/VMapManager.cpp b/src/shared/vmap/VMapManager.cpp
index 342da0eb9e2..a059f267f2e 100644
--- a/src/shared/vmap/VMapManager.cpp
+++ b/src/shared/vmap/VMapManager.cpp
@@ -41,7 +41,7 @@ namespace VMAP
VMapManager::~VMapManager(void)
{
Array<unsigned int > keyArray = iInstanceMapTrees.getKeys();
- for(int i=0;i<keyArray.size(); ++i)
+ for (int i=0; i<keyArray.size(); ++i)
{
delete iInstanceMapTrees.get(keyArray[i]);
iInstanceMapTrees.remove(keyArray[i]);
@@ -151,7 +151,7 @@ namespace VMAP
{
bool result = false;
unsigned int i;
- for(i=pStartPos;i<pString.size(); ++i)
+ for (i=pStartPos; i<pString.size(); ++i)
{
if(pString[i] == ',')
{
@@ -740,7 +740,7 @@ namespace VMAP
{
Array<std::string> fileNames = filesInDir.getFiles();
bool treeChanged = false;
- for(int i=0; i<fileNames.size(); ++i)
+ for (int i=0; i<fileNames.size(); ++i)
{
std::string name = fileNames[i];
ManagedModelContainer* mc = getModelContainer(name);