Imported Upstream version 0.14

parent 6a93e643
repo: 5ec20c9e20a4a77b0aa9c21aa4c7a1e1f60978f8
node: bd71868b92674fae9b9e41e61ca8875134e8249c
node: a77b1d06e3a62b0116e7d3c4be4c6beaac8726ea
branch: default
latesttag: 0.13.1
latesttagdistance: 19
tag: 0.14
......@@ -10,3 +10,5 @@
c528f26e7eb8e95aa14d68e0c76f2acf0bca2ddf 0.0.1
f89ea1ff3fc1b669d5f7b8d8475580b00f28ba9c 0.10.1
f6383a55d1a34cf18200dcc38b19536387cee7f5 0.13.1
4cf81eb385f506785054e0773d94f89eff7484f9 0.13.2
7b0c5226eb9c3090e1b8a63aa202f2d8588fea6b 0.14
......@@ -8,6 +8,21 @@ the rules for this file:
* keep the format consistent (79 char width, M/D/Y date format).
------------------------------------------------------------------------------
11/28/2015 Oleh Derevenko
* Convex-Trimesh collider added (libccd+GIMPACT only)(by Piotr Piastucki)
* dCreateConvex() and dGeomSetConvex() public APIs changed to expect
their parameter arrays as const pointers
11/01/2015 Oleh Derevenko
* OPCODE mesh colliders' input coordinates have been offset to
mesh-relative frames to decrease potential computational errors
(suggested by luckytrashsc2@g***l.com)
08/05/2015 Oleh Derevenko
* Implemented change to return highest depth contacts subset for GIMPACT
in cases if contacts count exceeds requested maximum (as suggested in
the issue #36 by Piotr Piastucki)
11/17/2014 Daniel K. O.
* Added support for using libccd from the system (if found via
pkg-config)
......
......@@ -59,6 +59,9 @@ Constants starting with G_
#define GINT32 int32_t
#define GUINT32 uint32_t
#ifdef GPTR
#undef GPTR
#endif
#define GPTR void*
/*! Constants for integers*/
......
......@@ -4,7 +4,7 @@
-- For more information on Premake: http://industriousone.com/premake
----------------------------------------------------------------------
ode_version = "0.13.1"
ode_version = "0.14"
----------------------------------------------------------------------
-- Demo list: add/remove demos from here and the rest of the build
......@@ -349,7 +349,8 @@
"../ode/src/collision_trimesh_ray.cpp",
"../ode/src/collision_trimesh_sphere.cpp",
"../ode/src/collision_trimesh_trimesh.cpp",
"../ode/src/collision_trimesh_plane.cpp"
"../ode/src/collision_trimesh_plane.cpp",
"../ode/src/collision_convex_trimesh.cpp"
}
configuration { "not no-trimesh", "with-gimpact or all-collis-libs" }
......@@ -360,7 +361,9 @@
configuration { "with-libccd" }
files { "../libccd/src/ccd/*.h", "../libccd/src/*.c" }
defines { "dLIBCCD_ENABLED", "dLIBCCD_CYL_CYL" }
defines { "dLIBCCD_ENABLED", "dLIBCCD_INTERNAL",
"dLIBCCD_BOX_CYL", "dLIBCCD_CYL_CYL", "dLIBCCD_CAP_CYL", "dLIBCCD_CONVEX_BOX",
"dLIBCCD_CONVEX_CAP", "dLIBCCD_CONVEX_CYL", "dLIBCCD_CONVEX_SPHERE", "dLIBCCD_CONVEX_CONVEX" }
configuration { "not with-libccd" }
excludes { "../ode/src/collision_libccd.cpp", "../ode/src/collision_libccd.h" }
......
dnl AC_INIT does not take a macro as a version nr: set it separately! - Bram
AC_INIT([ODE],[0.13.1],[ode@ode.org])
ODE_VERSION=0.13.1
AC_INIT([ODE],[0.14],[ode@ode.org])
ODE_VERSION=0.14
AC_SUBST(ODE_VERSION)
# Those are instructions from the Libtool manual:
......@@ -22,9 +22,9 @@ AC_SUBST(ODE_VERSION)
#
# 6. If any interfaces have been removed since the last public release,
# then set AGE to 0.
CURRENT=5
CURRENT=6
REVISION=0
AGE=1
AGE=0
AC_ARG_ENABLE(version-info,
AS_HELP_STRING([--disable-version-info],
......@@ -440,7 +440,7 @@ libccd_source=internal
AC_ARG_WITH(libccd,
[AS_HELP_STRING([--with-libccd=@<:@internal|system@:>@],
[use the specified libccd @<:@default=internal@:>@])],
[use the specified libccd @<:@default=system@:>@])],
[libccd_source=$withval],
[libccd_source=system])
......@@ -452,7 +452,13 @@ then
fi
fi
AC_CONFIG_SUBDIRS([libccd])
if test x$use_libccd = xyes
then
if test x$libccd_source = xinternal
then
AC_CONFIG_SUBDIRS([libccd])
fi
fi
AM_CONDITIONAL(LIBCCD, test x$use_libccd != xno)
AM_CONDITIONAL(LIBCCD_INTERNAL, test x$libccd_source = xinternal)
......
......@@ -394,10 +394,9 @@ static void setShadowTransform()
glMultMatrixf (matrix);
}
static void drawConvex (float *_planes,unsigned int _planecount,
float *_points,
unsigned int /*_pointcount*/,
unsigned int *_polygons)
static void drawConvex (const float *_planes, unsigned int _planecount,
const float *_points, unsigned int /*_pointcount*/,
const unsigned int *_polygons)
{
unsigned int polyindex=0;
for(unsigned int i=0;i<_planecount;++i)
......@@ -419,10 +418,9 @@ static void drawConvex (float *_planes,unsigned int _planecount,
}
}
static void drawConvexD (double *_planes,unsigned int _planecount,
double *_points,
unsigned int /*_pointcount*/,
unsigned int *_polygons)
static void drawConvexD (const double *_planes, unsigned int _planecount,
const double *_points, unsigned int /*_pointcount*/,
const unsigned int *_polygons)
{
unsigned int polyindex=0;
for(unsigned int i=0;i<_planecount;++i)
......@@ -1379,10 +1377,9 @@ extern "C" void dsDrawBox (const float pos[3], const float R[12],
}
extern "C" void dsDrawConvex (const float pos[3], const float R[12],
float *_planes,unsigned int _planecount,
float *_points,
unsigned int _pointcount,
unsigned int *_polygons)
const float *_planes,unsigned int _planecount,
const float *_points, unsigned int _pointcount,
const unsigned int *_polygons)
{
if (current_state != 2) dsError ("drawing function called outside simulation loop");
setupDrawingMode();
......@@ -1537,10 +1534,9 @@ extern "C" void dsDrawBoxD (const double pos[3], const double R[12],
}
extern "C" void dsDrawConvexD (const double pos[3], const double R[12],
double *_planes,unsigned int _planecount,
double *_points,
unsigned int _pointcount,
unsigned int *_polygons)
const double *_planes, unsigned int _planecount,
const double *_points, unsigned int _pointcount,
const unsigned int *_polygons)
{
if (current_state != 2) dsError ("drawing function called outside simulation loop");
setupDrawingMode();
......
......@@ -253,11 +253,11 @@ DS_API void dsDrawLine (const float pos1[3], const float pos2[3]);
* @ingroup drawstuff
*/
DS_API void dsDrawConvex(const float pos[3], const float R[12],
float *_planes,
const float *_planes,
unsigned int _planecount,
float *_points,
const float *_points,
unsigned int _pointcount,
unsigned int *_polygons);
const unsigned int *_polygons);
/* these drawing functions are identical to the ones above, except they take
* double arrays for `pos' and `R'.
......@@ -274,11 +274,11 @@ DS_API void dsDrawCapsuleD (const double pos[3], const double R[12],
float length, float radius);
DS_API void dsDrawLineD (const double pos1[3], const double pos2[3]);
DS_API void dsDrawConvexD(const double pos[3], const double R[12],
double *_planes,
const double *_planes,
unsigned int _planecount,
double *_points,
const double *_points,
unsigned int _pointcount,
unsigned int *_polygons);
const unsigned int *_polygons);
/**
* @brief Set the quality with which curved objects are rendered.
......
......@@ -963,16 +963,18 @@ ODE_API dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z);
/*--> Convex Functions*/
ODE_API dGeomID dCreateConvex (dSpaceID space,
dReal *_planes,
const dReal *_planes,
unsigned int _planecount,
dReal *_points,
unsigned int _pointcount,unsigned int *_polygons);
const dReal *_points,
unsigned int _pointcount,
const unsigned int *_polygons);
ODE_API void dGeomSetConvex (dGeomID g,
dReal *_planes,
const dReal *_planes,
unsigned int _count,
dReal *_points,
unsigned int _pointcount,unsigned int *_polygons);
const dReal *_points,
unsigned int _pointcount,
const unsigned int *_polygons);
/*<-- Convex Functions*/
/**
......
......@@ -5,7 +5,7 @@
AC_INIT([libccd], [1.0], [danfis@danfis.cz])
AC_CONFIG_SRCDIR([src/ccd.c])
AC_CONFIG_HEADERS([src/config.h])
AM_INIT_AUTOMAKE
AM_INIT_AUTOMAKE(foreign)
# Checks for programs.
AC_PROG_CXX
......
......@@ -29,6 +29,84 @@
#pragma warning(disable:4244 4305) // for VC++, no precision loss complaints
#endif
//<---- Convex Object
static const dReal planes[] = // planes for a cube
{
1.0f ,0.0f ,0.0f ,0.25f,
0.0f ,1.0f ,0.0f ,0.25f,
0.0f ,0.0f ,1.0f ,0.25f,
0.0f ,0.0f ,-1.0f,0.25f,
0.0f ,-1.0f,0.0f ,0.25f,
-1.0f,0.0f ,0.0f ,0.25f
/*
1.0f ,0.0f ,0.0f ,2.0f,
0.0f ,1.0f ,0.0f ,1.0f,
0.0f ,0.0f ,1.0f ,1.0f,
0.0f ,0.0f ,-1.0f,1.0f,
0.0f ,-1.0f,0.0f ,1.0f,
-1.0f,0.0f ,0.0f ,0.0f
*/
};
static const unsigned int planecount=6;
static const dReal points[] = // points for a cube
{
0.25f,0.25f,0.25f,
-0.25f,0.25f,0.25f,
0.25f,-0.25f,0.25f,
-0.25f,-0.25f,0.25f,
0.25f,0.25f,-0.25f,
-0.25f,0.25f,-0.25f,
0.25f,-0.25f,-0.25f,
-0.25f,-0.25f,-0.25f,
};
static const unsigned int pointcount=8;
static const unsigned int polygons[] = //Polygons for a cube (6 squares)
{
4,0,2,6,4, // positive X
4,1,0,4,5, // positive Y
4,0,1,3,2, // positive Z
4,3,1,5,7, // negative X
4,2,3,7,6, // negative Y
4,5,4,6,7, // negative Z
};
//----> Convex Object
int tmTriangles[] =
{
0,2,6,
0,6,4,
1,0,4,
1,4,5,
0,1,3,
0,3,2,
3,1,5,
3,5,7,
2,3,7,
2,7,6,
5,4,6,
5,6,7
};
float tmVertices[] =
{
0.25f,0.25f,0.25f, // point 0
-0.25f,0.25f,0.25f, // point 1
0.25f,-0.25f,0.25f, // point 2
-0.25f,-0.25f,0.25f,// point 3
0.25f,0.25f,-0.25f, // point 4
-0.25f,0.25f,-0.25f,// point 5
0.25f,-0.25f,-0.25f,// point 6
-0.25f,-0.25f,-0.25f,// point 7
};
// select correct drawing functions
#ifdef dDOUBLE
......@@ -38,6 +116,7 @@
#define dsDrawCapsule dsDrawCapsuleD
#define dsDrawLine dsDrawLineD
#define dsDrawTriangle dsDrawTriangleD
#define dsDrawConvex dsDrawConvexD
#endif
......@@ -128,6 +207,7 @@ static void start()
printf (" y for cylinder.\n");
printf (" c for capsule.\n");
printf (" x for a composite object.\n");
printf (" v for a convex object.\n");
printf (" m for a trimesh.\n");
printf ("To select an object, press space.\n");
printf ("To disable the selected object, press d.\n");
......@@ -155,7 +235,7 @@ static void command (int cmd)
bool setBody = false;
cmd = locase (cmd);
if (cmd == 'b' || cmd == 's' || cmd == 'c' || cmd == 'x' || cmd == 'm' || cmd == 'y' ) {
if (cmd == 'b' || cmd == 's' || cmd == 'c' || cmd == 'x' || cmd == 'm' || cmd == 'y' || cmd == 'v') {
if (num < NUM) {
i = num;
num++;
......@@ -203,6 +283,15 @@ static void command (int cmd)
sides[0] *= 0.5;
dMassSetCapsule (&m,DENSITY,3,sides[0],sides[1]);
obj[i].geom[0] = dCreateCapsule (space,sides[0],sides[1]);
} else if (cmd == 'v') {
dMassSetBox (&m,DENSITY,0.25,0.25,0.25);
obj[i].geom[0] = dCreateConvex(space,
planes,
planecount,
points,
pointcount,
polygons);
}
else if (cmd == 'y') {
sides[1] *= 0.5;
......@@ -340,6 +429,13 @@ void drawGeom (dGeomID g, const dReal *pos, const dReal *R, int show_aabb)
dReal radius,length;
dGeomCylinderGetParams (g,&radius,&length);
dsDrawCylinder (pos,R,length,radius);
} else if (type == dConvexClass) {
//dVector3 sides={0.50,0.50,0.50};
dsDrawConvex(pos,R,planes,
planecount,
points,
pointcount,
polygons);
}
if (show_aabb) {
......
......@@ -30,6 +30,53 @@
#pragma warning(disable:4244 4305) // for VC++, no precision loss complaints
#endif
//<---- Convex Object
static const dReal planes[] = // planes for a cube
{
1.0f ,0.0f ,0.0f ,0.25f,
0.0f ,1.0f ,0.0f ,0.25f,
0.0f ,0.0f ,1.0f ,0.25f,
0.0f ,0.0f ,-1.0f,0.25f,
0.0f ,-1.0f,0.0f ,0.25f,
-1.0f,0.0f ,0.0f ,0.25f
/*
1.0f ,0.0f ,0.0f ,2.0f,
0.0f ,1.0f ,0.0f ,1.0f,
0.0f ,0.0f ,1.0f ,1.0f,
0.0f ,0.0f ,-1.0f,1.0f,
0.0f ,-1.0f,0.0f ,1.0f,
-1.0f,0.0f ,0.0f ,0.0f
*/
};
static const unsigned int planecount=6;
static const dReal points[] = // points for a cube
{
0.25f,0.25f,0.25f,
-0.25f,0.25f,0.25f,
0.25f,-0.25f,0.25f,
-0.25f,-0.25f,0.25f,
0.25f,0.25f,-0.25f,
-0.25f,0.25f,-0.25f,
0.25f,-0.25f,-0.25f,
-0.25f,-0.25f,-0.25f,
};
static const unsigned int pointcount=8;
static const unsigned int polygons[] = //Polygons for a cube (6 squares)
{
4,0,2,6,4, // positive X
4,1,0,4,5, // positive Y
4,0,1,3,2, // positive Z
4,3,1,5,7, // negative X
4,2,3,7,6, // negative Y
4,5,4,6,7, // negative Z
};
//----> Convex Object
// select correct drawing functions
#ifdef dDOUBLE
......@@ -39,6 +86,7 @@
#define dsDrawCapsule dsDrawCapsuleD
#define dsDrawLine dsDrawLineD
#define dsDrawTriangle dsDrawTriangleD
#define dsDrawConvex dsDrawConvexD
#endif
......@@ -143,6 +191,7 @@ static void start()
printf (" b for box.\n");
printf (" s for sphere.\n");
printf (" c for cylinder.\n");
printf( " v for a convex.\n" );
printf (" x for a composite object.\n");
printf ("To select an object, press space.\n");
printf ("To disable the selected object, press d.\n");
......@@ -170,7 +219,7 @@ static void command (int cmd)
bool setBody = false;
cmd = locase (cmd);
if (cmd == 'b' || cmd == 's' || cmd == 'c' || cmd == 'x'
if (cmd == 'b' || cmd == 's' || cmd == 'c' || cmd == 'x' || cmd == 'v'
/* || cmd == 'l' */) {
if (num < NUM) {
i = num;
......@@ -284,7 +333,17 @@ static void command (int cmd)
dMassTranslate(&m,-m.c[0],-m.c[1],-m.c[2]);
dBodySetMass(obj[i].body,&m);
}
} else if (cmd == 'v') {
dMassSetBox (&m,DENSITY,0.25,0.25,0.25);
obj[i].geom[0] = dCreateConvex(space,
planes,
planecount,
points,
pointcount,
polygons);
}
if (!setBody) { // avoid calling for composite geometries
for (k=0; k < GPB; k++)
......@@ -339,6 +398,13 @@ void drawGeom (dGeomID g, const dReal *pos, const dReal *R, int show_aabb)
dReal radius,length;
dGeomCapsuleGetParams (g,&radius,&length);
dsDrawCapsule (pos,R,length,radius);
} else if (type == dConvexClass) {
//dVector3 sides={0.50,0.50,0.50};
dsDrawConvex(pos,R,planes,
planecount,
points,
pointcount,
polygons);
}
/*
// cylinder option not yet implemented
......
......@@ -108,7 +108,8 @@ libode_la_SOURCES += collision_trimesh_trimesh.cpp \
collision_trimesh_distance.cpp \
collision_trimesh_internal.h \
collision_cylinder_trimesh.cpp \
collision_trimesh_plane.cpp
collision_trimesh_plane.cpp \
collision_convex_trimesh.cpp
endif
......@@ -133,7 +134,8 @@ libode_la_SOURCES+= collision_trimesh_trimesh.cpp \
collision_trimesh_distance.cpp \
collision_trimesh_internal.h \
collision_cylinder_trimesh.cpp \
collision_trimesh_plane.cpp
collision_trimesh_plane.cpp \
collision_convex_trimesh.cpp
endif
......
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
#include <ode/collision.h>
#include <ode/rotation.h>
#include "config.h"
#include "matrix.h"
#include "odemath.h"
typedef struct _sLocalContactData
{
dVector3 vPos;
dVector3 vNormal;
dReal fDepth;
int triIndex;
int nFlags; // 0 = filtered out, 1 = OK
}sLocalContactData;
#if dTRIMESH_ENABLED
#include "collision_util.h"
#include "collision_std.h"
#include "collision_trimesh_internal.h"
#if dLIBCCD_ENABLED
#include "collision_libccd.h"
#endif
int dCollideConvexTrimesh( dxGeom *o1, dxGeom *o2, int flags, dContactGeom* contacts, int skip )
{
int contactcount = 0;
dIASSERT( skip >= (int)sizeof( dContactGeom ) );
dIASSERT( o1->type == dConvexClass );
dIASSERT( o2->type == dTriMeshClass );
dIASSERT ((flags & NUMC_MASK) >= 1);
#if dLIBCCD_ENABLED
#if dTRIMESH_OPCODE
#elif dTRIMESH_GIMPACT
dxTriMesh *trimesh = (dxTriMesh *)o2;
aabb3f test_aabb;
test_aabb.minX = o1->aabb[0];
test_aabb.maxX = o1->aabb[1];
test_aabb.minY = o1->aabb[2];
test_aabb.maxY = o1->aabb[3];
test_aabb.minZ = o1->aabb[4];
test_aabb.maxZ = o1->aabb[5];
GDYNAMIC_ARRAY collision_result;
GIM_CREATE_BOXQUERY_LIST(collision_result);
gim_aabbset_box_collision(&test_aabb, &trimesh->m_collision_trimesh.m_aabbset, &collision_result);
if (collision_result.m_size != 0)
{
GUINT32 * boxesresult = GIM_DYNARRAY_POINTER(GUINT32,collision_result);
GIM_TRIMESH * ptrimesh = &trimesh->m_collision_trimesh;
gim_trimesh_locks_work_data(ptrimesh);
contactcount = dCollideConvexTrimeshTrianglesCCD(o1, o2, (int *)boxesresult, collision_result.m_size, flags, contacts, skip);
gim_trimesh_unlocks_work_data(ptrimesh);
}
GIM_DYNARRAY_DESTROY(collision_result);
#endif // dTRIMESH_GIMPACT
#endif // dLIBCCD_ENABLED
return contactcount;
}
#endif // dTRIMESH_ENABLED
......@@ -971,48 +971,35 @@ static void dQueryCTLPotentialCollisionTriangles(OBBCollider &Collider,
sCylinderTrimeshColliderData &cData, dxGeom *Cylinder, dxTriMesh *Trimesh,
OBBCache &BoxCache)
{
const dVector3 &vCylinderPos = cData.m_vCylinderPos;
Point cCenter(vCylinderPos[0],vCylinderPos[1],vCylinderPos[2]);
Point cExtents(cData.m_fCylinderRadius,cData.m_fCylinderRadius,cData.m_fCylinderRadius);
cExtents[nCYLINDER_AXIS] = cData.m_fCylinderSize * REAL(0.5);
Matrix3x3 obbRot;
Matrix4x4 MeshMatrix;
const dVector3 vZeroVector3 = { REAL(0.0), };
MakeMatrix(vZeroVector3, cData.m_mTrimeshRot, MeshMatrix);
const dVector3 &vCylinderPos = cData.m_vCylinderPos;
const dMatrix3 &mCylinderRot = cData.m_mCylinderRot;
// It is a potential issue to explicitly cast to float
// if custom width floating point type is introduced in OPCODE.
// It is necessary to make a typedef and cast to it
// (e.g. typedef float opc_float;)
// However I'm not sure in what header it should be added.
dVector3 vCylinderOffsetPos;
dSubtractVectors3(vCylinderOffsetPos, vCylinderPos, cData.m_vTrimeshPos);
obbRot[0][0] = /*(float)*/mCylinderRot[0];
obbRot[1][0] = /*(float)*/mCylinderRot[1];
obbRot[2][0] = /*(float)*/mCylinderRot[2];
const dReal fCylinderRadius = cData.m_fCylinderRadius, fCylinderHalfAxis = cData.m_fCylinderSize * REAL(0.5);
obbRot[0][1] = /*(float)*/mCylinderRot[4];
obbRot[1][1] = /*(float)*/mCylinderRot[5];
obbRot[2][1] = /*(float)*/mCylinderRot[6];
obbRot[0][2] = /*(float)*/mCylinderRot[8];
obbRot[1][2] = /*(float)*/mCylinderRot[9];
obbRot[2][2] = /*(float)*/mCylinderRot[10];
OBB obbCapsule(cCenter,cExtents,obbRot);
Matrix4x4 CapsuleMatrix;
MakeMatrix(vCylinderPos, mCylinderRot, CapsuleMatrix);
Matrix4x4 MeshMatrix;
MakeMatrix(cData.m_vTrimeshPos, cData.m_mTrimeshRot, MeshMatrix);
OBB obbCylinder;
obbCylinder.mCenter.Set(vCylinderOffsetPos[0], vCylinderOffsetPos[1], vCylinderOffsetPos[2]);
obbCylinder.mExtents.Set(
0 == nCYLINDER_AXIS ? fCylinderHalfAxis : fCylinderRadius,
1 == nCYLINDER_AXIS ? fCylinderHalfAxis : fCylinderRadius,
2 == nCYLINDER_AXIS ? fCylinderHalfAxis : fCylinderRadius);
obbCylinder.mRot.Set(
mCylinderRot[0], mCylinderRot[4], mCylinderRot[8],
mCylinderRot[1], mCylinderRot[5], mCylinderRot[9],
mCylinderRot[2], mCylinderRot[6], mCylinderRot[10]);
// TC results
if (Trimesh->doBoxTC)
{
dxTriMesh::BoxTC* BoxTC = 0;
for (int i = 0; i < Trimesh->BoxTCCache.size(); i++)
const int iBoxCacheSize = Trimesh->BoxTCCache.size();
for (int i = 0; i != iBoxCacheSize; i++)
{
if (Trimesh->BoxTCCache[i].Geom == Cylinder)
{
......@@ -1031,12 +1018,12 @@ static void dQueryCTLPotentialCollisionTriangles(OBBCollider &Collider,
// Intersect
Collider.SetTemporalCoherence(true);
Collider.Collide(*BoxTC, obbCapsule, Trimesh->Data->BVTree, null, &MeshMatrix);
Collider.Collide(*BoxTC, obbCylinder, Trimesh->Data->BVTree, null, &MeshMatrix);
}
else
{
Collider.SetTemporalCoherence(false);
Collider.Collide(BoxCache, obbCapsule, Trimesh->Data->BVTree, null,&MeshMatrix);
Collider.Collide(BoxCache, obbCylinder, Trimesh->Data->BVTree, null, &MeshMatrix);
}
}
......@@ -1070,7 +1057,7 @@ int dCollideCylinderTrimesh(dxGeom *o1, dxGeom *o2, int flags, dContactGeom *con
{
const int* Triangles = (const int*)Collider.GetTouchedPrimitives();
if (Trimesh->ArrayCallback != null)
if (Trimesh->ArrayCallback != NULL)
{
Trimesh->ArrayCallback(Trimesh, Cylinder, Triangles, TriCount);
}
......
......@@ -201,6 +201,7 @@ static void setAllColliders (int i, dColliderFn *fn)
setCollider (dTriMeshClass,dCapsuleClass,&dCollideCCTL);
setCollider (dTriMeshClass,dPlaneClass,&dCollideTrimeshPlane);
setCollider (dCylinderClass,dTriMeshClass,&dCollideCylinderTrimesh);
setCollider (dConvexClass,dTriMeshClass,&dCollideConvexTrimesh);
#endif
#ifdef dLIBCCD_BOX_CYL
......
......@@ -27,6 +27,9 @@
#include "odemath.h"
#include "collision_libccd.h"
#include "collision_std.h"
#if dTRIMESH_ENABLED
#include "collision_util.h"
#endif
struct _ccd_obj_t {
......@@ -65,6 +68,12 @@ struct _ccd_convex_t {
};
typedef struct _ccd_convex_t ccd_convex_t;
struct _ccd_triangle_t {