mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 18:35:37 +01:00
1 line
929 B
GLSL
1 line
929 B
GLSL
#define PROCESSING_TEXTURE_SHADER
|
|
|
|
uniform mat4 transform;
|
|
uniform mat4 modelview;
|
|
uniform mat4 texMatrix;
|
|
|
|
attribute vec4 vertex;
|
|
attribute vec4 color;
|
|
attribute vec2 texCoord;
|
|
attribute vec3 normal;
|
|
|
|
varying vec4 vertColor;
|
|
varying vec4 vertTexCoord;
|
|
|
|
uniform mat3 normalMatrix;
|
|
|
|
varying vec3 reflectDir;
|
|
|
|
void main() {
|
|
gl_Position = transform * vertex;
|
|
|
|
vec3 ecNormal = normalize(normalMatrix * normal); // Vertex in eye coordinates
|
|
vec3 ecVertex = vec3(modelview * vertex); // Normal vector in eye coordinates
|
|
vec3 eyeDir = ecVertex.xyz;
|
|
reflectDir = reflect(eyeDir, ecNormal);
|
|
|
|
vertColor = color;
|
|
vertTexCoord = texMatrix * vec4(texCoord, 1.0, 1.0);
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
varying vec3 ReflectDir;
|
|
|
|
void main() {
|
|
gl_Position = ftransform();
|
|
vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
|
|
vec4 pos = gl_ModelViewMatrix * gl_Vertex;
|
|
vec3 eyeDir = pos.xyz;
|
|
ReflectDir = reflect(eyeDir, normal);
|
|
}
|
|
*/ |