Browse Source

Backport Triplanar Mapping example to v0.17.0;

bjorn 10 months ago
parent
commit
0d350dd587
1 changed files with 7 additions and 4 deletions
  1. 7 4
      examples/Environment/Triplanar_Mapping/main.lua

+ 7 - 4
examples/Environment/Triplanar_Mapping/main.lua

@@ -4,10 +4,13 @@ function lovr.load()
   dirt = lovr.graphics.newTexture('dirt.png')
 
   triplanar = lovr.graphics.newShader('unlit', [[
-    uniform texture2D textureX;
-    uniform texture2D textureY;
-    uniform texture2D textureZ;
-    uniform float textureScale;
+    layout(set = 2, binding = 0) uniform texture2D textureX;
+    layout(set = 2, binding = 1) uniform texture2D textureY;
+    layout(set = 2, binding = 2) uniform texture2D textureZ;
+    
+    Constants {
+      float textureScale;
+    };
 
     vec4 lovrmain() {
       vec2 xscale = vec2(-sign(Normal.x), -1.);