Particles and frustum culling
This commit is contained in:
parent
d88c8142a4
commit
e107a3b611
|
@ -128,7 +128,7 @@ void kore() {
|
|||
outColor = vec4(vec3(rgb * visibility), 1.0);
|
||||
}
|
||||
else {
|
||||
outColor = vec4(vec3(t * visibility), 1.0);
|
||||
outColor = vec4(t * visibility, 1.0);
|
||||
}
|
||||
|
||||
#ifdef _Texturing
|
||||
|
|
|
@ -8,10 +8,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -41,11 +41,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -42,11 +42,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -46,11 +46,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ void kore() {
|
|||
vec4 texel = texture2D(stex, texCoord);
|
||||
|
||||
#ifdef _AlphaTest
|
||||
if(texel.a < 0.1)
|
||||
if(texel.a < 0.4)
|
||||
discard;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -4,12 +4,148 @@
|
|||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec3 matColor;
|
||||
#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;
|
||||
|
||||
float shadowSimple(vec4 lPos) {
|
||||
|
||||
vec4 lPosH = lPos / lPos.w;
|
||||
|
||||
lPosH.x = (lPosH.x + 1.0) / 2.0;
|
||||
lPosH.y = 1.0 - ((-lPosH.y + 1.0) / (2.0));
|
||||
|
||||
vec4 packedZValue = texture2D(shadowMap, lPosH.st);
|
||||
|
||||
float distanceFromLight = packedZValue.z;
|
||||
|
||||
//float bias = clamp(0.005*tan(acos(dotNL)), 0, 0.01);
|
||||
float bias = 0.0;//0.0005;
|
||||
|
||||
// 1.0 = not in shadow, 0.0 = in shadow
|
||||
return float(distanceFromLight > lPosH.z - bias);
|
||||
}
|
||||
|
||||
vec2 LightingFuncGGX_FV(float dotLH, float roughness) {
|
||||
|
||||
float alpha = roughness*roughness;
|
||||
|
||||
// F
|
||||
float F_a, F_b;
|
||||
float dotLH5 = pow(1.0 - dotLH, 5.0);
|
||||
F_a = 1.0;
|
||||
F_b = dotLH5;
|
||||
|
||||
// V
|
||||
float vis;
|
||||
float k = alpha / 2.0;
|
||||
float k2 = k * k;
|
||||
float invK2 = 1.0 - k2;
|
||||
//vis = rcp(dotLH * dotLH * invK2 + k2);
|
||||
vis = inversesqrt(dotLH * dotLH * invK2 + k2);
|
||||
|
||||
return vec2(F_a * vis, F_b * vis);
|
||||
}
|
||||
|
||||
float LightingFuncGGX_D(float dotNH, float roughness) {
|
||||
|
||||
float alpha = roughness * roughness;
|
||||
float alphaSqr = alpha * alpha;
|
||||
float pi = 3.14159;
|
||||
float denom = dotNH * dotNH * (alphaSqr - 1.0) + 1.0;
|
||||
|
||||
float D = alphaSqr / (pi * denom * denom);
|
||||
return D;
|
||||
}
|
||||
|
||||
// John Hable - Optimizing GGX Shaders
|
||||
// http://www.filmicworlds.com/2014/04/21/optimizing-ggx-shaders-with-dotlh/
|
||||
float LightingFuncGGX_OPT3(vec3 N, vec3 V, vec3 L, float roughness, float F0) {
|
||||
|
||||
vec3 H = normalize(V + L);
|
||||
|
||||
float dotNL = clamp(dot(N, L), 0.0, 1.0);
|
||||
float dotLH = clamp(dot(L, H), 0.0, 1.0);
|
||||
float dotNH = clamp(dot(N, H), 0.0, 1.0);
|
||||
|
||||
float D = LightingFuncGGX_D(dotNH, roughness);
|
||||
vec2 FV_helper = LightingFuncGGX_FV(dotLH, roughness);
|
||||
float FV = F0 * FV_helper.x + (1.0 - F0) * FV_helper.y;
|
||||
float specular = dotNL * D * FV;
|
||||
|
||||
return specular;
|
||||
}
|
||||
|
||||
void kore() {
|
||||
|
||||
vec3 t = pow(matColor, vec3(2.2));
|
||||
gl_FragColor = vec4(pow(t, vec3(1.0 / 2.2)), 1.0);
|
||||
float visibility = 1.0;
|
||||
if (receiveShadow && lPos.w > 0.0) {
|
||||
visibility = shadowSimple(lPos);
|
||||
visibility = (visibility * 0.8) + 0.2;
|
||||
}
|
||||
|
||||
vec4 outColor;
|
||||
vec3 t = pow(matColor.rgb, vec3(2.2));
|
||||
|
||||
if (lighting) {
|
||||
float specular = 0.1;
|
||||
|
||||
vec3 n = normalize(normal);
|
||||
vec3 l = lightDir;
|
||||
vec3 v = eyeDir;
|
||||
|
||||
float dotNL = 0.0;
|
||||
#ifdef _NormalMapping
|
||||
vec3 tn = normalize(texture2D(normalMap, texCoord).rgb * 2.0 - 1.0);
|
||||
dotNL = clamp(dot(tn, l), 0.0, 1.0);
|
||||
#else
|
||||
dotNL = clamp(dot(n, l), 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
float spec = LightingFuncGGX_OPT3(n, v, l, roughness, specular);
|
||||
vec3 rgb = spec + t * dotNL;
|
||||
|
||||
outColor = vec4(vec3(rgb * visibility), 1.0);
|
||||
}
|
||||
else {
|
||||
outColor = vec4(t * visibility, 1.0);
|
||||
}
|
||||
|
||||
#ifdef _Texturing
|
||||
vec4 texel = texture2D(stex, texCoord);
|
||||
|
||||
#ifdef _AlphaTest
|
||||
if(texel.a < 0.4)
|
||||
discard;
|
||||
#endif
|
||||
|
||||
outColor = vec4(texel * outColor);
|
||||
#else
|
||||
outColor = vec4(outColor.rgb, 1.0);
|
||||
#endif
|
||||
|
||||
gl_FragColor = vec4(pow(outColor.rgb, vec3(1.0 / 2.2)), outColor.a);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,41 +4,86 @@
|
|||
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;
|
||||
attribute vec3 bitan;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform float time;
|
||||
uniform vec3 eye;
|
||||
|
||||
varying vec3 matColor;
|
||||
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
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 mPos = M * vec4(pos + off, 1.0);
|
||||
mPos.x += (sin(time * 2.0 + cos(mPos.x))) * ((pos.z + 0.3) / 2.0);
|
||||
mPos.y += (cos(time * 2.0 + sin(mPos.x))) * ((pos.z + 0.3) / 8.0);
|
||||
|
||||
lPos = lightMVP * vec4(pos + off, 1.0);
|
||||
#else
|
||||
vec4 mPos = M * vec4(pos, 1.0);
|
||||
lPos = lightMVP * vec4(pos, 1.0);
|
||||
#endif
|
||||
gl_Position = P * V * mPos;
|
||||
vec3 position = mPos.xyz / mPos.w;
|
||||
position = mPos.xyz / mPos.w;
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
normal = normalize((M * vec4(nor, 0.0)).xyz);
|
||||
|
||||
matColor = diffuseColor.rgb;
|
||||
float r = (sin(off.x * off.y * off.z) + 1.0) / 2.0;
|
||||
matColor += r / 5.0;
|
||||
matColor = diffuseColor;
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
matColor *= 0.5;
|
||||
matColor *= (pos.z + 0.2) * 1.8;
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
|
||||
matColor -= vec3(((mPos.z + 0.73062) + 1.2) / 5.0);
|
||||
|
||||
vec3 normal = normalize((M * vec4(nor, 0.0)).xyz);
|
||||
vec3 lightDir = normalize(light - position);
|
||||
float dotNL = clamp(dot(normal, lightDir), 0.8, 1.0);
|
||||
matColor *= dotNL;
|
||||
#ifdef _NormalMapping
|
||||
vec3 vTangent = (tan);
|
||||
vec3 vBitangent = cross( normal, vTangent ) * 1.0;//tangent.w;
|
||||
//vec3 vBitangent = (bitan);
|
||||
|
||||
mat3 TBN = transpose(mat3(vTangent, vBitangent, normal));
|
||||
//mat3 TBN = (mat3(vTangent, vBitangent, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -42,11 +42,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -42,11 +42,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -42,11 +42,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1178,6 +1178,15 @@ class LueExporter(bpy.types.Operator, ExportHelper):
|
|||
|
||||
o.material_refs.append(self.materialArray[material]["structName"])
|
||||
|
||||
def ExportParticleSystemRef(self, psys, index, o):
|
||||
if (not psys.settings in self.particleSystemArray):
|
||||
self.particleSystemArray[psys.settings] = {"structName" : psys.settings.name}
|
||||
|
||||
pref = Object()
|
||||
pref.id = psys.name
|
||||
pref.seed = psys.seed
|
||||
pref.particle = self.particleSystemArray[psys.settings]["structName"]
|
||||
o.particle_refs.append(pref)
|
||||
|
||||
|
||||
def ExportNode(self, node, scene, poseBone = None, parento = None):
|
||||
|
@ -1220,11 +1229,15 @@ class LueExporter(bpy.types.Operator, ExportHelper):
|
|||
|
||||
oid = self.geometryArray[object]["structName"].replace(".", "_")
|
||||
o.object_ref = 'geom_' + oid + '/' + oid
|
||||
|
||||
o.material_refs = []
|
||||
|
||||
for i in range(len(node.material_slots)):
|
||||
self.ExportMaterialRef(node.material_slots[i].material, i, o)
|
||||
|
||||
o.particle_refs = []
|
||||
for i in range(len(node.particle_systems)):
|
||||
self.ExportParticleSystemRef(node.particle_systems[i], i, o)
|
||||
|
||||
shapeKeys = LueExporter.GetShapeKeys(object)
|
||||
#if (shapeKeys):
|
||||
# self.ExportMorphWeights(node, shapeKeys, scene, o)
|
||||
|
@ -1432,7 +1445,10 @@ class LueExporter(bpy.types.Operator, ExportHelper):
|
|||
oid = objectRef[1]["structName"].replace(".", "_")
|
||||
|
||||
index = self.filepath.rfind('/')
|
||||
fp = self.filepath[:(index+1)] + 'geom_' + oid + '.json'
|
||||
geom_fp = self.filepath[:(index+1)] + 'geoms/'
|
||||
if not os.path.exists(geom_fp):
|
||||
os.makedirs(geom_fp)
|
||||
fp = geom_fp + 'geom_' + oid + '.json'
|
||||
|
||||
# Check if geometry is using instanced rendering
|
||||
is_instanced = False
|
||||
|
@ -1938,9 +1954,6 @@ class LueExporter(bpy.types.Operator, ExportHelper):
|
|||
|
||||
o.id = materialRef[1]["structName"]
|
||||
|
||||
#if (material.name != ""):
|
||||
# o.name = material.name
|
||||
|
||||
#intensity = material.diffuse_intensity
|
||||
#diffuse = [material.diffuse_color[0] * intensity, material.diffuse_color[1] * intensity, material.diffuse_color[2] * intensity]
|
||||
|
||||
|
@ -2026,7 +2039,7 @@ class LueExporter(bpy.types.Operator, ExportHelper):
|
|||
|
||||
for ob in mat_users:
|
||||
# Instancing used by material user
|
||||
if ob.instanced_children:
|
||||
if ob.instanced_children or len(ob.particle_systems) > 0:
|
||||
defs.append('_Instancing')
|
||||
# VCols used by material user
|
||||
if ob.data.vertex_colors:
|
||||
|
@ -2104,6 +2117,19 @@ class LueExporter(bpy.types.Operator, ExportHelper):
|
|||
'''
|
||||
self.output.material_resources.append(o)
|
||||
|
||||
def ExportParticleSystems(self):
|
||||
for particleRef in self.particleSystemArray.items():
|
||||
o = Object()
|
||||
psettings = particleRef[0]
|
||||
|
||||
if psettings == None:
|
||||
continue
|
||||
|
||||
o.id = particleRef[1]["structName"]
|
||||
o.count = psettings.count
|
||||
o.lifetime = psettings.lifetime
|
||||
|
||||
self.output.particle_resources.append(o)
|
||||
|
||||
def ExportObjects(self, scene):
|
||||
for objectRef in self.geometryArray.items():
|
||||
|
@ -2132,6 +2158,7 @@ class LueExporter(bpy.types.Operator, ExportHelper):
|
|||
self.lightArray = {}
|
||||
self.cameraArray = {}
|
||||
self.materialArray = {}
|
||||
self.particleSystemArray = {}
|
||||
self.boneParentArray = {}
|
||||
|
||||
self.exportAllFlag = not self.option_export_selection
|
||||
|
@ -2153,6 +2180,9 @@ class LueExporter(bpy.types.Operator, ExportHelper):
|
|||
self.output.material_resources = []
|
||||
self.ExportMaterials()
|
||||
|
||||
self.output.particle_resources = []
|
||||
self.ExportParticleSystems()
|
||||
|
||||
self.output.geometry_resources = [];
|
||||
self.output.light_resources = [];
|
||||
self.output.camera_resources = [];
|
||||
|
|
|
@ -8,10 +8,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -41,11 +41,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -42,11 +42,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -46,11 +46,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -42,11 +42,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -45,11 +45,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -42,11 +42,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -44,11 +44,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -42,11 +42,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -43,11 +43,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ precision highp float;
|
|||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
attribute vec3 nor;
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
|
@ -42,11 +42,13 @@ 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
|
||||
|
||||
void kore() {
|
||||
|
||||
|
|
23
data/out/env_map.frag.glsl
Normal file
23
data/out/env_map.frag.glsl
Normal file
|
@ -0,0 +1,23 @@
|
|||
//--------------------------------------------------------
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#define PI 3.1415926
|
||||
#define TwoPI (2.0 * PI)
|
||||
|
||||
uniform sampler2D envmap;
|
||||
|
||||
varying vec3 wcNormal;
|
||||
|
||||
vec2 envMapEquirect(vec3 wcNormal, float flipEnvMap) {
|
||||
float phi = acos(wcNormal.z);
|
||||
float theta = atan(flipEnvMap * wcNormal.x, wcNormal.y) + PI;
|
||||
return vec2(theta / TwoPI, phi / PI);
|
||||
}
|
||||
|
||||
void kore() {
|
||||
|
||||
vec3 N = normalize(wcNormal);
|
||||
gl_FragColor = texture2D(envmap, envMapEquirect(N, -1.0));
|
||||
}
|
73
data/out/env_map.vert.glsl
Normal file
73
data/out/env_map.vert.glsl
Normal file
|
@ -0,0 +1,73 @@
|
|||
//--------------------------------------------------------
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
|
||||
attribute vec2 pos;
|
||||
|
||||
varying vec3 wcNormal;
|
||||
|
||||
mat4 inverse(mat4 m) {
|
||||
float
|
||||
a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
|
||||
a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
|
||||
a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
|
||||
a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],
|
||||
|
||||
b00 = a00 * a11 - a01 * a10,
|
||||
b01 = a00 * a12 - a02 * a10,
|
||||
b02 = a00 * a13 - a03 * a10,
|
||||
b03 = a01 * a12 - a02 * a11,
|
||||
b04 = a01 * a13 - a03 * a11,
|
||||
b05 = a02 * a13 - a03 * a12,
|
||||
b06 = a20 * a31 - a21 * a30,
|
||||
b07 = a20 * a32 - a22 * a30,
|
||||
b08 = a20 * a33 - a23 * a30,
|
||||
b09 = a21 * a32 - a22 * a31,
|
||||
b10 = a21 * a33 - a23 * a31,
|
||||
b11 = a22 * a33 - a23 * a32,
|
||||
|
||||
det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
|
||||
|
||||
return mat4(
|
||||
a11 * b11 - a12 * b10 + a13 * b09,
|
||||
a02 * b10 - a01 * b11 - a03 * b09,
|
||||
a31 * b05 - a32 * b04 + a33 * b03,
|
||||
a22 * b04 - a21 * b05 - a23 * b03,
|
||||
a12 * b08 - a10 * b11 - a13 * b07,
|
||||
a00 * b11 - a02 * b08 + a03 * b07,
|
||||
a32 * b02 - a30 * b05 - a33 * b01,
|
||||
a20 * b05 - a22 * b02 + a23 * b01,
|
||||
a10 * b10 - a11 * b08 + a13 * b06,
|
||||
a01 * b08 - a00 * b10 - a03 * b06,
|
||||
a30 * b04 - a31 * b02 + a33 * b00,
|
||||
a21 * b02 - a20 * b04 - a23 * b00,
|
||||
a11 * b07 - a10 * b09 - a12 * b06,
|
||||
a00 * b09 - a01 * b07 + a02 * b06,
|
||||
a31 * b01 - a30 * b03 - a32 * b00,
|
||||
a20 * b03 - a21 * b01 + a22 * b00) / det;
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
void kore() {
|
||||
|
||||
mat4 invP = inverse(P);
|
||||
mat3 invMV = transpose(mat3(V));
|
||||
|
||||
vec4 p = vec4(pos.xy, 0.0, 1.0);
|
||||
|
||||
vec3 unprojected = (invP * p).xyz;
|
||||
|
||||
wcNormal = invMV * unprojected;
|
||||
|
||||
gl_Position = vec4(pos.xy, 0.0, 1.0);
|
||||
}
|
||||
|
Loading…
Reference in a new issue