Modifications in testbed application
This commit is contained in:
parent
06e68baa39
commit
bd3fc98fba
|
@ -188,6 +188,8 @@ Box::Box(const openglframework::Vector3& size, const openglframework::Vector3& p
|
||||||
rp3d::Quaternion initOrientation = rp3d::Quaternion::identity();
|
rp3d::Quaternion initOrientation = rp3d::Quaternion::identity();
|
||||||
rp3d::Transform transform(initPosition, initOrientation);
|
rp3d::Transform transform(initPosition, initOrientation);
|
||||||
|
|
||||||
|
mPreviousTransform = transform;
|
||||||
|
|
||||||
// Create a rigid body in the dynamics world
|
// Create a rigid body in the dynamics world
|
||||||
rp3d::RigidBody* body = world->createRigidBody(transform);
|
rp3d::RigidBody* body = world->createRigidBody(transform);
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,6 @@ CubesScene::~CubesScene() {
|
||||||
// Update the physics world (take a simulation step)
|
// Update the physics world (take a simulation step)
|
||||||
void CubesScene::updatePhysics() {
|
void CubesScene::updatePhysics() {
|
||||||
|
|
||||||
|
|
||||||
// Update the physics engine parameters
|
// Update the physics engine parameters
|
||||||
mDynamicsWorld->setIsGratityEnabled(mEngineSettings.isGravityEnabled);
|
mDynamicsWorld->setIsGratityEnabled(mEngineSettings.isGravityEnabled);
|
||||||
rp3d::Vector3 gravity(mEngineSettings.gravity.x, mEngineSettings.gravity.y,
|
rp3d::Vector3 gravity(mEngineSettings.gravity.x, mEngineSettings.gravity.y,
|
||||||
|
|
|
@ -69,7 +69,6 @@ void main() {
|
||||||
float diffuseFactor = max(dot(N, L0), 0.0);
|
float diffuseFactor = max(dot(N, L0), 0.0);
|
||||||
vec3 diffuse = light0DiffuseColor * diffuseFactor * textureColor;
|
vec3 diffuse = light0DiffuseColor * diffuseFactor * textureColor;
|
||||||
|
|
||||||
|
|
||||||
// Compute shadow factor
|
// Compute shadow factor
|
||||||
float shadow = 1.0;
|
float shadow = 1.0;
|
||||||
if (isShadowEnabled) {
|
if (isShadowEnabled) {
|
||||||
|
@ -80,7 +79,6 @@ void main() {
|
||||||
shadowMapUV.z -= shadowBias;
|
shadowMapUV.z -= shadowBias;
|
||||||
vec4 shadowMapCoordsOverW = shadowMapUV / shadowMapUV.w;
|
vec4 shadowMapCoordsOverW = shadowMapUV / shadowMapUV.w;
|
||||||
|
|
||||||
/*
|
|
||||||
// PCF Shadow Mapping
|
// PCF Shadow Mapping
|
||||||
for (float i=-1; i<=1; i++) {
|
for (float i=-1; i<=1; i++) {
|
||||||
for (float j=-1; j<=1; j++) {
|
for (float j=-1; j<=1; j++) {
|
||||||
|
@ -91,14 +89,13 @@ void main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shadow /= 9.0;
|
shadow /= 9.0;
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
float distanceInShadowMap = texture(shadowMapSampler, shadowMapCoordsOverW.xy).r + bias;
|
float distanceInShadowMap = texture(shadowMapSampler, shadowMapCoordsOverW.xy).r + bias;
|
||||||
if (shadowMapCoords.w > 0) {
|
if (shadowMapCoords.w > 0) {
|
||||||
shadow = distanceInShadowMap < shadowMapCoordsOverW.z ? 0.5 : 1.0;
|
shadow = distanceInShadowMap < shadowMapCoordsOverW.z ? 0.5 : 1.0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the final color
|
// Compute the final color
|
||||||
|
|
|
@ -166,7 +166,7 @@ void SceneDemo::render() {
|
||||||
mPhongShader.setVector3Uniform("light0DiffuseColor", Vector3(diffCol.r, diffCol.g, diffCol.b));
|
mPhongShader.setVector3Uniform("light0DiffuseColor", Vector3(diffCol.r, diffCol.g, diffCol.b));
|
||||||
mPhongShader.setIntUniform("shadowMapSampler", textureUnit);
|
mPhongShader.setIntUniform("shadowMapSampler", textureUnit);
|
||||||
mPhongShader.setIntUniform("isShadowEnabled", mIsShadowMappingEnabled);
|
mPhongShader.setIntUniform("isShadowEnabled", mIsShadowMappingEnabled);
|
||||||
//mPhongShader.setVector2Uniform("shadowMapDimension", Vector2(SHADOWMAP_WIDTH, SHADOWMAP_HEIGHT));
|
mPhongShader.setVector2Uniform("shadowMapDimension", Vector2(SHADOWMAP_WIDTH, SHADOWMAP_HEIGHT));
|
||||||
|
|
||||||
// Set the viewport to render the scene
|
// Set the viewport to render the scene
|
||||||
glViewport(mViewportX, mViewportY, mViewportWidth, mViewportHeight);
|
glViewport(mViewportX, mViewportY, mViewportWidth, mViewportHeight);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user