+ provide access to 'root' collision shape, in case the original collision shape is temporarily replaced by a child collision shape.
+ added MultiMaterialDemo showing how to use the new btTriangleIndexVertexMaterialArray. Thanks to Alex Silverman for this contribution!
This commit is contained in:
@@ -52,6 +52,8 @@ CONCAVE_SHAPES_START_HERE,
|
||||
TERRAIN_SHAPE_PROXYTYPE,
|
||||
///Used for GIMPACT Trimesh integration
|
||||
GIMPACT_SHAPE_PROXYTYPE,
|
||||
///Multimaterial mesh
|
||||
MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE,
|
||||
|
||||
EMPTY_SHAPE_PROXYTYPE,
|
||||
STATIC_PLANE_PROXYTYPE,
|
||||
|
||||
@@ -19,6 +19,7 @@ subject to the following restrictions:
|
||||
btCollisionObject::btCollisionObject()
|
||||
: m_broadphaseHandle(0),
|
||||
m_collisionShape(0),
|
||||
m_rootCollisionShape(0),
|
||||
m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT),
|
||||
m_islandTag1(-1),
|
||||
m_companionId(-1),
|
||||
|
||||
@@ -51,6 +51,11 @@ protected:
|
||||
btVector3 m_interpolationAngularVelocity;
|
||||
btBroadphaseProxy* m_broadphaseHandle;
|
||||
btCollisionShape* m_collisionShape;
|
||||
|
||||
///m_rootCollisionShape is temporarily used to store the original collision shape
|
||||
///The m_collisionShape might be temporarily replaced by a child collision shape during collision detection purposes
|
||||
///If it is NULL, the m_collisionShape is not temporarily replaced.
|
||||
btCollisionShape* m_rootCollisionShape;
|
||||
|
||||
int m_collisionFlags;
|
||||
|
||||
@@ -141,6 +146,7 @@ public:
|
||||
void setCollisionShape(btCollisionShape* collisionShape)
|
||||
{
|
||||
m_collisionShape = collisionShape;
|
||||
m_rootCollisionShape = collisionShape;
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE const btCollisionShape* getCollisionShape() const
|
||||
@@ -153,8 +159,22 @@ public:
|
||||
return m_collisionShape;
|
||||
}
|
||||
|
||||
|
||||
SIMD_FORCE_INLINE const btCollisionShape* getRootCollisionShape() const
|
||||
{
|
||||
return m_rootCollisionShape;
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE btCollisionShape* getRootCollisionShape()
|
||||
{
|
||||
return m_rootCollisionShape;
|
||||
}
|
||||
|
||||
///Avoid using this internal API call
|
||||
///internalSetTemporaryCollisionShape is used to temporary replace the actual collision shape by a child collision shape.
|
||||
void internalSetTemporaryCollisionShape(btCollisionShape* collisionShape)
|
||||
{
|
||||
m_collisionShape = collisionShape;
|
||||
}
|
||||
|
||||
int getActivationState() const { return m_activationState1;}
|
||||
|
||||
|
||||
@@ -34,10 +34,9 @@ m_isSwapped(isSwapped)
|
||||
for (i=0;i<numChildren;i++)
|
||||
{
|
||||
btCollisionShape* childShape = compoundShape->getChildShape(i);
|
||||
btCollisionShape* orgShape = colObj->getCollisionShape();
|
||||
colObj->setCollisionShape( childShape );
|
||||
colObj->internalSetTemporaryCollisionShape( childShape );
|
||||
m_childCollisionAlgorithms[i] = ci.m_dispatcher1->findAlgorithm(colObj,otherObj);
|
||||
colObj->setCollisionShape( orgShape );
|
||||
colObj->setCollisionShape( colObj->getRootCollisionShape());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,14 +116,9 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i
|
||||
{
|
||||
btTriangleShape tm(triangle[0],triangle[1],triangle[2]);
|
||||
tm.setMargin(m_collisionMarginTriangle);
|
||||
btCollisionShape* tmpShape = ob->getCollisionShape();
|
||||
|
||||
//copy over user pointers to temporary shape
|
||||
tm.setUserPointer(tmpShape->getUserPointer());
|
||||
|
||||
ob->setCollisionShape( &tm );
|
||||
ob->internalSetTemporaryCollisionShape( &tm );
|
||||
|
||||
|
||||
btCollisionAlgorithm* colAlgo = ci.m_dispatcher1->findAlgorithm(m_convexBody,m_triBody,m_manifoldPtr);
|
||||
///this should use the btDispatcher, so the actual registered algorithm is used
|
||||
// btConvexConvexAlgorithm cvxcvxalgo(m_manifoldPtr,ci,m_convexBody,m_triBody);
|
||||
@@ -134,11 +129,9 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i
|
||||
colAlgo->processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
|
||||
colAlgo->~btCollisionAlgorithm();
|
||||
ci.m_dispatcher1->freeCollisionAlgorithm(colAlgo);
|
||||
ob->setCollisionShape( tmpShape );
|
||||
|
||||
ob->setCollisionShape( ob->getRootCollisionShape());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
34
src/BulletCollision/CollisionShapes/btMaterial.h
Normal file
34
src/BulletCollision/CollisionShapes/btMaterial.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2008 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.
|
||||
*/
|
||||
|
||||
/// This file was created by Alex Silverman
|
||||
|
||||
#ifndef MATERIAL_H
|
||||
#define MATERIAL_H
|
||||
|
||||
// Material class to be used by btMultimaterialTriangleMeshShape to store triangle properties
|
||||
class btMaterial
|
||||
{
|
||||
// public members so that materials can change due to world events
|
||||
public:
|
||||
btScalar m_friction;
|
||||
btScalar m_restitution;
|
||||
int pad[2];
|
||||
|
||||
btMaterial(){}
|
||||
btMaterial(btScalar fric, btScalar rest) { m_friction = fric; m_restitution = rest; }
|
||||
};
|
||||
|
||||
#endif // MATERIAL_H
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2008 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.
|
||||
*/
|
||||
|
||||
/// This file was created by Alex Silverman
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h"
|
||||
//#include "BulletCollision/CollisionShapes/btOptimizedBvh.h"
|
||||
|
||||
|
||||
///Obtains the material for a specific triangle
|
||||
const btMaterial * btMultimaterialTriangleMeshShape::getMaterialProperties(int partID, int triIndex)
|
||||
{
|
||||
const unsigned char * materialBase = 0;
|
||||
int numMaterials;
|
||||
PHY_ScalarType materialType;
|
||||
int materialStride;
|
||||
const unsigned char * triangleMaterialBase = 0;
|
||||
int numTriangles;
|
||||
int triangleMaterialStride;
|
||||
PHY_ScalarType triangleType;
|
||||
|
||||
((btTriangleIndexVertexMaterialArray*)m_meshInterface)->getLockedReadOnlyMaterialBase(&materialBase, numMaterials, materialType, materialStride,
|
||||
&triangleMaterialBase, numTriangles, triangleMaterialStride, triangleType, partID);
|
||||
|
||||
// return the pointer to the place with the friction for the triangle
|
||||
// TODO: This depends on whether it's a moving mesh or not
|
||||
// BUG IN GIMPACT
|
||||
//return (btScalar*)(&materialBase[triangleMaterialBase[(triIndex-1) * triangleMaterialStride] * materialStride]);
|
||||
int * matInd = (int *)(&(triangleMaterialBase[(triIndex * triangleMaterialStride)]));
|
||||
btMaterial *matVal = (btMaterial *)(&(materialBase[*matInd * materialStride]));
|
||||
return (matVal);
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2008 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.
|
||||
*/
|
||||
|
||||
/// This file was created by Alex Silverman
|
||||
|
||||
#ifndef BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
|
||||
#define BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
|
||||
|
||||
#include "btBvhTriangleMeshShape.h"
|
||||
#include "btMaterial.h"
|
||||
|
||||
///BvhTriangleMaterialMeshShape extends BvhTriangleMeshShape.
|
||||
///Its main contribution is the interface into a material array.
|
||||
ATTRIBUTE_ALIGNED16(class) btMultimaterialTriangleMeshShape : public btBvhTriangleMeshShape
|
||||
{
|
||||
btAlignedObjectArray <btMaterial*> m_materialList;
|
||||
int ** m_triangleMaterials;
|
||||
|
||||
public:
|
||||
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
|
||||
btMultimaterialTriangleMeshShape(): btBvhTriangleMeshShape() {}
|
||||
btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true):
|
||||
btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, buildBvh)
|
||||
{
|
||||
btVector3 m_triangle[3];
|
||||
const unsigned char *vertexbase;
|
||||
int numverts;
|
||||
PHY_ScalarType type;
|
||||
int stride;
|
||||
const unsigned char *indexbase;
|
||||
int indexstride;
|
||||
int numfaces;
|
||||
PHY_ScalarType indicestype;
|
||||
|
||||
//m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * meshInterface->getNumSubParts(), 16));
|
||||
|
||||
for(int i = 0; i < meshInterface->getNumSubParts(); i++)
|
||||
{
|
||||
m_meshInterface->getLockedReadOnlyVertexIndexBase(
|
||||
&vertexbase,
|
||||
numverts,
|
||||
type,
|
||||
stride,
|
||||
&indexbase,
|
||||
indexstride,
|
||||
numfaces,
|
||||
indicestype,
|
||||
i);
|
||||
//m_materialLookup[i] = (int*)(btAlignedAlloc(sizeof(int) * numfaces, 16));
|
||||
}
|
||||
}
|
||||
|
||||
///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
|
||||
btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true):
|
||||
btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh)
|
||||
{
|
||||
btVector3 m_triangle[3];
|
||||
const unsigned char *vertexbase;
|
||||
int numverts;
|
||||
PHY_ScalarType type;
|
||||
int stride;
|
||||
const unsigned char *indexbase;
|
||||
int indexstride;
|
||||
int numfaces;
|
||||
PHY_ScalarType indicestype;
|
||||
|
||||
//m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * meshInterface->getNumSubParts(), 16));
|
||||
|
||||
for(int i = 0; i < meshInterface->getNumSubParts(); i++)
|
||||
{
|
||||
m_meshInterface->getLockedReadOnlyVertexIndexBase(
|
||||
&vertexbase,
|
||||
numverts,
|
||||
type,
|
||||
stride,
|
||||
&indexbase,
|
||||
indexstride,
|
||||
numfaces,
|
||||
indicestype,
|
||||
i);
|
||||
//m_materialLookup[i] = (int*)(btAlignedAlloc(sizeof(int) * numfaces * 2, 16));
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~btMultimaterialTriangleMeshShape()
|
||||
{
|
||||
/*
|
||||
for(int i = 0; i < m_meshInterface->getNumSubParts(); i++)
|
||||
{
|
||||
btAlignedFree(m_materialValues[i]);
|
||||
m_materialLookup[i] = NULL;
|
||||
}
|
||||
btAlignedFree(m_materialValues);
|
||||
m_materialLookup = NULL;
|
||||
*/
|
||||
}
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
|
||||
}
|
||||
|
||||
//debugging
|
||||
virtual const char* getName()const {return "MULTIMATERIALTRIANGLEMESH";}
|
||||
|
||||
///Obtains the material for a specific triangle
|
||||
const btMaterial * getMaterialProperties(int partID, int triIndex);
|
||||
|
||||
}
|
||||
;
|
||||
|
||||
#endif //BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
///This file was created by Alex Silverman
|
||||
|
||||
#include "btTriangleIndexVertexMaterialArray.h"
|
||||
|
||||
btTriangleIndexVertexMaterialArray::btTriangleIndexVertexMaterialArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,
|
||||
int numVertices,btScalar* vertexBase,int vertexStride,
|
||||
int numMaterials, unsigned char* materialBase, int materialStride,
|
||||
int* triangleMaterialsBase, int materialIndexStride) :
|
||||
btTriangleIndexVertexArray(numTriangles, triangleIndexBase, triangleIndexStride, numVertices, vertexBase, vertexStride)
|
||||
{
|
||||
btMaterialProperties mat;
|
||||
|
||||
mat.m_numMaterials = numMaterials;
|
||||
mat.m_materialBase = materialBase;
|
||||
mat.m_materialStride = materialStride;
|
||||
#ifdef BT_USE_DOUBLE_PRECISION
|
||||
mat.m_materialType = PHY_DOUBLE;
|
||||
#else
|
||||
mat.m_materialType = PHY_FLOAT;
|
||||
#endif
|
||||
|
||||
mat.m_numTriangles = numTriangles;
|
||||
mat.m_triangleMaterialsBase = (unsigned char *)triangleMaterialsBase;
|
||||
mat.m_triangleMaterialStride = materialIndexStride;
|
||||
mat.m_triangleType = PHY_INTEGER;
|
||||
|
||||
addMaterialProperties(mat);
|
||||
}
|
||||
|
||||
|
||||
void btTriangleIndexVertexMaterialArray::getLockedMaterialBase(unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
|
||||
unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart)
|
||||
{
|
||||
btAssert(subpart< getNumSubParts() );
|
||||
|
||||
btMaterialProperties& mats = m_materials[subpart];
|
||||
|
||||
numMaterials = mats.m_numMaterials;
|
||||
(*materialBase) = (unsigned char *) mats.m_materialBase;
|
||||
#ifdef BT_USE_DOUBLE_PRECISION
|
||||
materialType = PHY_DOUBLE;
|
||||
#else
|
||||
materialType = PHY_FLOAT;
|
||||
#endif
|
||||
materialStride = mats.m_materialStride;
|
||||
|
||||
numTriangles = mats.m_numTriangles;
|
||||
(*triangleMaterialBase) = (unsigned char *)mats.m_triangleMaterialsBase;
|
||||
triangleMaterialStride = mats.m_triangleMaterialStride;
|
||||
triangleType = mats.m_triangleType;
|
||||
}
|
||||
|
||||
void btTriangleIndexVertexMaterialArray::getLockedReadOnlyMaterialBase(const unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
|
||||
const unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart)
|
||||
{
|
||||
btMaterialProperties& mats = m_materials[subpart];
|
||||
|
||||
numMaterials = mats.m_numMaterials;
|
||||
(*materialBase) = (const unsigned char *) mats.m_materialBase;
|
||||
#ifdef BT_USE_DOUBLE_PRECISION
|
||||
materialType = PHY_DOUBLE;
|
||||
#else
|
||||
materialType = PHY_FLOAT;
|
||||
#endif
|
||||
materialStride = mats.m_materialStride;
|
||||
|
||||
numTriangles = mats.m_numTriangles;
|
||||
(*triangleMaterialBase) = (const unsigned char *)mats.m_triangleMaterialsBase;
|
||||
triangleMaterialStride = mats.m_triangleMaterialStride;
|
||||
triangleType = mats.m_triangleType;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
///This file was created by Alex Silverman
|
||||
|
||||
#ifndef BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
|
||||
#define BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
|
||||
|
||||
#include "btTriangleIndexVertexArray.h"
|
||||
|
||||
|
||||
ATTRIBUTE_ALIGNED16( struct) btMaterialProperties
|
||||
{
|
||||
///m_materialBase ==========> 2 btScalar values make up one material, friction then restitution
|
||||
int m_numMaterials;
|
||||
const unsigned char * m_materialBase;
|
||||
int m_materialStride;
|
||||
PHY_ScalarType m_materialType;
|
||||
///m_numTriangles <=========== This exists in the btIndexedMesh object for the same subpart, but since we're
|
||||
/// padding the structure, it can be reproduced at no real cost
|
||||
///m_triangleMaterials =====> 1 integer value makes up one entry
|
||||
/// eg: m_triangleMaterials[1] = 5; // This will set triangle 2 to use material 5
|
||||
int m_numTriangles;
|
||||
const unsigned char * m_triangleMaterialsBase;
|
||||
int m_triangleMaterialStride;
|
||||
///m_triangleType <========== Automatically set in addMaterialProperties
|
||||
PHY_ScalarType m_triangleType;
|
||||
};
|
||||
|
||||
typedef btAlignedObjectArray<btMaterialProperties> MaterialArray;
|
||||
|
||||
///TriangleIndexVertexMaterialArray is built on TriangleIndexVertexArray
|
||||
///The addition of a material array allows for the utilization of the partID and
|
||||
///triangleIndex that are returned in the ContactAddedCallback. As with
|
||||
///TriangleIndexVertexArray, no duplicate is made of the material data, so it
|
||||
///is the users responsibility to maintain the array during the lifetime of the
|
||||
///TriangleIndexVertexMaterialArray.
|
||||
ATTRIBUTE_ALIGNED16(class) btTriangleIndexVertexMaterialArray : public btTriangleIndexVertexArray
|
||||
{
|
||||
protected:
|
||||
MaterialArray m_materials;
|
||||
|
||||
public:
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
|
||||
btTriangleIndexVertexMaterialArray()
|
||||
{
|
||||
}
|
||||
|
||||
btTriangleIndexVertexMaterialArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,
|
||||
int numVertices,btScalar* vertexBase,int vertexStride,
|
||||
int numMaterials, unsigned char* materialBase, int materialStride,
|
||||
int* triangleMaterialsBase, int materialIndexStride);
|
||||
|
||||
virtual ~btTriangleIndexVertexMaterialArray() {}
|
||||
|
||||
void addMaterialProperties(const btMaterialProperties& mat, PHY_ScalarType triangleType = PHY_INTEGER)
|
||||
{
|
||||
m_materials.push_back(mat);
|
||||
m_materials[m_materials.size()-1].m_triangleType = triangleType;
|
||||
}
|
||||
|
||||
virtual void getLockedMaterialBase(unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
|
||||
unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType ,int subpart = 0);
|
||||
|
||||
virtual void getLockedReadOnlyMaterialBase(const unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
|
||||
const unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart = 0);
|
||||
|
||||
}
|
||||
;
|
||||
|
||||
#endif //BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
|
||||
@@ -27,7 +27,6 @@ public:
|
||||
|
||||
btVector3 m_vertices1[3];
|
||||
|
||||
|
||||
virtual int getNumVertices() const
|
||||
{
|
||||
return 3;
|
||||
@@ -84,14 +83,13 @@ public:
|
||||
|
||||
|
||||
|
||||
btTriangleShape(const btVector3& p0,const btVector3& p1,const btVector3& p2)
|
||||
{
|
||||
m_vertices1[0] = p0;
|
||||
m_vertices1[1] = p1;
|
||||
m_vertices1[2] = p2;
|
||||
}
|
||||
btTriangleShape(const btVector3& p0,const btVector3& p1,const btVector3& p2)
|
||||
{
|
||||
m_vertices1[0] = p0;
|
||||
m_vertices1[1] = p1;
|
||||
m_vertices1[2] = p2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
|
||||
{
|
||||
|
||||
@@ -77,7 +77,7 @@ void btRigidBody::setupRigidBody(const btRigidBody::btRigidBodyConstructionInfo&
|
||||
m_friction = constructionInfo.m_friction;
|
||||
m_restitution = constructionInfo.m_restitution;
|
||||
|
||||
m_collisionShape = constructionInfo.m_collisionShape;
|
||||
setCollisionShape( constructionInfo.m_collisionShape );
|
||||
m_debugBodyId = uniqueId++;
|
||||
|
||||
setMassProps(constructionInfo.m_mass, constructionInfo.m_localInertia);
|
||||
|
||||
Reference in New Issue
Block a user