Fix sleeping colors in testbed application
This commit is contained in:
parent
e530a1a7cc
commit
4d982ebd31
|
@ -182,7 +182,8 @@ void ConcaveMesh::render(openglframework::Shader& shader,
|
|||
shader.setMatrix3x3Uniform("normalMatrix", normalMatrix, false);
|
||||
|
||||
// Set the vertex color
|
||||
openglframework::Vector4 color(mColor.r, mColor.g, mColor.b, mColor.a);
|
||||
openglframework::Color currentColor = mBody->isSleeping() ? mSleepingColor : mColor;
|
||||
openglframework::Vector4 color(currentColor.r, currentColor.g, currentColor.b, currentColor.a);
|
||||
shader.setVector4Uniform("vertexColor", color, false);
|
||||
|
||||
// Bind the VAO
|
||||
|
|
|
@ -166,7 +166,8 @@ void Cone::render(openglframework::Shader& shader,
|
|||
shader.setMatrix3x3Uniform("normalMatrix", normalMatrix, false);
|
||||
|
||||
// Set the vertex color
|
||||
openglframework::Vector4 color(mColor.r, mColor.g, mColor.b, mColor.a);
|
||||
openglframework::Color currentColor = mBody->isSleeping() ? mSleepingColor : mColor;
|
||||
openglframework::Vector4 color(currentColor.r, currentColor.g, currentColor.b, currentColor.a);
|
||||
shader.setVector4Uniform("vertexColor", color, false);
|
||||
|
||||
// Bind the VAO
|
||||
|
|
|
@ -163,7 +163,8 @@ void ConvexMesh::render(openglframework::Shader& shader,
|
|||
shader.setMatrix3x3Uniform("normalMatrix", normalMatrix, false);
|
||||
|
||||
// Set the vertex color
|
||||
openglframework::Vector4 color(mColor.r, mColor.g, mColor.b, mColor.a);
|
||||
openglframework::Color currentColor = mBody->isSleeping() ? mSleepingColor : mColor;
|
||||
openglframework::Vector4 color(currentColor.r, currentColor.g, currentColor.b, currentColor.a);
|
||||
shader.setVector4Uniform("vertexColor", color, false);
|
||||
|
||||
// Bind the VAO
|
||||
|
|
|
@ -167,7 +167,8 @@ void Cylinder::render(openglframework::Shader& shader,
|
|||
shader.setMatrix3x3Uniform("normalMatrix", normalMatrix, false);
|
||||
|
||||
// Set the vertex color
|
||||
openglframework::Vector4 color(mColor.r, mColor.g, mColor.b, mColor.a);
|
||||
openglframework::Color currentColor = mBody->isSleeping() ? mSleepingColor : mColor;
|
||||
openglframework::Vector4 color(currentColor.r, currentColor.g, currentColor.b, currentColor.a);
|
||||
shader.setVector4Uniform("vertexColor", color, false);
|
||||
|
||||
// Bind the VAO
|
||||
|
|
|
@ -208,7 +208,8 @@ void Dumbbell::render(openglframework::Shader& shader,
|
|||
shader.setMatrix3x3Uniform("normalMatrix", normalMatrix, false);
|
||||
|
||||
// Set the vertex color
|
||||
openglframework::Vector4 color(mColor.r, mColor.g, mColor.b, mColor.a);
|
||||
openglframework::Color currentColor = mBody->isSleeping() ? mSleepingColor : mColor;
|
||||
openglframework::Vector4 color(currentColor.r, currentColor.g, currentColor.b, currentColor.a);
|
||||
shader.setVector4Uniform("vertexColor", color, false);
|
||||
|
||||
// Bind the VAO
|
||||
|
|
|
@ -148,7 +148,8 @@ void HeightField::render(openglframework::Shader& shader,
|
|||
shader.setMatrix3x3Uniform("normalMatrix", normalMatrix, false);
|
||||
|
||||
// Set the vertex color
|
||||
openglframework::Vector4 color(mColor.r, mColor.g, mColor.b, mColor.a);
|
||||
openglframework::Color currentColor = mBody->isSleeping() ? mSleepingColor : mColor;
|
||||
openglframework::Vector4 color(currentColor.r, currentColor.g, currentColor.b, currentColor.a);
|
||||
shader.setVector4Uniform("vertexColor", color, false);
|
||||
|
||||
// Bind the VAO
|
||||
|
|
|
@ -168,7 +168,8 @@ void Sphere::render(openglframework::Shader& shader,
|
|||
shader.setMatrix3x3Uniform("normalMatrix", normalMatrix, false);
|
||||
|
||||
// Set the vertex color
|
||||
openglframework::Vector4 color(mColor.r, mColor.g, mColor.b, mColor.a);
|
||||
openglframework::Color currentColor = mBody->isSleeping() ? mSleepingColor : mColor;
|
||||
openglframework::Vector4 color(currentColor.r, currentColor.g, currentColor.b, currentColor.a);
|
||||
shader.setVector4Uniform("vertexColor", color, false);
|
||||
|
||||
// Bind the VAO
|
||||
|
|
|
@ -237,7 +237,6 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name)
|
|||
|
||||
// ---------- Create the floor ---------
|
||||
|
||||
|
||||
openglframework::Vector3 floorPosition(0, 0, 0);
|
||||
mFloor = new Box(FLOOR_SIZE, floorPosition, FLOOR_MASS, mDynamicsWorld);
|
||||
|
||||
|
@ -252,7 +251,6 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name)
|
|||
rp3d::Material& material = mFloor->getRigidBody()->getMaterial();
|
||||
material.setBounciness(rp3d::decimal(0.2));
|
||||
|
||||
|
||||
// ---------- Create the triangular mesh ---------- //
|
||||
|
||||
/*
|
||||
|
|
|
@ -62,7 +62,7 @@ ConcaveMeshScene::ConcaveMeshScene(const std::string& name)
|
|||
mBox = new Box(Vector3(3, 3, 3), spherePos, 80.1, mDynamicsWorld);
|
||||
|
||||
// Set the sphere color
|
||||
mBox->setColor(mDemoColors[1]);
|
||||
mBox->setColor(mDemoColors[0]);
|
||||
mBox->setSleepingColor(mRedColorDemo);
|
||||
|
||||
// Change the material properties of the rigid body
|
||||
|
@ -82,8 +82,8 @@ ConcaveMeshScene::ConcaveMeshScene(const std::string& name)
|
|||
mConcaveMesh->getRigidBody()->setType(rp3d::STATIC);
|
||||
|
||||
// Set the box color
|
||||
mConcaveMesh->setColor(mDemoColors[0]);
|
||||
mConcaveMesh->setSleepingColor(mRedColorDemo);
|
||||
mConcaveMesh->setColor(mGreyColorDemo);
|
||||
mConcaveMesh->setSleepingColor(mGreyColorDemo);
|
||||
|
||||
// Change the material properties of the rigid body
|
||||
rp3d::Material& material = mConcaveMesh->getRigidBody()->getMaterial();
|
||||
|
|
|
@ -55,13 +55,13 @@ HeightFieldScene::HeightFieldScene(const std::string& name) : SceneDemo(name, SC
|
|||
for (int i=0; i<NB_BOXES; i++) {
|
||||
|
||||
// Position
|
||||
openglframework::Vector3 spherePos(15, 10, 0);
|
||||
openglframework::Vector3 position(15, 10 + 6 * i, 0);
|
||||
|
||||
// Create a sphere and a corresponding rigid in the dynamics world
|
||||
mBoxes[i] = new Box(Vector3(3, 3, 3), spherePos, 80.1, mDynamicsWorld);
|
||||
mBoxes[i] = new Box(Vector3(3, 3, 3), position, 80.1, mDynamicsWorld);
|
||||
|
||||
// Set the sphere color
|
||||
mBoxes[i]->setColor(mDemoColors[1]);
|
||||
mBoxes[i]->setColor(mDemoColors[2]);
|
||||
mBoxes[i]->setSleepingColor(mRedColorDemo);
|
||||
|
||||
// Change the material properties of the rigid body
|
||||
|
@ -82,8 +82,8 @@ HeightFieldScene::HeightFieldScene(const std::string& name) : SceneDemo(name, SC
|
|||
mHeightField->getRigidBody()->setType(rp3d::STATIC);
|
||||
|
||||
// Set the color
|
||||
mHeightField->setColor(mDemoColors[0]);
|
||||
mHeightField->setSleepingColor(mRedColorDemo);
|
||||
mHeightField->setColor(mGreyColorDemo);
|
||||
mHeightField->setSleepingColor(mGreyColorDemo);
|
||||
|
||||
// Change the material properties of the rigid body
|
||||
rp3d::Material& material = mHeightField->getRigidBody()->getMaterial();
|
||||
|
|
Loading…
Reference in New Issue
Block a user