compile convexdecomposition under unix, removed another template

This commit is contained in:
ejcoumans
2006-05-26 17:47:54 +00:00
parent 98129bcae9
commit 8402358d46
8 changed files with 34 additions and 23 deletions

View File

@@ -35,7 +35,7 @@ if $(GLUT.AVAILABLE) = "yes"
MsvcIncDirs $(<) : MsvcIncDirs $(<) :
"../../Demos/OpenGL" "../../Demos/OpenGL"
"../../Extras/PhysicsInterface/CcdPhysics" "../../Extras/PhysicsInterface/CcdPhysics"
"../../Extras/PhysicsInterface/Common" ; "../../Extras/PhysicsInterface/Common"
"../../Extras/ConvexDecomposition" ; "../../Extras/ConvexDecomposition" ;
} }

View File

@@ -36,7 +36,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
#include "convexdecomposition.h" #include "ConvexDecomposition.h"
#include "vlookup.h" #include "vlookup.h"
using namespace ConvexDecomposition; using namespace ConvexDecomposition;
@@ -107,4 +107,4 @@ public:
ConvexDecompInterface *mCallback; ConvexDecompInterface *mCallback;
}; };
#endif //CONVEX_BUILDER_H #endif //CONVEX_BUILDER_H

View File

@@ -44,7 +44,7 @@
#include "cd_vector.h" #include "cd_vector.h"
#include "cd_hull.h" #include "cd_hull.h"
#include "bestfit.h" #include "bestfit.h"
#include "PlaneTri.h" #include "planetri.h"
#include "vlookup.h" #include "vlookup.h"
#include "splitplane.h" #include "splitplane.h"
#include "meshvolume.h" #include "meshvolume.h"

View File

@@ -675,7 +675,9 @@ int OBJ::ParseLine(int lineno,int argc,const char **argv) // return TRUE to con
const char *foo = argv[0]; const char *foo = argv[0];
if ( *foo != '#' ) if ( *foo != '#' )
{ {
if ( stricmp(argv[0],"v") == 0 && argc == 4 ) if ( strcmp(argv[0],"v") == 0 && argc == 4 )
//if ( stricmp(argv[0],"v") == 0 && argc == 4 )
{ {
float vx = (float) atof( argv[1] ); float vx = (float) atof( argv[1] );
float vy = (float) atof( argv[2] ); float vy = (float) atof( argv[2] );
@@ -684,14 +686,18 @@ int OBJ::ParseLine(int lineno,int argc,const char **argv) // return TRUE to con
mVerts.push_back(vy); mVerts.push_back(vy);
mVerts.push_back(vz); mVerts.push_back(vz);
} }
else if ( stricmp(argv[0],"vt") == 0 && argc == 3 ) else if ( strcmp(argv[0],"vt") == 0 && argc == 3 )
// else if ( stricmp(argv[0],"vt") == 0 && argc == 3 )
{ {
float tx = (float) atof( argv[1] ); float tx = (float) atof( argv[1] );
float ty = (float) atof( argv[2] ); float ty = (float) atof( argv[2] );
mTexels.push_back(tx); mTexels.push_back(tx);
mTexels.push_back(ty); mTexels.push_back(ty);
} }
else if ( stricmp(argv[0],"vn") == 0 && argc == 4 ) // else if ( stricmp(argv[0],"vn") == 0 && argc == 4 )
else if ( strcmp(argv[0],"vn") == 0 && argc == 4 )
{ {
float normalx = (float) atof(argv[1]); float normalx = (float) atof(argv[1]);
float normaly = (float) atof(argv[2]); float normaly = (float) atof(argv[2]);
@@ -700,7 +706,9 @@ int OBJ::ParseLine(int lineno,int argc,const char **argv) // return TRUE to con
mNormals.push_back(normaly); mNormals.push_back(normaly);
mNormals.push_back(normalz); mNormals.push_back(normalz);
} }
else if ( stricmp(argv[0],"f") == 0 && argc >= 4 ) // else if ( stricmp(argv[0],"f") == 0 && argc >= 4 )
else if ( strcmp(argv[0],"f") == 0 && argc >= 4 )
{ {
GeometryVertex v[32]; GeometryVertex v[32];

View File

@@ -169,9 +169,9 @@ void fm_quatToMatrix(const float *quat,float *matrix) // convert quaterinion rot
matrix[1*4+2] = 2 * ( yz + wx ); matrix[1*4+2] = 2 * ( yz + wx );
matrix[2*4+2] = 1 - 2 * ( xx + yy ); matrix[2*4+2] = 1 - 2 * ( xx + yy );
matrix[3*4+0] =(float) matrix[3*4+1] = matrix[3*4+2] = 0.0f; matrix[3*4+0] = matrix[3*4+1] = matrix[3*4+2] = 0.0f;
matrix[0*4+3] =(float) matrix[1*4+3] = matrix[2*4+3] = 0.0f; matrix[0*4+3] = matrix[1*4+3] = matrix[2*4+3] = 0.0f;
matrix[3*4+3] =(float) 1.0f; matrix[3*4+3] = 1.0f;
} }

View File

@@ -46,7 +46,7 @@
#include "cd_hull.h" #include "cd_hull.h"
#include "cd_wavefront.h" #include "cd_wavefront.h"
#include "bestfit.h" #include "bestfit.h"
#include "PlaneTri.h" #include "planetri.h"
#include "vlookup.h" #include "vlookup.h"
#include "meshvolume.h" #include "meshvolume.h"

View File

@@ -143,39 +143,39 @@ public:
}; };
template <class Type> class VertexLess class VertexLess
{ {
public: public:
typedef std::vector< Type > VertexVector; typedef std::vector< VertexPosition > VertexVector;
bool operator()(int v1,int v2) const; bool operator()(int v1,int v2) const;
static void SetSearch(const Type& match,VertexVector *list) static void SetSearch(const VertexPosition& match,VertexVector *list)
{ {
mFind = match; mFind = match;
mList = list; mList = list;
}; };
private: private:
const Type& Get(int index) const const VertexPosition& Get(int index) const
{ {
if ( index == -1 ) return mFind; if ( index == -1 ) return mFind;
VertexVector &vlist = *mList; VertexVector &vlist = *mList;
return vlist[index]; return vlist[index];
} }
static Type mFind; // vertice to locate. static VertexPosition mFind; // vertice to locate.
static VertexVector *mList; static VertexVector *mList;
}; };
template <class Type> class VertexPool template <class Type> class VertexPool
{ {
public: public:
typedef std::set<int, VertexLess<Type> > VertexSet; typedef std::set<int, VertexLess > VertexSet;
typedef std::vector< Type > VertexVector; typedef std::vector< Type > VertexVector;
int GetVertex(const Type& vtx) int GetVertex(const Type& vtx)
{ {
VertexLess<Type>::SetSearch(vtx,&mVtxs); VertexLess::SetSearch(vtx,&mVtxs);
VertexSet::iterator found; VertexSet::iterator found;
found = mVertSet.find( -1 ); found = mVertSet.find( -1 );
if ( found != mVertSet.end() ) if ( found != mVertSet.end() )
@@ -188,6 +188,7 @@ public:
return idx; return idx;
}; };
const float * GetPos(int idx) const const float * GetPos(int idx) const
{ {
return mVtxs[idx].mPos; return mVtxs[idx].mPos;
@@ -234,10 +235,10 @@ private:
}; };
VertexPosition VertexLess<VertexPosition>::mFind; VertexPosition VertexLess::mFind;
std::vector<VertexPosition > *VertexLess<VertexPosition>::mList=0; std::vector<VertexPosition > *VertexLess::mList=0;
bool VertexLess<VertexPosition>::operator()(int v1,int v2) const bool VertexLess::operator()(int v1,int v2) const
{ {
const VertexPosition& a = Get(v1); const VertexPosition& a = Get(v1);
@@ -267,6 +268,7 @@ bool VertexLess<VertexPosition>::operator()(int v1,int v2) const
}; };
using namespace Vlookup; using namespace Vlookup;

View File

@@ -1,3 +1,4 @@
SubDir TOP Extras ; SubDir TOP Extras ;
SubInclude TOP Extras PhysicsInterface ; SubInclude TOP Extras PhysicsInterface ;
SubInclude TOP Extras ConvexDecomposition ;