mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Updated shader examples
This commit is contained in:
@@ -2,25 +2,27 @@
|
||||
// tutorial from lighthouse 3D:
|
||||
// http://www.lighthouse3d.com/tutorials/glsl-tutorial/toon-shader-version-ii/
|
||||
|
||||
uniform mat4 modelviewMatrix;
|
||||
uniform mat4 projmodelviewMatrix;
|
||||
#define PROCESSING_LIGHT_SHADER
|
||||
|
||||
uniform mat4 modelview;
|
||||
uniform mat4 transform;
|
||||
uniform mat3 normalMatrix;
|
||||
|
||||
uniform vec3 lightNormal[8];
|
||||
|
||||
attribute vec4 inVertex;
|
||||
attribute vec3 inNormal;
|
||||
attribute vec4 vertex;
|
||||
attribute vec3 normal;
|
||||
|
||||
varying vec3 vertNormal;
|
||||
varying vec3 vertLightDir;
|
||||
|
||||
void main() {
|
||||
// Vertex in clip coordinates
|
||||
gl_Position = projmodelviewMatrix * inVertex;
|
||||
gl_Position = transform * vertex;
|
||||
|
||||
// Normal vector in eye coordinates is passed
|
||||
// to the fragment shader
|
||||
vertNormal = normalize(normalMatrix * inNormal);
|
||||
vertNormal = normalize(normalMatrix * normal);
|
||||
|
||||
// Assuming that there is only one directional light.
|
||||
// Its normal vector is passed to the fragment shader
|
||||
|
||||
Reference in New Issue
Block a user