1.0.0 • Published 10 years ago
glsl-basic-vertex-shader v1.0.0
glsl-basic-vertex-shader
GLSL snippet for a generic vertex shader for use with glslify. Includes standard components like model, animate, view, and projection matrices. Designed for standalone use. You might find it useful if you find yourself writing this boilerplate shader, or something similar, a lot.
install
Add to your project with
npm install glsl-basic-vertex-shaderusage
Inside your vertex shader just call
#pragma glslify: main = require('glsl-basic-vertex-shader')components
Make sure you define all attributes and uniforms. If you don't need to use any of the matrices just set them to the identity matrix. The varying variables can be used in your fragment shader.
attributes
vec3positioninput vertex positionvec3normalinput vertex normal
uniforms
mat4projectionprojection matrixmat4viewview matrixmat4modelmodel matrixmat4animateanimation matrixmat3modelNormaltranspose inverse of model matrixmat3animateNormaltranspose inverse of animation matrix
varying
vec3vpositioncomputed vertex positionvec3vnormalcomputed vertex normal
1.0.0
10 years ago