27 int numtotalphysicsverts = 0;
29 const unsigned char* vertexbase;
30 const unsigned char* indexbase;
34 int stride, numverts, numtriangles;
41 for (part = 0; part < graphicssubparts; part++)
44 numtotalphysicsverts += numtriangles * 3;
60 for (gfxindex = 0; gfxindex < numtriangles; gfxindex++)
62 unsigned int* tri_indices = (
unsigned int*)(indexbase + gfxindex * indexstride);
63 graphicsbase = (
float*)(vertexbase + tri_indices[0] *
stride);
64 triangle[0].setValue(graphicsbase[0] * meshScaling.getX(), graphicsbase[1] * meshScaling.getY(), graphicsbase[2] * meshScaling.getZ());
65 graphicsbase = (
float*)(vertexbase + tri_indices[1] *
stride);
66 triangle[1].setValue(graphicsbase[0] * meshScaling.getX(), graphicsbase[1] * meshScaling.getY(), graphicsbase[2] * meshScaling.getZ());
67 graphicsbase = (
float*)(vertexbase + tri_indices[2] *
stride);
68 triangle[2].setValue(graphicsbase[0] * meshScaling.getX(), graphicsbase[1] * meshScaling.getY(), graphicsbase[2] * meshScaling.getZ());
69 callback->internalProcessTriangleIndex(triangle, part, gfxindex);
75 for (gfxindex = 0; gfxindex < numtriangles; gfxindex++)
77 unsigned short int* tri_indices = (
unsigned short int*)(indexbase + gfxindex * indexstride);
78 graphicsbase = (
float*)(vertexbase + tri_indices[0] *
stride);
79 triangle[0].setValue(graphicsbase[0] * meshScaling.getX(), graphicsbase[1] * meshScaling.getY(), graphicsbase[2] * meshScaling.getZ());
80 graphicsbase = (
float*)(vertexbase + tri_indices[1] *
stride);
81 triangle[1].setValue(graphicsbase[0] * meshScaling.getX(), graphicsbase[1] * meshScaling.getY(), graphicsbase[2] * meshScaling.getZ());
82 graphicsbase = (
float*)(vertexbase + tri_indices[2] *
stride);
83 triangle[2].setValue(graphicsbase[0] * meshScaling.getX(), graphicsbase[1] * meshScaling.getY(), graphicsbase[2] * meshScaling.getZ());
84 callback->internalProcessTriangleIndex(triangle, part, gfxindex);
90 for (gfxindex = 0; gfxindex < numtriangles; gfxindex++)
92 unsigned char* tri_indices = (
unsigned char*)(indexbase + gfxindex * indexstride);
93 graphicsbase = (
float*)(vertexbase + tri_indices[0] *
stride);
94 triangle[0].setValue(graphicsbase[0] * meshScaling.getX(), graphicsbase[1] * meshScaling.getY(), graphicsbase[2] * meshScaling.getZ());
95 graphicsbase = (
float*)(vertexbase + tri_indices[1] *
stride);
96 triangle[1].setValue(graphicsbase[0] * meshScaling.getX(), graphicsbase[1] * meshScaling.getY(), graphicsbase[2] * meshScaling.getZ());
97 graphicsbase = (
float*)(vertexbase + tri_indices[2] *
stride);
98 triangle[2].setValue(graphicsbase[0] * meshScaling.getX(), graphicsbase[1] * meshScaling.getY(), graphicsbase[2] * meshScaling.getZ());
99 callback->internalProcessTriangleIndex(triangle, part, gfxindex);
111 double* graphicsbase;
113 switch (gfxindextype)
117 for (gfxindex = 0; gfxindex < numtriangles; gfxindex++)
119 unsigned int* tri_indices = (
unsigned int*)(indexbase + gfxindex * indexstride);
120 graphicsbase = (
double*)(vertexbase + tri_indices[0] *
stride);
121 triangle[0].setValue((
btScalar)graphicsbase[0] * meshScaling.getX(), (
btScalar)graphicsbase[1] * meshScaling.getY(), (
btScalar)graphicsbase[2] * meshScaling.getZ());
122 graphicsbase = (
double*)(vertexbase + tri_indices[1] *
stride);
123 triangle[1].setValue((
btScalar)graphicsbase[0] * meshScaling.getX(), (
btScalar)graphicsbase[1] * meshScaling.getY(), (
btScalar)graphicsbase[2] * meshScaling.getZ());
124 graphicsbase = (
double*)(vertexbase + tri_indices[2] *
stride);
125 triangle[2].setValue((
btScalar)graphicsbase[0] * meshScaling.getX(), (
btScalar)graphicsbase[1] * meshScaling.getY(), (
btScalar)graphicsbase[2] * meshScaling.getZ());
126 callback->internalProcessTriangleIndex(triangle, part, gfxindex);
132 for (gfxindex = 0; gfxindex < numtriangles; gfxindex++)
134 unsigned short int* tri_indices = (
unsigned short int*)(indexbase + gfxindex * indexstride);
135 graphicsbase = (
double*)(vertexbase + tri_indices[0] *
stride);
136 triangle[0].setValue((
btScalar)graphicsbase[0] * meshScaling.getX(), (
btScalar)graphicsbase[1] * meshScaling.getY(), (
btScalar)graphicsbase[2] * meshScaling.getZ());
137 graphicsbase = (
double*)(vertexbase + tri_indices[1] *
stride);
138 triangle[1].setValue((
btScalar)graphicsbase[0] * meshScaling.getX(), (
btScalar)graphicsbase[1] * meshScaling.getY(), (
btScalar)graphicsbase[2] * meshScaling.getZ());
139 graphicsbase = (
double*)(vertexbase + tri_indices[2] *
stride);
140 triangle[2].setValue((
btScalar)graphicsbase[0] * meshScaling.getX(), (
btScalar)graphicsbase[1] * meshScaling.getY(), (
btScalar)graphicsbase[2] * meshScaling.getZ());
141 callback->internalProcessTriangleIndex(triangle, part, gfxindex);
147 for (gfxindex = 0; gfxindex < numtriangles; gfxindex++)
149 unsigned char* tri_indices = (
unsigned char*)(indexbase + gfxindex * indexstride);
150 graphicsbase = (
double*)(vertexbase + tri_indices[0] *
stride);
151 triangle[0].setValue((
btScalar)graphicsbase[0] * meshScaling.getX(), (
btScalar)graphicsbase[1] * meshScaling.getY(), (
btScalar)graphicsbase[2] * meshScaling.getZ());
152 graphicsbase = (
double*)(vertexbase + tri_indices[1] *
stride);
153 triangle[1].setValue((
btScalar)graphicsbase[0] * meshScaling.getX(), (
btScalar)graphicsbase[1] * meshScaling.getY(), (
btScalar)graphicsbase[2] * meshScaling.getZ());
154 graphicsbase = (
double*)(vertexbase + tri_indices[2] *
stride);
155 triangle[2].setValue((
btScalar)graphicsbase[0] * meshScaling.getX(), (
btScalar)graphicsbase[1] * meshScaling.getY(), (
btScalar)graphicsbase[2] * meshScaling.getZ());
156 callback->internalProcessTriangleIndex(triangle, part, gfxindex);
180 AabbCalculationCallback()
201 AabbCalculationCallback aabbCallback;
206 aabbMin = aabbCallback.m_aabbMin;
207 aabbMax = aabbCallback.m_aabbMax;
229 const unsigned char* vertexbase;
230 const unsigned char* indexbase;
234 int stride, numverts, numtriangles;
241 for (part = 0; part < graphicssubparts; part++, memPtr++)
253 switch (gfxindextype)
257 int numindices = numtriangles * 3;
264 for (gfxindex = 0; gfxindex < numtriangles; gfxindex++)
266 unsigned int* tri_indices = (
unsigned int*)(indexbase + gfxindex * indexstride);
267 tmpIndices[gfxindex * 3].
m_value = tri_indices[0];
268 tmpIndices[gfxindex * 3 + 1].
m_value = tri_indices[1];
269 tmpIndices[gfxindex * 3 + 2].
m_value = tri_indices[2];
282 for (gfxindex = 0; gfxindex < numtriangles; gfxindex++)
284 unsigned short int* tri_indices = (
unsigned short int*)(indexbase + gfxindex * indexstride);
285 tmpIndices[gfxindex].
m_values[0] = tri_indices[0];
286 tmpIndices[gfxindex].
m_values[1] = tri_indices[1];
287 tmpIndices[gfxindex].
m_values[2] = tri_indices[2];
289 tmpIndices[gfxindex].
m_pad[0] = 0;
290 tmpIndices[gfxindex].
m_pad[1] = 0;
303 for (gfxindex = 0; gfxindex < numtriangles; gfxindex++)
305 unsigned char* tri_indices = (
unsigned char*)(indexbase + gfxindex * indexstride);
306 tmpIndices[gfxindex].
m_values[0] = tri_indices[0];
307 tmpIndices[gfxindex].
m_values[1] = tri_indices[1];
308 tmpIndices[gfxindex].
m_values[2] = tri_indices[2];
310 tmpIndices[gfxindex].
m_pad = 0;
334 for (
int i = 0; i < numverts; i++)
336 graphicsbase = (
float*)(vertexbase + i *
stride);
337 tmpVertices[i].
m_floats[0] = graphicsbase[0];
338 tmpVertices[i].
m_floats[1] = graphicsbase[1];
339 tmpVertices[i].
m_floats[2] = graphicsbase[2];
353 for (
int i = 0; i < numverts; i++)
355 double* graphicsbase = (
double*)(vertexbase + i *
stride);
356 tmpVertices[i].
m_floats[0] = graphicsbase[0];
357 tmpVertices[i].
m_floats[1] = graphicsbase[1];
358 tmpVertices[i].
m_floats[2] = graphicsbase[2];
378 m_scaling.serializeFloat(trimeshData->
m_scaling);
379 return "btStridingMeshInterfaceData";
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei stride
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const
Data buffer MUST be 16 byte aligned.
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int &numverts, PHY_ScalarType &type, int &stride, const unsigned char **indexbase, int &indexstride, int &numfaces, PHY_ScalarType &indicestype, int subpart=0) const =0
const btVector3 & getScaling() const
virtual ~btStridingMeshInterface()
void calculateAabbBruteForce(btVector3 &aabbMin, btVector3 &aabbMax)
brute force method to calculate aabb
virtual void unLockReadOnlyVertexBase(int subpart) const =0
virtual int getNumSubParts() const =0
virtual void InternalProcessAllTriangles(btInternalTriangleIndexCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
virtual void internalProcessTriangleIndex(btVector3 *triangle, int partId, int triangleIndex)=0
virtual btChunk * allocate(size_t size, int numElements)=0
virtual void * getUniquePointer(void *oldPtr)=0
virtual void finalizeChunk(btChunk *chunk, const char *structType, int chunkCode, void *oldPtr)=0
DEGForeachIDComponentCallback callback
SyclQueue void void size_t num_bytes void
unsigned char m_values[3]
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btShortIntIndexData * m_indices16
btCharIndexTripletData * m_3indices8
btVector3FloatData * m_vertices3f
btShortIntIndexTripletData * m_3indices16
btIntIndexData * m_indices32
btVector3DoubleData * m_vertices3d
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btMeshPartData * m_meshPartsPtr
btVector3FloatData m_scaling