fix: some file didn't have the svn:eol-style native yet
This commit is contained in:
@@ -1,42 +1,42 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "btBox2dShape.h"
|
||||
|
||||
|
||||
//{
|
||||
|
||||
|
||||
void btBox2dShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
|
||||
void btBox2dShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||
{
|
||||
//btScalar margin = btScalar(0.);
|
||||
btVector3 halfExtents = getHalfExtentsWithMargin();
|
||||
|
||||
btScalar lx=btScalar(2.)*(halfExtents.x());
|
||||
btScalar ly=btScalar(2.)*(halfExtents.y());
|
||||
btScalar lz=btScalar(2.)*(halfExtents.z());
|
||||
|
||||
inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz),
|
||||
mass/(btScalar(12.0)) * (lx*lx + lz*lz),
|
||||
mass/(btScalar(12.0)) * (lx*lx + ly*ly));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "btBox2dShape.h"
|
||||
|
||||
|
||||
//{
|
||||
|
||||
|
||||
void btBox2dShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
|
||||
void btBox2dShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||
{
|
||||
//btScalar margin = btScalar(0.);
|
||||
btVector3 halfExtents = getHalfExtentsWithMargin();
|
||||
|
||||
btScalar lx=btScalar(2.)*(halfExtents.x());
|
||||
btScalar ly=btScalar(2.)*(halfExtents.y());
|
||||
btScalar lz=btScalar(2.)*(halfExtents.z());
|
||||
|
||||
inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz),
|
||||
mass/(btScalar(12.0)) * (lx*lx + lz*lz),
|
||||
mass/(btScalar(12.0)) * (lx*lx + ly*ly));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,363 +1,363 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef OBB_BOX_2D_SHAPE_H
|
||||
#define OBB_BOX_2D_SHAPE_H
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include "LinearMath/btMinMax.h"
|
||||
|
||||
///The btBox2dShape is a box primitive around the origin, its sides axis aligned with length specified by half extents, in local shape coordinates. When used as part of a btCollisionObject or btRigidBody it will be an oriented box in world space.
|
||||
class btBox2dShape: public btPolyhedralConvexShape
|
||||
{
|
||||
|
||||
//btVector3 m_boxHalfExtents1; //use m_implicitShapeDimensions instead
|
||||
|
||||
btVector3 m_centroid;
|
||||
btVector3 m_vertices[4];
|
||||
btVector3 m_normals[4];
|
||||
|
||||
public:
|
||||
|
||||
btVector3 getHalfExtentsWithMargin() const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
halfExtents += margin;
|
||||
return halfExtents;
|
||||
}
|
||||
|
||||
const btVector3& getHalfExtentsWithoutMargin() const
|
||||
{
|
||||
return m_implicitShapeDimensions;//changed in Bullet 2.63: assume the scaling and margin are included
|
||||
}
|
||||
|
||||
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
halfExtents += margin;
|
||||
|
||||
return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
|
||||
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
|
||||
btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
const btVector3& halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
|
||||
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
|
||||
btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
|
||||
}
|
||||
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
const btVector3& halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
const btVector3& vec = vectors[i];
|
||||
supportVerticesOut[i].setValue(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
|
||||
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
|
||||
btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
btBox2dShape( const btVector3& boxHalfExtents)
|
||||
: btPolyhedralConvexShape(),
|
||||
m_centroid(0,0,0)
|
||||
{
|
||||
m_vertices[0].setValue(-boxHalfExtents.getX(),-boxHalfExtents.getY(),0);
|
||||
m_vertices[1].setValue(boxHalfExtents.getX(),-boxHalfExtents.getY(),0);
|
||||
m_vertices[2].setValue(boxHalfExtents.getX(),boxHalfExtents.getY(),0);
|
||||
m_vertices[3].setValue(-boxHalfExtents.getX(),boxHalfExtents.getY(),0);
|
||||
|
||||
m_normals[0].setValue(0,-1,0);
|
||||
m_normals[1].setValue(1,0,0);
|
||||
m_normals[2].setValue(0,1,0);
|
||||
m_normals[3].setValue(-1,0,0);
|
||||
|
||||
m_shapeType = BOX_2D_SHAPE_PROXYTYPE;
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin;
|
||||
};
|
||||
|
||||
virtual void setMargin(btScalar collisionMargin)
|
||||
{
|
||||
//correct the m_implicitShapeDimensions for the margin
|
||||
btVector3 oldMargin(getMargin(),getMargin(),getMargin());
|
||||
btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
|
||||
|
||||
btConvexInternalShape::setMargin(collisionMargin);
|
||||
btVector3 newMargin(getMargin(),getMargin(),getMargin());
|
||||
m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin;
|
||||
|
||||
}
|
||||
virtual void setLocalScaling(const btVector3& scaling)
|
||||
{
|
||||
btVector3 oldMargin(getMargin(),getMargin(),getMargin());
|
||||
btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
|
||||
btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling;
|
||||
|
||||
btConvexInternalShape::setLocalScaling(scaling);
|
||||
|
||||
m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin;
|
||||
|
||||
}
|
||||
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int getVertexCount() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
virtual int getNumVertices()const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
const btVector3* getVertices() const
|
||||
{
|
||||
return &m_vertices[0];
|
||||
}
|
||||
|
||||
const btVector3* getNormals() const
|
||||
{
|
||||
return &m_normals[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const
|
||||
{
|
||||
//this plane might not be aligned...
|
||||
btVector4 plane ;
|
||||
getPlaneEquation(plane,i);
|
||||
planeNormal = btVector3(plane.getX(),plane.getY(),plane.getZ());
|
||||
planeSupport = localGetSupportingVertex(-planeNormal);
|
||||
}
|
||||
|
||||
|
||||
const btVector3& getCentroid() const
|
||||
{
|
||||
return m_centroid;
|
||||
}
|
||||
|
||||
virtual int getNumPlanes() const
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual int getNumEdges() const
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
|
||||
virtual void getVertex(int i,btVector3& vtx) const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
vtx = btVector3(
|
||||
halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1),
|
||||
halfExtents.y() * (1-((i&2)>>1)) - halfExtents.y() * ((i&2)>>1),
|
||||
halfExtents.z() * (1-((i&4)>>2)) - halfExtents.z() * ((i&4)>>2));
|
||||
}
|
||||
|
||||
|
||||
virtual void getPlaneEquation(btVector4& plane,int i) const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.),-halfExtents.x());
|
||||
break;
|
||||
case 1:
|
||||
plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0.),-halfExtents.x());
|
||||
break;
|
||||
case 2:
|
||||
plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.),-halfExtents.y());
|
||||
break;
|
||||
case 3:
|
||||
plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0.),-halfExtents.y());
|
||||
break;
|
||||
case 4:
|
||||
plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.),-halfExtents.z());
|
||||
break;
|
||||
case 5:
|
||||
plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.),-halfExtents.z());
|
||||
break;
|
||||
default:
|
||||
btAssert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const
|
||||
//virtual void getEdge(int i,Edge& edge) const
|
||||
{
|
||||
int edgeVert0 = 0;
|
||||
int edgeVert1 = 0;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
edgeVert0 = 0;
|
||||
edgeVert1 = 1;
|
||||
break;
|
||||
case 1:
|
||||
edgeVert0 = 0;
|
||||
edgeVert1 = 2;
|
||||
break;
|
||||
case 2:
|
||||
edgeVert0 = 1;
|
||||
edgeVert1 = 3;
|
||||
|
||||
break;
|
||||
case 3:
|
||||
edgeVert0 = 2;
|
||||
edgeVert1 = 3;
|
||||
break;
|
||||
case 4:
|
||||
edgeVert0 = 0;
|
||||
edgeVert1 = 4;
|
||||
break;
|
||||
case 5:
|
||||
edgeVert0 = 1;
|
||||
edgeVert1 = 5;
|
||||
|
||||
break;
|
||||
case 6:
|
||||
edgeVert0 = 2;
|
||||
edgeVert1 = 6;
|
||||
break;
|
||||
case 7:
|
||||
edgeVert0 = 3;
|
||||
edgeVert1 = 7;
|
||||
break;
|
||||
case 8:
|
||||
edgeVert0 = 4;
|
||||
edgeVert1 = 5;
|
||||
break;
|
||||
case 9:
|
||||
edgeVert0 = 4;
|
||||
edgeVert1 = 6;
|
||||
break;
|
||||
case 10:
|
||||
edgeVert0 = 5;
|
||||
edgeVert1 = 7;
|
||||
break;
|
||||
case 11:
|
||||
edgeVert0 = 6;
|
||||
edgeVert1 = 7;
|
||||
break;
|
||||
default:
|
||||
btAssert(0);
|
||||
|
||||
}
|
||||
|
||||
getVertex(edgeVert0,pa );
|
||||
getVertex(edgeVert1,pb );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual bool isInside(const btVector3& pt,btScalar tolerance) const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
//btScalar minDist = 2*tolerance;
|
||||
|
||||
bool result = (pt.x() <= (halfExtents.x()+tolerance)) &&
|
||||
(pt.x() >= (-halfExtents.x()-tolerance)) &&
|
||||
(pt.y() <= (halfExtents.y()+tolerance)) &&
|
||||
(pt.y() >= (-halfExtents.y()-tolerance)) &&
|
||||
(pt.z() <= (halfExtents.z()+tolerance)) &&
|
||||
(pt.z() >= (-halfExtents.z()-tolerance));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//debugging
|
||||
virtual const char* getName()const
|
||||
{
|
||||
return "Box2d";
|
||||
}
|
||||
|
||||
virtual int getNumPreferredPenetrationDirections() const
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
penetrationVector.setValue(btScalar(1.),btScalar(0.),btScalar(0.));
|
||||
break;
|
||||
case 1:
|
||||
penetrationVector.setValue(btScalar(-1.),btScalar(0.),btScalar(0.));
|
||||
break;
|
||||
case 2:
|
||||
penetrationVector.setValue(btScalar(0.),btScalar(1.),btScalar(0.));
|
||||
break;
|
||||
case 3:
|
||||
penetrationVector.setValue(btScalar(0.),btScalar(-1.),btScalar(0.));
|
||||
break;
|
||||
case 4:
|
||||
penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(1.));
|
||||
break;
|
||||
case 5:
|
||||
penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
|
||||
break;
|
||||
default:
|
||||
btAssert(0);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //OBB_BOX_2D_SHAPE_H
|
||||
|
||||
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef OBB_BOX_2D_SHAPE_H
|
||||
#define OBB_BOX_2D_SHAPE_H
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include "LinearMath/btMinMax.h"
|
||||
|
||||
///The btBox2dShape is a box primitive around the origin, its sides axis aligned with length specified by half extents, in local shape coordinates. When used as part of a btCollisionObject or btRigidBody it will be an oriented box in world space.
|
||||
class btBox2dShape: public btPolyhedralConvexShape
|
||||
{
|
||||
|
||||
//btVector3 m_boxHalfExtents1; //use m_implicitShapeDimensions instead
|
||||
|
||||
btVector3 m_centroid;
|
||||
btVector3 m_vertices[4];
|
||||
btVector3 m_normals[4];
|
||||
|
||||
public:
|
||||
|
||||
btVector3 getHalfExtentsWithMargin() const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
halfExtents += margin;
|
||||
return halfExtents;
|
||||
}
|
||||
|
||||
const btVector3& getHalfExtentsWithoutMargin() const
|
||||
{
|
||||
return m_implicitShapeDimensions;//changed in Bullet 2.63: assume the scaling and margin are included
|
||||
}
|
||||
|
||||
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
halfExtents += margin;
|
||||
|
||||
return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
|
||||
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
|
||||
btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
const btVector3& halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
|
||||
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
|
||||
btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
|
||||
}
|
||||
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
const btVector3& halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
const btVector3& vec = vectors[i];
|
||||
supportVerticesOut[i].setValue(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
|
||||
btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
|
||||
btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
btBox2dShape( const btVector3& boxHalfExtents)
|
||||
: btPolyhedralConvexShape(),
|
||||
m_centroid(0,0,0)
|
||||
{
|
||||
m_vertices[0].setValue(-boxHalfExtents.getX(),-boxHalfExtents.getY(),0);
|
||||
m_vertices[1].setValue(boxHalfExtents.getX(),-boxHalfExtents.getY(),0);
|
||||
m_vertices[2].setValue(boxHalfExtents.getX(),boxHalfExtents.getY(),0);
|
||||
m_vertices[3].setValue(-boxHalfExtents.getX(),boxHalfExtents.getY(),0);
|
||||
|
||||
m_normals[0].setValue(0,-1,0);
|
||||
m_normals[1].setValue(1,0,0);
|
||||
m_normals[2].setValue(0,1,0);
|
||||
m_normals[3].setValue(-1,0,0);
|
||||
|
||||
m_shapeType = BOX_2D_SHAPE_PROXYTYPE;
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin;
|
||||
};
|
||||
|
||||
virtual void setMargin(btScalar collisionMargin)
|
||||
{
|
||||
//correct the m_implicitShapeDimensions for the margin
|
||||
btVector3 oldMargin(getMargin(),getMargin(),getMargin());
|
||||
btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
|
||||
|
||||
btConvexInternalShape::setMargin(collisionMargin);
|
||||
btVector3 newMargin(getMargin(),getMargin(),getMargin());
|
||||
m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin;
|
||||
|
||||
}
|
||||
virtual void setLocalScaling(const btVector3& scaling)
|
||||
{
|
||||
btVector3 oldMargin(getMargin(),getMargin(),getMargin());
|
||||
btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
|
||||
btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling;
|
||||
|
||||
btConvexInternalShape::setLocalScaling(scaling);
|
||||
|
||||
m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin;
|
||||
|
||||
}
|
||||
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int getVertexCount() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
virtual int getNumVertices()const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
const btVector3* getVertices() const
|
||||
{
|
||||
return &m_vertices[0];
|
||||
}
|
||||
|
||||
const btVector3* getNormals() const
|
||||
{
|
||||
return &m_normals[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const
|
||||
{
|
||||
//this plane might not be aligned...
|
||||
btVector4 plane ;
|
||||
getPlaneEquation(plane,i);
|
||||
planeNormal = btVector3(plane.getX(),plane.getY(),plane.getZ());
|
||||
planeSupport = localGetSupportingVertex(-planeNormal);
|
||||
}
|
||||
|
||||
|
||||
const btVector3& getCentroid() const
|
||||
{
|
||||
return m_centroid;
|
||||
}
|
||||
|
||||
virtual int getNumPlanes() const
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual int getNumEdges() const
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
|
||||
virtual void getVertex(int i,btVector3& vtx) const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
vtx = btVector3(
|
||||
halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1),
|
||||
halfExtents.y() * (1-((i&2)>>1)) - halfExtents.y() * ((i&2)>>1),
|
||||
halfExtents.z() * (1-((i&4)>>2)) - halfExtents.z() * ((i&4)>>2));
|
||||
}
|
||||
|
||||
|
||||
virtual void getPlaneEquation(btVector4& plane,int i) const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.),-halfExtents.x());
|
||||
break;
|
||||
case 1:
|
||||
plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0.),-halfExtents.x());
|
||||
break;
|
||||
case 2:
|
||||
plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.),-halfExtents.y());
|
||||
break;
|
||||
case 3:
|
||||
plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0.),-halfExtents.y());
|
||||
break;
|
||||
case 4:
|
||||
plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.),-halfExtents.z());
|
||||
break;
|
||||
case 5:
|
||||
plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.),-halfExtents.z());
|
||||
break;
|
||||
default:
|
||||
btAssert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const
|
||||
//virtual void getEdge(int i,Edge& edge) const
|
||||
{
|
||||
int edgeVert0 = 0;
|
||||
int edgeVert1 = 0;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
edgeVert0 = 0;
|
||||
edgeVert1 = 1;
|
||||
break;
|
||||
case 1:
|
||||
edgeVert0 = 0;
|
||||
edgeVert1 = 2;
|
||||
break;
|
||||
case 2:
|
||||
edgeVert0 = 1;
|
||||
edgeVert1 = 3;
|
||||
|
||||
break;
|
||||
case 3:
|
||||
edgeVert0 = 2;
|
||||
edgeVert1 = 3;
|
||||
break;
|
||||
case 4:
|
||||
edgeVert0 = 0;
|
||||
edgeVert1 = 4;
|
||||
break;
|
||||
case 5:
|
||||
edgeVert0 = 1;
|
||||
edgeVert1 = 5;
|
||||
|
||||
break;
|
||||
case 6:
|
||||
edgeVert0 = 2;
|
||||
edgeVert1 = 6;
|
||||
break;
|
||||
case 7:
|
||||
edgeVert0 = 3;
|
||||
edgeVert1 = 7;
|
||||
break;
|
||||
case 8:
|
||||
edgeVert0 = 4;
|
||||
edgeVert1 = 5;
|
||||
break;
|
||||
case 9:
|
||||
edgeVert0 = 4;
|
||||
edgeVert1 = 6;
|
||||
break;
|
||||
case 10:
|
||||
edgeVert0 = 5;
|
||||
edgeVert1 = 7;
|
||||
break;
|
||||
case 11:
|
||||
edgeVert0 = 6;
|
||||
edgeVert1 = 7;
|
||||
break;
|
||||
default:
|
||||
btAssert(0);
|
||||
|
||||
}
|
||||
|
||||
getVertex(edgeVert0,pa );
|
||||
getVertex(edgeVert1,pb );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual bool isInside(const btVector3& pt,btScalar tolerance) const
|
||||
{
|
||||
btVector3 halfExtents = getHalfExtentsWithoutMargin();
|
||||
|
||||
//btScalar minDist = 2*tolerance;
|
||||
|
||||
bool result = (pt.x() <= (halfExtents.x()+tolerance)) &&
|
||||
(pt.x() >= (-halfExtents.x()-tolerance)) &&
|
||||
(pt.y() <= (halfExtents.y()+tolerance)) &&
|
||||
(pt.y() >= (-halfExtents.y()-tolerance)) &&
|
||||
(pt.z() <= (halfExtents.z()+tolerance)) &&
|
||||
(pt.z() >= (-halfExtents.z()-tolerance));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//debugging
|
||||
virtual const char* getName()const
|
||||
{
|
||||
return "Box2d";
|
||||
}
|
||||
|
||||
virtual int getNumPreferredPenetrationDirections() const
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
penetrationVector.setValue(btScalar(1.),btScalar(0.),btScalar(0.));
|
||||
break;
|
||||
case 1:
|
||||
penetrationVector.setValue(btScalar(-1.),btScalar(0.),btScalar(0.));
|
||||
break;
|
||||
case 2:
|
||||
penetrationVector.setValue(btScalar(0.),btScalar(1.),btScalar(0.));
|
||||
break;
|
||||
case 3:
|
||||
penetrationVector.setValue(btScalar(0.),btScalar(-1.),btScalar(0.));
|
||||
break;
|
||||
case 4:
|
||||
penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(1.));
|
||||
break;
|
||||
case 5:
|
||||
penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
|
||||
break;
|
||||
default:
|
||||
btAssert(0);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //OBB_BOX_2D_SHAPE_H
|
||||
|
||||
|
||||
|
||||
@@ -1,92 +1,92 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "btConvex2dShape.h"
|
||||
|
||||
btConvex2dShape::btConvex2dShape( btConvexShape* convexChildShape):
|
||||
btConvexShape (), m_childConvexShape(convexChildShape)
|
||||
{
|
||||
m_shapeType = CONVEX_2D_SHAPE_PROXYTYPE;
|
||||
}
|
||||
|
||||
btConvex2dShape::~btConvex2dShape()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
btVector3 btConvex2dShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return m_childConvexShape->localGetSupportingVertexWithoutMargin(vec);
|
||||
}
|
||||
|
||||
void btConvex2dShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
m_childConvexShape->batchedUnitVectorGetSupportingVertexWithoutMargin(vectors,supportVerticesOut,numVectors);
|
||||
}
|
||||
|
||||
|
||||
btVector3 btConvex2dShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
return m_childConvexShape->localGetSupportingVertex(vec);
|
||||
}
|
||||
|
||||
|
||||
void btConvex2dShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||
{
|
||||
///this linear upscaling is not realistic, but we don't deal with large mass ratios...
|
||||
m_childConvexShape->calculateLocalInertia(mass,inertia);
|
||||
}
|
||||
|
||||
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btConvex2dShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
m_childConvexShape->getAabb(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
void btConvex2dShape::getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
m_childConvexShape->getAabbSlow(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
void btConvex2dShape::setLocalScaling(const btVector3& scaling)
|
||||
{
|
||||
m_childConvexShape->setLocalScaling(scaling);
|
||||
}
|
||||
|
||||
const btVector3& btConvex2dShape::getLocalScaling() const
|
||||
{
|
||||
return m_childConvexShape->getLocalScaling();
|
||||
}
|
||||
|
||||
void btConvex2dShape::setMargin(btScalar margin)
|
||||
{
|
||||
m_childConvexShape->setMargin(margin);
|
||||
}
|
||||
btScalar btConvex2dShape::getMargin() const
|
||||
{
|
||||
return m_childConvexShape->getMargin();
|
||||
}
|
||||
|
||||
int btConvex2dShape::getNumPreferredPenetrationDirections() const
|
||||
{
|
||||
return m_childConvexShape->getNumPreferredPenetrationDirections();
|
||||
}
|
||||
|
||||
void btConvex2dShape::getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
|
||||
{
|
||||
m_childConvexShape->getPreferredPenetrationDirection(index,penetrationVector);
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "btConvex2dShape.h"
|
||||
|
||||
btConvex2dShape::btConvex2dShape( btConvexShape* convexChildShape):
|
||||
btConvexShape (), m_childConvexShape(convexChildShape)
|
||||
{
|
||||
m_shapeType = CONVEX_2D_SHAPE_PROXYTYPE;
|
||||
}
|
||||
|
||||
btConvex2dShape::~btConvex2dShape()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
btVector3 btConvex2dShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return m_childConvexShape->localGetSupportingVertexWithoutMargin(vec);
|
||||
}
|
||||
|
||||
void btConvex2dShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
m_childConvexShape->batchedUnitVectorGetSupportingVertexWithoutMargin(vectors,supportVerticesOut,numVectors);
|
||||
}
|
||||
|
||||
|
||||
btVector3 btConvex2dShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
return m_childConvexShape->localGetSupportingVertex(vec);
|
||||
}
|
||||
|
||||
|
||||
void btConvex2dShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||
{
|
||||
///this linear upscaling is not realistic, but we don't deal with large mass ratios...
|
||||
m_childConvexShape->calculateLocalInertia(mass,inertia);
|
||||
}
|
||||
|
||||
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btConvex2dShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
m_childConvexShape->getAabb(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
void btConvex2dShape::getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
m_childConvexShape->getAabbSlow(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
void btConvex2dShape::setLocalScaling(const btVector3& scaling)
|
||||
{
|
||||
m_childConvexShape->setLocalScaling(scaling);
|
||||
}
|
||||
|
||||
const btVector3& btConvex2dShape::getLocalScaling() const
|
||||
{
|
||||
return m_childConvexShape->getLocalScaling();
|
||||
}
|
||||
|
||||
void btConvex2dShape::setMargin(btScalar margin)
|
||||
{
|
||||
m_childConvexShape->setMargin(margin);
|
||||
}
|
||||
btScalar btConvex2dShape::getMargin() const
|
||||
{
|
||||
return m_childConvexShape->getMargin();
|
||||
}
|
||||
|
||||
int btConvex2dShape::getNumPreferredPenetrationDirections() const
|
||||
{
|
||||
return m_childConvexShape->getNumPreferredPenetrationDirections();
|
||||
}
|
||||
|
||||
void btConvex2dShape::getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
|
||||
{
|
||||
m_childConvexShape->getPreferredPenetrationDirection(index,penetrationVector);
|
||||
}
|
||||
|
||||
@@ -1,80 +1,80 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef BT_CONVEX_2D_SHAPE_H
|
||||
#define BT_CONVEX_2D_SHAPE_H
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btConvexShape.h"
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
|
||||
|
||||
///The btConvex2dShape allows to use arbitrary convex shapes are 2d convex shapes, with the Z component assumed to be 0.
|
||||
///For 2d boxes, the btBox2dShape is recommended.
|
||||
class btConvex2dShape : public btConvexShape
|
||||
{
|
||||
btConvexShape* m_childConvexShape;
|
||||
|
||||
public:
|
||||
|
||||
btConvex2dShape( btConvexShape* convexChildShape);
|
||||
|
||||
virtual ~btConvex2dShape();
|
||||
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||
|
||||
btConvexShape* getChildShape()
|
||||
{
|
||||
return m_childConvexShape;
|
||||
}
|
||||
|
||||
const btConvexShape* getChildShape() const
|
||||
{
|
||||
return m_childConvexShape;
|
||||
}
|
||||
|
||||
virtual const char* getName()const
|
||||
{
|
||||
return "Convex2dShape";
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////
|
||||
|
||||
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling) ;
|
||||
virtual const btVector3& getLocalScaling() const ;
|
||||
|
||||
virtual void setMargin(btScalar margin);
|
||||
virtual btScalar getMargin() const;
|
||||
|
||||
virtual int getNumPreferredPenetrationDirections() const;
|
||||
|
||||
virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //BT_CONVEX_2D_SHAPE_H
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef BT_CONVEX_2D_SHAPE_H
|
||||
#define BT_CONVEX_2D_SHAPE_H
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btConvexShape.h"
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
|
||||
|
||||
///The btConvex2dShape allows to use arbitrary convex shapes are 2d convex shapes, with the Z component assumed to be 0.
|
||||
///For 2d boxes, the btBox2dShape is recommended.
|
||||
class btConvex2dShape : public btConvexShape
|
||||
{
|
||||
btConvexShape* m_childConvexShape;
|
||||
|
||||
public:
|
||||
|
||||
btConvex2dShape( btConvexShape* convexChildShape);
|
||||
|
||||
virtual ~btConvex2dShape();
|
||||
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||
|
||||
btConvexShape* getChildShape()
|
||||
{
|
||||
return m_childConvexShape;
|
||||
}
|
||||
|
||||
const btConvexShape* getChildShape() const
|
||||
{
|
||||
return m_childConvexShape;
|
||||
}
|
||||
|
||||
virtual const char* getName()const
|
||||
{
|
||||
return "Convex2dShape";
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////
|
||||
|
||||
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling) ;
|
||||
virtual const btVector3& getLocalScaling() const ;
|
||||
|
||||
virtual void setMargin(btScalar margin);
|
||||
virtual btScalar getMargin() const;
|
||||
|
||||
virtual int getNumPreferredPenetrationDirections() const;
|
||||
|
||||
virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //BT_CONVEX_2D_SHAPE_H
|
||||
|
||||
@@ -1,238 +1,238 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2010 Erwin Coumans http://bulletphysics.org
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _BT_TRIANGLE_INFO_MAP_H
|
||||
#define _BT_TRIANGLE_INFO_MAP_H
|
||||
|
||||
|
||||
#include "LinearMath/btHashMap.h"
|
||||
#include "LinearMath/btSerializer.h"
|
||||
|
||||
|
||||
///for btTriangleInfo m_flags
|
||||
#define TRI_INFO_V0V1_CONVEX 1
|
||||
#define TRI_INFO_V1V2_CONVEX 2
|
||||
#define TRI_INFO_V2V0_CONVEX 4
|
||||
|
||||
#define TRI_INFO_V0V1_SWAP_NORMALB 8
|
||||
#define TRI_INFO_V1V2_SWAP_NORMALB 16
|
||||
#define TRI_INFO_V2V0_SWAP_NORMALB 32
|
||||
|
||||
|
||||
///The btTriangleInfo structure stores information to adjust collision normals to avoid collisions against internal edges
|
||||
///it can be generated using
|
||||
struct btTriangleInfo
|
||||
{
|
||||
btTriangleInfo()
|
||||
{
|
||||
m_edgeV0V1Angle = SIMD_2_PI;
|
||||
m_edgeV1V2Angle = SIMD_2_PI;
|
||||
m_edgeV2V0Angle = SIMD_2_PI;
|
||||
m_flags=0;
|
||||
}
|
||||
|
||||
int m_flags;
|
||||
|
||||
btScalar m_edgeV0V1Angle;
|
||||
btScalar m_edgeV1V2Angle;
|
||||
btScalar m_edgeV2V0Angle;
|
||||
|
||||
};
|
||||
|
||||
typedef btHashMap<btHashInt,btTriangleInfo> btInternalTriangleInfoMap;
|
||||
|
||||
|
||||
///The btTriangleInfoMap stores edge angle information for some triangles. You can compute this information yourself or using btGenerateInternalEdgeInfo.
|
||||
struct btTriangleInfoMap : public btInternalTriangleInfoMap
|
||||
{
|
||||
btScalar m_convexEpsilon;///used to determine if an edge or contact normal is convex, using the dot product
|
||||
btScalar m_planarEpsilon; ///used to determine if a triangle edge is planar with zero angle
|
||||
btScalar m_equalVertexThreshold; ///used to compute connectivity: if the distance between two vertices is smaller than m_equalVertexThreshold, they are considered to be 'shared'
|
||||
btScalar m_edgeDistanceThreshold; ///used to determine edge contacts: if the closest distance between a contact point and an edge is smaller than this distance threshold it is considered to "hit the edge"
|
||||
btScalar m_zeroAreaThreshold; ///used to determine if a triangle is degenerate (length squared of cross product of 2 triangle edges < threshold)
|
||||
|
||||
|
||||
btTriangleInfoMap()
|
||||
{
|
||||
m_convexEpsilon = 0.00f;
|
||||
m_planarEpsilon = 0.0001f;
|
||||
m_equalVertexThreshold = btScalar(0.0001)*btScalar(0.0001);
|
||||
m_edgeDistanceThreshold = btScalar(0.1);
|
||||
m_zeroAreaThreshold = btScalar(0.0001)*btScalar(0.0001);
|
||||
}
|
||||
virtual ~btTriangleInfoMap() {}
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
|
||||
|
||||
void deSerialize(struct btTriangleInfoMapData& data);
|
||||
|
||||
};
|
||||
|
||||
struct btTriangleInfoData
|
||||
{
|
||||
int m_flags;
|
||||
float m_edgeV0V1Angle;
|
||||
float m_edgeV1V2Angle;
|
||||
float m_edgeV2V0Angle;
|
||||
};
|
||||
|
||||
struct btTriangleInfoMapData
|
||||
{
|
||||
int *m_hashTablePtr;
|
||||
int *m_nextPtr;
|
||||
btTriangleInfoData *m_valueArrayPtr;
|
||||
int *m_keyArrayPtr;
|
||||
|
||||
float m_convexEpsilon;
|
||||
float m_planarEpsilon;
|
||||
float m_equalVertexThreshold;
|
||||
float m_edgeDistanceThreshold;
|
||||
float m_zeroAreaThreshold;
|
||||
|
||||
int m_nextSize;
|
||||
int m_hashTableSize;
|
||||
int m_numValues;
|
||||
int m_numKeys;
|
||||
char m_padding[4];
|
||||
};
|
||||
|
||||
SIMD_FORCE_INLINE int btTriangleInfoMap::calculateSerializeBufferSize() const
|
||||
{
|
||||
return sizeof(btTriangleInfoMapData);
|
||||
}
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
SIMD_FORCE_INLINE const char* btTriangleInfoMap::serialize(void* dataBuffer, btSerializer* serializer) const
|
||||
{
|
||||
btTriangleInfoMapData* tmapData = (btTriangleInfoMapData*) dataBuffer;
|
||||
tmapData->m_convexEpsilon = m_convexEpsilon;
|
||||
tmapData->m_planarEpsilon = m_planarEpsilon;
|
||||
tmapData->m_equalVertexThreshold = m_equalVertexThreshold;
|
||||
tmapData->m_edgeDistanceThreshold = m_edgeDistanceThreshold;
|
||||
tmapData->m_zeroAreaThreshold = m_zeroAreaThreshold;
|
||||
|
||||
tmapData->m_hashTableSize = m_hashTable.size();
|
||||
|
||||
tmapData->m_hashTablePtr = tmapData->m_hashTableSize ? (int*)serializer->getUniquePointer((void*)&m_hashTable[0]) : 0;
|
||||
if (tmapData->m_hashTablePtr)
|
||||
{
|
||||
//serialize an int buffer
|
||||
int sz = sizeof(int);
|
||||
int numElem = tmapData->m_hashTableSize;
|
||||
btChunk* chunk = serializer->allocate(sz,numElem);
|
||||
int* memPtr = (int*)chunk->m_oldPtr;
|
||||
for (int i=0;i<numElem;i++,memPtr++)
|
||||
{
|
||||
*memPtr = m_hashTable[i];
|
||||
}
|
||||
serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*)&m_hashTable[0]);
|
||||
|
||||
}
|
||||
|
||||
tmapData->m_nextSize = m_next.size();
|
||||
tmapData->m_nextPtr = tmapData->m_nextSize? (int*)serializer->getUniquePointer((void*)&m_next[0]): 0;
|
||||
if (tmapData->m_nextPtr)
|
||||
{
|
||||
int sz = sizeof(int);
|
||||
int numElem = tmapData->m_nextSize;
|
||||
btChunk* chunk = serializer->allocate(sz,numElem);
|
||||
int* memPtr = (int*)chunk->m_oldPtr;
|
||||
for (int i=0;i<numElem;i++,memPtr++)
|
||||
{
|
||||
*memPtr = m_next[i];
|
||||
}
|
||||
serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*)&m_next[0]);
|
||||
}
|
||||
|
||||
tmapData->m_numValues = m_valueArray.size();
|
||||
tmapData->m_valueArrayPtr = tmapData->m_numValues ? (btTriangleInfoData*)serializer->getUniquePointer((void*)&m_valueArray[0]): 0;
|
||||
if (tmapData->m_valueArrayPtr)
|
||||
{
|
||||
int sz = sizeof(btTriangleInfoData);
|
||||
int numElem = tmapData->m_numValues;
|
||||
btChunk* chunk = serializer->allocate(sz,numElem);
|
||||
btTriangleInfoData* memPtr = (btTriangleInfoData*)chunk->m_oldPtr;
|
||||
for (int i=0;i<numElem;i++,memPtr++)
|
||||
{
|
||||
memPtr->m_edgeV0V1Angle = m_valueArray[i].m_edgeV0V1Angle;
|
||||
memPtr->m_edgeV1V2Angle = m_valueArray[i].m_edgeV1V2Angle;
|
||||
memPtr->m_edgeV2V0Angle = m_valueArray[i].m_edgeV2V0Angle;
|
||||
memPtr->m_flags = m_valueArray[i].m_flags;
|
||||
}
|
||||
serializer->finalizeChunk(chunk,"btTriangleInfoData",BT_ARRAY_CODE,(void*) &m_valueArray[0]);
|
||||
}
|
||||
|
||||
tmapData->m_numKeys = m_keyArray.size();
|
||||
tmapData->m_keyArrayPtr = tmapData->m_numKeys ? (int*)serializer->getUniquePointer((void*)&m_keyArray[0]) : 0;
|
||||
if (tmapData->m_keyArrayPtr)
|
||||
{
|
||||
int sz = sizeof(int);
|
||||
int numElem = tmapData->m_numValues;
|
||||
btChunk* chunk = serializer->allocate(sz,numElem);
|
||||
int* memPtr = (int*)chunk->m_oldPtr;
|
||||
for (int i=0;i<numElem;i++,memPtr++)
|
||||
{
|
||||
*memPtr = m_keyArray[i].getUid1();
|
||||
}
|
||||
serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*) &m_keyArray[0]);
|
||||
|
||||
}
|
||||
return "btTriangleInfoMapData";
|
||||
}
|
||||
|
||||
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
SIMD_FORCE_INLINE void btTriangleInfoMap::deSerialize(btTriangleInfoMapData& tmapData )
|
||||
{
|
||||
|
||||
|
||||
m_convexEpsilon = tmapData.m_convexEpsilon;
|
||||
m_planarEpsilon = tmapData.m_planarEpsilon;
|
||||
m_equalVertexThreshold = tmapData.m_equalVertexThreshold;
|
||||
m_edgeDistanceThreshold = tmapData.m_edgeDistanceThreshold;
|
||||
m_zeroAreaThreshold = tmapData.m_zeroAreaThreshold;
|
||||
m_hashTable.resize(tmapData.m_hashTableSize);
|
||||
int i =0;
|
||||
for (i=0;i<tmapData.m_hashTableSize;i++)
|
||||
{
|
||||
m_hashTable[i] = tmapData.m_hashTablePtr[i];
|
||||
}
|
||||
m_next.resize(tmapData.m_nextSize);
|
||||
for (i=0;i<tmapData.m_nextSize;i++)
|
||||
{
|
||||
m_next[i] = tmapData.m_nextPtr[i];
|
||||
}
|
||||
m_valueArray.resize(tmapData.m_numValues);
|
||||
for (i=0;i<tmapData.m_numValues;i++)
|
||||
{
|
||||
m_valueArray[i].m_edgeV0V1Angle = tmapData.m_valueArrayPtr[i].m_edgeV0V1Angle;
|
||||
m_valueArray[i].m_edgeV1V2Angle = tmapData.m_valueArrayPtr[i].m_edgeV1V2Angle;
|
||||
m_valueArray[i].m_edgeV2V0Angle = tmapData.m_valueArrayPtr[i].m_edgeV2V0Angle;
|
||||
m_valueArray[i].m_flags = tmapData.m_valueArrayPtr[i].m_flags;
|
||||
}
|
||||
|
||||
m_keyArray.resize(tmapData.m_numKeys,btHashInt(0));
|
||||
for (i=0;i<tmapData.m_numKeys;i++)
|
||||
{
|
||||
m_keyArray[i].setUid1(tmapData.m_keyArrayPtr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif //_BT_TRIANGLE_INFO_MAP_H
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2010 Erwin Coumans http://bulletphysics.org
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _BT_TRIANGLE_INFO_MAP_H
|
||||
#define _BT_TRIANGLE_INFO_MAP_H
|
||||
|
||||
|
||||
#include "LinearMath/btHashMap.h"
|
||||
#include "LinearMath/btSerializer.h"
|
||||
|
||||
|
||||
///for btTriangleInfo m_flags
|
||||
#define TRI_INFO_V0V1_CONVEX 1
|
||||
#define TRI_INFO_V1V2_CONVEX 2
|
||||
#define TRI_INFO_V2V0_CONVEX 4
|
||||
|
||||
#define TRI_INFO_V0V1_SWAP_NORMALB 8
|
||||
#define TRI_INFO_V1V2_SWAP_NORMALB 16
|
||||
#define TRI_INFO_V2V0_SWAP_NORMALB 32
|
||||
|
||||
|
||||
///The btTriangleInfo structure stores information to adjust collision normals to avoid collisions against internal edges
|
||||
///it can be generated using
|
||||
struct btTriangleInfo
|
||||
{
|
||||
btTriangleInfo()
|
||||
{
|
||||
m_edgeV0V1Angle = SIMD_2_PI;
|
||||
m_edgeV1V2Angle = SIMD_2_PI;
|
||||
m_edgeV2V0Angle = SIMD_2_PI;
|
||||
m_flags=0;
|
||||
}
|
||||
|
||||
int m_flags;
|
||||
|
||||
btScalar m_edgeV0V1Angle;
|
||||
btScalar m_edgeV1V2Angle;
|
||||
btScalar m_edgeV2V0Angle;
|
||||
|
||||
};
|
||||
|
||||
typedef btHashMap<btHashInt,btTriangleInfo> btInternalTriangleInfoMap;
|
||||
|
||||
|
||||
///The btTriangleInfoMap stores edge angle information for some triangles. You can compute this information yourself or using btGenerateInternalEdgeInfo.
|
||||
struct btTriangleInfoMap : public btInternalTriangleInfoMap
|
||||
{
|
||||
btScalar m_convexEpsilon;///used to determine if an edge or contact normal is convex, using the dot product
|
||||
btScalar m_planarEpsilon; ///used to determine if a triangle edge is planar with zero angle
|
||||
btScalar m_equalVertexThreshold; ///used to compute connectivity: if the distance between two vertices is smaller than m_equalVertexThreshold, they are considered to be 'shared'
|
||||
btScalar m_edgeDistanceThreshold; ///used to determine edge contacts: if the closest distance between a contact point and an edge is smaller than this distance threshold it is considered to "hit the edge"
|
||||
btScalar m_zeroAreaThreshold; ///used to determine if a triangle is degenerate (length squared of cross product of 2 triangle edges < threshold)
|
||||
|
||||
|
||||
btTriangleInfoMap()
|
||||
{
|
||||
m_convexEpsilon = 0.00f;
|
||||
m_planarEpsilon = 0.0001f;
|
||||
m_equalVertexThreshold = btScalar(0.0001)*btScalar(0.0001);
|
||||
m_edgeDistanceThreshold = btScalar(0.1);
|
||||
m_zeroAreaThreshold = btScalar(0.0001)*btScalar(0.0001);
|
||||
}
|
||||
virtual ~btTriangleInfoMap() {}
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
|
||||
|
||||
void deSerialize(struct btTriangleInfoMapData& data);
|
||||
|
||||
};
|
||||
|
||||
struct btTriangleInfoData
|
||||
{
|
||||
int m_flags;
|
||||
float m_edgeV0V1Angle;
|
||||
float m_edgeV1V2Angle;
|
||||
float m_edgeV2V0Angle;
|
||||
};
|
||||
|
||||
struct btTriangleInfoMapData
|
||||
{
|
||||
int *m_hashTablePtr;
|
||||
int *m_nextPtr;
|
||||
btTriangleInfoData *m_valueArrayPtr;
|
||||
int *m_keyArrayPtr;
|
||||
|
||||
float m_convexEpsilon;
|
||||
float m_planarEpsilon;
|
||||
float m_equalVertexThreshold;
|
||||
float m_edgeDistanceThreshold;
|
||||
float m_zeroAreaThreshold;
|
||||
|
||||
int m_nextSize;
|
||||
int m_hashTableSize;
|
||||
int m_numValues;
|
||||
int m_numKeys;
|
||||
char m_padding[4];
|
||||
};
|
||||
|
||||
SIMD_FORCE_INLINE int btTriangleInfoMap::calculateSerializeBufferSize() const
|
||||
{
|
||||
return sizeof(btTriangleInfoMapData);
|
||||
}
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
SIMD_FORCE_INLINE const char* btTriangleInfoMap::serialize(void* dataBuffer, btSerializer* serializer) const
|
||||
{
|
||||
btTriangleInfoMapData* tmapData = (btTriangleInfoMapData*) dataBuffer;
|
||||
tmapData->m_convexEpsilon = m_convexEpsilon;
|
||||
tmapData->m_planarEpsilon = m_planarEpsilon;
|
||||
tmapData->m_equalVertexThreshold = m_equalVertexThreshold;
|
||||
tmapData->m_edgeDistanceThreshold = m_edgeDistanceThreshold;
|
||||
tmapData->m_zeroAreaThreshold = m_zeroAreaThreshold;
|
||||
|
||||
tmapData->m_hashTableSize = m_hashTable.size();
|
||||
|
||||
tmapData->m_hashTablePtr = tmapData->m_hashTableSize ? (int*)serializer->getUniquePointer((void*)&m_hashTable[0]) : 0;
|
||||
if (tmapData->m_hashTablePtr)
|
||||
{
|
||||
//serialize an int buffer
|
||||
int sz = sizeof(int);
|
||||
int numElem = tmapData->m_hashTableSize;
|
||||
btChunk* chunk = serializer->allocate(sz,numElem);
|
||||
int* memPtr = (int*)chunk->m_oldPtr;
|
||||
for (int i=0;i<numElem;i++,memPtr++)
|
||||
{
|
||||
*memPtr = m_hashTable[i];
|
||||
}
|
||||
serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*)&m_hashTable[0]);
|
||||
|
||||
}
|
||||
|
||||
tmapData->m_nextSize = m_next.size();
|
||||
tmapData->m_nextPtr = tmapData->m_nextSize? (int*)serializer->getUniquePointer((void*)&m_next[0]): 0;
|
||||
if (tmapData->m_nextPtr)
|
||||
{
|
||||
int sz = sizeof(int);
|
||||
int numElem = tmapData->m_nextSize;
|
||||
btChunk* chunk = serializer->allocate(sz,numElem);
|
||||
int* memPtr = (int*)chunk->m_oldPtr;
|
||||
for (int i=0;i<numElem;i++,memPtr++)
|
||||
{
|
||||
*memPtr = m_next[i];
|
||||
}
|
||||
serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*)&m_next[0]);
|
||||
}
|
||||
|
||||
tmapData->m_numValues = m_valueArray.size();
|
||||
tmapData->m_valueArrayPtr = tmapData->m_numValues ? (btTriangleInfoData*)serializer->getUniquePointer((void*)&m_valueArray[0]): 0;
|
||||
if (tmapData->m_valueArrayPtr)
|
||||
{
|
||||
int sz = sizeof(btTriangleInfoData);
|
||||
int numElem = tmapData->m_numValues;
|
||||
btChunk* chunk = serializer->allocate(sz,numElem);
|
||||
btTriangleInfoData* memPtr = (btTriangleInfoData*)chunk->m_oldPtr;
|
||||
for (int i=0;i<numElem;i++,memPtr++)
|
||||
{
|
||||
memPtr->m_edgeV0V1Angle = m_valueArray[i].m_edgeV0V1Angle;
|
||||
memPtr->m_edgeV1V2Angle = m_valueArray[i].m_edgeV1V2Angle;
|
||||
memPtr->m_edgeV2V0Angle = m_valueArray[i].m_edgeV2V0Angle;
|
||||
memPtr->m_flags = m_valueArray[i].m_flags;
|
||||
}
|
||||
serializer->finalizeChunk(chunk,"btTriangleInfoData",BT_ARRAY_CODE,(void*) &m_valueArray[0]);
|
||||
}
|
||||
|
||||
tmapData->m_numKeys = m_keyArray.size();
|
||||
tmapData->m_keyArrayPtr = tmapData->m_numKeys ? (int*)serializer->getUniquePointer((void*)&m_keyArray[0]) : 0;
|
||||
if (tmapData->m_keyArrayPtr)
|
||||
{
|
||||
int sz = sizeof(int);
|
||||
int numElem = tmapData->m_numValues;
|
||||
btChunk* chunk = serializer->allocate(sz,numElem);
|
||||
int* memPtr = (int*)chunk->m_oldPtr;
|
||||
for (int i=0;i<numElem;i++,memPtr++)
|
||||
{
|
||||
*memPtr = m_keyArray[i].getUid1();
|
||||
}
|
||||
serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*) &m_keyArray[0]);
|
||||
|
||||
}
|
||||
return "btTriangleInfoMapData";
|
||||
}
|
||||
|
||||
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
SIMD_FORCE_INLINE void btTriangleInfoMap::deSerialize(btTriangleInfoMapData& tmapData )
|
||||
{
|
||||
|
||||
|
||||
m_convexEpsilon = tmapData.m_convexEpsilon;
|
||||
m_planarEpsilon = tmapData.m_planarEpsilon;
|
||||
m_equalVertexThreshold = tmapData.m_equalVertexThreshold;
|
||||
m_edgeDistanceThreshold = tmapData.m_edgeDistanceThreshold;
|
||||
m_zeroAreaThreshold = tmapData.m_zeroAreaThreshold;
|
||||
m_hashTable.resize(tmapData.m_hashTableSize);
|
||||
int i =0;
|
||||
for (i=0;i<tmapData.m_hashTableSize;i++)
|
||||
{
|
||||
m_hashTable[i] = tmapData.m_hashTablePtr[i];
|
||||
}
|
||||
m_next.resize(tmapData.m_nextSize);
|
||||
for (i=0;i<tmapData.m_nextSize;i++)
|
||||
{
|
||||
m_next[i] = tmapData.m_nextPtr[i];
|
||||
}
|
||||
m_valueArray.resize(tmapData.m_numValues);
|
||||
for (i=0;i<tmapData.m_numValues;i++)
|
||||
{
|
||||
m_valueArray[i].m_edgeV0V1Angle = tmapData.m_valueArrayPtr[i].m_edgeV0V1Angle;
|
||||
m_valueArray[i].m_edgeV1V2Angle = tmapData.m_valueArrayPtr[i].m_edgeV1V2Angle;
|
||||
m_valueArray[i].m_edgeV2V0Angle = tmapData.m_valueArrayPtr[i].m_edgeV2V0Angle;
|
||||
m_valueArray[i].m_flags = tmapData.m_valueArrayPtr[i].m_flags;
|
||||
}
|
||||
|
||||
m_keyArray.resize(tmapData.m_numKeys,btHashInt(0));
|
||||
for (i=0;i<tmapData.m_numKeys;i++)
|
||||
{
|
||||
m_keyArray[i].setUid1(tmapData.m_keyArrayPtr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif //_BT_TRIANGLE_INFO_MAP_H
|
||||
|
||||
Reference in New Issue
Block a user