diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-04 21:57:24 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-04 21:57:24 -0500 |
commit | 1e8de01d3704c584e43e1b84947487c2aaddb7d7 (patch) | |
tree | 44daec2c6cadacd2a2f66bcbf05e2dabbab83a54 | |
parent | 51971f4d3b08e9e0835e3e11d50e8c27672a25aa (diff) | |
download | therapy-1e8de01d3704c584e43e1b84947487c2aaddb7d7.tar.gz therapy-1e8de01d3704c584e43e1b84947487c2aaddb7d7.tar.bz2 therapy-1e8de01d3704c584e43e1b84947487c2aaddb7d7.zip |
Made some fixes to rendering I guess
This is pretty old so I'm not exactly sure what it does but without it, the monitor gets rendered upside down.
-rw-r--r-- | shaders/bloom2.fragment | 12 | ||||
-rw-r--r-- | shaders/final.fragment | 9 | ||||
-rw-r--r-- | shaders/final.vertex | 2 | ||||
-rw-r--r-- | src/renderer.cpp | 7 |
4 files changed, 16 insertions, 14 deletions
diff --git a/shaders/bloom2.fragment b/shaders/bloom2.fragment index da44ea1..4c50e86 100644 --- a/shaders/bloom2.fragment +++ b/shaders/bloom2.fragment | |||
@@ -16,18 +16,18 @@ float nrand(vec2 n) | |||
16 | void main() | 16 | void main() |
17 | { | 17 | { |
18 | color = vec3(0.0); | 18 | color = vec3(0.0); |
19 | //color += texture(tex2, UV).rgb / 2.0; | 19 | color += texture(clearTex, UV).rgb / 2.0; |
20 | color += texture(blurTex, UV).rgb; | 20 | color += texture(blurTex, UV).rgb; |
21 | color = max(vec3(0.0), color - 0.5); | 21 | color = max(vec3(0.0), color - 0.5); |
22 | //color *= color; | 22 | color *= color; |
23 | 23 | ||
24 | //float flicker = 0.5 + nrand(vec2(iGlobalTime)); | 24 | float flicker = 0.5 + nrand(vec2(iGlobalTime)); |
25 | //flicker *= (flicker); | 25 | flicker *= (flicker); |
26 | //flicker = sqrt(flicker); | 26 | //flicker = sqrt(flicker); |
27 | //flicker = pow(flicker, 1.0/8.0); | 27 | //flicker = pow(flicker, 1.0/8.0); |
28 | //color *= flicker; | 28 | //color *= flicker; |
29 | //color *= mix(vec3(0.0), color, flicker); | 29 | color *= mix(vec3(0.0), color, flicker); |
30 | 30 | ||
31 | color += texture(clearTex, UV).rgb; | 31 | color += texture(clearTex, UV).rgb; |
32 | //color = clamp(color, vec3(0.0), vec3(1.0)); | 32 | color = clamp(color, vec3(0.0), vec3(1.0)); |
33 | } | 33 | } |
diff --git a/shaders/final.fragment b/shaders/final.fragment index b6c49a8..a3ee243 100644 --- a/shaders/final.fragment +++ b/shaders/final.fragment | |||
@@ -15,14 +15,15 @@ const float Tuning_Dimming = 0.0; | |||
15 | const float Tuning_Satur = 1.13; | 15 | const float Tuning_Satur = 1.13; |
16 | const float Tuning_ReflScalar = 0.3; | 16 | const float Tuning_ReflScalar = 0.3; |
17 | const float Tuning_Barrel = 0;//0.12; | 17 | const float Tuning_Barrel = 0;//0.12; |
18 | const float Tuning_Scanline_Brightness = 0.45; | 18 | const float Tuning_Scanline_Brightness = 0.5;//0.45; |
19 | const float Tuning_Scanline_Opacity = 0.55; | 19 | const float Tuning_Scanline_Opacity = 0.75;//0.55; |
20 | const float Tuning_Diff_Brightness = 0.75; | 20 | const float Tuning_Diff_Brightness = 0.75; |
21 | const float Tuning_Spec_Brightness = 0.35; | 21 | const float Tuning_Spec_Brightness = 0.5;//0.35; |
22 | const float Tuning_Spec_Power = 50.0; | 22 | const float Tuning_Spec_Power = 50.0; |
23 | const float Tuning_Fres_Brightness = 1.0; | 23 | const float Tuning_Fres_Brightness = 0.0;//1.0; |
24 | 24 | ||
25 | uniform vec2 resolution; | 25 | uniform vec2 resolution; |
26 | uniform vec3 frameColor; | ||
26 | 27 | ||
27 | vec4 sampleCRT(vec2 uv) | 28 | vec4 sampleCRT(vec2 uv) |
28 | { | 29 | { |
diff --git a/shaders/final.vertex b/shaders/final.vertex index ed6079f..adf266d 100644 --- a/shaders/final.vertex +++ b/shaders/final.vertex | |||
@@ -23,6 +23,6 @@ void main() | |||
23 | mat3 invWorldRot = transpose(mat3(worldMat[0].xyz, worldMat[1].xyz, worldMat[2].xyz)); | 23 | mat3 invWorldRot = transpose(mat3(worldMat[0].xyz, worldMat[1].xyz, worldMat[2].xyz)); |
24 | vec3 worldPos = (worldMat * vec4(vertexPosition_modelspace,1)).xyz; | 24 | vec3 worldPos = (worldMat * vec4(vertexPosition_modelspace,1)).xyz; |
25 | 25 | ||
26 | camDirIn = invWorldRot * (vec3(2,0,0) - worldPos); | 26 | camDirIn = invWorldRot * (vec3(3.75,0,0) - worldPos); |
27 | lightDirIn = invWorldRot * (Tuning_LightPos - worldPos); | 27 | lightDirIn = invWorldRot * (Tuning_LightPos - worldPos); |
28 | } | 28 | } |
diff --git a/src/renderer.cpp b/src/renderer.cpp index 99d5389..ffe9d47 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp | |||
@@ -363,7 +363,7 @@ GLFWwindow* initRenderer() | |||
363 | std::vector<glm::vec3> mesh_vertices; | 363 | std::vector<glm::vec3> mesh_vertices; |
364 | std::vector<glm::vec2> mesh_uvs; | 364 | std::vector<glm::vec2> mesh_uvs; |
365 | std::vector<glm::vec3> mesh_normals; | 365 | std::vector<glm::vec3> mesh_normals; |
366 | loadMesh("res/monitor-fef.obj", mesh_vertices, mesh_uvs, mesh_normals); | 366 | loadMesh("res/monitor-old.obj", mesh_vertices, mesh_uvs, mesh_normals); |
367 | 367 | ||
368 | mesh_numvertices = mesh_vertices.size(); | 368 | mesh_numvertices = mesh_vertices.size(); |
369 | 369 | ||
@@ -795,8 +795,8 @@ void Texture::renderScreen() const | |||
795 | glUniform1i(glGetUniformLocation(finalShader, "scanlinestex"), 1); | 795 | glUniform1i(glGetUniformLocation(finalShader, "scanlinestex"), 1); |
796 | 796 | ||
797 | // Initialize the MVP matrices | 797 | // Initialize the MVP matrices |
798 | glm::mat4 p_matrix = glm::perspective(42.5f, (float) buffer_width / (float) buffer_height, 0.1f, 100.0f); | 798 | glm::mat4 p_matrix = glm::perspective(glm::radians(25.0f), (float) buffer_width / (float) buffer_height, 0.1f, 100.0f); |
799 | glm::mat4 v_matrix = glm::lookAt(glm::vec3(2,0,0), glm::vec3(0,0,0), glm::vec3(0,1,0)); | 799 | glm::mat4 v_matrix = glm::lookAt(glm::vec3(3.75,0,0), glm::vec3(0,0,0), glm::vec3(0,1,0)); |
800 | glm::mat4 m_matrix = glm::mat4(1.0); | 800 | glm::mat4 m_matrix = glm::mat4(1.0); |
801 | glm::mat4 mvp_matrix = p_matrix * v_matrix * m_matrix; | 801 | glm::mat4 mvp_matrix = p_matrix * v_matrix * m_matrix; |
802 | 802 | ||
@@ -804,6 +804,7 @@ void Texture::renderScreen() const | |||
804 | glUniformMatrix4fv(glGetUniformLocation(finalShader, "worldMat"), 1, GL_FALSE, &m_matrix[0][0]); | 804 | glUniformMatrix4fv(glGetUniformLocation(finalShader, "worldMat"), 1, GL_FALSE, &m_matrix[0][0]); |
805 | glUniform2f(glGetUniformLocation(finalShader, "resolution"), buffer_width, buffer_height); | 805 | glUniform2f(glGetUniformLocation(finalShader, "resolution"), buffer_width, buffer_height); |
806 | glUniform1f(glGetUniformLocation(finalShader, "iGlobalTime"), glfwGetTime()); | 806 | glUniform1f(glGetUniformLocation(finalShader, "iGlobalTime"), glfwGetTime()); |
807 | glUniform3f(glGetUniformLocation(finalShader, "frameColor"), 0.76f, 0.78f, 0.81f); | ||
807 | 808 | ||
808 | glEnableVertexAttribArray(0); | 809 | glEnableVertexAttribArray(0); |
809 | glBindBuffer(GL_ARRAY_BUFFER, mesh_vertexbuffer); | 810 | glBindBuffer(GL_ARRAY_BUFFER, mesh_vertexbuffer); |