Browse Source

Fix ShaderBlock example again;

bjorn 3 years ago
parent
commit
910ede83e8
1 changed files with 7 additions and 3 deletions
  1. 7 3
      api/lovr/graphics/ShaderBlock/init.lua

+ 7 - 3
api/lovr/graphics/ShaderBlock/init.lua

@@ -41,10 +41,14 @@ return {
       -- Create the shader, injecting the shader code for the block
       -- Create the shader, injecting the shader code for the block
       shader = lovr.graphics.newShader(
       shader = lovr.graphics.newShader(
         block:getShaderCode('ModelBlock') .. [[
         block:getShaderCode('ModelBlock') .. [[
-        vec4 position(mat4 project, mat4 transform, vec4 vertex) {
-          return lovrProjection * lovrTransform * modelPositions[gl_InstanceID] * lovrVertex;
+        vec4 position(mat4 projection, mat4 transform, vec4 vertex) {
+          return projection * transform * modelPositions[lovrInstanceID] * vertex;
         }
         }
-      ]], nil)
+      ]], [[
+        vec4 color(vec4 gcolor, sampler2D image, vec2 uv) {
+          return gcolor * texture(image, uv);
+        }
+      ]])
 
 
       -- Bind the block to the shader
       -- Bind the block to the shader
       shader:sendBlock('ModelBlock', block)
       shader:sendBlock('ModelBlock', block)