From e63e356ec5947f2641b7df33fa47daa782814358 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 25 Apr 2016 22:07:15 -0400 Subject: render: Use separate model, view, and projection matrices. * sly/render.scm: Replace 'model-view' procedures with separate 'model' and 'view' procedures. ()[model-view]: Delete field. [model, view]: New fields. * sly/render/camera.scm (with-camera): Use separate model/view matrices. * sly/render/shader.scm (%default-shader): Specify model, view, and projection uniforms. * sly/render/sprite-batch.scm (sprite-batch-flush!): Use new model, view, and projection uniforms. * data/shaders/default-vertex.glsl (model, view, projection): New uniforms. (mvp): Delete. --- data/shaders/default-vertex.glsl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'data/shaders') diff --git a/data/shaders/default-vertex.glsl b/data/shaders/default-vertex.glsl index 11f389f..d2ab135 100644 --- a/data/shaders/default-vertex.glsl +++ b/data/shaders/default-vertex.glsl @@ -3,9 +3,11 @@ in vec3 position; in vec2 tex; out vec2 frag_tex; -uniform mat4 mvp; +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; void main(void) { frag_tex = tex; - gl_Position = mvp * vec4(position.xyz, 1.0); + gl_Position = projection * view * model * vec4(position.xyz, 1.0); } -- cgit v1.2.3