bt -> b3 and BT -> B3 rename for content and filenames
This commit is contained in:
@@ -15,7 +15,7 @@ GpuDemo::~GpuDemo()
|
||||
{
|
||||
if (m_clData)
|
||||
{
|
||||
btAssert(m_clData->m_clInitialized==false);
|
||||
b3Assert(m_clData->m_clInitialized==false);
|
||||
|
||||
delete m_clData;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ void GpuDemo::initCL(int preferredDeviceIndex, int preferredPlatformIndex)
|
||||
oclCHECKERROR(ciErrNum, CL_SUCCESS);
|
||||
|
||||
b3OpenCLUtils::printDeviceInfo(m_clData->m_clDevice);
|
||||
btOpenCLDeviceInfo info;
|
||||
b3OpenCLDeviceInfo info;
|
||||
b3OpenCLUtils::getDeviceInfo(m_clData->m_clDevice,&info);
|
||||
m_clData->m_clDeviceName = info.m_deviceName;
|
||||
m_clData->m_clInitialized = true;
|
||||
@@ -98,7 +98,7 @@ int GpuDemo::registerGraphicsSphereShape(const ConstructionInfo& ci, float radiu
|
||||
{
|
||||
int numVertices = sizeof(point_sphere_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(point_sphere_indices)/sizeof(int);
|
||||
graphicsShapeIndex = ci.m_instancingRenderer->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,BT_GL_POINTS);
|
||||
graphicsShapeIndex = ci.m_instancingRenderer->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,B3_GL_POINTS);
|
||||
} else
|
||||
{
|
||||
if (radius>=mediumSphereThreshold)
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
float gapY;
|
||||
float gapZ;
|
||||
GLInstancingRenderer* m_instancingRenderer;
|
||||
class btgWindowInterface* m_window;
|
||||
class b3gWindowInterface* m_window;
|
||||
class GwenUserInterface* m_gui;
|
||||
|
||||
ConstructionInfo()
|
||||
|
||||
@@ -12,9 +12,9 @@ static char* particleKernelsString =
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
#include "OpenGLWindow/OpenGLInclude.h"
|
||||
#include "OpenGLWindow/GLInstanceRendererInternalData.h"
|
||||
#include "parallel_primitives/host/btLauncherCL.h"
|
||||
#include "parallel_primitives/host/b3LauncherCL.h"
|
||||
//#include "../../opencl/primitives/AdlPrimitives/Math/Math.h"
|
||||
//#include "../../opencl/broadphase_benchmark/btGridBroadphaseCL.h"
|
||||
//#include "../../opencl/broadphase_benchmark/b3GridBroadphaseCL.h"
|
||||
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
|
||||
#include "GpuDemoInternalData.h"
|
||||
|
||||
@@ -43,9 +43,9 @@ static char* particleKernelsString =
|
||||
|
||||
|
||||
|
||||
ATTRIBUTE_ALIGNED16(struct) btSimParams
|
||||
ATTRIBUTE_ALIGNED16(struct) b3SimParams
|
||||
{
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
B3_DECLARE_ALIGNED_ALLOCATOR();
|
||||
b3Vector3 m_gravity;
|
||||
float m_worldMin[4];
|
||||
float m_worldMax[4];
|
||||
@@ -61,7 +61,7 @@ ATTRIBUTE_ALIGNED16(struct) btSimParams
|
||||
float m_dummy;
|
||||
|
||||
|
||||
btSimParams()
|
||||
b3SimParams()
|
||||
{
|
||||
m_gravity.setValue(0,-0.03,0.f);
|
||||
m_particleRad = 0.023f;
|
||||
@@ -98,10 +98,10 @@ struct ParticleInternalData
|
||||
cl_mem m_clPositionBuffer;
|
||||
|
||||
b3AlignedObjectArray<b3Vector3> m_velocitiesCPU;
|
||||
btOpenCLArray<b3Vector3>* m_velocitiesGPU;
|
||||
b3OpenCLArray<b3Vector3>* m_velocitiesGPU;
|
||||
|
||||
b3AlignedObjectArray<btSimParams> m_simParamCPU;
|
||||
btOpenCLArray<btSimParams>* m_simParamGPU;
|
||||
b3AlignedObjectArray<b3SimParams> m_simParamCPU;
|
||||
b3OpenCLArray<b3SimParams>* m_simParamGPU;
|
||||
|
||||
|
||||
|
||||
@@ -170,12 +170,12 @@ void ParticleDemo::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
m_data->m_broadphaseGPU = new b3GpuSapBroadphase(m_clData->m_clContext ,m_clData->m_clDevice,m_clData->m_clQueue);//overlappingPairCache,b3Vector3(4.f, 4.f, 4.f), 128, 128, 128,maxObjects, maxObjects, maxPairsSmallProxy, 100.f, 128,
|
||||
|
||||
/*m_data->m_broadphaseGPU = new btGridBroadphaseCl(overlappingPairCache,b3Vector3(radius,radius,radius), 128, 128, 128,
|
||||
/*m_data->m_broadphaseGPU = new b3GridBroadphaseCl(overlappingPairCache,b3Vector3(radius,radius,radius), 128, 128, 128,
|
||||
maxObjects, maxObjects, maxPairsSmallProxy, 100.f, 128,
|
||||
m_clData->m_clContext ,m_clData->m_clDevice,m_clData->m_clQueue);
|
||||
*/
|
||||
|
||||
m_data->m_velocitiesGPU = new btOpenCLArray<b3Vector3>(m_clData->m_clContext,m_clData->m_clQueue,numParticles);
|
||||
m_data->m_velocitiesGPU = new b3OpenCLArray<b3Vector3>(m_clData->m_clContext,m_clData->m_clQueue,numParticles);
|
||||
m_data->m_velocitiesCPU.resize(numParticles);
|
||||
for (int i=0;i<numParticles;i++)
|
||||
{
|
||||
@@ -183,7 +183,7 @@ void ParticleDemo::setupScene(const ConstructionInfo& ci)
|
||||
}
|
||||
m_data->m_velocitiesGPU->copyFromHost(m_data->m_velocitiesCPU);
|
||||
|
||||
m_data->m_simParamGPU = new btOpenCLArray<btSimParams>(m_clData->m_clContext,m_clData->m_clQueue,1,false);
|
||||
m_data->m_simParamGPU = new b3OpenCLArray<b3SimParams>(m_clData->m_clContext,m_clData->m_clQueue,1,false);
|
||||
m_data->m_simParamGPU->copyFromHost(m_data->m_simParamCPU);
|
||||
|
||||
cl_int pErrNum;
|
||||
@@ -210,7 +210,7 @@ void ParticleDemo::setupScene(const ConstructionInfo& ci)
|
||||
{
|
||||
int numVertices = sizeof(point_sphere_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(point_sphere_indices)/sizeof(int);
|
||||
shapeId = m_instancingRenderer->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,BT_GL_POINTS);
|
||||
shapeId = m_instancingRenderer->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,B3_GL_POINTS);
|
||||
} else
|
||||
{
|
||||
int numVertices = sizeof(low_sphere_vertices)/strideInBytes;
|
||||
@@ -341,14 +341,14 @@ void ParticleDemo::clientMoveAndDisplay()
|
||||
|
||||
if (0)
|
||||
{
|
||||
btBufferInfoCL bInfo[] = {
|
||||
btBufferInfoCL( m_data->m_velocitiesGPU->getBufferCL(), true ),
|
||||
btBufferInfoCL( m_data->m_clPositionBuffer)
|
||||
b3BufferInfoCL bInfo[] = {
|
||||
b3BufferInfoCL( m_data->m_velocitiesGPU->getBufferCL(), true ),
|
||||
b3BufferInfoCL( m_data->m_clPositionBuffer)
|
||||
};
|
||||
|
||||
btLauncherCL launcher(m_clData->m_clQueue, m_data->m_updatePositionsKernel );
|
||||
b3LauncherCL launcher(m_clData->m_clQueue, m_data->m_updatePositionsKernel );
|
||||
|
||||
launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(btBufferInfoCL) );
|
||||
launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(b3BufferInfoCL) );
|
||||
launcher.setConst( numParticles);
|
||||
|
||||
launcher.launch1D( numParticles);
|
||||
@@ -359,16 +359,16 @@ void ParticleDemo::clientMoveAndDisplay()
|
||||
|
||||
if (1)
|
||||
{
|
||||
btBufferInfoCL bInfo[] = {
|
||||
btBufferInfoCL( m_data->m_clPositionBuffer),
|
||||
btBufferInfoCL( m_data->m_velocitiesGPU->getBufferCL() ),
|
||||
btBufferInfoCL( m_data->m_simParamGPU->getBufferCL(),true)
|
||||
b3BufferInfoCL bInfo[] = {
|
||||
b3BufferInfoCL( m_data->m_clPositionBuffer),
|
||||
b3BufferInfoCL( m_data->m_velocitiesGPU->getBufferCL() ),
|
||||
b3BufferInfoCL( m_data->m_simParamGPU->getBufferCL(),true)
|
||||
};
|
||||
|
||||
btLauncherCL launcher(m_clData->m_clQueue, m_data->m_updatePositionsKernel2 );
|
||||
b3LauncherCL launcher(m_clData->m_clQueue, m_data->m_updatePositionsKernel2 );
|
||||
|
||||
launcher.setConst( numParticles);
|
||||
launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(btBufferInfoCL) );
|
||||
launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(b3BufferInfoCL) );
|
||||
float timeStep = 1.f/60.f;
|
||||
launcher.setConst( timeStep);
|
||||
|
||||
@@ -378,13 +378,13 @@ void ParticleDemo::clientMoveAndDisplay()
|
||||
}
|
||||
|
||||
{
|
||||
btBufferInfoCL bInfo[] = {
|
||||
btBufferInfoCL( m_data->m_clPositionBuffer),
|
||||
btBufferInfoCL( m_data->m_broadphaseGPU->getAabbBufferWS()),
|
||||
b3BufferInfoCL bInfo[] = {
|
||||
b3BufferInfoCL( m_data->m_clPositionBuffer),
|
||||
b3BufferInfoCL( m_data->m_broadphaseGPU->getAabbBufferWS()),
|
||||
};
|
||||
|
||||
btLauncherCL launcher(m_clData->m_clQueue, m_data->m_updateAabbsKernel );
|
||||
launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(btBufferInfoCL) );
|
||||
b3LauncherCL launcher(m_clData->m_clQueue, m_data->m_updateAabbsKernel );
|
||||
launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(b3BufferInfoCL) );
|
||||
launcher.setConst( m_data->m_simParamCPU[0].m_particleRad);
|
||||
launcher.setConst( numParticles);
|
||||
|
||||
@@ -404,14 +404,14 @@ void ParticleDemo::clientMoveAndDisplay()
|
||||
|
||||
if (numPairsGPU)
|
||||
{
|
||||
btBufferInfoCL bInfo[] = {
|
||||
btBufferInfoCL( m_data->m_clPositionBuffer),
|
||||
btBufferInfoCL( m_data->m_velocitiesGPU->getBufferCL() ),
|
||||
btBufferInfoCL( m_data->m_broadphaseGPU->getOverlappingPairBuffer(),true),
|
||||
b3BufferInfoCL bInfo[] = {
|
||||
b3BufferInfoCL( m_data->m_clPositionBuffer),
|
||||
b3BufferInfoCL( m_data->m_velocitiesGPU->getBufferCL() ),
|
||||
b3BufferInfoCL( m_data->m_broadphaseGPU->getOverlappingPairBuffer(),true),
|
||||
};
|
||||
|
||||
btLauncherCL launcher(m_clData->m_clQueue, m_data->m_collideParticlesKernel);
|
||||
launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(btBufferInfoCL) );
|
||||
b3LauncherCL launcher(m_clData->m_clQueue, m_data->m_collideParticlesKernel);
|
||||
launcher.setBuffers( bInfo, sizeof(bInfo)/sizeof(b3BufferInfoCL) );
|
||||
launcher.setConst( numPairsGPU);
|
||||
launcher.launch1D( numPairsGPU);
|
||||
clFinish(m_clData->m_clQueue);
|
||||
@@ -454,7 +454,7 @@ void ParticleDemo::clientMoveAndDisplay()
|
||||
glFlush();
|
||||
|
||||
char* orgBase = (char*)glMapBuffer( GL_ARRAY_BUFFER,GL_READ_WRITE);
|
||||
//btGraphicsInstance* gfxObj = m_graphicsInstances[k];
|
||||
//b3GraphicsInstance* gfxObj = m_graphicsInstances[k];
|
||||
int totalNumInstances= numParticles;
|
||||
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
#include "OpenGLWindow/ShapeData.h"
|
||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
#include "OpenGLWindow/btgWindowInterface.h"
|
||||
#include "OpenGLWindow/b3gWindowInterface.h"
|
||||
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
|
||||
#include "../GpuDemoInternalData.h"
|
||||
#include "basic_initialize/b3OpenCLUtils.h"
|
||||
#include "OpenGLWindow/OpenGLInclude.h"
|
||||
#include "OpenGLWindow/GLInstanceRendererInternalData.h"
|
||||
#include "parallel_primitives/host/btLauncherCL.h"
|
||||
#include "parallel_primitives/host/b3LauncherCL.h"
|
||||
|
||||
static btKeyboardCallback oldCallback = 0;
|
||||
static b3KeyboardCallback oldCallback = 0;
|
||||
extern bool gReset;
|
||||
|
||||
#define MSTRINGIFY(A) #A
|
||||
@@ -70,9 +70,9 @@ typedef struct
|
||||
float fy;
|
||||
float fz;
|
||||
int uw;
|
||||
} btAABBCL;
|
||||
} b3AABBCL;
|
||||
|
||||
__kernel void updateAabbSimple( __global float4* posOrnColors, const int numNodes, __global btAABBCL* pAABB)
|
||||
__kernel void updateAabbSimple( __global float4* posOrnColors, const int numNodes, __global b3AABBCL* pAABB)
|
||||
{
|
||||
int nodeId = get_global_id(0);
|
||||
if( nodeId < numNodes )
|
||||
@@ -102,8 +102,8 @@ struct PairBenchInternalData
|
||||
cl_kernel m_colorPairsKernel;
|
||||
cl_kernel m_updateAabbSimple;
|
||||
|
||||
btOpenCLArray<btVector4>* m_instancePosOrnColor;
|
||||
btOpenCLArray<float>* m_bodyTimes;
|
||||
b3OpenCLArray<b3Vector4>* m_instancePosOrnColor;
|
||||
b3OpenCLArray<float>* m_bodyTimes;
|
||||
PairBenchInternalData()
|
||||
:m_broadphaseGPU(0),
|
||||
m_moveObjectsKernel(0),
|
||||
@@ -141,7 +141,7 @@ static void PairKeyboardCallback(int key, int state)
|
||||
gReset = true;
|
||||
}
|
||||
|
||||
//btDefaultKeyboardCallback(key,state);
|
||||
//b3DefaultKeyboardCallback(key,state);
|
||||
oldCallback(key,state);
|
||||
}
|
||||
|
||||
@@ -190,8 +190,8 @@ void PairBench::initPhysics(const ConstructionInfo& ci)
|
||||
b3Vector3 position(k*3,i*3,j*3);
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color(0,1,0,1);
|
||||
btVector4 scaling(1,1,1,1);
|
||||
b3Vector4 color(0,1,0,1);
|
||||
b3Vector4 scaling(1,1,1,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
b3Vector3 aabbHalfExtents(1,1,1);
|
||||
|
||||
@@ -236,21 +236,21 @@ void PairBench::clientMoveAndDisplay()
|
||||
|
||||
bool animate=true;
|
||||
int numObjects= m_instancingRenderer->getInternalData()->m_totalNumInstances;
|
||||
btVector4* positions = 0;
|
||||
b3Vector4* positions = 0;
|
||||
if (animate)
|
||||
{
|
||||
GLuint vbo = m_instancingRenderer->getInternalData()->m_vbo;
|
||||
|
||||
|
||||
|
||||
int arraySizeInBytes = numObjects * (3)*sizeof(btVector4);
|
||||
int arraySizeInBytes = numObjects * (3)*sizeof(b3Vector4);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
cl_bool blocking= CL_TRUE;
|
||||
char* hostPtr= (char*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_WRITE_BIT|GL_MAP_READ_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY
|
||||
GLint err = glGetError();
|
||||
assert(err==GL_NO_ERROR);
|
||||
positions = (btVector4*)hostPtr;
|
||||
positions = (b3Vector4*)hostPtr;
|
||||
|
||||
if (m_data->m_instancePosOrnColor && m_data->m_instancePosOrnColor->size() != 3*numObjects)
|
||||
{
|
||||
@@ -259,10 +259,10 @@ void PairBench::clientMoveAndDisplay()
|
||||
}
|
||||
if (!m_data->m_instancePosOrnColor)
|
||||
{
|
||||
m_data->m_instancePosOrnColor = new btOpenCLArray<btVector4>(m_clData->m_clContext,m_clData->m_clQueue);
|
||||
m_data->m_instancePosOrnColor = new b3OpenCLArray<b3Vector4>(m_clData->m_clContext,m_clData->m_clQueue);
|
||||
m_data->m_instancePosOrnColor->resize(3*numObjects);
|
||||
m_data->m_instancePosOrnColor->copyFromHostPointer(positions,3*numObjects,0);
|
||||
m_data->m_bodyTimes = new btOpenCLArray<float>(m_clData->m_clContext,m_clData->m_clQueue);
|
||||
m_data->m_bodyTimes = new b3OpenCLArray<float>(m_clData->m_clContext,m_clData->m_clQueue);
|
||||
m_data->m_bodyTimes ->resize(numObjects);
|
||||
b3AlignedObjectArray<float> tmp;
|
||||
tmp.resize(numObjects);
|
||||
@@ -278,7 +278,7 @@ void PairBench::clientMoveAndDisplay()
|
||||
if (1)
|
||||
{
|
||||
|
||||
btLauncherCL launcher(m_clData->m_clQueue, m_data->m_sineWaveKernel);
|
||||
b3LauncherCL launcher(m_clData->m_clQueue, m_data->m_sineWaveKernel);
|
||||
launcher.setBuffer(m_data->m_instancePosOrnColor->getBufferCL() );
|
||||
launcher.setBuffer(m_data->m_bodyTimes->getBufferCL() );
|
||||
launcher.setConst( numObjects);
|
||||
@@ -288,7 +288,7 @@ void PairBench::clientMoveAndDisplay()
|
||||
else
|
||||
{
|
||||
|
||||
btLauncherCL launcher(m_clData->m_clQueue, m_data->m_moveObjectsKernel);
|
||||
b3LauncherCL launcher(m_clData->m_clQueue, m_data->m_moveObjectsKernel);
|
||||
launcher.setBuffer(m_data->m_instancePosOrnColor->getBufferCL() );
|
||||
launcher.setConst( numObjects);
|
||||
launcher.launch1D( numObjects);
|
||||
@@ -298,7 +298,7 @@ void PairBench::clientMoveAndDisplay()
|
||||
}
|
||||
|
||||
{
|
||||
btLauncherCL launcher(m_clData->m_clQueue, m_data->m_updateAabbSimple);
|
||||
b3LauncherCL launcher(m_clData->m_clQueue, m_data->m_updateAabbSimple);
|
||||
launcher.setBuffer(m_data->m_instancePosOrnColor->getBufferCL() );
|
||||
launcher.setConst( numObjects);
|
||||
launcher.setBuffer(m_data->m_broadphaseGPU->getAabbBufferWS());
|
||||
@@ -307,7 +307,7 @@ void PairBench::clientMoveAndDisplay()
|
||||
|
||||
}
|
||||
{
|
||||
BT_PROFILE("calculateOverlappingPairs");
|
||||
B3_PROFILE("calculateOverlappingPairs");
|
||||
m_data->m_broadphaseGPU->calculateOverlappingPairs();
|
||||
//int numPairs = m_data->m_broadphaseGPU->getNumOverlap();
|
||||
//printf("numPairs = %d\n", numPairs);
|
||||
@@ -331,7 +331,7 @@ void PairBench::clientMoveAndDisplay()
|
||||
int numPairs = m_data->m_broadphaseGPU->getNumOverlap();
|
||||
cl_mem pairBuf = m_data->m_broadphaseGPU->getOverlappingPairBuffer();
|
||||
|
||||
btLauncherCL launcher(m_clData->m_clQueue, m_data->m_colorPairsKernel);
|
||||
b3LauncherCL launcher(m_clData->m_clQueue, m_data->m_colorPairsKernel);
|
||||
launcher.setBuffer(m_data->m_instancePosOrnColor->getBufferCL() );
|
||||
launcher.setConst( numObjects);
|
||||
launcher.setBuffer( pairBuf);
|
||||
|
||||
@@ -7,7 +7,7 @@ class PairBench : public GpuDemo
|
||||
{
|
||||
|
||||
class GLInstancingRenderer* m_instancingRenderer;
|
||||
class btgWindowInterface* m_window;
|
||||
class b3gWindowInterface* m_window;
|
||||
|
||||
struct PairBenchInternalData* m_data;
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ struct GwenInternalData
|
||||
Gwen::Controls::Label* m_leftStatusBar;
|
||||
|
||||
b3AlignedObjectArray<struct Gwen::Event::Handler*> m_handlers;
|
||||
btToggleButtonCallback m_toggleButtonCallback;
|
||||
btComboBoxCallback m_comboBoxCallback;
|
||||
b3ToggleButtonCallback m_toggleButtonCallback;
|
||||
b3ComboBoxCallback m_comboBoxCallback;
|
||||
|
||||
};
|
||||
GwenUserInterface::GwenUserInterface()
|
||||
@@ -243,7 +243,7 @@ void GwenUserInterface::init(int width, int height,struct sth_stash* stash,float
|
||||
}
|
||||
|
||||
|
||||
void GwenUserInterface::setToggleButtonCallback(btToggleButtonCallback callback)
|
||||
void GwenUserInterface::setToggleButtonCallback(b3ToggleButtonCallback callback)
|
||||
{
|
||||
m_data->m_toggleButtonCallback = callback;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ void GwenUserInterface::registerToggleButton(int buttonId, const char* name)
|
||||
|
||||
}
|
||||
|
||||
void GwenUserInterface::setComboBoxCallback(btComboBoxCallback callback)
|
||||
void GwenUserInterface::setComboBoxCallback(b3ComboBoxCallback callback)
|
||||
{
|
||||
m_data->m_comboBoxCallback = callback;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
struct GwenInternalData;
|
||||
|
||||
typedef void (*btComboBoxCallback) (int combobox, const char* item);
|
||||
typedef void (*btToggleButtonCallback)(int button, int state);
|
||||
typedef void (*b3ComboBoxCallback) (int combobox, const char* item);
|
||||
typedef void (*b3ToggleButtonCallback)(int button, int state);
|
||||
|
||||
class GwenUserInterface
|
||||
{
|
||||
@@ -25,10 +25,10 @@ class GwenUserInterface
|
||||
bool mouseMoveCallback( float x, float y);
|
||||
bool mouseButtonCallback(int button, int state, float x, float y);
|
||||
|
||||
void setToggleButtonCallback(btToggleButtonCallback callback);
|
||||
void setToggleButtonCallback(b3ToggleButtonCallback callback);
|
||||
void registerToggleButton(int buttonId, const char* name);
|
||||
|
||||
void setComboBoxCallback(btComboBoxCallback callback);
|
||||
void setComboBoxCallback(b3ComboBoxCallback callback);
|
||||
void registerComboBox(int buttonId, int numItems, const char** items);
|
||||
|
||||
void setStatusBarMessage(const char* message, bool isLeft=true);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||
//#include "OpenGL3CoreRenderer.h"
|
||||
#include "Bullet3Common/b3Quickprof.h"
|
||||
//#include "btGpuDynamicsWorld.h"
|
||||
//#include "b3GpuDynamicsWorld.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "OpenGLTrueTypeFont/fontstash.h"
|
||||
@@ -44,7 +44,7 @@ static void MyResizeCallback( float width, float height)
|
||||
g_OpenGLHeight = height;
|
||||
}
|
||||
|
||||
btgWindowInterface* window=0;
|
||||
b3gWindowInterface* window=0;
|
||||
GwenUserInterface* gui = 0;
|
||||
bool gPause = false;
|
||||
bool gReset = false;
|
||||
@@ -161,7 +161,7 @@ static void MyMouseMoveCallback( float x, float y)
|
||||
{
|
||||
bool handled = gui ->mouseMoveCallback(x,y);
|
||||
if (!handled)
|
||||
btDefaultMouseMoveCallback(x,y);
|
||||
b3DefaultMouseMoveCallback(x,y);
|
||||
}
|
||||
}
|
||||
static void MyMouseButtonCallback(int button, int state, float x, float y)
|
||||
@@ -170,18 +170,18 @@ static void MyMouseButtonCallback(int button, int state, float x, float y)
|
||||
{
|
||||
bool handled = gui->mouseButtonCallback(button,state,x,y);
|
||||
if (!handled)
|
||||
btDefaultMouseButtonCallback(button,state,x,y);
|
||||
b3DefaultMouseButtonCallback(button,state,x,y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MyKeyboardCallback(int key, int state)
|
||||
{
|
||||
if (key==BTG_ESCAPE && window)
|
||||
if (key==B3G_ESCAPE && window)
|
||||
{
|
||||
window->setRequestExit();
|
||||
}
|
||||
btDefaultKeyboardCallback(key,state);
|
||||
b3DefaultKeyboardCallback(key,state);
|
||||
}
|
||||
|
||||
|
||||
@@ -440,14 +440,14 @@ int main(int argc, char* argv[])
|
||||
printf("Preferred cl_platform index%d\n", ci.preferredOpenCLPlatformIndex);
|
||||
printf("-----------------------------------------------------\n");
|
||||
|
||||
#ifndef BT_NO_PROFILE
|
||||
#ifndef B3_NO_PROFILE
|
||||
CProfileManager::Reset();
|
||||
#endif //BT_NO_PROFILE
|
||||
#endif //B3_NO_PROFILE
|
||||
|
||||
|
||||
window = new btgDefaultOpenGLWindow();
|
||||
window = new b3gDefaultOpenGLWindow();
|
||||
|
||||
btgWindowConstructionInfo wci(g_OpenGLWidth,g_OpenGLHeight);
|
||||
b3gWindowConstructionInfo wci(g_OpenGLWidth,g_OpenGLHeight);
|
||||
|
||||
window->createWindow(wci);
|
||||
window->setResizeCallback(MyResizeCallback);
|
||||
@@ -535,7 +535,7 @@ int main(int argc, char* argv[])
|
||||
float dx=0;
|
||||
if (1)
|
||||
{
|
||||
BT_PROFILE("font sth_draw_text");
|
||||
B3_PROFILE("font sth_draw_text");
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
GLint err = glGetError();
|
||||
@@ -579,7 +579,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
|
||||
window->setWheelCallback(btDefaultWheelCallback);
|
||||
window->setWheelCallback(b3DefaultWheelCallback);
|
||||
|
||||
|
||||
|
||||
@@ -654,7 +654,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
if (!gPause)
|
||||
{
|
||||
BT_PROFILE("clientMoveAndDisplay");
|
||||
B3_PROFILE("clientMoveAndDisplay");
|
||||
|
||||
demo->clientMoveAndDisplay();
|
||||
}
|
||||
@@ -664,16 +664,16 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
{
|
||||
BT_PROFILE("renderScene");
|
||||
B3_PROFILE("renderScene");
|
||||
demo->renderScene();
|
||||
}
|
||||
|
||||
|
||||
/*if (demo->getDynamicsWorld() && demo->getDynamicsWorld()->getNumCollisionObjects())
|
||||
{
|
||||
BT_PROFILE("renderPhysicsWorld");
|
||||
b3AlignedObjectArray<btCollisionObject*> arr = demo->getDynamicsWorld()->getCollisionObjectArray();
|
||||
btCollisionObject** colObjArray = &arr[0];
|
||||
B3_PROFILE("renderPhysicsWorld");
|
||||
b3AlignedObjectArray<b3CollisionObject*> arr = demo->getDynamicsWorld()->getCollisionObjectArray();
|
||||
b3CollisionObject** colObjArray = &arr[0];
|
||||
|
||||
render.renderPhysicsWorld(demo->getDynamicsWorld()->getNumCollisionObjects(),colObjArray, syncOnly);
|
||||
syncOnly = true;
|
||||
@@ -681,15 +681,15 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
*/
|
||||
{
|
||||
BT_PROFILE("gui->draw");
|
||||
B3_PROFILE("gui->draw");
|
||||
gui->draw(g_OpenGLWidth,g_OpenGLHeight);
|
||||
}
|
||||
{
|
||||
BT_PROFILE("window->endRendering");
|
||||
B3_PROFILE("window->endRendering");
|
||||
window->endRendering();
|
||||
}
|
||||
{
|
||||
BT_PROFILE("glFinish");
|
||||
B3_PROFILE("glFinish");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -65,14 +65,14 @@ function createProject(vendor)
|
||||
"../../opencl/gpu_broadphase/host/b3GpuSapBroadphase.cpp",
|
||||
"../../opencl/gpu_narrowphase/host/**.cpp",
|
||||
"../../opencl/gpu_narrowphase/host/**.h",
|
||||
"../../opencl/parallel_primitives/host/btBoundSearchCL.cpp",
|
||||
"../../opencl/parallel_primitives/host/btBoundSearchCL.h",
|
||||
"../../opencl/parallel_primitives/host/btFillCL.cpp",
|
||||
"../../opencl/parallel_primitives/host/btFillCL.h",
|
||||
"../../opencl/parallel_primitives/host/btPrefixScanCL.cpp",
|
||||
"../../opencl/parallel_primitives/host/btPrefixScanCL.h",
|
||||
"../../opencl/parallel_primitives/host/btRadixSort32CL.cpp",
|
||||
"../../opencl/parallel_primitives/host/btRadixSort32CL.h",
|
||||
"../../opencl/parallel_primitives/host/b3BoundSearchCL.cpp",
|
||||
"../../opencl/parallel_primitives/host/b3BoundSearchCL.h",
|
||||
"../../opencl/parallel_primitives/host/b3FillCL.cpp",
|
||||
"../../opencl/parallel_primitives/host/b3FillCL.h",
|
||||
"../../opencl/parallel_primitives/host/b3PrefixScanCL.cpp",
|
||||
"../../opencl/parallel_primitives/host/b3PrefixScanCL.h",
|
||||
"../../opencl/parallel_primitives/host/b3RadixSort32CL.cpp",
|
||||
"../../opencl/parallel_primitives/host/b3RadixSort32CL.h",
|
||||
"../../opencl/gpu_rigidbody/host/**.cpp",
|
||||
"../../opencl/gpu_rigidbody/host/**.h",
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Bullet2FileDemo::~Bullet2FileDemo()
|
||||
|
||||
void Bullet2FileDemo::setupScene(const ConstructionInfo& ci)
|
||||
{
|
||||
btAssert(ci.m_instancingRenderer);
|
||||
b3Assert(ci.m_instancingRenderer);
|
||||
|
||||
const char* fileName="data/testFile.bullet";
|
||||
|
||||
@@ -35,7 +35,7 @@ void Bullet2FileDemo::setupScene(const ConstructionInfo& ci)
|
||||
fclose(f);
|
||||
createScene(*ci.m_instancingRenderer,*m_data->m_np,*m_data->m_rigidBodyPipeline,relativeFileName);
|
||||
}
|
||||
// m_loader = new btBulletDataExtractor(*ci.m_instancingRenderer,*m_data->m_np,*m_data->m_rigidBodyPipeline);
|
||||
// m_loader = new b3BulletDataExtractor(*ci.m_instancingRenderer,*m_data->m_np,*m_data->m_rigidBodyPipeline);
|
||||
// m_loader->convertAllObjects(bulletFile);
|
||||
|
||||
b3Vector3 pos(-20,10,0);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
class Bullet2FileDemo : public GpuRigidBodyDemo
|
||||
{
|
||||
class btBulletDataExtractor* m_loader;
|
||||
class b3BulletDataExtractor* m_loader;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ float Y_GAP = 2.f;
|
||||
float Z_GAP = 2.3f;
|
||||
|
||||
#include "BulletDataExtractor.h"
|
||||
#include "Bullet3Serialize/Bullet2FileLoader/btBulletFile.h"
|
||||
#include "Bullet3Serialize/Bullet2FileLoader/b3BulletFile.h"
|
||||
bool keepStaticObjects = true;
|
||||
extern bool enableExperimentalCpuConcaveCollision;
|
||||
|
||||
@@ -19,7 +19,7 @@ extern bool enableExperimentalCpuConcaveCollision;
|
||||
|
||||
|
||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||
//#include "LinearMath/btQuickprof.h"
|
||||
//#include "LinearMath/b3Quickprof.h"
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
#include "Bullet3Common/b3Matrix3x3.h"
|
||||
#include "gpu_narrowphase/host/b3ConvexUtility.h"
|
||||
@@ -54,7 +54,7 @@ struct GraphicsShape
|
||||
|
||||
struct InstanceGroup
|
||||
{
|
||||
Bullet::btCollisionShapeData* m_shape;
|
||||
Bullet::b3CollisionShapeData* m_shape;
|
||||
int m_collisionShapeIndex;
|
||||
|
||||
b3AlignedObjectArray<bParse::bStructHandle*> m_rigidBodies;
|
||||
@@ -80,7 +80,7 @@ void createScene( GLInstancingRenderer& renderer,b3GpuNarrowPhase& np, b3GpuRigi
|
||||
|
||||
bool verboseDumpAllTypes = false;
|
||||
|
||||
bParse::btBulletFile* bulletFile2 = new bParse::btBulletFile(fileName);
|
||||
bParse::b3BulletFile* bulletFile2 = new bParse::b3BulletFile(fileName);
|
||||
|
||||
bool ok = (bulletFile2->getFlags()& bParse::FD_OK)!=0;
|
||||
|
||||
@@ -107,7 +107,7 @@ void createScene( GLInstancingRenderer& renderer,b3GpuNarrowPhase& np, b3GpuRigi
|
||||
}
|
||||
|
||||
|
||||
btBulletDataExtractor extractor(renderer,np,rbWorld);
|
||||
b3BulletDataExtractor extractor(renderer,np,rbWorld);
|
||||
|
||||
extractor.convertAllObjects(bulletFile2);
|
||||
delete bulletFile2;
|
||||
@@ -181,24 +181,24 @@ CONCAVE_SHAPES_END_HERE,
|
||||
|
||||
};
|
||||
|
||||
btBulletDataExtractor::btBulletDataExtractor(GLInstancingRenderer& renderer, b3GpuNarrowPhase& np, b3GpuRigidBodyPipeline& rbWorld)
|
||||
b3BulletDataExtractor::b3BulletDataExtractor(GLInstancingRenderer& renderer, b3GpuNarrowPhase& np, b3GpuRigidBodyPipeline& rbWorld)
|
||||
:m_renderer(renderer), m_np(np), m_rbPipeline(rbWorld)
|
||||
{
|
||||
}
|
||||
|
||||
btBulletDataExtractor::~btBulletDataExtractor()
|
||||
b3BulletDataExtractor::~b3BulletDataExtractor()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void btBulletDataExtractor::convertAllObjects(bParse::btBulletFile* bulletFile2)
|
||||
void b3BulletDataExtractor::convertAllObjects(bParse::b3BulletFile* bulletFile2)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<bulletFile2->m_collisionShapes.size();i++)
|
||||
{
|
||||
Bullet::btCollisionShapeData* shapeData = (Bullet::btCollisionShapeData*)bulletFile2->m_collisionShapes[i];
|
||||
Bullet::b3CollisionShapeData* shapeData = (Bullet::b3CollisionShapeData*)bulletFile2->m_collisionShapes[i];
|
||||
if (shapeData->m_name)
|
||||
printf("converting shape %s\n", shapeData->m_name);
|
||||
int shapeIndex = convertCollisionShape(shapeData);
|
||||
@@ -216,8 +216,8 @@ void btBulletDataExtractor::convertAllObjects(bParse::btBulletFile* bulletFile2)
|
||||
for (i=0;i<bulletFile2->m_rigidBodies.size();i++)
|
||||
{
|
||||
|
||||
Bullet::btRigidBodyFloatData* colObjData = (Bullet::btRigidBodyFloatData*)bulletFile2->m_rigidBodies[i];
|
||||
Bullet::btCollisionShapeData* shapeData = (Bullet::btCollisionShapeData*)colObjData->m_collisionObjectData.m_collisionShape;
|
||||
Bullet::b3RigidBodyFloatData* colObjData = (Bullet::b3RigidBodyFloatData*)bulletFile2->m_rigidBodies[i];
|
||||
Bullet::b3CollisionShapeData* shapeData = (Bullet::b3CollisionShapeData*)colObjData->m_collisionObjectData.m_collisionShape;
|
||||
for (int j=0;j<m_instanceGroups.size();j++)
|
||||
{
|
||||
if (m_instanceGroups[j]->m_shape == shapeData)
|
||||
@@ -237,10 +237,10 @@ void btBulletDataExtractor::convertAllObjects(bParse::btBulletFile* bulletFile2)
|
||||
|
||||
for (int j=0;j<m_instanceGroups[i]->m_rigidBodies.size();j++)
|
||||
{
|
||||
Bullet::btRigidBodyFloatData* colObjData = (Bullet::btRigidBodyFloatData*)m_instanceGroups[i]->m_rigidBodies[j];
|
||||
Bullet::b3RigidBodyFloatData* colObjData = (Bullet::b3RigidBodyFloatData*)m_instanceGroups[i]->m_rigidBodies[j];
|
||||
|
||||
b3Matrix3x3 mat;
|
||||
mat.deSerializeFloat((const btMatrix3x3FloatData&)colObjData->m_collisionObjectData.m_worldTransform.m_basis);
|
||||
mat.deSerializeFloat((const b3Matrix3x3FloatData&)colObjData->m_collisionObjectData.m_worldTransform.m_basis);
|
||||
b3Quaternion orn;
|
||||
mat.getRotation(orn);
|
||||
float quaternion[4] = {orn[0],orn[1],orn[2],orn[3]};
|
||||
@@ -283,7 +283,7 @@ void btBulletDataExtractor::convertAllObjects(bParse::btBulletFile* bulletFile2)
|
||||
|
||||
|
||||
|
||||
int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData* shapeData )
|
||||
int b3BulletDataExtractor::convertCollisionShape( Bullet::b3CollisionShapeData* shapeData )
|
||||
{
|
||||
int shapeIndex = -1;
|
||||
|
||||
@@ -291,7 +291,7 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
{
|
||||
case STATIC_PLANE_PROXYTYPE:
|
||||
{
|
||||
Bullet::btStaticPlaneShapeData* planeData = (Bullet::btStaticPlaneShapeData*)shapeData;
|
||||
Bullet::b3StaticPlaneShapeData* planeData = (Bullet::b3StaticPlaneShapeData*)shapeData;
|
||||
shapeIndex = createPlaneShape(planeData->m_planeNormal,planeData->m_planeConstant, planeData->m_localScaling);
|
||||
break;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
case MULTI_SPHERE_SHAPE_PROXYTYPE:
|
||||
case CONVEX_HULL_SHAPE_PROXYTYPE:
|
||||
{
|
||||
Bullet::btConvexInternalShapeData* bsd = (Bullet::btConvexInternalShapeData*)shapeData;
|
||||
Bullet::b3ConvexInternalShapeData* bsd = (Bullet::b3ConvexInternalShapeData*)shapeData;
|
||||
|
||||
switch (shapeData->m_shapeType)
|
||||
{
|
||||
@@ -319,10 +319,10 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
}
|
||||
case CONVEX_HULL_SHAPE_PROXYTYPE:
|
||||
{
|
||||
Bullet::btConvexHullShapeData* convexData = (Bullet::btConvexHullShapeData*)bsd;
|
||||
Bullet::b3ConvexHullShapeData* convexData = (Bullet::b3ConvexHullShapeData*)bsd;
|
||||
int numPoints = convexData->m_numUnscaledPoints;
|
||||
b3Vector3 localScaling;
|
||||
localScaling.deSerializeFloat((btVector3FloatData&)bsd->m_localScaling);
|
||||
localScaling.deSerializeFloat((b3Vector3FloatData&)bsd->m_localScaling);
|
||||
b3AlignedObjectArray<b3Vector3> tmpPoints;
|
||||
int i;
|
||||
if (convexData->m_unscaledPointsFloatPtr)
|
||||
@@ -355,7 +355,7 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
#if 0
|
||||
case CAPSULE_SHAPE_PROXYTYPE:
|
||||
{
|
||||
btCapsuleShapeData* capData = (btCapsuleShapeData*)shapeData;
|
||||
b3CapsuleShapeData* capData = (b3CapsuleShapeData*)shapeData;
|
||||
switch (capData->m_upAxis)
|
||||
{
|
||||
case 0:
|
||||
@@ -375,7 +375,7 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
}
|
||||
default:
|
||||
{
|
||||
printf("error: wrong up axis for btCapsuleShape\n");
|
||||
printf("error: wrong up axis for b3CapsuleShape\n");
|
||||
}
|
||||
|
||||
};
|
||||
@@ -384,7 +384,7 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
}
|
||||
case CYLINDER_SHAPE_PROXYTYPE:
|
||||
{
|
||||
btCylinderShapeData* cylData = (btCylinderShapeData*) shapeData;
|
||||
b3CylinderShapeData* cylData = (b3CylinderShapeData*) shapeData;
|
||||
b3Vector3 halfExtents = implicitShapeDimensions+margin;
|
||||
switch (cylData->m_upAxis)
|
||||
{
|
||||
@@ -416,7 +416,7 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
}
|
||||
case MULTI_SPHERE_SHAPE_PROXYTYPE:
|
||||
{
|
||||
btMultiSphereShapeData* mss = (btMultiSphereShapeData*)bsd;
|
||||
b3MultiSphereShapeData* mss = (b3MultiSphereShapeData*)bsd;
|
||||
int numSpheres = mss->m_localPositionArraySize;
|
||||
int i;
|
||||
for ( i=0;i<numSpheres;i++)
|
||||
@@ -424,7 +424,7 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
tmpPos[i].deSerializeFloat(mss->m_localPositionArrayPtr[i].m_pos);
|
||||
radii[i] = mss->m_localPositionArrayPtr[i].m_radius;
|
||||
}
|
||||
shape = new btMultiSphereShape(&tmpPos[0],&radii[0],numSpheres);
|
||||
shape = new b3MultiSphereShape(&tmpPos[0],&radii[0],numSpheres);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -441,13 +441,13 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
|
||||
case TRIANGLE_MESH_SHAPE_PROXYTYPE:
|
||||
{
|
||||
Bullet::btTriangleMeshShapeData* trimesh = (Bullet::btTriangleMeshShapeData*)shapeData;
|
||||
Bullet::b3TriangleMeshShapeData* trimesh = (Bullet::b3TriangleMeshShapeData*)shapeData;
|
||||
printf("numparts = %d\n",trimesh->m_meshInterface.m_numMeshParts);
|
||||
if (trimesh->m_meshInterface.m_numMeshParts)
|
||||
{
|
||||
for (int i=0;i<trimesh->m_meshInterface.m_numMeshParts;i++)
|
||||
{
|
||||
Bullet::btMeshPartData& dat = trimesh->m_meshInterface.m_meshPartsPtr[i];
|
||||
Bullet::b3MeshPartData& dat = trimesh->m_meshInterface.m_meshPartsPtr[i];
|
||||
printf("numtris = %d, numverts = %d\n", dat.m_numTriangles,dat.m_numVertices);//,dat.m_vertices3f,dat.m_3indices16
|
||||
printf("scaling = %f,%f,%f\n", trimesh->m_meshInterface.m_scaling.m_floats[0],trimesh->m_meshInterface.m_scaling.m_floats[1],trimesh->m_meshInterface.m_scaling.m_floats[2]);
|
||||
// dat.
|
||||
@@ -459,7 +459,7 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
//trimesh->m_meshInterface.m_scaling
|
||||
}
|
||||
//trimesh->m_meshInterface
|
||||
//btTriangleIndexVertexArray* meshInterface = createMeshInterface(trimesh->m_meshInterface);
|
||||
//b3TriangleIndexVertexArray* meshInterface = createMeshInterface(trimesh->m_meshInterface);
|
||||
|
||||
|
||||
//scaling
|
||||
@@ -473,17 +473,17 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
#if 0
|
||||
case COMPOUND_SHAPE_PROXYTYPE:
|
||||
{
|
||||
btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData;
|
||||
btCompoundShape* compoundShape = createCompoundShape();
|
||||
b3CompoundShapeData* compoundData = (b3CompoundShapeData*)shapeData;
|
||||
b3CompoundShape* compoundShape = createCompoundShape();
|
||||
|
||||
|
||||
b3AlignedObjectArray<btCollisionShape*> childShapes;
|
||||
b3AlignedObjectArray<b3CollisionShape*> childShapes;
|
||||
for (int i=0;i<compoundData->m_numChildShapes;i++)
|
||||
{
|
||||
btCollisionShape* childShape = convertCollisionShape(compoundData->m_childShapePtr[i].m_childShape);
|
||||
b3CollisionShape* childShape = convertCollisionShape(compoundData->m_childShapePtr[i].m_childShape);
|
||||
if (childShape)
|
||||
{
|
||||
btTransform localTransform;
|
||||
b3Transform localTransform;
|
||||
localTransform.deSerializeFloat(compoundData->m_childShapePtr[i].m_transform);
|
||||
compoundShape->addChildShape(localTransform,childShape);
|
||||
} else
|
||||
@@ -499,11 +499,11 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
|
||||
case GIMPACT_SHAPE_PROXYTYPE:
|
||||
{
|
||||
btGImpactMeshShapeData* gimpactData = (btGImpactMeshShapeData*) shapeData;
|
||||
b3GImpactMeshShapeData* gimpactData = (b3GImpactMeshShapeData*) shapeData;
|
||||
if (gimpactData->m_gimpactSubType == CONST_GIMPACT_TRIMESH_SHAPE)
|
||||
{
|
||||
btTriangleIndexVertexArray* meshInterface = createMeshInterface(gimpactData->m_meshInterface);
|
||||
btGImpactMeshShape* gimpactShape = createGimpactShape(meshInterface);
|
||||
b3TriangleIndexVertexArray* meshInterface = createMeshInterface(gimpactData->m_meshInterface);
|
||||
b3GImpactMeshShape* gimpactShape = createGimpactShape(meshInterface);
|
||||
b3Vector3 localScaling;
|
||||
localScaling.deSerializeFloat(gimpactData->m_localScaling);
|
||||
gimpactShape->setLocalScaling(localScaling);
|
||||
@@ -531,7 +531,7 @@ int btBulletDataExtractor::convertCollisionShape( Bullet::btCollisionShapeData*
|
||||
|
||||
}
|
||||
|
||||
int btBulletDataExtractor::createBoxShape( const Bullet::btVector3FloatData& halfDimensions, const Bullet::btVector3FloatData& localScaling, float collisionMargin)
|
||||
int b3BulletDataExtractor::createBoxShape( const Bullet::b3Vector3FloatData& halfDimensions, const Bullet::b3Vector3FloatData& localScaling, float collisionMargin)
|
||||
{
|
||||
float cubeScaling[4] = {
|
||||
halfDimensions.m_floats[0]*localScaling.m_floats[0]+collisionMargin,
|
||||
@@ -561,14 +561,14 @@ int btBulletDataExtractor::createBoxShape( const Bullet::btVector3FloatData& hal
|
||||
return cubeCollisionShapeIndex;
|
||||
}
|
||||
|
||||
int btBulletDataExtractor::createSphereShape( float radius, const Bullet::btVector3FloatData& localScaling, float collisionMargin)
|
||||
int b3BulletDataExtractor::createSphereShape( float radius, const Bullet::b3Vector3FloatData& localScaling, float collisionMargin)
|
||||
{
|
||||
printf("createSphereShape with radius %f\n",radius);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int btBulletDataExtractor::createPlaneShape( const Bullet::btVector3FloatData& planeNormal, float planeConstant, const Bullet::btVector3FloatData& localScaling)
|
||||
int b3BulletDataExtractor::createPlaneShape( const Bullet::b3Vector3FloatData& planeNormal, float planeConstant, const Bullet::b3Vector3FloatData& localScaling)
|
||||
{
|
||||
printf("createPlaneShape with normal %f,%f,%f and planeConstant\n",planeNormal.m_floats[0], planeNormal.m_floats[1],planeNormal.m_floats[2],planeConstant);
|
||||
return -1;
|
||||
@@ -576,7 +576,7 @@ int btBulletDataExtractor::createPlaneShape( const Bullet::btVector3FloatData& p
|
||||
|
||||
|
||||
|
||||
GraphicsShape* btBulletDataExtractor::createGraphicsShapeFromWavefrontObj(objLoader* obj)
|
||||
GraphicsShape* b3BulletDataExtractor::createGraphicsShapeFromWavefrontObj(objLoader* obj)
|
||||
{
|
||||
b3AlignedObjectArray<GraphicsVertex>* vertices = new b3AlignedObjectArray<GraphicsVertex>;
|
||||
{
|
||||
@@ -701,7 +701,7 @@ GraphicsShape* btBulletDataExtractor::createGraphicsShapeFromWavefrontObj(objLoa
|
||||
}
|
||||
|
||||
|
||||
GraphicsShape* btBulletDataExtractor::createGraphicsShapeFromConvexHull(const b3Vector3* tmpPoints, int numPoints)
|
||||
GraphicsShape* b3BulletDataExtractor::createGraphicsShapeFromConvexHull(const b3Vector3* tmpPoints, int numPoints)
|
||||
{
|
||||
b3ConvexUtility* utilPtr = new b3ConvexUtility();
|
||||
bool merge = true;
|
||||
@@ -714,7 +714,7 @@ GraphicsShape* btBulletDataExtractor::createGraphicsShapeFromConvexHull(const b3
|
||||
b3AlignedObjectArray<int>* indicesPtr = new b3AlignedObjectArray<int>;
|
||||
for (int f=0;f<utilPtr->m_faces.size();f++)
|
||||
{
|
||||
const btMyFace& face = utilPtr->m_faces[f];
|
||||
const b3MyFace& face = utilPtr->m_faces[f];
|
||||
b3Vector3 normal(face.m_plane[0],face.m_plane[1],face.m_plane[2]);
|
||||
if (face.m_indices.size()>2)
|
||||
{
|
||||
|
||||
@@ -14,10 +14,10 @@ void createScene(GLInstancingRenderer& renderer,b3GpuNarrowPhase& np, b3GpuRigid
|
||||
|
||||
namespace bParse
|
||||
{
|
||||
class btBulletFile;
|
||||
class b3BulletFile;
|
||||
};
|
||||
|
||||
class btBulletDataExtractor
|
||||
class b3BulletDataExtractor
|
||||
{
|
||||
GLInstancingRenderer& m_renderer;
|
||||
b3GpuNarrowPhase& m_np;
|
||||
@@ -28,20 +28,20 @@ class btBulletDataExtractor
|
||||
b3AlignedObjectArray<struct InstanceGroup*> m_instanceGroups;
|
||||
b3AlignedObjectArray<struct GraphicsShape*> m_graphicsShapes;
|
||||
|
||||
btBulletDataExtractor(GLInstancingRenderer& renderer, b3GpuNarrowPhase& np, b3GpuRigidBodyPipeline& rbPipeline);
|
||||
b3BulletDataExtractor(GLInstancingRenderer& renderer, b3GpuNarrowPhase& np, b3GpuRigidBodyPipeline& rbPipeline);
|
||||
|
||||
virtual ~btBulletDataExtractor();
|
||||
virtual ~b3BulletDataExtractor();
|
||||
|
||||
virtual void convertAllObjects(bParse::btBulletFile* bulletFile);
|
||||
virtual void convertAllObjects(bParse::b3BulletFile* bulletFile);
|
||||
|
||||
//return -1 for invalid
|
||||
virtual int convertCollisionShape( Bullet::btCollisionShapeData* shapeData );
|
||||
virtual int convertCollisionShape( Bullet::b3CollisionShapeData* shapeData );
|
||||
|
||||
virtual int createPlaneShape( const Bullet::btVector3FloatData& planeNormal, float planeConstant, const Bullet::btVector3FloatData& localScaling);
|
||||
virtual int createPlaneShape( const Bullet::b3Vector3FloatData& planeNormal, float planeConstant, const Bullet::b3Vector3FloatData& localScaling);
|
||||
|
||||
virtual int createBoxShape( const Bullet::btVector3FloatData& halfDimensions, const Bullet::btVector3FloatData& localScaling, float collisionMargin);
|
||||
virtual int createBoxShape( const Bullet::b3Vector3FloatData& halfDimensions, const Bullet::b3Vector3FloatData& localScaling, float collisionMargin);
|
||||
|
||||
virtual int createSphereShape( float radius, const Bullet::btVector3FloatData& localScaling, float collisionMargin);
|
||||
virtual int createSphereShape( float radius, const Bullet::b3Vector3FloatData& localScaling, float collisionMargin);
|
||||
|
||||
static GraphicsShape* createGraphicsShapeFromConvexHull(const b3Vector3* tmpPoints, int numPoints);
|
||||
static GraphicsShape* createGraphicsShapeFromWavefrontObj(class objLoader* obj);
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
#include "OpenGLWindow/btgWindowInterface.h"
|
||||
#include "OpenGLWindow/b3gWindowInterface.h"
|
||||
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
|
||||
#include "../GpuDemoInternalData.h"
|
||||
#include "basic_initialize/b3OpenCLUtils.h"
|
||||
#include "OpenGLWindow/OpenGLInclude.h"
|
||||
#include "OpenGLWindow/GLInstanceRendererInternalData.h"
|
||||
#include "parallel_primitives/host/btLauncherCL.h"
|
||||
#include "parallel_primitives/host/b3LauncherCL.h"
|
||||
#include "gpu_rigidbody/host/b3GpuRigidBodyPipeline.h"
|
||||
#include "gpu_rigidbody/host/b3GpuNarrowPhase.h"
|
||||
#include "gpu_rigidbody/host/b3Config.h"
|
||||
@@ -216,7 +216,7 @@ void ConcaveScene::createConcaveMesh(const ConstructionInfo& ci, const char* fil
|
||||
int shapeId = ci.m_instancingRenderer->registerShape(&shape->m_vertices->at(0).xyzw[0], shape->m_numvertices, &shape->m_indices->at(0), shape->m_numIndices);
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color(0.3,0.3,1,1.f);//0.5);//1.f
|
||||
b3Vector4 color(0.3,0.3,1,1.f);//0.5);//1.f
|
||||
|
||||
|
||||
{
|
||||
@@ -256,7 +256,7 @@ void ConcaveScene::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
b3Vector3 shift1(0,-50,0);//0,230,80);//150,-100,-120);
|
||||
|
||||
btVector4 scaling(4,4,4,1);
|
||||
b3Vector4 scaling(4,4,4,1);
|
||||
|
||||
// createConcaveMesh(ci,"data/plane100.obj",shift1,scaling);
|
||||
//createConcaveMesh(ci,"data/plane100.obj",shift,scaling);
|
||||
@@ -278,12 +278,12 @@ void ConcaveScene::setupScene(const ConstructionInfo& ci)
|
||||
int mask=1;
|
||||
int index=0;
|
||||
{
|
||||
btVector4 scaling(400,0.001,400,1);
|
||||
b3Vector4 scaling(400,0.001,400,1);
|
||||
int colIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
|
||||
b3Vector3 position(0,-2,0);
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color(0,0,1,1);
|
||||
b3Vector4 color(0,0,1,1);
|
||||
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false);
|
||||
@@ -320,15 +320,15 @@ void ConcaveScene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
if (1)
|
||||
{
|
||||
int curColor = 0;
|
||||
btVector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
btVector4(1,1,1,1),
|
||||
btVector4(1,1,0.3,1),
|
||||
btVector4(0.3,1,1,1),
|
||||
btVector4(0.3,0.3,1,1),
|
||||
b3Vector4(1,1,1,1),
|
||||
b3Vector4(1,1,0.3,1),
|
||||
b3Vector4(0.3,1,1,1),
|
||||
b3Vector4(0.3,0.3,1,1),
|
||||
};
|
||||
|
||||
btVector4 scaling(1,1,1,1);
|
||||
b3Vector4 scaling(1,1,1,1);
|
||||
int colIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
|
||||
for (int i=0;i<ci.arraySizeX;i++)
|
||||
{
|
||||
@@ -342,7 +342,7 @@ void ConcaveScene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
b3Vector3 position(-(ci.arraySizeX/2)*CONCAVE_GAPX+i*CONCAVE_GAPX,150+j*CONCAVE_GAPY,-(ci.arraySizeZ/2)*CONCAVE_GAPZ+k*CONCAVE_GAPZ);
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color = colors[curColor];
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
|
||||
@@ -379,7 +379,7 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
|
||||
|
||||
b3Vector3 shift(0,0,0);//0,230,80);//150,-100,-120);
|
||||
btVector4 scaling(1,1,1,1);
|
||||
b3Vector4 scaling(1,1,1,1);
|
||||
FILE* f = 0;
|
||||
|
||||
char relativeFileName[1024];
|
||||
@@ -427,12 +427,12 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
|
||||
b3AlignedObjectArray<GLInstanceVertex> vertices;
|
||||
int stride2 = sizeof(GLInstanceVertex);
|
||||
btAssert(stride2 == strideInBytes);
|
||||
b3Assert(stride2 == strideInBytes);
|
||||
|
||||
{
|
||||
|
||||
|
||||
b3AlignedObjectArray<btGpuChildShape> childShapes;
|
||||
b3AlignedObjectArray<b3GpuChildShape> childShapes;
|
||||
|
||||
int numChildShapes = objData->objectCount;
|
||||
|
||||
@@ -448,7 +448,7 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
|
||||
|
||||
//for now, only support polyhedral child shapes
|
||||
btGpuChildShape child;
|
||||
b3GpuChildShape child;
|
||||
|
||||
b3Vector3 pos(0,0,0);
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
@@ -476,7 +476,7 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
}
|
||||
} else
|
||||
{
|
||||
btAssert(0);
|
||||
b3Assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,12 +545,12 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
//int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
||||
int shapeId = ci.m_instancingRenderer->registerShape(&vertexArray[0].xyzw[0],vertexArray.size(),&indexArray[0],indexArray.size());
|
||||
|
||||
btVector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
btVector4(1,0,0,1),
|
||||
btVector4(0,1,0,1),
|
||||
btVector4(0,0,1,1),
|
||||
btVector4(0,1,1,1),
|
||||
b3Vector4(1,0,0,1),
|
||||
b3Vector4(0,1,0,1),
|
||||
b3Vector4(0,0,1,1),
|
||||
b3Vector4(0,1,1,1),
|
||||
};
|
||||
|
||||
int curColor = 0;
|
||||
@@ -569,10 +569,10 @@ void ConcaveCompound2Scene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
// b3Quaternion orn(0,0,0,1);
|
||||
b3Quaternion orn(b3Vector3(0,0,1),1.8);
|
||||
|
||||
btVector4 color = colors[curColor];
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
btVector4 scaling(1,1,1,1);
|
||||
b3Vector4 scaling(1,1,1,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
|
||||
|
||||
@@ -605,7 +605,7 @@ void ConcaveCompoundScene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
|
||||
GLInstanceVertex* cubeVerts = (GLInstanceVertex*)&cube_vertices[0];
|
||||
int stride2 = sizeof(GLInstanceVertex);
|
||||
btAssert(stride2 == strideInBytes);
|
||||
b3Assert(stride2 == strideInBytes);
|
||||
|
||||
{
|
||||
int childColIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
|
||||
@@ -617,12 +617,12 @@ b3Vector3 childPositions[3] = {
|
||||
b3Vector3(0,0,2)
|
||||
};
|
||||
|
||||
b3AlignedObjectArray<btGpuChildShape> childShapes;
|
||||
b3AlignedObjectArray<b3GpuChildShape> childShapes;
|
||||
int numChildShapes = 3;
|
||||
for (int i=0;i<numChildShapes;i++)
|
||||
{
|
||||
//for now, only support polyhedral child shapes
|
||||
btGpuChildShape child;
|
||||
b3GpuChildShape child;
|
||||
child.m_shapeIndex = childColIndex;
|
||||
b3Vector3 pos = childPositions[i];
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
@@ -662,12 +662,12 @@ b3Vector3 childPositions[3] = {
|
||||
//int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
||||
int shapeId = ci.m_instancingRenderer->registerShape(&vertexArray[0].xyzw[0],vertexArray.size(),&indexArray[0],indexArray.size());
|
||||
|
||||
btVector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
btVector4(1,0,0,1),
|
||||
btVector4(0,1,0,1),
|
||||
btVector4(0,0,1,1),
|
||||
btVector4(0,1,1,1),
|
||||
b3Vector4(1,0,0,1),
|
||||
b3Vector4(0,1,0,1),
|
||||
b3Vector4(0,0,1,1),
|
||||
b3Vector4(0,1,1,1),
|
||||
};
|
||||
|
||||
int curColor = 0;
|
||||
@@ -684,10 +684,10 @@ b3Vector3 childPositions[3] = {
|
||||
//b3Quaternion orn(0,0,0,1);
|
||||
b3Quaternion orn(b3Vector3(1,0,0),0.7);
|
||||
|
||||
btVector4 color = colors[curColor];
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
btVector4 scaling(1,1,1,1);
|
||||
b3Vector4 scaling(1,1,1,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
|
||||
|
||||
@@ -713,12 +713,12 @@ void ConcaveSphereScene::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
void ConcaveSphereScene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
{
|
||||
btVector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
btVector4(1,0,0,1),
|
||||
btVector4(0,1,0,1),
|
||||
btVector4(0,1,1,1),
|
||||
btVector4(1,1,0,1),
|
||||
b3Vector4(1,0,0,1),
|
||||
b3Vector4(0,1,0,1),
|
||||
b3Vector4(0,1,1,1),
|
||||
b3Vector4(1,1,0,1),
|
||||
};
|
||||
|
||||
int index=0;
|
||||
@@ -743,10 +743,10 @@ void ConcaveSphereScene::createDynamicObjects(const ConstructionInfo& ci)
|
||||
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color = colors[curColor];
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
btVector4 scaling(radius,radius,radius,1);
|
||||
b3Vector4 scaling(radius,radius,radius,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(prevGraphicsShapeIndex,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
#include "OpenGLWindow/btgWindowInterface.h"
|
||||
#include "OpenGLWindow/b3gWindowInterface.h"
|
||||
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
|
||||
#include "../GpuDemoInternalData.h"
|
||||
#include "basic_initialize/b3OpenCLUtils.h"
|
||||
#include "OpenGLWindow/OpenGLInclude.h"
|
||||
#include "OpenGLWindow/GLInstanceRendererInternalData.h"
|
||||
#include "parallel_primitives/host/btLauncherCL.h"
|
||||
#include "parallel_primitives/host/b3LauncherCL.h"
|
||||
#include "gpu_rigidbody/host/b3GpuRigidBodyPipeline.h"
|
||||
#include "gpu_rigidbody/host/b3GpuNarrowPhase.h"
|
||||
#include "gpu_rigidbody/host/b3Config.h"
|
||||
@@ -34,7 +34,7 @@ void GpuCompoundScene::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
GLInstanceVertex* cubeVerts = (GLInstanceVertex*)&cube_vertices[0];
|
||||
int stride2 = sizeof(GLInstanceVertex);
|
||||
btAssert(stride2 == strideInBytes);
|
||||
b3Assert(stride2 == strideInBytes);
|
||||
int index=0;
|
||||
int colIndex = -1;
|
||||
b3AlignedObjectArray<GLInstanceVertex> vertexArray;
|
||||
@@ -50,12 +50,12 @@ void GpuCompoundScene::setupScene(const ConstructionInfo& ci)
|
||||
};
|
||||
|
||||
|
||||
b3AlignedObjectArray<btGpuChildShape> childShapes;
|
||||
b3AlignedObjectArray<b3GpuChildShape> childShapes;
|
||||
int numChildShapes = 3;
|
||||
for (int i=0;i<numChildShapes;i++)
|
||||
{
|
||||
//for now, only support polyhedral child shapes
|
||||
btGpuChildShape child;
|
||||
b3GpuChildShape child;
|
||||
child.m_shapeIndex = childColIndex;
|
||||
b3Vector3 pos = childPositions[i];
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
@@ -96,12 +96,12 @@ void GpuCompoundScene::setupScene(const ConstructionInfo& ci)
|
||||
//int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
||||
int shapeId = ci.m_instancingRenderer->registerShape(&vertexArray[0].xyzw[0],vertexArray.size(),&indexArray[0],indexArray.size());
|
||||
|
||||
btVector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
btVector4(1,0,0,1),
|
||||
btVector4(0,1,0,1),
|
||||
btVector4(0,0,1,1),
|
||||
btVector4(0,1,1,1),
|
||||
b3Vector4(1,0,0,1),
|
||||
b3Vector4(0,1,0,1),
|
||||
b3Vector4(0,0,1,1),
|
||||
b3Vector4(0,1,1,1),
|
||||
};
|
||||
|
||||
int curColor = 0;
|
||||
@@ -117,10 +117,10 @@ void GpuCompoundScene::setupScene(const ConstructionInfo& ci)
|
||||
//b3Quaternion orn(0,0,0,1);
|
||||
b3Quaternion orn(b3Vector3(1,0,0),0.7);
|
||||
|
||||
btVector4 color = colors[curColor];
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
btVector4 scaling(1,1,1,1);
|
||||
b3Vector4 scaling(1,1,1,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
|
||||
|
||||
@@ -179,7 +179,7 @@ void GpuCompoundScene::createStaticEnvironment(const ConstructionInfo& ci)
|
||||
{
|
||||
int numVertices = sizeof(point_sphere_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(point_sphere_indices)/sizeof(int);
|
||||
prevGraphicsShapeIndex = ci.m_instancingRenderer->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,BT_GL_POINTS);
|
||||
prevGraphicsShapeIndex = ci.m_instancingRenderer->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,B3_GL_POINTS);
|
||||
} else
|
||||
{
|
||||
if (radius>=10)
|
||||
@@ -197,12 +197,12 @@ void GpuCompoundScene::createStaticEnvironment(const ConstructionInfo& ci)
|
||||
}
|
||||
|
||||
}
|
||||
btVector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
btVector4(1,0,0,1),
|
||||
btVector4(0,1,0,1),
|
||||
btVector4(0,1,1,1),
|
||||
btVector4(1,1,0,1),
|
||||
b3Vector4(1,0,0,1),
|
||||
b3Vector4(0,1,0,1),
|
||||
b3Vector4(0,1,1,1),
|
||||
b3Vector4(1,1,0,1),
|
||||
};
|
||||
|
||||
int curColor = 1;
|
||||
@@ -217,10 +217,10 @@ void GpuCompoundScene::createStaticEnvironment(const ConstructionInfo& ci)
|
||||
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color = colors[curColor];
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
btVector4 scaling(radius,radius,radius,1);
|
||||
b3Vector4 scaling(radius,radius,radius,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(prevGraphicsShapeIndex,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
|
||||
|
||||
@@ -241,8 +241,8 @@ void GpuCompoundPlaneScene::createStaticEnvironment(const ConstructionInfo& ci)
|
||||
b3Vector3 position(0,0,0);
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
// b3Quaternion orn(b3Vector3(1,0,0),0.3);
|
||||
btVector4 color(0,0,1,1);
|
||||
btVector4 scaling(100,0.01,100,1);
|
||||
b3Vector4 color(0,0,1,1);
|
||||
b3Vector4 scaling(100,0.01,100,1);
|
||||
int strideInBytes = 9*sizeof(float);
|
||||
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(cube_indices)/sizeof(int);
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
#include "OpenGLWindow/btgWindowInterface.h"
|
||||
#include "OpenGLWindow/b3gWindowInterface.h"
|
||||
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
|
||||
#include "../GpuDemoInternalData.h"
|
||||
#include "basic_initialize/b3OpenCLUtils.h"
|
||||
#include "OpenGLWindow/OpenGLInclude.h"
|
||||
#include "OpenGLWindow/GLInstanceRendererInternalData.h"
|
||||
#include "parallel_primitives/host/btLauncherCL.h"
|
||||
#include "parallel_primitives/host/b3LauncherCL.h"
|
||||
#include "gpu_rigidbody/host/b3GpuRigidBodyPipeline.h"
|
||||
#include "gpu_rigidbody/host/b3GpuNarrowPhase.h"
|
||||
#include "gpu_rigidbody/host/b3Config.h"
|
||||
@@ -73,12 +73,12 @@ int GpuConvexScene::createDynamicsObjects2(const ConstructionInfo& ci, const flo
|
||||
|
||||
|
||||
{
|
||||
btVector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
btVector4(1,0,0,1),
|
||||
btVector4(0,1,0,1),
|
||||
btVector4(0,1,1,1),
|
||||
btVector4(1,1,0,1),
|
||||
b3Vector4(1,0,0,1),
|
||||
b3Vector4(0,1,0,1),
|
||||
b3Vector4(0,1,1,1),
|
||||
b3Vector4(1,1,0,1),
|
||||
};
|
||||
|
||||
int curColor = 0;
|
||||
@@ -104,10 +104,10 @@ int GpuConvexScene::createDynamicsObjects2(const ConstructionInfo& ci, const flo
|
||||
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color = colors[curColor];
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
btVector4 scaling(1,1,1,1);
|
||||
b3Vector4 scaling(1,1,1,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
|
||||
|
||||
@@ -140,12 +140,12 @@ void GpuConvexScene::createStaticEnvironment(const ConstructionInfo& ci)
|
||||
|
||||
|
||||
{
|
||||
btVector4 scaling(400,1,400,1);
|
||||
b3Vector4 scaling(400,1,400,1);
|
||||
int colIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
|
||||
b3Vector3 position(0,0,0);
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color(0,0,1,1);
|
||||
b3Vector4 color(0,0,1,1);
|
||||
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false);
|
||||
@@ -162,8 +162,8 @@ void GpuConvexPlaneScene::createStaticEnvironment(const ConstructionInfo& ci)
|
||||
b3Vector3 position(0,0,0);
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
// b3Quaternion orn(b3Vector3(1,0,0),0.3);
|
||||
btVector4 color(0,0,1,1);
|
||||
btVector4 scaling(100,0.001,100,1);
|
||||
b3Vector4 color(0,0,1,1);
|
||||
b3Vector4 scaling(100,0.001,100,1);
|
||||
int strideInBytes = 9*sizeof(float);
|
||||
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(cube_indices)/sizeof(int);
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
#include "OpenGLWindow/ShapeData.h"
|
||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
#include "OpenGLWindow/btgWindowInterface.h"
|
||||
#include "OpenGLWindow/b3gWindowInterface.h"
|
||||
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
|
||||
#include "../GpuDemoInternalData.h"
|
||||
#include "basic_initialize/b3OpenCLUtils.h"
|
||||
#include "OpenGLWindow/OpenGLInclude.h"
|
||||
#include "OpenGLWindow/GLInstanceRendererInternalData.h"
|
||||
#include "parallel_primitives/host/btLauncherCL.h"
|
||||
#include "parallel_primitives/host/b3LauncherCL.h"
|
||||
#include "gpu_rigidbody/host/b3GpuRigidBodyPipeline.h"
|
||||
#include "gpu_rigidbody/host/b3GpuNarrowPhase.h"
|
||||
#include "gpu_rigidbody/host/b3Config.h"
|
||||
#include "GpuRigidBodyDemoInternalData.h"
|
||||
#include "Bullet3Collision/BroadPhaseCollision/b3DynamicBvhBroadphase.h"
|
||||
|
||||
static btKeyboardCallback oldCallback = 0;
|
||||
static b3KeyboardCallback oldCallback = 0;
|
||||
extern bool gReset;
|
||||
|
||||
#define MSTRINGIFY(A) #A
|
||||
@@ -76,7 +76,7 @@ static void PairKeyboardCallback(int key, int state)
|
||||
gReset = true;
|
||||
}
|
||||
|
||||
//btDefaultKeyboardCallback(key,state);
|
||||
//b3DefaultKeyboardCallback(key,state);
|
||||
oldCallback(key,state);
|
||||
}
|
||||
|
||||
@@ -156,21 +156,21 @@ void GpuRigidBodyDemo::clientMoveAndDisplay()
|
||||
bool animate=true;
|
||||
int numObjects= m_data->m_rigidBodyPipeline->getNumBodies();
|
||||
//m_instancingRenderer->getInternalData()->m_totalNumInstances;
|
||||
btVector4* positions = 0;
|
||||
b3Vector4* positions = 0;
|
||||
if (animate && numObjects)
|
||||
{
|
||||
BT_PROFILE("gl2cl");
|
||||
B3_PROFILE("gl2cl");
|
||||
|
||||
if (!m_data->m_instancePosOrnColor)
|
||||
{
|
||||
GLuint vbo = m_instancingRenderer->getInternalData()->m_vbo;
|
||||
int arraySizeInBytes = numObjects * (3)*sizeof(btVector4);
|
||||
int arraySizeInBytes = numObjects * (3)*sizeof(b3Vector4);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
cl_bool blocking= CL_TRUE;
|
||||
positions= (btVector4*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_READ_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY
|
||||
positions= (b3Vector4*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_READ_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY
|
||||
GLint err = glGetError();
|
||||
assert(err==GL_NO_ERROR);
|
||||
m_data->m_instancePosOrnColor = new btOpenCLArray<btVector4>(m_clData->m_clContext,m_clData->m_clQueue);
|
||||
m_data->m_instancePosOrnColor = new b3OpenCLArray<b3Vector4>(m_clData->m_clContext,m_clData->m_clQueue);
|
||||
m_data->m_instancePosOrnColor->resize(3*numObjects);
|
||||
m_data->m_instancePosOrnColor->copyFromHostPointer(positions,3*numObjects,0);
|
||||
glUnmapBuffer( GL_ARRAY_BUFFER);
|
||||
@@ -180,16 +180,16 @@ void GpuRigidBodyDemo::clientMoveAndDisplay()
|
||||
}
|
||||
|
||||
{
|
||||
BT_PROFILE("stepSimulation");
|
||||
B3_PROFILE("stepSimulation");
|
||||
m_data->m_rigidBodyPipeline->stepSimulation(1./60.f);
|
||||
}
|
||||
|
||||
if (numObjects)
|
||||
{
|
||||
BT_PROFILE("cl2gl_convert");
|
||||
B3_PROFILE("cl2gl_convert");
|
||||
int ciErrNum = 0;
|
||||
cl_mem bodies = m_data->m_rigidBodyPipeline->getBodyBuffer();
|
||||
btLauncherCL launch(m_clData->m_clQueue,m_data->m_copyTransformsToVBOKernel);
|
||||
b3LauncherCL launch(m_clData->m_clQueue,m_data->m_copyTransformsToVBOKernel);
|
||||
launch.setBuffer(bodies);
|
||||
launch.setBuffer(m_data->m_instancePosOrnColor->getBufferCL());
|
||||
launch.setConst(numObjects);
|
||||
@@ -199,14 +199,14 @@ void GpuRigidBodyDemo::clientMoveAndDisplay()
|
||||
|
||||
if (animate && numObjects)
|
||||
{
|
||||
BT_PROFILE("cl2gl_upload");
|
||||
B3_PROFILE("cl2gl_upload");
|
||||
GLint err = glGetError();
|
||||
assert(err==GL_NO_ERROR);
|
||||
GLuint vbo = m_instancingRenderer->getInternalData()->m_vbo;
|
||||
int arraySizeInBytes = numObjects * (3)*sizeof(btVector4);
|
||||
int arraySizeInBytes = numObjects * (3)*sizeof(b3Vector4);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
cl_bool blocking= CL_TRUE;
|
||||
positions= (btVector4*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_WRITE_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY
|
||||
positions= (b3Vector4*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_WRITE_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY
|
||||
err = glGetError();
|
||||
assert(err==GL_NO_ERROR);
|
||||
m_data->m_instancePosOrnColor->copyToHostPointer(positions,3*numObjects,0);
|
||||
|
||||
@@ -7,7 +7,7 @@ class GpuRigidBodyDemo : public GpuDemo
|
||||
{
|
||||
protected:
|
||||
class GLInstancingRenderer* m_instancingRenderer;
|
||||
class btgWindowInterface* m_window;
|
||||
class b3gWindowInterface* m_window;
|
||||
|
||||
struct GpuRigidBodyDemoInternalData* m_data;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define GPU_RIGIDBODY_INTERNAL_DATA_H
|
||||
|
||||
#include "basic_initialize/b3OpenCLUtils.h"
|
||||
#include "parallel_primitives/host/btOpenCLArray.h"
|
||||
#include "parallel_primitives/host/b3OpenCLArray.h"
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
|
||||
struct GpuRigidBodyDemoInternalData
|
||||
@@ -10,7 +10,7 @@ struct GpuRigidBodyDemoInternalData
|
||||
|
||||
cl_kernel m_copyTransformsToVBOKernel;
|
||||
|
||||
btOpenCLArray<btVector4>* m_instancePosOrnColor;
|
||||
b3OpenCLArray<b3Vector4>* m_instancePosOrnColor;
|
||||
|
||||
class b3GpuRigidBodyPipeline* m_rigidBodyPipeline;
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
#include "OpenGLWindow/btgWindowInterface.h"
|
||||
#include "OpenGLWindow/b3gWindowInterface.h"
|
||||
#include "gpu_broadphase/host/b3GpuSapBroadphase.h"
|
||||
#include "../GpuDemoInternalData.h"
|
||||
#include "basic_initialize/b3OpenCLUtils.h"
|
||||
#include "OpenGLWindow/OpenGLInclude.h"
|
||||
#include "OpenGLWindow/GLInstanceRendererInternalData.h"
|
||||
#include "parallel_primitives/host/btLauncherCL.h"
|
||||
#include "parallel_primitives/host/b3LauncherCL.h"
|
||||
#include "gpu_rigidbody/host/b3GpuRigidBodyPipeline.h"
|
||||
#include "gpu_rigidbody/host/b3GpuNarrowPhase.h"
|
||||
#include "gpu_rigidbody/host/b3Config.h"
|
||||
@@ -53,7 +53,7 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
|
||||
{
|
||||
int numVertices = sizeof(point_sphere_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(point_sphere_indices)/sizeof(int);
|
||||
prevGraphicsShapeIndex = ci.m_instancingRenderer->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,BT_GL_POINTS);
|
||||
prevGraphicsShapeIndex = ci.m_instancingRenderer->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,B3_GL_POINTS);
|
||||
} else
|
||||
{
|
||||
if (radius>=10)
|
||||
@@ -71,12 +71,12 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
|
||||
}
|
||||
|
||||
}
|
||||
btVector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
btVector4(1,0,0,1),
|
||||
btVector4(0,1,0,1),
|
||||
btVector4(0,1,1,1),
|
||||
btVector4(1,1,0,1),
|
||||
b3Vector4(1,0,0,1),
|
||||
b3Vector4(0,1,0,1),
|
||||
b3Vector4(0,1,1,1),
|
||||
b3Vector4(1,1,0,1),
|
||||
};
|
||||
|
||||
int curColor = 0;
|
||||
@@ -90,10 +90,10 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color = colors[curColor];
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
btVector4 scaling(radius,radius,radius,1);
|
||||
b3Vector4 scaling(radius,radius,radius,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(prevGraphicsShapeIndex,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index, writeInstanceToGpu);
|
||||
|
||||
@@ -110,12 +110,12 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
|
||||
|
||||
btVector4 colors[4] =
|
||||
b3Vector4 colors[4] =
|
||||
{
|
||||
btVector4(1,0,0,1),
|
||||
btVector4(0,1,0,1),
|
||||
btVector4(0,1,1,1),
|
||||
btVector4(1,1,0,1),
|
||||
b3Vector4(1,0,0,1),
|
||||
b3Vector4(0,1,0,1),
|
||||
b3Vector4(0,1,1,1),
|
||||
b3Vector4(1,1,0,1),
|
||||
};
|
||||
|
||||
|
||||
@@ -147,10 +147,10 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
btVector4 color = colors[curColor];
|
||||
b3Vector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
btVector4 scaling(radius,radius,radius,1);
|
||||
b3Vector4 scaling(radius,radius,radius,1);
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(prevGraphicsShapeIndex,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index, writeInstanceToGpu);
|
||||
|
||||
@@ -163,7 +163,7 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
|
||||
if (1)
|
||||
{
|
||||
int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
||||
btVector4 scaling(0.5,0.5,0.5,1);//1,1,1,1);//0.1,0.1,0.1,1);
|
||||
b3Vector4 scaling(0.5,0.5,0.5,1);//1,1,1,1);//0.1,0.1,0.1,1);
|
||||
int colIndex = m_data->m_np->registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
|
||||
b3Vector3 normal(0,-1,0);
|
||||
float constant=2;
|
||||
@@ -175,11 +175,11 @@ void GpuSphereScene::setupScene(const ConstructionInfo& ci)
|
||||
//int i=0;int j=0;
|
||||
{
|
||||
//int colIndex = m_data->m_np->registerPlaneShape(normal,constant);//>registerConvexHullShape(&cube_vertices[0],strideInBytes,numVertices, scaling);
|
||||
btVector4 position(2*i,70+k*2,2*j+8,0);
|
||||
b3Vector4 position(2*i,70+k*2,2*j+8,0);
|
||||
//b3Quaternion orn(0,0,0,1);
|
||||
b3Quaternion orn(b3Vector3(1,0,0),0.3);
|
||||
|
||||
btVector4 color(0,0,1,1);
|
||||
b3Vector4 color(0,0,1,1);
|
||||
|
||||
int id = ci.m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(1.f,position,orn,colIndex,index,false);
|
||||
|
||||
Reference in New Issue
Block a user