Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Compiler should remove unneeded stuff
- attribute vec3 vertex_position;
- attribute vec3 vertex_normal;
- attribute vec4 vertex_tangent;
- attribute vec2 vertex_texCoord0;
- attribute vec2 vertex_texCoord1;
- attribute vec4 vertex_color;
- uniform mat4 matrix_viewProjection;
- uniform mat4 matrix_model;
- uniform mat3 matrix_normal;
- uniform vec3 view_position;
- varying vec3 vPositionW;
- varying vec3 vNormalW;
- varying vec3 vTangentW;
- varying vec3 vBinormalW;
- varying vec2 vUv0;
- varying vec2 vUv1;
- varying vec4 vVertexColor;
- varying vec3 vNormalV;
- struct vsInternalData {
- vec3 positionW;
- mat4 modelMatrix;
- mat3 normalMatrix;
- };
- vec2 getUv0(inout vsInternalData data) {
- return vertex_texCoord0;
- }
- mat4 getModelMatrix(inout vsInternalData data) {
- return matrix_model;
- }
- vec3 getNormal(inout vsInternalData data) {
- data.normalMatrix = matrix_normal;
- return normalize(data.normalMatrix * vertex_normal);
- }
- vec4 getPosition(inout vsInternalData data) {
- data.modelMatrix = getModelMatrix(data);
- vec4 posW = data.modelMatrix * vec4(vertex_position, 1.0);
- data.positionW = posW.xyz;
- return matrix_viewProjection * posW;
- }
- vec3 getWorldPosition(inout vsInternalData data) {
- return data.positionW;
- }
- void main(void) {
- vsInternalData data;
- gl_Position = getPosition(data);
- vPositionW = getWorldPosition(data);
- vNormalW = getNormal(data);
- vUv0 = getUv0(data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement