Ver código fonte

Minor example fixes;

bjorn 2 anos atrás
pai
commit
dc6b4c3922

+ 2 - 2
examples/Effects/Billboards/main.lua

@@ -15,14 +15,14 @@ function lovr.load()
     end
   end
   puffTexture = lovr.graphics.newTexture(puffImage)
-  puffMaterial = lovr.graphics.newMaterial(puffTexture)
+  puffMaterial = lovr.graphics.newMaterial({ texture = puffTexture })
 
   -- puff positions
   redPuffs = {}
   for i = 1, 100 do
     table.insert(redPuffs, {
       position = lovr.math.newVec3(
-        lovr.math.random() - .5, 
+        lovr.math.random() - .5,
         lovr.math.random() - .5 + 1.7,
         lovr.math.random() - .5
       )

+ 4 - 2
examples/Interaction/Controller_Models/main.lua

@@ -3,8 +3,6 @@ function lovr.load()
     left = lovr.headset.newModel('hand/left'),
     right = lovr.headset.newModel('hand/right')
   }
-
-  if not next(models) then print('No models loaded') end
 end
 
 function lovr.draw(pass)
@@ -13,4 +11,8 @@ function lovr.draw(pass)
       pass:draw(model, mat4(lovr.headset.getPose(hand)))
     end
   end
+
+  if not next(models) then
+    pass:text('No models loaded', 0, 1.7, -1, .1)
+  end
 end

+ 0 - 26
examples/Intro/Custom_Mesh/shader.lua

@@ -1,26 +0,0 @@
--- Copy of fragment shader from Physics example
-return [[
-in vec3 lightDirection;
-in vec3 normalDirection;
-in vec3 vertexPosition;
-
-vec4 color(vec4 graphicsColor, sampler2D image, vec2 uv) {
-  vec3 cAmbient = vec3(.25);
-  vec3 cDiffuse = vec3(1.);
-  vec3 cSpecular = vec3(.35);
-
-  float diffuse = max(dot(normalDirection, lightDirection), 0.);
-  float specular = 0.;
-
-  if (diffuse > 0.) {
-    vec3 r = reflect(lightDirection, normalDirection);
-    vec3 viewDirection = normalize(-vertexPosition);
-
-    float specularAngle = max(dot(r, viewDirection), 0.);
-    specular = pow(specularAngle, 5.);
-  }
-
-  vec3 cFinal = pow(clamp(vec3(diffuse) * cDiffuse + vec3(specular) * cSpecular, cAmbient, vec3(1.)), vec3(.4545));
-  return vec4(cFinal, 1.) * graphicsColor * texture(image, uv);
-}
-]]