From 17f86c313ead7d2b07619dab365a9a7e3ab8794d Mon Sep 17 00:00:00 2001 From: codeanticode Date: Tue, 5 Feb 2013 16:24:42 -0500 Subject: [PATCH] renamed modelview and projection matrices in the shaders --- .../src/processing/opengl/LineShaderFrag.glsl | 2 +- .../src/processing/opengl/LineShaderVert.glsl | 14 ++++---- .../src/processing/opengl/MaskShaderFrag.glsl | 2 +- .../processing/opengl/PGraphicsOpenGL.java | 36 +++++++++---------- .../processing/opengl/PointShaderFrag.glsl | 2 +- .../processing/opengl/PointShaderVert.glsl | 12 +++---- .../opengl/PolyColorShaderVert.glsl | 2 +- .../opengl/PolyLightShaderVert.glsl | 6 ++-- .../opengl/PolyNoTexShaderFrag.glsl | 2 +- .../processing/opengl/PolyTexShaderFrag.glsl | 2 +- .../processing/opengl/PolyTexShaderVert.glsl | 2 +- .../opengl/PolyTexlightShaderVert.glsl | 8 ++--- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/core/src/processing/opengl/LineShaderFrag.glsl b/core/src/processing/opengl/LineShaderFrag.glsl index b05b87776..dc08a3fa2 100644 --- a/core/src/processing/opengl/LineShaderFrag.glsl +++ b/core/src/processing/opengl/LineShaderFrag.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/core/src/processing/opengl/LineShaderVert.glsl b/core/src/processing/opengl/LineShaderVert.glsl index 5e6122c0d..8d6a7e79c 100644 --- a/core/src/processing/opengl/LineShaderVert.glsl +++ b/core/src/processing/opengl/LineShaderVert.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,8 +18,8 @@ Boston, MA 02111-1307 USA */ -uniform mat4 modelviewMatrix; -uniform mat4 projectionMatrix; +uniform mat4 modelview; +uniform mat4 projection; uniform vec4 viewport; uniform int perspective; @@ -44,20 +44,20 @@ vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) { void main() { vec4 pos_p = inVertex; - vec4 v_p = modelviewMatrix * pos_p; + vec4 v_p = modelview * pos_p; // Moving vertices slightly toward the camera // to avoid depth-fighting with the fill triangles. // Discussed here: // http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848 v_p.xyz = v_p.xyz * scale; - vec4 clip_p = projectionMatrix * v_p; + vec4 clip_p = projection * v_p; float thickness = inLine.w; if (thickness != 0.0) { vec4 pos_q = vec4(inLine.xyz, 1); - vec4 v_q = modelviewMatrix * pos_q; + vec4 v_q = modelview * pos_q; v_q.xyz = v_q.xyz * scale; - vec4 clip_q = projectionMatrix * v_q; + vec4 clip_q = projection * v_q; vec3 window_p = clipToWindow(clip_p, viewport); vec3 window_q = clipToWindow(clip_q, viewport); diff --git a/core/src/processing/opengl/MaskShaderFrag.glsl b/core/src/processing/opengl/MaskShaderFrag.glsl index d70e76394..4dfba01eb 100644 --- a/core/src/processing/opengl/MaskShaderFrag.glsl +++ b/core/src/processing/opengl/MaskShaderFrag.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012 Ben Fry and Casey Reas + Copyright (c) 2012-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 954385a1e..b360bd32c 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2004-12 Ben Fry and Casey Reas + Copyright (c) 2004-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -6470,10 +6470,10 @@ public class PGraphicsOpenGL extends PGraphics { protected class BaseShader extends PShader { - protected int transformMatrixLoc; - protected int modelviewMatrixLoc; - protected int projectionMatrixLoc; - protected int bufferSamplerLoc; + protected int transformLoc; + protected int modelviewLoc; + protected int projectionLoc; + protected int bufferLoc; protected int viewportLoc; public BaseShader(PApplet parent) { @@ -6490,16 +6490,16 @@ public class PGraphicsOpenGL extends PGraphics { @Override public void loadUniforms() { - transformMatrixLoc = getUniformLoc("transform"); - modelviewMatrixLoc = getUniformLoc("modelviewMatrix"); - projectionMatrixLoc = getUniformLoc("projectionMatrix"); + transformLoc = getUniformLoc("transform"); + modelviewLoc = getUniformLoc("modelview"); + projectionLoc = getUniformLoc("projection"); viewportLoc = getUniformLoc("viewport"); - bufferSamplerLoc = getUniformLoc("buffer"); + bufferLoc = getUniformLoc("buffer"); } @Override public void unbind() { - if (-1 < bufferSamplerLoc) { + if (-1 < bufferLoc) { pgl.needFBOLayer(); pgl.activeTexture(PGL.TEXTURE0 + lastTexUnit); pgCurrent.unbindBackTexture(); @@ -6512,19 +6512,19 @@ public class PGraphicsOpenGL extends PGraphics { } protected void setCommonUniforms() { - if (-1 < transformMatrixLoc) { + if (-1 < transformLoc) { pgCurrent.updateGLProjmodelview(); - setUniformMatrix(transformMatrixLoc, pgCurrent.glProjmodelview); + setUniformMatrix(transformLoc, pgCurrent.glProjmodelview); } - if (-1 < modelviewMatrixLoc) { + if (-1 < modelviewLoc) { pgCurrent.updateGLModelview(); - setUniformMatrix(modelviewMatrixLoc, pgCurrent.glModelview); + setUniformMatrix(modelviewLoc, pgCurrent.glModelview); } - if (-1 < projectionMatrixLoc) { + if (-1 < projectionLoc) { pgCurrent.updateGLProjection(); - setUniformMatrix(projectionMatrixLoc, pgCurrent.glProjection); + setUniformMatrix(projectionLoc, pgCurrent.glProjection); } if (-1 < viewportLoc) { @@ -6535,8 +6535,8 @@ public class PGraphicsOpenGL extends PGraphics { setUniformValue(viewportLoc, x, y, w, h); } - if (-1 < bufferSamplerLoc) { - setUniformValue(bufferSamplerLoc, lastTexUnit); + if (-1 < bufferLoc) { + setUniformValue(bufferLoc, lastTexUnit); pgl.activeTexture(PGL.TEXTURE0 + lastTexUnit); pgCurrent.bindBackTexture(); } diff --git a/core/src/processing/opengl/PointShaderFrag.glsl b/core/src/processing/opengl/PointShaderFrag.glsl index 16742d2bd..d5d23ae22 100644 --- a/core/src/processing/opengl/PointShaderFrag.glsl +++ b/core/src/processing/opengl/PointShaderFrag.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/core/src/processing/opengl/PointShaderVert.glsl b/core/src/processing/opengl/PointShaderVert.glsl index 25b226b5b..43c94d39b 100644 --- a/core/src/processing/opengl/PointShaderVert.glsl +++ b/core/src/processing/opengl/PointShaderVert.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,8 +18,8 @@ Boston, MA 02111-1307 USA */ -uniform mat4 projectionMatrix; -uniform mat4 modelviewMatrix; +uniform mat4 projection; +uniform mat4 modelview; uniform vec4 viewport; uniform int perspective; @@ -36,13 +36,13 @@ vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) { } void main() { - vec4 pos = modelviewMatrix * inVertex; - vec4 clip = projectionMatrix * pos; + vec4 pos = modelview * inVertex; + vec4 clip = projection * pos; if (0 < perspective) { // Perspective correction (points will look thiner as they move away // from the view position). - gl_Position = clip + projectionMatrix * vec4(inPoint.xy, 0, 0); + gl_Position = clip + projection * vec4(inPoint.xy, 0, 0); } else { // No perspective correction. vec4 offset = windowToClipVector(inPoint.xy, viewport, clip.w); diff --git a/core/src/processing/opengl/PolyColorShaderVert.glsl b/core/src/processing/opengl/PolyColorShaderVert.glsl index 42c916216..241cc2f32 100644 --- a/core/src/processing/opengl/PolyColorShaderVert.glsl +++ b/core/src/processing/opengl/PolyColorShaderVert.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/core/src/processing/opengl/PolyLightShaderVert.glsl b/core/src/processing/opengl/PolyLightShaderVert.glsl index fd181210a..0ab15878f 100644 --- a/core/src/processing/opengl/PolyLightShaderVert.glsl +++ b/core/src/processing/opengl/PolyLightShaderVert.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,7 +18,7 @@ Boston, MA 02111-1307 USA */ -uniform mat4 modelviewMatrix; +uniform mat4 modelview; uniform mat4 transform; uniform mat3 normalMatrix; @@ -76,7 +76,7 @@ void main() { gl_Position = transform * inVertex; // Vertex in eye coordinates - vec3 ecVertex = vec3(modelviewMatrix * inVertex); + vec3 ecVertex = vec3(modelview * inVertex); // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * inNormal); diff --git a/core/src/processing/opengl/PolyNoTexShaderFrag.glsl b/core/src/processing/opengl/PolyNoTexShaderFrag.glsl index 16742d2bd..d5d23ae22 100644 --- a/core/src/processing/opengl/PolyNoTexShaderFrag.glsl +++ b/core/src/processing/opengl/PolyNoTexShaderFrag.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/core/src/processing/opengl/PolyTexShaderFrag.glsl b/core/src/processing/opengl/PolyTexShaderFrag.glsl index 9d09c61a0..6c1ed8a8e 100644 --- a/core/src/processing/opengl/PolyTexShaderFrag.glsl +++ b/core/src/processing/opengl/PolyTexShaderFrag.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/core/src/processing/opengl/PolyTexShaderVert.glsl b/core/src/processing/opengl/PolyTexShaderVert.glsl index d34b69fe5..460ec4037 100644 --- a/core/src/processing/opengl/PolyTexShaderVert.glsl +++ b/core/src/processing/opengl/PolyTexShaderVert.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/core/src/processing/opengl/PolyTexlightShaderVert.glsl b/core/src/processing/opengl/PolyTexlightShaderVert.glsl index ce12288b6..13ef16548 100644 --- a/core/src/processing/opengl/PolyTexlightShaderVert.glsl +++ b/core/src/processing/opengl/PolyTexlightShaderVert.glsl @@ -1,7 +1,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2011-12 Ben Fry and Casey Reas + Copyright (c) 2011-13 Ben Fry and Casey Reas This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,7 +18,7 @@ Boston, MA 02111-1307 USA */ -uniform mat4 modelviewMatrix; +uniform mat4 modelview; uniform mat4 transform; uniform mat3 normalMatrix; uniform mat4 texcoordMatrix; @@ -76,10 +76,10 @@ float blinnPhongFactor(vec3 lightDir, vec3 vertPos, vec3 vecNormal, float shine) void main() { // Vertex in clip coordinates - gl_Position = projmodelviewMatrix * inVertex; + gl_Position = transform * inVertex; // Vertex in eye coordinates - vec3 ecVertex = vec3(modelviewMatrix * inVertex); + vec3 ecVertex = vec3(modelview * inVertex); // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * inNormal);