diff --git a/data/levels/Compositions.xml b/data/levels/Compositions.xml index c512ba2..443a8e1 100644 --- a/data/levels/Compositions.xml +++ b/data/levels/Compositions.xml @@ -75,7 +75,7 @@ 0.9 0.3 4.0 - -1.5 + -0.5 1.0 1.0 diff --git a/data/levels/scripts/openSecondDoor1.lua b/data/levels/scripts/openSecondDoor1.lua index 836b11b..85f1958 100644 --- a/data/levels/scripts/openSecondDoor1.lua +++ b/data/levels/scripts/openSecondDoor1.lua @@ -29,7 +29,7 @@ function trigger(objectToChange) local yPos = 25.0 local zPos = 54.5 level:preloadLightPosition(xPos, yPos, zPos) - level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -3.5, 1.3, 2.3) + level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.5, 1.3, 2.3) print("openSecondDoor1") end end diff --git a/data/levels/scripts/openSecondDoor2.lua b/data/levels/scripts/openSecondDoor2.lua index 23f3b97..b680df7 100644 --- a/data/levels/scripts/openSecondDoor2.lua +++ b/data/levels/scripts/openSecondDoor2.lua @@ -29,7 +29,7 @@ function trigger(objectToChange) local yPos = 25.0 local zPos = 26.5 level:preloadLightPosition(xPos, yPos, zPos) - level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -3.5, 1.3, 2.3) + level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.5, 1.3, 2.3) print("openSecondDoor2") end end diff --git a/data/levels/scripts/openSecondDoor3.lua b/data/levels/scripts/openSecondDoor3.lua index f931783..9a5faf5 100644 --- a/data/levels/scripts/openSecondDoor3.lua +++ b/data/levels/scripts/openSecondDoor3.lua @@ -29,7 +29,7 @@ function trigger(objectToChange) local yPos = 25.0 local zPos = 26.5 level:preloadLightPosition(xPos, yPos, zPos) - level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -3.5, 1.3, 2.3) + level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.5, 1.3, 2.3) print("openSecondDoor3") end end diff --git a/data/levels/scripts/openSecondDoor4.lua b/data/levels/scripts/openSecondDoor4.lua index 4101d46..fe9ed6c 100644 --- a/data/levels/scripts/openSecondDoor4.lua +++ b/data/levels/scripts/openSecondDoor4.lua @@ -38,7 +38,7 @@ function trigger(objectToChange) local yPos = 25.0 local zPos = 54.5 level:preloadLightPosition(xPos, yPos, zPos) - level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -3.5, 1.3, 2.3) + level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.5, 1.3, 2.3) print("openSecondDoor4") end end diff --git a/data/shader/flame.gsh b/data/shader/flame.gsh index 3c1cba4..11723c1 100644 --- a/data/shader/flame.gsh +++ b/data/shader/flame.gsh @@ -12,37 +12,37 @@ in vec3 Color[]; out vec3 fColor; const float PI = 3.1415926; -const float transition_point_1 = 1.178097; -const float sin_p1_1 = 0.4; -const float sin_p2_1 = 2; -const float ex_p1_1 = 1.093; -const float ex_p2_1 = 1.9996; -const float begin_1 = 0; -const float end_1 = 2.5; +const float transition_point_1 = 0.486946; +const float cos_p1_1 = 0.35; +const float cos_p2_1 = 2.0; +const float ex_p1_1 = -0.193; +const float ex_p2_1 = 2.9426; +const float begin_1 = -0.785398; +const float end_1 = 1.5; -const float transition_point_2 = 1.570796; -const float sin_p1_2 = 0.2; -const float sin_p2_2 = 1.5; -const float ex_p1_2 = 0.4; -const float ex_p2_2 = 1.5; -const float begin_2 = 0; -const float end_2 = 3; +const float transition_point_2 = 0.600598; +const float cos_p1_2 = 0.3; +const float cos_p2_2 = 1.7; +const float ex_p1_2 = -0.19; +const float ex_p2_2 = 2.762; +const float begin_2 = -0.923998; +const float end_2 = 2; float flickerFunction() { - return pow(0.6*sin(20.0*time), 2) + 0.4; + return pow(sin(20.0*time + gl_in[0].gl_Position.x*gl_in[0].gl_Position.z), 2); } float radiusFunction(float x) { float value_1 = 0.0; float value_2 = 0.0; if (x < transition_point_1) { - value_1 = sin_p1_1 * sin(sin_p2_1 * x); + value_1 = cos_p1_1 * cos(cos_p2_1 * x); } else { value_1 = exp(ex_p1_1 - ex_p2_1 * x); } if (x < transition_point_2) { - value_2 = sin_p1_2 * sin(sin_p2_2 * x); + value_2 = cos_p1_2 * cos(cos_p2_2 * x); } else { value_2 = exp(ex_p1_2 - ex_p2_2 * x); @@ -53,7 +53,7 @@ float radiusFunction(float x) { void main() { fColor = Color[0]; - float resolution = 8.0; + float resolution = 6.0; float this_begin = mix(begin_1, begin_2, flickerFunction()); float this_end = mix(end_1, end_2, flickerFunction()); float step = abs(this_end-this_begin)/resolution/2.0; diff --git a/data/shader/flame.vsh b/data/shader/flame.vsh index 7f730c9..6d645f2 100644 --- a/data/shader/flame.vsh +++ b/data/shader/flame.vsh @@ -1,6 +1,7 @@ #version 150 uniform mat4 viewProjectionMatrix; +uniform vec2 skew; in vec3 aPosition; in vec3 aColor; diff --git a/data/shader/phong.fsh b/data/shader/phong.fsh index 707fe32..a44f9d7 100644 --- a/data/shader/phong.fsh +++ b/data/shader/phong.fsh @@ -64,8 +64,8 @@ vec2 poissonDisk[16] = vec2[]( vec2( 0.14383161, -0.14100790 ) ); -float flickerFunction() { - return pow(0.6*sin(20.0*time), 2) + 0.4; +float flickerFunction(int index) { + return 0.7*pow(sin(20.0*time + lightSources[index].x*lightSources[index].z), 2) + 0.3; } float sampleDirectionalShadow(sampler2DShadow shadowMap, vec4 shadowCoord, float maxBias ) { @@ -187,7 +187,7 @@ void main() vec3 lightVector = normalize(lightSources[i]-vec3(fragPosition)); float intensity = 0.0f; if (isFlame[i] == true) { - intensity = clamp(exp(-(1/(lightIntensities[i] + flickerFunction()))*distance), 0.0, 1.0); + intensity = clamp(exp(-(1/(lightIntensities[i] + flickerFunction(i)))*distance), 0.0, 1.0); } else { intensity = clamp(exp(-(1/lightIntensities[i])*distance), 0.0, 1.0); diff --git a/flame.cc b/flame.cc index 2512f74..33183ac 100644 --- a/flame.cc +++ b/flame.cc @@ -38,16 +38,21 @@ void Flame::render(SharedShaderProgram shader, glm::mat4 viewProjectionMatrix, f 0.0f, tan(skewing.y), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); if (!withColor) { - modelMatrix = skewMatrixX * skewMatrixZ * glm::scale(size * glm::vec3(1.1f)); + modelMatrix = skewMatrixX * skewMatrixZ * glm::scale(size * glm::vec3(1.1f)) + * glm::rotate(skewing.x, glm::vec3(1.0f, 0.0f, 0.0f)) + * glm::rotate(skewing.y, glm::vec3(0.0f, 0.0f, 1.0f)); } else { - modelMatrix = skewMatrixX * skewMatrixZ * glm::scale(size); + modelMatrix = skewMatrixX * skewMatrixZ * glm::scale(size) + * glm::rotate(skewing.x, glm::vec3(1.0f, 0.0f, 0.0f)) + * glm::rotate(skewing.y, glm::vec3(0.0f, 0.0f, 1.0f)); } glm::mat4 modelViewProjectionMatrix = viewProjectionMatrix * modelMatrix; shader->setUniform("modelViewProjectionMatrix", modelViewProjectionMatrix); shader->setUniform("viewProjectionMatrix", viewProjectionMatrix); shader->setUniform("withColor", withColor); shader->setUniform("time", time); + shader->setUniform("skew", skewing); shader->setUniform("bottom", true); shader->setUniform("left", true); vao->render(); diff --git a/graphics.cc b/graphics.cc index 5e25d97..dab7afa 100644 --- a/graphics.cc +++ b/graphics.cc @@ -292,7 +292,7 @@ void Graphics::render(double time) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //wind - glm::vec2 wind = glm::vec2(-0.4f, 0.3f); + glm::vec2 wind = glm::vec2(0.0f, 0.0f); //set view and projection matrix glm::mat4 lightingViewProjectionMatrix = glm::perspective(1.571f, (float)windowSize.x/(float)windowSize.y, 0.1f, farPlane) * buildViewMatrix(level);