tweaks to demos, add middle-mouse support,
This commit is contained in:
@@ -53,7 +53,7 @@ void GpuConstraintsDemo::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
m_data->m_rigidBodyPipeline->writeAllInstancesToGpu();
|
||||
// m_data->m_rigidBodyPipeline->setGravity(b3Vector3(4,-10,0));
|
||||
float camPos[4]={ci.arraySizeX,ci.gapY,ci.arraySizeZ,0};
|
||||
float camPos[4]={ci.arraySizeX,0.5*ci.arraySizeY*ci.gapY,ci.arraySizeZ,0};
|
||||
//float camPos[4]={1,12.5,1.5,0};
|
||||
|
||||
m_instancingRenderer->setCameraTargetPosition(camPos);
|
||||
@@ -167,8 +167,8 @@ int GpuConstraintsDemo::createDynamicsObjects2(const ConstructionInfo& ci, const
|
||||
}
|
||||
//b3Vector3 position((j&1)+i*2.2,1+j*2.,(j&1)+k*2.2);
|
||||
//b3Vector3 position((-ci.arraySizeX/2*ci.gapX)+i*ci.gapX,1+j*2.,(-ci.arraySizeZ/2*ci.gapZ)+k*ci.gapZ);
|
||||
b3Vector3 position(-ci.arraySizeY/2*2+1+j*2.,
|
||||
10+i*ci.gapX,
|
||||
b3Vector3 position(-ci.arraySizeX/2*2+1+j*2.,
|
||||
10+i*ci.gapY,
|
||||
(-ci.arraySizeZ/2*ci.gapZ)+k*ci.gapZ);
|
||||
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
@@ -191,7 +191,7 @@ int GpuConstraintsDemo::createDynamicsObjects2(const ConstructionInfo& ci, const
|
||||
{
|
||||
///enable next line to force CPU constraint solving
|
||||
//c = new b3Point2PointConstraint(pid,prevBody,b3Vector3(-1.1,0,0),b3Vector3(1.1,0,0));
|
||||
float breakingThreshold=14;
|
||||
float breakingThreshold=44;
|
||||
// c->setBreakingImpulseThreshold(breakingThreshold);
|
||||
b3Vector3 pivotInA(-1.1,0,0);
|
||||
b3Vector3 pivotInB (1.1,0,0);
|
||||
@@ -212,7 +212,7 @@ int GpuConstraintsDemo::createDynamicsObjects2(const ConstructionInfo& ci, const
|
||||
b3Quaternion relTargetAB = frameInA.getRotation()*frameInB.getRotation().inverse();
|
||||
|
||||
//c = new b3FixedConstraint(pid,prevBody,frameInA,frameInB);
|
||||
float breakingThreshold = 15;//37.f;
|
||||
float breakingThreshold = 45;//37.f;
|
||||
//c->setBreakingImpulseThreshold(37.1);
|
||||
int cid = m_data->m_rigidBodyPipeline->createFixedConstraint(pid,prevBody,pivotInA,pivotInB,relTargetAB,breakingThreshold);
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "constraints/ConstraintsDemo.h"
|
||||
|
||||
bool exportFrame=false;
|
||||
bool exportMovie = false;
|
||||
int frameIndex = 0;
|
||||
GLRenderToTexture* renderTexture =0;
|
||||
//#include "BroadphaseBenchmark.h"
|
||||
@@ -82,7 +83,7 @@ int selectedDemo = 0;
|
||||
GpuDemo::CreateFunc* allDemos[]=
|
||||
{
|
||||
//ConcaveCompound2Scene::MyCreateFunc,
|
||||
// GpuConvexScene::MyCreateFunc,
|
||||
|
||||
|
||||
//ConcaveSphereScene::MyCreateFunc,
|
||||
|
||||
@@ -91,23 +92,24 @@ GpuDemo::CreateFunc* allDemos[]=
|
||||
// ConcaveSphereScene::MyCreateFunc,
|
||||
|
||||
|
||||
|
||||
ConcaveScene::MyCreateFunc,
|
||||
|
||||
GpuBoxPlaneScene::MyCreateFunc,
|
||||
GpuConstraintsDemo::MyCreateFunc,
|
||||
//GpuConvexPlaneScene::MyCreateFunc,
|
||||
|
||||
GpuConvexScene::MyCreateFunc,
|
||||
|
||||
GpuCompoundScene::MyCreateFunc,
|
||||
|
||||
GpuSphereScene::MyCreateFunc,
|
||||
|
||||
ConcaveSphereScene::MyCreateFunc,
|
||||
|
||||
|
||||
ConcaveScene::MyCreateFunc,
|
||||
|
||||
|
||||
|
||||
|
||||
ConcaveSphereScene::MyCreateFunc,
|
||||
|
||||
ConcaveCompoundScene::MyCreateFunc,
|
||||
|
||||
// GpuCompoundPlaneScene::MyCreateFunc,
|
||||
@@ -228,9 +230,15 @@ void MyKeyboardCallback(int key, int state)
|
||||
{
|
||||
window->setRequestExit();
|
||||
}
|
||||
if (key==B3G_F2)
|
||||
{
|
||||
if (state)
|
||||
exportMovie = !exportMovie;
|
||||
}
|
||||
if (key==B3G_F1)
|
||||
{
|
||||
exportFrame = true;
|
||||
if (state)
|
||||
exportFrame = true;
|
||||
}
|
||||
if (sDemo)
|
||||
sDemo->keyboardCallback(key,state);
|
||||
@@ -671,7 +679,7 @@ int main(int argc, char* argv[])
|
||||
bool useGpu = false;
|
||||
|
||||
|
||||
int maxObjectCapacity=128*1024;
|
||||
int maxObjectCapacity=512*1024;
|
||||
maxObjectCapacity = b3Max(maxObjectCapacity,ci.arraySizeX*ci.arraySizeX*ci.arraySizeX+10);
|
||||
|
||||
{
|
||||
@@ -786,7 +794,7 @@ int main(int argc, char* argv[])
|
||||
assert(err==GL_NO_ERROR);
|
||||
|
||||
|
||||
if (exportFrame)
|
||||
if (exportFrame || exportMovie)
|
||||
{
|
||||
|
||||
if (!renderTexture)
|
||||
@@ -808,7 +816,7 @@ int main(int argc, char* argv[])
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
renderTexture->init(g_OpenGLWidth,g_OpenGLHeight,renderTextureId, false);
|
||||
renderTexture->init(g_OpenGLWidth,g_OpenGLHeight,renderTextureId, RENDERTEXTURE_COLOR);
|
||||
}
|
||||
|
||||
bool result = renderTexture->enable();
|
||||
@@ -870,7 +878,7 @@ int main(int argc, char* argv[])
|
||||
*/
|
||||
|
||||
|
||||
if (exportFrame)
|
||||
if (exportFrame || exportMovie)
|
||||
{
|
||||
|
||||
char fileName[1024];
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
#include "Bullet3Common/b3Transform.h"
|
||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3ConvexUtility.h"
|
||||
|
||||
|
||||
#include "../gwenUserInterface.h"
|
||||
#include "OpenGLWindow/GLInstanceGraphicsShape.h"
|
||||
#define CONCAVE_GAPX 16
|
||||
#define CONCAVE_GAPX 14
|
||||
#define CONCAVE_GAPY 8
|
||||
#define CONCAVE_GAPZ 16
|
||||
#define CONCAVE_GAPZ 14
|
||||
|
||||
|
||||
GLInstanceGraphicsShape* createGraphicsShapeFromWavefrontObj(std::vector<tinyobj::shape_t>& shapes)
|
||||
@@ -224,7 +224,7 @@ void ConcaveScene::setupScene(const ConstructionInfo& ci)
|
||||
|
||||
b3Vector3 shift1(0,0,0);//0,230,80);//150,-100,-120);
|
||||
|
||||
b3Vector4 scaling(4,4,4,1);
|
||||
b3Vector4 scaling(10,10,10,1);
|
||||
|
||||
// createConcaveMesh(ci,"plane100.obj",shift1,scaling);
|
||||
//createConcaveMesh(ci,"plane100.obj",shift,scaling);
|
||||
@@ -269,6 +269,11 @@ void ConcaveScene::setupScene(const ConstructionInfo& ci)
|
||||
m_instancingRenderer->setCameraPitch(45);
|
||||
m_instancingRenderer->setCameraTargetPosition(camPos);
|
||||
m_instancingRenderer->setCameraDistance(155);
|
||||
char msg[1024];
|
||||
int numInstances = m_data->m_rigidBodyPipeline->getNumBodies();
|
||||
sprintf(msg,"Num objects = %d",numInstances);
|
||||
if (ci.m_gui)
|
||||
ci.m_gui->setStatusBarMessage(msg,true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ int GpuConvexScene::createDynamicsObjects2(const ConstructionInfo& ci, const flo
|
||||
{
|
||||
//mass=0.f;
|
||||
}
|
||||
b3Vector3 position((j&1)+i*2.2,1+j*2.,(j&1)+k*2.2);
|
||||
b3Vector3 position(((j+1)&1)+i*2.2,1+j*2.,((j+1)&1)+k*2.2);
|
||||
//b3Vector3 position(i*2.2,10+j*1.9,k*2.2);
|
||||
|
||||
b3Quaternion orn(0,0,0,1);
|
||||
|
||||
Reference in New Issue
Block a user