mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Updated shaders
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
varying vec4 vertColor;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vertColor;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D textureSampler;
|
||||
|
||||
uniform vec2 texcoordOffset;
|
||||
|
||||
varying vec4 vertColor;
|
||||
varying vec4 vertTexcoord;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = texture2D(textureSampler, vertTexcoord.st) * vertColor;
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
uniform mat4 modelviewMatrix;
|
||||
uniform mat4 projmodelviewMatrix;
|
||||
uniform mat3 normalMatrix;
|
||||
uniform mat4 texcoordMatrix;
|
||||
|
||||
uniform int lightCount;
|
||||
uniform vec4 lightPosition[8];
|
||||
uniform vec3 lightNormal[8];
|
||||
uniform vec3 lightAmbient[8];
|
||||
uniform vec3 lightDiffuse[8];
|
||||
uniform vec3 lightSpecular[8];
|
||||
uniform vec3 lightFalloffCoefficients[8];
|
||||
uniform vec2 lightSpotParameters[8];
|
||||
|
||||
attribute vec4 inVertex;
|
||||
attribute vec4 inColor;
|
||||
attribute vec3 inNormal;
|
||||
attribute vec2 inTexcoord;
|
||||
|
||||
attribute vec4 inAmbient;
|
||||
attribute vec4 inSpecular;
|
||||
attribute vec4 inEmissive;
|
||||
attribute float inShine;
|
||||
|
||||
varying vec4 vertColor;
|
||||
varying vec4 vertTexcoord;
|
||||
|
||||
const float zero_float = 0.0;
|
||||
const float one_float = 1.0;
|
||||
const vec3 zero_vec3 = vec3(0);
|
||||
|
||||
float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) {
|
||||
vec3 lpv = lightPos - vertPos;
|
||||
vec3 dist = vec3(one_float);
|
||||
dist.z = dot(lpv, lpv);
|
||||
dist.y = sqrt(dist.z);
|
||||
return one_float / dot(dist, coeff);
|
||||
}
|
||||
|
||||
float spotFactor(vec3 lightPos, vec3 vertPos, vec3 lightNorm, float minCos, float spotExp) {
|
||||
vec3 lpv = normalize(lightPos - vertPos);
|
||||
float spotCos = dot(-lightNorm, lpv);
|
||||
return spotCos <= minCos ? zero_float : pow(spotCos, spotExp);
|
||||
}
|
||||
|
||||
float lambertFactor(vec3 lightDir, vec3 vecNormal) {
|
||||
return max(zero_float, dot(lightDir, vecNormal));
|
||||
}
|
||||
|
||||
float blinnPhongFactor(vec3 lightDir, vec3 lightPos, vec3 vecNormal, float shine) {
|
||||
vec3 ldp = normalize(lightDir - lightPos);
|
||||
return pow(max(zero_float, dot(ldp, vecNormal)), shine);
|
||||
}
|
||||
|
||||
void main() {
|
||||
// Vertex in clip coordinates
|
||||
gl_Position = projmodelviewMatrix * inVertex;
|
||||
|
||||
// Vertex in eye coordinates
|
||||
vec3 ecVertex = vec3(modelviewMatrix * inVertex);
|
||||
|
||||
// Normal vector in eye coordinates
|
||||
vec3 ecNormal = normalize(normalMatrix * inNormal);
|
||||
|
||||
if (dot(-ecVertex, ecNormal) < zero_float) {
|
||||
// If normal is away from camera, choose its opposite.
|
||||
// If we add backface culling, this will be backfacing
|
||||
ecNormal *= -one_float;
|
||||
}
|
||||
|
||||
// Light calculations
|
||||
vec3 totalAmbient = vec3(0, 0, 0);
|
||||
vec3 totalDiffuse = vec3(0, 0, 0);
|
||||
vec3 totalSpecular = vec3(0, 0, 0);
|
||||
for (int i = 0; i < lightCount; i++) {
|
||||
vec3 lightPos = lightPosition[i].xyz;
|
||||
bool isDir = zero_float < lightPosition[i].w;
|
||||
float spotCos = lightSpotParameters[i].x;
|
||||
float spotExp = lightSpotParameters[i].y;
|
||||
|
||||
vec3 lightDir;
|
||||
float falloff;
|
||||
float spotf;
|
||||
|
||||
if (isDir) {
|
||||
falloff = one_float;
|
||||
lightDir = -lightNormal[i];
|
||||
} else {
|
||||
falloff = falloffFactor(lightPos, ecVertex, lightFalloffCoefficients[i]);
|
||||
lightDir = normalize(lightPos - ecVertex);
|
||||
}
|
||||
|
||||
spotf = spotExp > zero_float ? spotFactor(lightPos, ecVertex, lightNormal[i],
|
||||
spotCos, spotExp)
|
||||
: one_float;
|
||||
|
||||
if (any(greaterThan(lightAmbient[i], zero_vec3))) {
|
||||
totalAmbient += lightAmbient[i] * falloff;
|
||||
}
|
||||
|
||||
if (any(greaterThan(lightDiffuse[i], zero_vec3))) {
|
||||
totalDiffuse += lightDiffuse[i] * falloff * spotf *
|
||||
lambertFactor(lightDir, ecNormal);
|
||||
}
|
||||
|
||||
if (any(greaterThan(lightSpecular[i], zero_vec3))) {
|
||||
totalSpecular += lightSpecular[i] * falloff * spotf *
|
||||
blinnPhongFactor(lightDir, lightPos, ecNormal, inShine);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculating final color as result of all lights (plus emissive term)
|
||||
vertColor = vec4(totalAmbient, 1) * inAmbient +
|
||||
vec4(totalDiffuse, 1) * inColor +
|
||||
vec4(totalSpecular, 1) * inSpecular +
|
||||
inEmissive;
|
||||
|
||||
// Calculating texture coordinates, with r and q set both to one
|
||||
vertTexcoord = texcoordMatrix * vec4(inTexcoord, 1.0, 1.0);
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
uniform mat4 modelviewMatrix;
|
||||
uniform mat4 projmodelviewMatrix;
|
||||
uniform mat3 normalMatrix;
|
||||
|
||||
uniform int lightCount;
|
||||
uniform vec4 lightPosition[8];
|
||||
uniform vec3 lightNormal[8];
|
||||
uniform vec3 lightAmbient[8];
|
||||
uniform vec3 lightDiffuse[8];
|
||||
uniform vec3 lightSpecular[8];
|
||||
uniform vec3 lightFalloffCoefficients[8];
|
||||
uniform vec2 lightSpotParameters[8];
|
||||
|
||||
attribute vec4 inVertex;
|
||||
attribute vec4 inColor;
|
||||
attribute vec3 inNormal;
|
||||
|
||||
attribute vec4 inAmbient;
|
||||
attribute vec4 inSpecular;
|
||||
attribute vec4 inEmissive;
|
||||
attribute float inShine;
|
||||
|
||||
varying vec4 vertColor;
|
||||
|
||||
const float zero_float = 0.0;
|
||||
const float one_float = 1.0;
|
||||
const vec3 zero_vec3 = vec3(0);
|
||||
|
||||
float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) {
|
||||
vec3 lpv = lightPos - vertPos;
|
||||
vec3 dist = vec3(one_float);
|
||||
dist.z = dot(lpv, lpv);
|
||||
dist.y = sqrt(dist.z);
|
||||
return one_float / dot(dist, coeff);
|
||||
}
|
||||
|
||||
float spotFactor(vec3 lightPos, vec3 vertPos, vec3 lightNorm, float minCos, float spotExp) {
|
||||
vec3 lpv = normalize(lightPos - vertPos);
|
||||
float spotCos = dot(-lightNorm, lpv);
|
||||
return spotCos <= minCos ? zero_float : pow(spotCos, spotExp);
|
||||
}
|
||||
|
||||
float lambertFactor(vec3 lightDir, vec3 vecNormal) {
|
||||
return max(zero_float, dot(lightDir, vecNormal));
|
||||
}
|
||||
|
||||
float blinnPhongFactor(vec3 lightDir, vec3 lightPos, vec3 vecNormal, float shine) {
|
||||
vec3 ldp = normalize(lightDir - lightPos);
|
||||
return pow(max(zero_float, dot(ldp, vecNormal)), shine);
|
||||
}
|
||||
|
||||
void main() {
|
||||
// Vertex in clip coordinates
|
||||
gl_Position = projmodelviewMatrix * inVertex;
|
||||
|
||||
// Vertex in eye coordinates
|
||||
vec3 ecVertex = vec3(modelviewMatrix * inVertex);
|
||||
|
||||
// Normal vector in eye coordinates
|
||||
vec3 ecNormal = normalize(normalMatrix * inNormal);
|
||||
|
||||
if (dot(-ecVertex, ecNormal) < zero_float) {
|
||||
// If normal is away from camera, choose its opposite.
|
||||
// If we add backface culling, this will be backfacing
|
||||
ecNormal *= -one_float;
|
||||
}
|
||||
|
||||
// Light calculations
|
||||
vec3 totalAmbient = vec3(0, 0, 0);
|
||||
vec3 totalDiffuse = vec3(0, 0, 0);
|
||||
vec3 totalSpecular = vec3(0, 0, 0);
|
||||
for (int i = 0; i < lightCount; i++) {
|
||||
vec3 lightPos = lightPosition[i].xyz;
|
||||
bool isDir = zero_float < lightPosition[i].w;
|
||||
float spotCos = lightSpotParameters[i].x;
|
||||
float spotExp = lightSpotParameters[i].y;
|
||||
|
||||
vec3 lightDir;
|
||||
float falloff;
|
||||
float spotf;
|
||||
|
||||
if (isDir) {
|
||||
falloff = one_float;
|
||||
lightDir = -lightNormal[i];
|
||||
} else {
|
||||
falloff = falloffFactor(lightPos, ecVertex, lightFalloffCoefficients[i]);
|
||||
lightDir = normalize(lightPos - ecVertex);
|
||||
}
|
||||
|
||||
spotf = spotExp > zero_float ? spotFactor(lightPos, ecVertex, lightNormal[i],
|
||||
spotCos, spotExp)
|
||||
: one_float;
|
||||
|
||||
if (any(greaterThan(lightAmbient[i], zero_vec3))) {
|
||||
totalAmbient += lightAmbient[i] * falloff;
|
||||
}
|
||||
|
||||
if (any(greaterThan(lightDiffuse[i], zero_vec3))) {
|
||||
totalDiffuse += lightDiffuse[i] * falloff * spotf *
|
||||
lambertFactor(lightDir, ecNormal);
|
||||
}
|
||||
|
||||
if (any(greaterThan(lightSpecular[i], zero_vec3))) {
|
||||
totalSpecular += lightSpecular[i] * falloff * spotf *
|
||||
blinnPhongFactor(lightDir, lightPos, ecNormal, inShine);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Calculating final color as result of all lights (plus emissive term)
|
||||
vertColor = vec4(totalAmbient, 1) * inAmbient +
|
||||
vec4(totalDiffuse, 1) * inColor +
|
||||
vec4(totalSpecular, 1) * inSpecular +
|
||||
inEmissive;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
uniform mat4 projmodelviewMatrix;
|
||||
|
||||
attribute vec4 inVertex;
|
||||
attribute vec4 inColor;
|
||||
|
||||
varying vec4 vertColor;
|
||||
|
||||
void main() {
|
||||
gl_Position = projmodelviewMatrix * inVertex;
|
||||
|
||||
vertColor = inColor;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
uniform mat4 projmodelviewMatrix;
|
||||
uniform mat4 texcoordMatrix;
|
||||
|
||||
attribute vec4 inVertex;
|
||||
attribute vec4 inColor;
|
||||
attribute vec2 inTexcoord;
|
||||
|
||||
varying vec4 vertColor;
|
||||
varying vec4 vertTexcoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = projmodelviewMatrix * inVertex;
|
||||
|
||||
vertColor = inColor;
|
||||
vertTexcoord = texcoordMatrix * vec4(inTexcoord, 1.0, 1.0);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
varying vec4 vertColor;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vertColor;
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
Based on glsl code from the dpix library:
|
||||
http://gfx.cs.princeton.edu/proj/dpix/
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
uniform mat4 modelviewMatrix;
|
||||
uniform mat4 projectionMatrix;
|
||||
|
||||
uniform vec4 viewport;
|
||||
uniform int perspective;
|
||||
|
||||
attribute vec4 inVertex;
|
||||
attribute vec4 inColor;
|
||||
attribute vec4 inDirWidth;
|
||||
|
||||
varying vec4 vertColor;
|
||||
|
||||
vec3 clipToWindow(vec4 clip, vec4 viewport) {
|
||||
vec3 post_div = clip.xyz / clip.w;
|
||||
vec2 xypos = (post_div.xy + vec2(1.0, 1.0)) * 0.5 * viewport.zw;
|
||||
return vec3(xypos, post_div.z * 0.5 + 0.5);
|
||||
}
|
||||
|
||||
vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) {
|
||||
vec2 xypos = (window / viewport.zw) * 2.0;
|
||||
return vec4(xypos, 0.0, 0.0) * clip_w;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 pos_p = inVertex;
|
||||
vec4 pos_q = vec4(inDirWidth.xyz, 1);
|
||||
|
||||
vec4 v_p = modelviewMatrix * pos_p;
|
||||
vec4 clip_p = projectionMatrix * v_p;
|
||||
|
||||
vec4 v_q = modelviewMatrix * pos_q;
|
||||
vec4 clip_q = projectionMatrix * v_q;
|
||||
|
||||
vec3 window_p = clipToWindow(clip_p, viewport);
|
||||
vec3 window_q = clipToWindow(clip_q, viewport);
|
||||
vec3 tangent = window_q - window_p;
|
||||
|
||||
float segment_length = length(tangent.xy);
|
||||
vec2 perp = normalize(vec2(-tangent.y, tangent.x));
|
||||
float thickness = inDirWidth.w;
|
||||
vec2 window_offset = perp * thickness;
|
||||
|
||||
if (0 < perspective) {
|
||||
// Perspective correction (lines will look thiner as they move away
|
||||
// from the view position).
|
||||
gl_Position.xy = clip_p.xy + window_offset.xy;
|
||||
gl_Position.zw = clip_p.zw;
|
||||
} else {
|
||||
// No perspective correction.
|
||||
float clip_p_w = clip_p.w;
|
||||
vec4 offset_p = windowToClipVector(window_offset, viewport, clip_p_w);
|
||||
gl_Position = clip_p + offset_p;
|
||||
}
|
||||
|
||||
vertColor = inColor;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
varying vec4 vertColor;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vertColor;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2011 Andres Colubri
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
uniform mat4 projectionMatrix;
|
||||
uniform mat4 modelviewMatrix;
|
||||
|
||||
attribute vec4 inVertex;
|
||||
attribute vec4 inColor;
|
||||
attribute vec2 inSize;
|
||||
|
||||
varying vec4 vertColor;
|
||||
|
||||
void main() {
|
||||
vec4 pos = modelviewMatrix * inVertex;
|
||||
pos.xy += inSize.xy;
|
||||
gl_Position = projectionMatrix * pos;
|
||||
|
||||
vertColor = inColor;
|
||||
}
|
||||
Reference in New Issue
Block a user