Skip to content

Commit

Permalink
wireframe shader compatible with wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
mathis committed Dec 18, 2023
1 parent 8784ed1 commit 1bf7552
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions OpenGL/src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ void loadResources() {
ResourceManager::loadCubeMap("skyboxNight", skyboxNightFaces);

#ifdef EMSCRIPTEN
ResourceManager::loadShader("simple", "simple_emscripten.vert", "simple_emscripten.frag");
ResourceManager::loadShader("simple", "simple_emscripten.vert", "simple_emscripten.frag");
#else
ResourceManager::loadShader("simple", "simple.vert", "simple.frag");
ResourceManager::loadShader("simple", "simple.vert", "simple.frag");
#endif
ResourceManager::loadShader("skyBox", "skyBox.vert", "skyBox.frag");
ResourceManager::loadShader("font", "font.vert", "font.frag");
Expand Down
2 changes: 1 addition & 1 deletion OpenGL/src/shader/wireframe.frag
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version 430 core
#version 300 es

precision mediump float;

Expand Down
9 changes: 4 additions & 5 deletions OpenGL/src/shader/wireframe.vert
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

#version 430 core
#version 300 es

in vec3 v_position;

Expand All @@ -14,8 +13,8 @@ void main() {
vec4 vertPos4 = m_view * m_model * vec4(v_position, 1.0);
gl_Position = m_projection * vertPos4;

const float maxDist = 64;
float alpha = 1 - length(vertPos4.xyz) / maxDist;
vertexColor = vec4(1.0, 1.0, 0.0, max(alpha, 0));
const float maxDist = 64.0;
float alpha = 1.0 - length(vertPos4.xyz) / maxDist;
vertexColor = vec4(1.0, 1.0, 0.0, max(alpha, 0.0));
}

0 comments on commit 1bf7552

Please sign in to comment.