more example browser tweaks, mostly related to (debug) rendering
This commit is contained in:
@@ -60,7 +60,7 @@ void BasicExample::initPhysics()
|
|||||||
|
|
||||||
///create a few basic rigid bodies
|
///create a few basic rigid bodies
|
||||||
btBoxShape* groundShape = createBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
|
btBoxShape* groundShape = createBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
|
||||||
m_guiHelper->createCollisionShapeGraphicsObject(groundShape);
|
|
||||||
|
|
||||||
//groundShape->initializePolyhedralFeatures();
|
//groundShape->initializePolyhedralFeatures();
|
||||||
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
|
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
|
||||||
@@ -74,7 +74,6 @@ void BasicExample::initPhysics()
|
|||||||
{
|
{
|
||||||
btScalar mass(0.);
|
btScalar mass(0.);
|
||||||
btRigidBody* body = createRigidBody(mass,groundTransform,groundShape, btVector4(0,0,1,1));
|
btRigidBody* body = createRigidBody(mass,groundTransform,groundShape, btVector4(0,0,1,1));
|
||||||
m_guiHelper->createRigidBodyGraphicsObject(body, btVector3(0, 1, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -83,7 +82,7 @@ void BasicExample::initPhysics()
|
|||||||
// Re-using the same collision is better for memory usage and performance
|
// Re-using the same collision is better for memory usage and performance
|
||||||
|
|
||||||
btBoxShape* colShape = createBoxShape(btVector3(1,1,1));
|
btBoxShape* colShape = createBoxShape(btVector3(1,1,1));
|
||||||
m_guiHelper->createCollisionShapeGraphicsObject(colShape);
|
|
||||||
|
|
||||||
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
|
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
|
||||||
m_collisionShapes.push_back(colShape);
|
m_collisionShapes.push_back(colShape);
|
||||||
@@ -115,14 +114,14 @@ void BasicExample::initPhysics()
|
|||||||
|
|
||||||
|
|
||||||
btRigidBody* body = createRigidBody(mass,startTransform,colShape);
|
btRigidBody* body = createRigidBody(mass,startTransform,colShape);
|
||||||
m_guiHelper->createRigidBodyGraphicsObject(body, btVector3(1, 1, 0));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -140,10 +140,8 @@ struct CommonMultiBodyBase : public CommonExampleInterface
|
|||||||
{
|
{
|
||||||
m_guiHelper->syncPhysicsToGraphics(m_dynamicsWorld);
|
m_guiHelper->syncPhysicsToGraphics(m_dynamicsWorld);
|
||||||
|
|
||||||
if (m_guiHelper->getRenderInterface())
|
m_guiHelper->render(m_dynamicsWorld);
|
||||||
{
|
|
||||||
m_guiHelper->getRenderInterface()->renderScene();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void physicsDebugDraw(int debugDrawFlags)
|
virtual void physicsDebugDraw(int debugDrawFlags)
|
||||||
|
|||||||
@@ -681,6 +681,7 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
|
|||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ extern bool useShadowMap;
|
|||||||
static bool visualWireframe=false;
|
static bool visualWireframe=false;
|
||||||
static bool renderVisualGeometry=true;
|
static bool renderVisualGeometry=true;
|
||||||
static bool renderGrid = true;
|
static bool renderGrid = true;
|
||||||
int gDebugDrawFlags = btIDebugDraw::DBG_DrawWireframe;
|
int gDebugDrawFlags = 0;
|
||||||
static bool pauseSimulation=false;
|
static bool pauseSimulation=false;
|
||||||
int midiBaseIndex = 176;
|
int midiBaseIndex = 176;
|
||||||
extern bool gDisableDeactivation;
|
extern bool gDisableDeactivation;
|
||||||
@@ -91,7 +91,7 @@ b3KeyboardCallback prevKeyboardCallback = 0;
|
|||||||
void MyKeyboardCallback(int key, int state)
|
void MyKeyboardCallback(int key, int state)
|
||||||
{
|
{
|
||||||
|
|
||||||
//printf("key=%d, state=%d\n", key, state);
|
//b3Printf("key=%d, state=%d", key, state);
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
if (gui && !handled )
|
if (gui && !handled )
|
||||||
@@ -701,14 +701,26 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
|||||||
firstAvailableDemoIndex = d;
|
firstAvailableDemoIndex = d;
|
||||||
firstNode = pNode;
|
firstNode = pNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d == selectedDemo)
|
if (d == selectedDemo)
|
||||||
{
|
{
|
||||||
pNode->SetSelected(true);
|
firstAvailableDemoIndex = d;
|
||||||
tree->ExpandAll();
|
firstNode = pNode;
|
||||||
selectDemo(d);
|
//pNode->SetSelected(true);
|
||||||
|
//tree->ExpandAll();
|
||||||
|
// tree->ForceUpdateScrollBars();
|
||||||
|
//tree->OnKeyLeft(true);
|
||||||
|
// tree->OnKeyRight(true);
|
||||||
|
|
||||||
|
|
||||||
|
//tree->ExpandAll();
|
||||||
|
|
||||||
|
// selectDemo(d);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MyMenuItemHander* handler = new MyMenuItemHander(d);
|
MyMenuItemHander* handler = new MyMenuItemHander(d);
|
||||||
pNode->onNamePress.Add(handler, &MyMenuItemHander::onButtonA);
|
pNode->onNamePress.Add(handler, &MyMenuItemHander::onButtonA);
|
||||||
pNode->GetButton()->onDoubleClick.Add(handler, &MyMenuItemHander::onButtonB);
|
pNode->GetButton()->onDoubleClick.Add(handler, &MyMenuItemHander::onButtonB);
|
||||||
@@ -733,7 +745,12 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
|||||||
if (firstAvailableDemoIndex>=0)
|
if (firstAvailableDemoIndex>=0)
|
||||||
{
|
{
|
||||||
firstNode->SetSelected(true);
|
firstNode->SetSelected(true);
|
||||||
tree->ExpandAll();
|
while (firstNode != tree)
|
||||||
|
{
|
||||||
|
firstNode->ExpandAll();
|
||||||
|
firstNode = (Gwen::Controls::TreeNode*)firstNode->GetParent();
|
||||||
|
}
|
||||||
|
|
||||||
selectDemo(firstAvailableDemoIndex);
|
selectDemo(firstAvailableDemoIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -815,7 +832,7 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
|||||||
sCurrentDemo->stepSimulation(deltaTime);//1./60.f);
|
sCurrentDemo->stepSimulation(deltaTime);//1./60.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderVisualGeometry)
|
if (renderVisualGeometry && ((gDebugDrawFlags&btIDebugDraw::DBG_DrawWireframe)==0))
|
||||||
{
|
{
|
||||||
if (visualWireframe)
|
if (visualWireframe)
|
||||||
{
|
{
|
||||||
@@ -825,6 +842,7 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
|||||||
sCurrentDemo->renderScene();
|
sCurrentDemo->renderScene();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
||||||
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
||||||
sCurrentDemo->physicsDebugDraw(gDebugDrawFlags);
|
sCurrentDemo->physicsDebugDraw(gDebugDrawFlags);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,14 +147,14 @@ void GpuConvexScene::setupScene()
|
|||||||
float camPos[4]={0,0,0,0};//ci.arraySizeX,ci.arraySizeY/2,ci.arraySizeZ,0};
|
float camPos[4]={0,0,0,0};//ci.arraySizeX,ci.arraySizeY/2,ci.arraySizeZ,0};
|
||||||
//float camPos[4]={1,12.5,1.5,0};
|
//float camPos[4]={1,12.5,1.5,0};
|
||||||
|
|
||||||
m_instancingRenderer->getActiveCamera()->setCameraTargetPosition(camPos[0],camPos[1],camPos[2]);
|
m_guiHelper->getRenderInterface()->getActiveCamera()->setCameraTargetPosition(camPos[0],camPos[1],camPos[2]);
|
||||||
m_instancingRenderer->getActiveCamera()->setCameraDistance(150);
|
m_guiHelper->getRenderInterface()->getActiveCamera()->setCameraDistance(150);
|
||||||
//m_instancingRenderer->setCameraYaw(85);
|
//m_instancingRenderer->setCameraYaw(85);
|
||||||
m_instancingRenderer->getActiveCamera()->setCameraYaw(30);
|
m_guiHelper->getRenderInterface()->getActiveCamera()->setCameraYaw(30);
|
||||||
m_instancingRenderer->getActiveCamera()->setCameraPitch(225);
|
m_guiHelper->getRenderInterface()->getActiveCamera()->setCameraPitch(225);
|
||||||
|
|
||||||
|
|
||||||
m_instancingRenderer->updateCamera();
|
m_guiHelper->getRenderInterface()->updateCamera(1);//>updateCamera();
|
||||||
|
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
int numInstances = index;
|
int numInstances = index;
|
||||||
@@ -222,7 +222,7 @@ int GpuConvexScene::createDynamicsObjects2( const float* vertices, int numVertic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int shapeId = m_instancingRenderer->registerShape(&vertices[0],numVertices,indices,numIndices,B3_GL_TRIANGLES,textureIndex);
|
int shapeId = m_guiHelper->getRenderInterface()->registerShape(&vertices[0],numVertices,indices,numIndices,B3_GL_TRIANGLES,textureIndex);
|
||||||
int group=1;
|
int group=1;
|
||||||
int mask=1;
|
int mask=1;
|
||||||
int index=0;
|
int index=0;
|
||||||
@@ -291,7 +291,7 @@ int GpuConvexScene::createDynamicsObjects2( const float* vertices, int numVertic
|
|||||||
curColor++;
|
curColor++;
|
||||||
curColor&=3;
|
curColor&=3;
|
||||||
b3Vector4 scalin=b3MakeVector4(1,1,1,1);
|
b3Vector4 scalin=b3MakeVector4(1,1,1,1);
|
||||||
int id = m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
|
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
|
||||||
|
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ void GpuConvexPlaneScene::createStaticEnvironment()
|
|||||||
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
||||||
int numIndices = sizeof(cube_indices)/sizeof(int);
|
int numIndices = sizeof(cube_indices)/sizeof(int);
|
||||||
//int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
//int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
||||||
int shapeId = m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
int shapeId = m_guiHelper->getRenderInterface()->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
||||||
int group=1;
|
int group=1;
|
||||||
int mask=1;
|
int mask=1;
|
||||||
int index=0;
|
int index=0;
|
||||||
@@ -358,7 +358,7 @@ void GpuConvexPlaneScene::createStaticEnvironment()
|
|||||||
|
|
||||||
b3Vector4 color=b3MakeVector4(0,0,1,1);
|
b3Vector4 color=b3MakeVector4(0,0,1,1);
|
||||||
|
|
||||||
int id = m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||||
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false);
|
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,13 @@ GpuRigidBodyDemo::GpuRigidBodyDemo(GUIHelperInterface* helper)
|
|||||||
m_instancingRenderer(0),
|
m_instancingRenderer(0),
|
||||||
m_window(0)
|
m_window(0)
|
||||||
{
|
{
|
||||||
m_instancingRenderer = (GLInstancingRenderer*)helper->getRenderInterface();
|
if (helper->getRenderInterface()->getInternalData())
|
||||||
|
{
|
||||||
|
m_instancingRenderer = (GLInstancingRenderer*)helper->getRenderInterface();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
m_instancingRenderer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
m_window = helper->getAppInterface()->m_window;
|
m_window = helper->getAppInterface()->m_window;
|
||||||
|
|
||||||
@@ -108,6 +114,8 @@ void GpuRigidBodyDemo::initPhysics()
|
|||||||
|
|
||||||
initCL(gPreferredOpenCLDeviceIndex,gPreferredOpenCLPlatformIndex);
|
initCL(gPreferredOpenCLDeviceIndex,gPreferredOpenCLPlatformIndex);
|
||||||
|
|
||||||
|
m_guiHelper->setUpAxis(1);
|
||||||
|
|
||||||
if (m_clData->m_clContext)
|
if (m_clData->m_clContext)
|
||||||
{
|
{
|
||||||
int errNum=0;
|
int errNum=0;
|
||||||
@@ -149,7 +157,7 @@ void GpuRigidBodyDemo::initPhysics()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_instancingRenderer->writeTransforms();
|
m_guiHelper->getRenderInterface()->writeTransforms();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -176,13 +184,16 @@ void GpuRigidBodyDemo::exitPhysics()
|
|||||||
|
|
||||||
void GpuRigidBodyDemo::renderScene()
|
void GpuRigidBodyDemo::renderScene()
|
||||||
{
|
{
|
||||||
m_instancingRenderer->renderScene();
|
m_guiHelper->getRenderInterface()->renderScene();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpuRigidBodyDemo::stepSimulation(float deltaTime)
|
void GpuRigidBodyDemo::stepSimulation(float deltaTime)
|
||||||
{
|
{
|
||||||
|
if (!m_instancingRenderer)
|
||||||
|
return;
|
||||||
|
|
||||||
bool animate=true;
|
bool animate=true;
|
||||||
int numObjects= m_data->m_rigidBodyPipeline->getNumBodies();
|
int numObjects= m_data->m_rigidBodyPipeline->getNumBodies();
|
||||||
//printf("numObjects=%d\n",numObjects);
|
//printf("numObjects=%d\n",numObjects);
|
||||||
@@ -368,6 +379,9 @@ bool GpuRigidBodyDemo::keyboardCallback(int key, int state)
|
|||||||
|
|
||||||
bool GpuRigidBodyDemo::mouseMoveCallback(float x,float y)
|
bool GpuRigidBodyDemo::mouseMoveCallback(float x,float y)
|
||||||
{
|
{
|
||||||
|
if (!m_instancingRenderer)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (m_data->m_altPressed!=0 || m_data->m_controlPressed!=0)
|
if (m_data->m_altPressed!=0 || m_data->m_controlPressed!=0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -378,7 +392,7 @@ bool GpuRigidBodyDemo::mouseMoveCallback(float x,float y)
|
|||||||
b3Vector3 rayFrom;
|
b3Vector3 rayFrom;
|
||||||
b3Vector3 oldPivotInB = m_data->m_pickPivotInB;
|
b3Vector3 oldPivotInB = m_data->m_pickPivotInB;
|
||||||
b3Vector3 newPivotB;
|
b3Vector3 newPivotB;
|
||||||
m_instancingRenderer->getActiveCamera()->getCameraPosition(rayFrom);
|
m_guiHelper->getRenderInterface()->getActiveCamera()->getCameraPosition(rayFrom);
|
||||||
b3Vector3 dir = newRayTo-rayFrom;
|
b3Vector3 dir = newRayTo-rayFrom;
|
||||||
dir.normalize();
|
dir.normalize();
|
||||||
dir *= m_data->m_pickDistance;
|
dir *= m_data->m_pickDistance;
|
||||||
@@ -393,6 +407,8 @@ bool GpuRigidBodyDemo::mouseMoveCallback(float x,float y)
|
|||||||
}
|
}
|
||||||
bool GpuRigidBodyDemo::mouseButtonCallback(int button, int state, float x, float y)
|
bool GpuRigidBodyDemo::mouseButtonCallback(int button, int state, float x, float y)
|
||||||
{
|
{
|
||||||
|
if (!m_instancingRenderer)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (state==1)
|
if (state==1)
|
||||||
{
|
{
|
||||||
@@ -401,7 +417,7 @@ bool GpuRigidBodyDemo::mouseButtonCallback(int button, int state, float x, float
|
|||||||
b3AlignedObjectArray<b3RayInfo> rays;
|
b3AlignedObjectArray<b3RayInfo> rays;
|
||||||
b3AlignedObjectArray<b3RayHit> hitResults;
|
b3AlignedObjectArray<b3RayHit> hitResults;
|
||||||
b3Vector3 camPos;
|
b3Vector3 camPos;
|
||||||
m_instancingRenderer->getActiveCamera()->getCameraPosition(camPos);
|
m_guiHelper->getRenderInterface()->getActiveCamera()->getCameraPosition(camPos);
|
||||||
|
|
||||||
b3RayInfo ray;
|
b3RayInfo ray;
|
||||||
ray.m_from = camPos;
|
ray.m_from = camPos;
|
||||||
@@ -448,19 +464,20 @@ bool GpuRigidBodyDemo::mouseButtonCallback(int button, int state, float x, float
|
|||||||
int strideInBytes = 9*sizeof(float);
|
int strideInBytes = 9*sizeof(float);
|
||||||
int numVertices = sizeof(point_sphere_vertices)/strideInBytes;
|
int numVertices = sizeof(point_sphere_vertices)/strideInBytes;
|
||||||
int numIndices = sizeof(point_sphere_indices)/sizeof(int);
|
int numIndices = sizeof(point_sphere_indices)/sizeof(int);
|
||||||
m_data->m_pickGraphicsShapeIndex = m_instancingRenderer->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,B3_GL_POINTS);
|
m_data->m_pickGraphicsShapeIndex = m_guiHelper->getRenderInterface()->registerShape(&point_sphere_vertices[0],numVertices,point_sphere_indices,numIndices,B3_GL_POINTS);
|
||||||
|
|
||||||
float color[4] ={1,0,0,1};
|
float color[4] ={1,0,0,1};
|
||||||
float scaling[4]={1,1,1,1};
|
float scaling[4]={1,1,1,1};
|
||||||
|
|
||||||
m_data->m_pickGraphicsShapeInstance = m_instancingRenderer->registerGraphicsInstance(m_data->m_pickGraphicsShapeIndex,pivotInB,orn,color,scaling);
|
m_data->m_pickGraphicsShapeInstance = m_guiHelper->getRenderInterface()->registerGraphicsInstance(m_data->m_pickGraphicsShapeIndex,pivotInB,orn,color,scaling);
|
||||||
m_instancingRenderer->writeTransforms();
|
m_guiHelper->getRenderInterface()->writeTransforms();
|
||||||
delete m_data->m_instancePosOrnColor;
|
delete m_data->m_instancePosOrnColor;
|
||||||
m_data->m_instancePosOrnColor=0;
|
m_data->m_instancePosOrnColor=0;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
m_instancingRenderer->writeSingleInstanceTransformToCPU(pivotInB,orn,m_data->m_pickGraphicsShapeInstance);
|
m_guiHelper->getRenderInterface()->writeSingleInstanceTransformToCPU(pivotInB,orn,m_data->m_pickGraphicsShapeInstance);
|
||||||
m_instancingRenderer->writeSingleInstanceTransformToGPU(pivotInB,orn,m_data->m_pickGraphicsShapeInstance);
|
if (this->m_instancingRenderer)
|
||||||
|
m_instancingRenderer->writeSingleInstanceTransformToGPU(pivotInB,orn,m_data->m_pickGraphicsShapeInstance);
|
||||||
m_data->m_np->setObjectTransformCpu(pos,orn,m_data->m_pickFixedBody);
|
m_data->m_np->setObjectTransformCpu(pos,orn,m_data->m_pickFixedBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,18 +57,14 @@ void Win32Window::pumpMessage()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
int getAsciiCodeFromVirtualKeycode(int virtualKeyCode)
|
int getSpecialKeyFromVirtualKeycode(int virtualKeyCode)
|
||||||
{
|
{
|
||||||
int keycode = 0xffffffff;
|
int keycode = -1;
|
||||||
if (virtualKeyCode >= '0' && virtualKeyCode <= '9')
|
|
||||||
{
|
|
||||||
return virtualKeyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (virtualKeyCode >= 'A' && virtualKeyCode <= 'Z')
|
if (virtualKeyCode >= 'A' && virtualKeyCode <= 'Z')
|
||||||
{
|
{
|
||||||
return virtualKeyCode+32;//todo: fix the ascii A vs a input
|
return virtualKeyCode+32;//todo: fix the ascii A vs a input
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (virtualKeyCode)
|
switch (virtualKeyCode)
|
||||||
{
|
{
|
||||||
case VK_RETURN: {keycode = B3G_RETURN; break; };
|
case VK_RETURN: {keycode = B3G_RETURN; break; };
|
||||||
@@ -110,6 +106,24 @@ int getAsciiCodeFromVirtualKeycode(int virtualKeyCode)
|
|||||||
return keycode;
|
return keycode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int getAsciiCodeFromVirtualKeycode(int virtualKeyCode)
|
||||||
|
{
|
||||||
|
int keycode = 0xffffffff;
|
||||||
|
|
||||||
|
if (virtualKeyCode >= 'a' && virtualKeyCode <= 'z')
|
||||||
|
{
|
||||||
|
return virtualKeyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (virtualKeyCode >= 'A' && virtualKeyCode <= 'Z')
|
||||||
|
{
|
||||||
|
return virtualKeyCode+32;//todo: fix the ascii A vs a input
|
||||||
|
}
|
||||||
|
|
||||||
|
return keycode;
|
||||||
|
}
|
||||||
|
|
||||||
bool Win32Window::isModifierKeyPressed(int key)
|
bool Win32Window::isModifierKeyPressed(int key)
|
||||||
{
|
{
|
||||||
bool isPressed = false;
|
bool isPressed = false;
|
||||||
@@ -173,7 +187,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
{
|
{
|
||||||
|
|
||||||
int keycode = getAsciiCodeFromVirtualKeycode(wParam);
|
int keycode = getSpecialKeyFromVirtualKeycode(wParam);
|
||||||
switch (keycode)
|
switch (keycode)
|
||||||
{
|
{
|
||||||
case B3G_ALT:
|
case B3G_ALT:
|
||||||
@@ -217,7 +231,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
{
|
{
|
||||||
int keycode = getAsciiCodeFromVirtualKeycode(wParam);
|
int keycode = getSpecialKeyFromVirtualKeycode(wParam);
|
||||||
switch (keycode)
|
switch (keycode)
|
||||||
{
|
{
|
||||||
case B3G_ALT:
|
case B3G_ALT:
|
||||||
|
|||||||
@@ -160,6 +160,22 @@ public:
|
|||||||
{
|
{
|
||||||
return m_guiHelper;
|
return m_guiHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void renderScene()
|
||||||
|
{
|
||||||
|
CommonRigidBodyBase::renderScene();
|
||||||
|
btSoftRigidDynamicsWorld* softWorld = getSoftDynamicsWorld();
|
||||||
|
|
||||||
|
for ( int i=0;i<softWorld->getSoftBodyArray().size();i++)
|
||||||
|
{
|
||||||
|
btSoftBody* psb=(btSoftBody*)softWorld->getSoftBodyArray()[i];
|
||||||
|
if (softWorld->getDebugDrawer() && !(softWorld->getDebugDrawer()->getDebugMode() & (btIDebugDraw::DBG_DrawWireframe)))
|
||||||
|
{
|
||||||
|
btSoftBodyHelpers::DrawFrame(psb,softWorld->getDebugDrawer());
|
||||||
|
btSoftBodyHelpers::Draw(psb,softWorld->getDebugDrawer(),softWorld->getDrawFlags());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user