Deferred rendering progress
This commit is contained in:
parent
2d213340bf
commit
9d3eb8a8fd
|
@ -1,38 +0,0 @@
|
|||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
#define _Instancing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _Instancing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
#define _Skinning
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _Skinning
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
Loading…
Reference in a new issue