Fixed over 500 compile warnings. Mostly:
* Unused variables. * Missing newlines at ends of #included files. * signed int loop variables where the termination condition is an unsigned 'get number of' function. * 'NULL' used inappropriately for an integer or character constant (NULL is a pointer) * abstract base classes with no virtual destructor. * Floating point constants used to initialise integer variables.
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
#include "fitsphere.h"
|
||||
#include "bestfitobb.h"
|
||||
|
||||
unsigned int MAXDEPTH = 8 ;
|
||||
float CONCAVE_PERCENT = 1.0f ;
|
||||
float MERGE_PERCENT = 2.0f ;
|
||||
|
||||
CHull::CHull(const ConvexResult &result)
|
||||
{
|
||||
mResult = new ConvexResult(result);
|
||||
@@ -147,8 +151,6 @@ CHull * ConvexBuilder::canMerge(CHull *a,CHull *b)
|
||||
if (!tcount)
|
||||
return 0;
|
||||
|
||||
unsigned int *idx = &indices[0];
|
||||
|
||||
HullResult hresult;
|
||||
HullLibrary hl;
|
||||
HullDesc desc;
|
||||
|
||||
@@ -79,7 +79,7 @@ class ConvexBuilder : public ConvexDecompInterface
|
||||
public:
|
||||
ConvexBuilder(ConvexDecompInterface *callback);
|
||||
|
||||
~ConvexBuilder(void);
|
||||
virtual ~ConvexBuilder(void);
|
||||
|
||||
bool isDuplicate(unsigned int i1,unsigned int i2,unsigned int i3,
|
||||
unsigned int ci1,unsigned int ci2,unsigned int ci3);
|
||||
@@ -108,3 +108,4 @@ public:
|
||||
};
|
||||
|
||||
#endif //CONVEX_BUILDER_H
|
||||
|
||||
|
||||
@@ -337,9 +337,6 @@ void calcConvexDecomposition(unsigned int vcount,
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int fsize = ifront.size()/3;
|
||||
unsigned int bsize = iback.size()/3;
|
||||
|
||||
// ok... here we recursively call
|
||||
if ( ifront.size() )
|
||||
{
|
||||
|
||||
@@ -1,219 +1,219 @@
|
||||
#ifndef CONVEX_DECOMPOSITION_H
|
||||
|
||||
#define CONVEX_DECOMPOSITION_H
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Copyright (c) 2004 Open Dynamics Framework Group
|
||||
www.physicstools.org
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the Open Dynamics Framework Group nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE INTEL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
// http://codesuppository.blogspot.com
|
||||
//
|
||||
// mailto: jratcliff@infiniplex.net
|
||||
//
|
||||
// http://www.amillionpixels.us
|
||||
//
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <memory.h> //memcpy
|
||||
#endif
|
||||
#include <string.h>
|
||||
#ifndef CONVEX_DECOMPOSITION_H
|
||||
|
||||
#define CONVEX_DECOMPOSITION_H
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Copyright (c) 2004 Open Dynamics Framework Group
|
||||
www.physicstools.org
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the Open Dynamics Framework Group nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE INTEL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
// http://codesuppository.blogspot.com
|
||||
//
|
||||
// mailto: jratcliff@infiniplex.net
|
||||
//
|
||||
// http://www.amillionpixels.us
|
||||
//
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <memory.h> //memcpy
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
static unsigned int MAXDEPTH=8;
|
||||
static float CONCAVE_PERCENT=1.0f;
|
||||
static float MERGE_PERCENT=2.0f;
|
||||
|
||||
#include <vector>
|
||||
typedef std::vector< unsigned int > UintVector;
|
||||
|
||||
|
||||
|
||||
namespace ConvexDecomposition
|
||||
{
|
||||
|
||||
class ConvexResult
|
||||
{
|
||||
public:
|
||||
ConvexResult(void)
|
||||
{
|
||||
mHullVcount = 0;
|
||||
mHullVertices = 0;
|
||||
mHullTcount = 0;
|
||||
mHullIndices = 0;
|
||||
}
|
||||
|
||||
ConvexResult(unsigned int hvcount,const float *hvertices,unsigned int htcount,const unsigned int *hindices)
|
||||
{
|
||||
mHullVcount = hvcount;
|
||||
if ( mHullVcount )
|
||||
{
|
||||
mHullVertices = new float[mHullVcount*sizeof(float)*3];
|
||||
memcpy(mHullVertices, hvertices, sizeof(float)*3*mHullVcount );
|
||||
}
|
||||
else
|
||||
{
|
||||
mHullVertices = 0;
|
||||
}
|
||||
|
||||
mHullTcount = htcount;
|
||||
|
||||
if ( mHullTcount )
|
||||
{
|
||||
mHullIndices = new unsigned int[sizeof(unsigned int)*mHullTcount*3];
|
||||
memcpy(mHullIndices,hindices, sizeof(unsigned int)*mHullTcount*3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
mHullIndices = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConvexResult(const ConvexResult &r)
|
||||
{
|
||||
mHullVcount = r.mHullVcount;
|
||||
if ( mHullVcount )
|
||||
{
|
||||
mHullVertices = new float[mHullVcount*sizeof(float)*3];
|
||||
memcpy(mHullVertices, r.mHullVertices, sizeof(float)*3*mHullVcount );
|
||||
}
|
||||
else
|
||||
{
|
||||
mHullVertices = 0;
|
||||
}
|
||||
mHullTcount = r.mHullTcount;
|
||||
if ( mHullTcount )
|
||||
{
|
||||
mHullIndices = new unsigned int[sizeof(unsigned int)*mHullTcount*3];
|
||||
memcpy(mHullIndices, r.mHullIndices, sizeof(unsigned int)*mHullTcount*3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
mHullIndices = 0;
|
||||
}
|
||||
}
|
||||
|
||||
~ConvexResult(void)
|
||||
{
|
||||
delete mHullVertices;
|
||||
delete mHullIndices;
|
||||
}
|
||||
|
||||
// the convex hull.
|
||||
unsigned int mHullVcount;
|
||||
float * mHullVertices;
|
||||
unsigned int mHullTcount;
|
||||
unsigned int *mHullIndices;
|
||||
|
||||
float mHullVolume; // the volume of the convex hull.
|
||||
|
||||
float mOBBSides[3]; // the width, height and breadth of the best fit OBB
|
||||
float mOBBCenter[3]; // the center of the OBB
|
||||
float mOBBOrientation[4]; // the quaternion rotation of the OBB.
|
||||
float mOBBTransform[16]; // the 4x4 transform of the OBB.
|
||||
float mOBBVolume; // the volume of the OBB
|
||||
|
||||
float mSphereRadius; // radius and center of best fit sphere
|
||||
float mSphereCenter[3];
|
||||
float mSphereVolume; // volume of the best fit sphere
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
class ConvexDecompInterface
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void ConvexDebugTri(const float *p1,const float *p2,const float *p3,unsigned int color) { };
|
||||
virtual void ConvexDebugPoint(const float *p,float dist,unsigned int color) { };
|
||||
virtual void ConvexDebugBound(const float *bmin,const float *bmax,unsigned int color) { };
|
||||
virtual void ConvexDebugOBB(const float *sides, const float *matrix,unsigned int color) { };
|
||||
|
||||
virtual void ConvexDecompResult(ConvexResult &result) = 0;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
// just to avoid passing a zillion parameters to the method the
|
||||
// options are packed into this descriptor.
|
||||
class DecompDesc
|
||||
{
|
||||
public:
|
||||
DecompDesc(void)
|
||||
{
|
||||
mVcount = 0;
|
||||
mVertices = 0;
|
||||
mTcount = 0;
|
||||
mIndices = 0;
|
||||
mDepth = 5;
|
||||
mCpercent = 5;
|
||||
mPpercent = 5;
|
||||
mMaxVertices = 32;
|
||||
mSkinWidth = 0;
|
||||
mCallback = 0;
|
||||
}
|
||||
|
||||
// describes the input triangle.
|
||||
unsigned int mVcount; // the number of vertices in the source mesh.
|
||||
const float *mVertices; // start of the vertex position array. Assumes a stride of 3 floats.
|
||||
unsigned int mTcount; // the number of triangles in the source mesh.
|
||||
unsigned int *mIndices; // the indexed triangle list array (zero index based)
|
||||
|
||||
// options
|
||||
unsigned int mDepth; // depth to split, a maximum of 10, generally not over 7.
|
||||
float mCpercent; // the concavity threshold percentage. 0=20 is reasonable.
|
||||
float mPpercent; // the percentage volume conservation threshold to collapse hulls. 0-30 is reasonable.
|
||||
|
||||
// hull output limits.
|
||||
unsigned int mMaxVertices; // maximum number of vertices in the output hull. Recommended 32 or less.
|
||||
float mSkinWidth; // a skin width to apply to the output hulls.
|
||||
|
||||
ConvexDecompInterface *mCallback; // the interface to receive back the results.
|
||||
|
||||
};
|
||||
|
||||
// perform approximate convex decomposition on a mesh.
|
||||
unsigned int performConvexDecomposition(const DecompDesc &desc); // returns the number of hulls produced.
|
||||
|
||||
|
||||
void calcConvexDecomposition(unsigned int vcount,
|
||||
const float *vertices,
|
||||
unsigned int tcount,
|
||||
const unsigned int *indices,
|
||||
ConvexDecompInterface *callback,
|
||||
float masterVolume,
|
||||
unsigned int depth);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
extern unsigned int MAXDEPTH ;
|
||||
extern float CONCAVE_PERCENT ;
|
||||
extern float MERGE_PERCENT ;
|
||||
|
||||
#include <vector>
|
||||
typedef std::vector< unsigned int > UintVector;
|
||||
|
||||
|
||||
|
||||
namespace ConvexDecomposition
|
||||
{
|
||||
|
||||
class ConvexResult
|
||||
{
|
||||
public:
|
||||
ConvexResult(void)
|
||||
{
|
||||
mHullVcount = 0;
|
||||
mHullVertices = 0;
|
||||
mHullTcount = 0;
|
||||
mHullIndices = 0;
|
||||
}
|
||||
|
||||
ConvexResult(unsigned int hvcount,const float *hvertices,unsigned int htcount,const unsigned int *hindices)
|
||||
{
|
||||
mHullVcount = hvcount;
|
||||
if ( mHullVcount )
|
||||
{
|
||||
mHullVertices = new float[mHullVcount*sizeof(float)*3];
|
||||
memcpy(mHullVertices, hvertices, sizeof(float)*3*mHullVcount );
|
||||
}
|
||||
else
|
||||
{
|
||||
mHullVertices = 0;
|
||||
}
|
||||
|
||||
mHullTcount = htcount;
|
||||
|
||||
if ( mHullTcount )
|
||||
{
|
||||
mHullIndices = new unsigned int[sizeof(unsigned int)*mHullTcount*3];
|
||||
memcpy(mHullIndices,hindices, sizeof(unsigned int)*mHullTcount*3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
mHullIndices = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConvexResult(const ConvexResult &r)
|
||||
{
|
||||
mHullVcount = r.mHullVcount;
|
||||
if ( mHullVcount )
|
||||
{
|
||||
mHullVertices = new float[mHullVcount*sizeof(float)*3];
|
||||
memcpy(mHullVertices, r.mHullVertices, sizeof(float)*3*mHullVcount );
|
||||
}
|
||||
else
|
||||
{
|
||||
mHullVertices = 0;
|
||||
}
|
||||
mHullTcount = r.mHullTcount;
|
||||
if ( mHullTcount )
|
||||
{
|
||||
mHullIndices = new unsigned int[sizeof(unsigned int)*mHullTcount*3];
|
||||
memcpy(mHullIndices, r.mHullIndices, sizeof(unsigned int)*mHullTcount*3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
mHullIndices = 0;
|
||||
}
|
||||
}
|
||||
|
||||
~ConvexResult(void)
|
||||
{
|
||||
delete mHullVertices;
|
||||
delete mHullIndices;
|
||||
}
|
||||
|
||||
// the convex hull.
|
||||
unsigned int mHullVcount;
|
||||
float * mHullVertices;
|
||||
unsigned int mHullTcount;
|
||||
unsigned int *mHullIndices;
|
||||
|
||||
float mHullVolume; // the volume of the convex hull.
|
||||
|
||||
float mOBBSides[3]; // the width, height and breadth of the best fit OBB
|
||||
float mOBBCenter[3]; // the center of the OBB
|
||||
float mOBBOrientation[4]; // the quaternion rotation of the OBB.
|
||||
float mOBBTransform[16]; // the 4x4 transform of the OBB.
|
||||
float mOBBVolume; // the volume of the OBB
|
||||
|
||||
float mSphereRadius; // radius and center of best fit sphere
|
||||
float mSphereCenter[3];
|
||||
float mSphereVolume; // volume of the best fit sphere
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
class ConvexDecompInterface
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void ConvexDebugTri(const float *p1,const float *p2,const float *p3,unsigned int color) { };
|
||||
virtual void ConvexDebugPoint(const float *p,float dist,unsigned int color) { };
|
||||
virtual void ConvexDebugBound(const float *bmin,const float *bmax,unsigned int color) { };
|
||||
virtual void ConvexDebugOBB(const float *sides, const float *matrix,unsigned int color) { };
|
||||
|
||||
virtual void ConvexDecompResult(ConvexResult &result) = 0;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
// just to avoid passing a zillion parameters to the method the
|
||||
// options are packed into this descriptor.
|
||||
class DecompDesc
|
||||
{
|
||||
public:
|
||||
DecompDesc(void)
|
||||
{
|
||||
mVcount = 0;
|
||||
mVertices = 0;
|
||||
mTcount = 0;
|
||||
mIndices = 0;
|
||||
mDepth = 5;
|
||||
mCpercent = 5;
|
||||
mPpercent = 5;
|
||||
mMaxVertices = 32;
|
||||
mSkinWidth = 0;
|
||||
mCallback = 0;
|
||||
}
|
||||
|
||||
// describes the input triangle.
|
||||
unsigned int mVcount; // the number of vertices in the source mesh.
|
||||
const float *mVertices; // start of the vertex position array. Assumes a stride of 3 floats.
|
||||
unsigned int mTcount; // the number of triangles in the source mesh.
|
||||
unsigned int *mIndices; // the indexed triangle list array (zero index based)
|
||||
|
||||
// options
|
||||
unsigned int mDepth; // depth to split, a maximum of 10, generally not over 7.
|
||||
float mCpercent; // the concavity threshold percentage. 0=20 is reasonable.
|
||||
float mPpercent; // the percentage volume conservation threshold to collapse hulls. 0-30 is reasonable.
|
||||
|
||||
// hull output limits.
|
||||
unsigned int mMaxVertices; // maximum number of vertices in the output hull. Recommended 32 or less.
|
||||
float mSkinWidth; // a skin width to apply to the output hulls.
|
||||
|
||||
ConvexDecompInterface *mCallback; // the interface to receive back the results.
|
||||
|
||||
};
|
||||
|
||||
// perform approximate convex decomposition on a mesh.
|
||||
unsigned int performConvexDecomposition(const DecompDesc &desc); // returns the number of hulls produced.
|
||||
|
||||
|
||||
void calcConvexDecomposition(unsigned int vcount,
|
||||
const float *vertices,
|
||||
unsigned int tcount,
|
||||
const unsigned int *indices,
|
||||
ConvexDecompInterface *callback,
|
||||
float masterVolume,
|
||||
unsigned int depth);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1725,7 +1725,6 @@ int AssertIntact(ConvexH &convex) {
|
||||
inext = estart;
|
||||
}
|
||||
assert(convex.edges[inext].p == convex.edges[i].p);
|
||||
HalfEdge &edge = convex.edges[i];
|
||||
int nb = convex.edges[i].ea;
|
||||
assert(nb!=255);
|
||||
if(nb==255 || nb==-1) return 0;
|
||||
@@ -1852,10 +1851,6 @@ ConvexH *ConvexHCrop(ConvexH &convex,const Plane &slice)
|
||||
int i;
|
||||
int vertcountunder=0;
|
||||
int vertcountover =0;
|
||||
int edgecountunder=0;
|
||||
int edgecountover =0;
|
||||
int planecountunder=0;
|
||||
int planecountover =0;
|
||||
static Array<int> vertscoplanar; // existing vertex members of convex that are coplanar
|
||||
vertscoplanar.count=0;
|
||||
static Array<int> edgesplit; // existing edges that members of convex that cross the splitplane
|
||||
@@ -1886,7 +1881,7 @@ ConvexH *ConvexHCrop(ConvexH &convex,const Plane &slice)
|
||||
else {
|
||||
assert(vertflag[i].planetest == OVER);
|
||||
vertflag[i].overmap = vertcountover++;
|
||||
vertflag[i].undermap = -1; // for debugging purposes
|
||||
vertflag[i].undermap = 255; // for debugging purposes
|
||||
}
|
||||
}
|
||||
int vertcountunderold = vertcountunder; // for debugging only
|
||||
@@ -1897,11 +1892,9 @@ ConvexH *ConvexHCrop(ConvexH &convex,const Plane &slice)
|
||||
|
||||
for(int currentplane=0; currentplane<convex.facets.count; currentplane++) {
|
||||
int estart =e0;
|
||||
int enextface;
|
||||
int enextface = 0;
|
||||
int planeside = 0;
|
||||
int e1 = e0+1;
|
||||
int eus=-1;
|
||||
int ecop=-1;
|
||||
int vout=-1;
|
||||
int vin =-1;
|
||||
int coplanaredge = -1;
|
||||
@@ -2157,8 +2150,8 @@ ConvexH *ConvexHCrop(ConvexH &convex,const Plane &slice)
|
||||
|
||||
static int candidateplane(Plane *planes,int planes_count,ConvexH *convex,float epsilon)
|
||||
{
|
||||
int p ;
|
||||
REAL md;
|
||||
int p = 0 ;
|
||||
REAL md= 0 ;
|
||||
int i;
|
||||
for(i=0;i<planes_count;i++)
|
||||
{
|
||||
@@ -2520,7 +2513,6 @@ int calchullgen(float3 *verts,int verts_count, int vlimit)
|
||||
isextreme[v]=1;
|
||||
//if(v==p0 || v==p1 || v==p2 || v==p3) continue; // done these already
|
||||
j=tris.count;
|
||||
int newstart=j;
|
||||
while(j--) {
|
||||
if(!tris[j]) continue;
|
||||
int3 t=*tris[j];
|
||||
@@ -2619,7 +2611,7 @@ int overhull(Plane *planes,int planes_count,float3 *verts, int verts_count,int m
|
||||
float3 *&verts_out, int &verts_count_out, int *&faces_out, int &faces_count_out ,float inflate)
|
||||
{
|
||||
int i,j;
|
||||
if(verts_count <4) return NULL;
|
||||
if(verts_count <4) return 0;
|
||||
maxplanes = Min(maxplanes,planes_count);
|
||||
float3 bmin(verts[0]),bmax(verts[0]);
|
||||
for(i=0;i<verts_count;i++)
|
||||
@@ -2627,7 +2619,7 @@ int overhull(Plane *planes,int planes_count,float3 *verts, int verts_count,int m
|
||||
bmin = VectorMin(bmin,verts[i]);
|
||||
bmax = VectorMax(bmax,verts[i]);
|
||||
}
|
||||
float diameter = magnitude(bmax-bmin);
|
||||
// float diameter = magnitude(bmax-bmin);
|
||||
// inflate *=diameter; // RELATIVE INFLATION
|
||||
bmin -= float3(inflate,inflate,inflate);
|
||||
bmax += float3(inflate,inflate,inflate);
|
||||
@@ -2957,9 +2949,7 @@ bool HullLibrary::CleanupVertices(unsigned int svcount,
|
||||
if ( svcount == 0 ) return false;
|
||||
|
||||
|
||||
#define EPSILON 0.000001f // close enough to consider two floating point numbers to be 'the same'.
|
||||
|
||||
bool ret = false;
|
||||
#define EPSILON 0.000001f /* close enough to consider two floating point numbers to be 'the same'. */
|
||||
|
||||
vcount = 0;
|
||||
|
||||
|
||||
@@ -88,7 +88,9 @@ typedef std::vector< float > FloatVector;
|
||||
class InPlaceParserInterface
|
||||
{
|
||||
public:
|
||||
virtual int ParseLine(int lineno,int argc,const char **argv) =0; // return TRUE to continue parsing, return FALSE to abort parsing process
|
||||
virtual ~InPlaceParserInterface () {} ;
|
||||
|
||||
virtual int ParseLine(int lineno,int argc,const char **argv) =0; // return TRUE to continue parsing, return FALSE to abort parsing process
|
||||
};
|
||||
|
||||
enum SeparatorType
|
||||
@@ -157,23 +159,23 @@ public:
|
||||
|
||||
void SetHardSeparator(char c) // add a hard separator
|
||||
{
|
||||
mHard[c] = ST_HARD;
|
||||
mHard[(int)c] = ST_HARD;
|
||||
}
|
||||
|
||||
void SetHard(char c) // add a hard separator
|
||||
{
|
||||
mHard[c] = ST_HARD;
|
||||
mHard[(int)c] = ST_HARD;
|
||||
}
|
||||
|
||||
|
||||
void SetCommentSymbol(char c) // comment character, treated as 'end of string'
|
||||
{
|
||||
mHard[c] = ST_EOS;
|
||||
mHard[(int)c] = ST_EOS;
|
||||
}
|
||||
|
||||
void ClearHardSeparator(char c)
|
||||
{
|
||||
mHard[c] = ST_DATA;
|
||||
mHard[(int)c] = ST_DATA;
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +183,7 @@ public:
|
||||
|
||||
bool EOS(char c)
|
||||
{
|
||||
if ( mHard[c] == ST_EOS )
|
||||
if ( mHard[(int)c] == ST_EOS )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -261,7 +263,7 @@ InPlaceParser::~InPlaceParser(void)
|
||||
|
||||
bool InPlaceParser::IsHard(char c)
|
||||
{
|
||||
return mHard[c] == ST_HARD;
|
||||
return mHard[(int)c] == ST_HARD;
|
||||
}
|
||||
|
||||
char * InPlaceParser::AddHard(int &argc,const char **argv,char *foo)
|
||||
@@ -280,7 +282,7 @@ char * InPlaceParser::AddHard(int &argc,const char **argv,char *foo)
|
||||
|
||||
bool InPlaceParser::IsWhiteSpace(char c)
|
||||
{
|
||||
return mHard[c] == ST_SOFT;
|
||||
return mHard[(int)c] == ST_SOFT;
|
||||
}
|
||||
|
||||
char * InPlaceParser::SkipSpaces(char *foo)
|
||||
@@ -550,10 +552,9 @@ class GeometryInterface
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void NodeTriangle(const GeometryVertex *v1,const GeometryVertex *v2,const GeometryVertex *v3)
|
||||
{
|
||||
}
|
||||
virtual void NodeTriangle(const GeometryVertex *v1,const GeometryVertex *v2,const GeometryVertex *v3) {}
|
||||
|
||||
virtual ~GeometryInterface () {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -113,7 +113,6 @@ static void intersect(const float *p1,const float *p2,float *split,const float *
|
||||
{
|
||||
|
||||
float dp1 = DistToPt(p1,plane);
|
||||
float dp2 = DistToPt(p2,plane);
|
||||
|
||||
float dir[3];
|
||||
|
||||
@@ -129,7 +128,6 @@ static void intersect(const float *p1,const float *p2,float *split,const float *
|
||||
split[0] = (dir[0]*t)+p1[0];
|
||||
split[1] = (dir[1]*t)+p1[1];
|
||||
split[2] = (dir[2]*t)+p1[2];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -602,8 +600,6 @@ float computeConcavity(unsigned int vcount,
|
||||
float bmin[3];
|
||||
float bmax[3];
|
||||
|
||||
float diagonal = getBoundingRegion( result.mNumOutputVertices, result.mOutputVertices, sizeof(float)*3, bmin, bmax );
|
||||
|
||||
float dx = bmax[0] - bmin[0];
|
||||
float dy = bmax[1] - bmin[1];
|
||||
float dz = bmax[2] - bmin[2];
|
||||
@@ -614,8 +610,6 @@ float computeConcavity(unsigned int vcount,
|
||||
center.y = bmin[1] + dy*0.5f;
|
||||
center.z = bmin[2] + dz*0.5f;
|
||||
|
||||
float boundVolume = dx*dy*dz;
|
||||
|
||||
volume = computeMeshVolume2( result.mOutputVertices, result.mNumFaces, result.mIndices );
|
||||
|
||||
#if 1
|
||||
|
||||
@@ -43,7 +43,6 @@ float computeMeshVolume(const float *vertices,unsigned int tcount,const unsigned
|
||||
{
|
||||
float volume = 0;
|
||||
|
||||
const float *p0 = vertices;
|
||||
for (unsigned int i=0; i<tcount; i++,indices+=3)
|
||||
{
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@ static void intersect(const float *p1,const float *p2,float *split,const float *
|
||||
{
|
||||
|
||||
float dp1 = DistToPt(p1,plane);
|
||||
float dp2 = DistToPt(p2,plane);
|
||||
|
||||
float dir[3];
|
||||
|
||||
|
||||
@@ -185,9 +185,6 @@ bool computeSplitPlane(unsigned int vcount,
|
||||
ConvexDecompInterface *callback,
|
||||
float *plane)
|
||||
{
|
||||
bool cret = false;
|
||||
|
||||
|
||||
float bmin[3] = { 1e9, 1e9, 1e9 };
|
||||
float bmax[3] = { -1e9, -1e9, -1e9 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user