diff --git a/Assets/blender_resource.json b/Assets/blender_resource.json index 6e10532d..ad1ef80b 100644 --- a/Assets/blender_resource.json +++ b/Assets/blender_resource.json @@ -50,10 +50,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -133,10 +130,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -216,10 +210,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -299,10 +290,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -394,10 +382,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -485,10 +470,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -575,10 +557,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -662,10 +641,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -745,10 +721,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -840,10 +813,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -931,10 +901,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1021,10 +988,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1108,10 +1072,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1203,10 +1164,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1294,10 +1252,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1384,10 +1339,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1476,10 +1428,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1574,10 +1523,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1671,10 +1617,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1770,10 +1713,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1873,10 +1813,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -1968,10 +1905,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2062,10 +1996,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2157,10 +2088,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2248,10 +2176,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2338,10 +2263,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2430,10 +2352,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2528,10 +2447,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2625,10 +2541,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2724,10 +2637,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2827,10 +2737,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -2922,10 +2829,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3021,10 +2925,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3119,10 +3020,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3216,10 +3114,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3315,10 +3210,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3418,10 +3310,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3513,10 +3402,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3612,10 +3498,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3722,10 +3605,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3824,10 +3704,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -3930,10 +3807,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4037,10 +3911,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4135,10 +4006,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4232,10 +4100,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4331,10 +4196,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4434,10 +4296,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4529,10 +4388,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4628,10 +4484,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4738,10 +4591,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4840,10 +4690,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -4946,10 +4793,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -5053,10 +4897,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -5163,10 +5004,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -5265,10 +5103,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -5371,10 +5206,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -5478,10 +5310,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -5592,10 +5421,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -5702,10 +5528,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -5804,10 +5627,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -5910,10 +5730,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -6017,10 +5834,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -6131,10 +5945,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" @@ -6245,10 +6056,7 @@ "id": "lighting", "type": "bool" }, - { - "id": "receiveShadow", - "type": "bool" - }, + { "id": "roughness", "type": "float" diff --git a/Assets/deferred_pass_resource.json b/Assets/deferred_pass_resource.json index 7113c194..d52a88fc 100644 --- a/Assets/deferred_pass_resource.json +++ b/Assets/deferred_pass_resource.json @@ -6,9 +6,20 @@ "blend_destination": "blend_zero", "blend_source": "blend_one", "compare_mode": "always", - "constants": [], + "constants": [ + { + "id": "light", + "link": "_lightPosition", + "type": "vec3" + }, + { + "id": "eye", + "link": "_cameraPosition", + "type": "vec3" + } + ], "cull_mode": "none", - "depth_write": false, + "depth_write": true, "fragment_shader": "deferred_pass.frag", "id": "deferred_pass", "texture_units": [ diff --git a/Assets/material_resource.json b/Assets/material_resource.json index d14772f3..66a56c63 100644 --- a/Assets/material_resource.json +++ b/Assets/material_resource.json @@ -19,11 +19,11 @@ }, { "id": "material_deferred", - "shader": "deferred_resource/deferred_pass", + "shader": "deferred_pass_resource/deferred_pass", "cast_shadow": true, "contexts": [ { - "id": "deferred", + "id": "deferred_pass", "bind_constants": [], "bind_textures": [] } diff --git a/Assets/pipeline_resource.json b/Assets/pipeline_resource.json index 467d3310..c2c83c1a 100644 --- a/Assets/pipeline_resource.json +++ b/Assets/pipeline_resource.json @@ -65,7 +65,7 @@ }, { "command": "draw_quad", - "params": ["material_resource", "material_deferred", "deferred"] + "params": ["material_resource", "material_deferred", "deferred_pass"] } ] } diff --git a/Sources/Shaders/attrib_pass.frag.glsl b/Sources/Shaders/attrib_pass.frag.glsl new file mode 100644 index 00000000..b973a105 --- /dev/null +++ b/Sources/Shaders/attrib_pass.frag.glsl @@ -0,0 +1,41 @@ +//#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(normal.xyz, 0); + //#ifdef _Texturing + //gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0); + //#endif +} diff --git a/Sources/Shaders/blender.vert.glsl b/Sources/Shaders/attrib_pass.vert.glsl similarity index 100% rename from Sources/Shaders/blender.vert.glsl rename to Sources/Shaders/attrib_pass.vert.glsl diff --git a/Sources/Shaders/deferred_pass.frag.glsl b/Sources/Shaders/deferred_pass.frag.glsl new file mode 100644 index 00000000..49de1bca --- /dev/null +++ b/Sources/Shaders/deferred_pass.frag.glsl @@ -0,0 +1,14 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform sampler2D gbuffer0; // Positions +uniform sampler2D gbuffer1; // Normals +uniform sampler2D gbuffer2; // Textures + +varying vec2 texCoord; + +void kore() { + + gl_FragColor = vec4(texture2D(gbuffer2, texCoord).rgb, 1.0); +} diff --git a/Sources/Shaders/deferred_pass.vert.glsl b/Sources/Shaders/deferred_pass.vert.glsl new file mode 100644 index 00000000..cc3f8275 --- /dev/null +++ b/Sources/Shaders/deferred_pass.vert.glsl @@ -0,0 +1,16 @@ +#ifdef GL_ES +precision highp float; +#endif + +attribute vec2 pos; + +varying vec2 texCoord; + +const vec2 madd = vec2(0.5, 0.5); + +void kore() { + // Scale vertex attribute to [0-1] range + texCoord = pos.xy * madd + madd; + + gl_Position = vec4(pos.xy, 0.0, 1.0); +} diff --git a/Sources/Shaders/env_map.frag.glsl b/Sources/Shaders/env_map.frag.glsl new file mode 100644 index 00000000..e1e01f33 --- /dev/null +++ b/Sources/Shaders/env_map.frag.glsl @@ -0,0 +1,22 @@ +#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)); +} diff --git a/Sources/Shaders/env_map.vert.glsl b/Sources/Shaders/env_map.vert.glsl new file mode 100644 index 00000000..787ff2fb --- /dev/null +++ b/Sources/Shaders/env_map.vert.glsl @@ -0,0 +1,71 @@ +#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); +} diff --git a/Sources/Shaders/blender.frag.glsl b/Sources/Shaders_/blender.frag.glsl similarity index 96% rename from Sources/Shaders/blender.frag.glsl rename to Sources/Shaders_/blender.frag.glsl index 2d294f88..410cc5bc 100644 --- a/Sources/Shaders/blender.frag.glsl +++ b/Sources/Shaders_/blender.frag.glsl @@ -98,10 +98,10 @@ float LightingFuncGGX_OPT3(vec3 N, vec3 V, vec3 L, float roughness, float F0) { void kore() { float visibility = 1.0; - if (receiveShadow && lPos.w > 0.0) { - visibility = shadowSimple(lPos); - visibility = (visibility * 0.8) + 0.2; - } + //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)); diff --git a/Sources/Shaders_/blender.vert.glsl b/Sources/Shaders_/blender.vert.glsl new file mode 100644 index 00000000..52a2fdc2 --- /dev/null +++ b/Sources/Shaders_/blender.vert.glsl @@ -0,0 +1,135 @@ +#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 +} diff --git a/Sources/Shaders/blender_AlphaTest.frag.glsl b/Sources/Shaders_/blender_AlphaTest.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest.frag.glsl rename to Sources/Shaders_/blender_AlphaTest.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest.vert.glsl b/Sources/Shaders_/blender_AlphaTest.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest.vert.glsl rename to Sources/Shaders_/blender_AlphaTest.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Skinning_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Skinning_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Texturing.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Texturing.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Texturing.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Texturing.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_NormalMapping_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_NormalMapping_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Skinning.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Skinning.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Skinning.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Skinning.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Skinning.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Skinning.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Skinning.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Skinning.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Skinning_Texturing.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Skinning_Texturing.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Skinning_Texturing.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Skinning_Texturing.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Skinning_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Skinning_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Skinning_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Skinning_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Skinning_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Skinning_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Skinning_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Skinning_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Skinning_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Texturing.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Texturing.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Texturing.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Texturing.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Instancing_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Instancing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Instancing_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Instancing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping.frag.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping.vert.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning.frag.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning.vert.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_Texturing.frag.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_Texturing.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_Texturing.vert.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_Texturing.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Skinning_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Skinning_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Texturing.frag.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Texturing.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Texturing.vert.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Texturing.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_NormalMapping_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_NormalMapping_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_NormalMapping_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_NormalMapping_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Skinning.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Skinning.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Skinning.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Skinning.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Skinning.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Skinning.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Skinning.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Skinning.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Skinning_Texturing.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Skinning_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Skinning_Texturing.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Skinning_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Skinning_Texturing.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Skinning_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Skinning_Texturing.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Skinning_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Skinning_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Skinning_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Skinning_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Skinning_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Skinning_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Skinning_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Skinning_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Skinning_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Skinning_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Skinning_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Skinning_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Skinning_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Skinning_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Skinning_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Skinning_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Skinning_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Texturing.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Texturing.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Texturing.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Texturing.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_AlphaTest_VCols.frag.glsl b/Sources/Shaders_/blender_AlphaTest_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_VCols.frag.glsl rename to Sources/Shaders_/blender_AlphaTest_VCols.frag.glsl diff --git a/Sources/Shaders/blender_AlphaTest_VCols.vert.glsl b/Sources/Shaders_/blender_AlphaTest_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_AlphaTest_VCols.vert.glsl rename to Sources/Shaders_/blender_AlphaTest_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Instancing.frag.glsl b/Sources/Shaders_/blender_Instancing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing.frag.glsl rename to Sources/Shaders_/blender_Instancing.frag.glsl diff --git a/Sources/Shaders/blender_Instancing.vert.glsl b/Sources/Shaders_/blender_Instancing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing.vert.glsl rename to Sources/Shaders_/blender_Instancing.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping.frag.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping.frag.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping.vert.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping.vert.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Skinning.frag.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Skinning.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Skinning.frag.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Skinning.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Skinning.vert.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Skinning.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Skinning.vert.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Skinning.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Skinning_Texturing.frag.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Skinning_Texturing.frag.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Skinning_Texturing.vert.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Skinning_Texturing.vert.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Skinning_VCols.frag.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Skinning_VCols.frag.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Skinning_VCols.vert.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Skinning_VCols.vert.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Skinning_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Texturing.frag.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Texturing.frag.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Texturing.vert.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Texturing.vert.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_VCols.frag.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_VCols.frag.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_NormalMapping_VCols.vert.glsl b/Sources/Shaders_/blender_Instancing_NormalMapping_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_NormalMapping_VCols.vert.glsl rename to Sources/Shaders_/blender_Instancing_NormalMapping_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_Skinning.frag.glsl b/Sources/Shaders_/blender_Instancing_Skinning.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Skinning.frag.glsl rename to Sources/Shaders_/blender_Instancing_Skinning.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_Skinning.vert.glsl b/Sources/Shaders_/blender_Instancing_Skinning.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Skinning.vert.glsl rename to Sources/Shaders_/blender_Instancing_Skinning.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_Skinning_Texturing.frag.glsl b/Sources/Shaders_/blender_Instancing_Skinning_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Skinning_Texturing.frag.glsl rename to Sources/Shaders_/blender_Instancing_Skinning_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_Skinning_Texturing.vert.glsl b/Sources/Shaders_/blender_Instancing_Skinning_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Skinning_Texturing.vert.glsl rename to Sources/Shaders_/blender_Instancing_Skinning_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_Skinning_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_Instancing_Skinning_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Skinning_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_Instancing_Skinning_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_Skinning_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_Instancing_Skinning_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Skinning_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_Instancing_Skinning_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_Skinning_VCols.frag.glsl b/Sources/Shaders_/blender_Instancing_Skinning_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Skinning_VCols.frag.glsl rename to Sources/Shaders_/blender_Instancing_Skinning_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_Skinning_VCols.vert.glsl b/Sources/Shaders_/blender_Instancing_Skinning_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Skinning_VCols.vert.glsl rename to Sources/Shaders_/blender_Instancing_Skinning_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_Texturing.frag.glsl b/Sources/Shaders_/blender_Instancing_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Texturing.frag.glsl rename to Sources/Shaders_/blender_Instancing_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_Texturing.vert.glsl b/Sources/Shaders_/blender_Instancing_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Texturing.vert.glsl rename to Sources/Shaders_/blender_Instancing_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_Instancing_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_Instancing_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_Instancing_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_Instancing_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Instancing_VCols.frag.glsl b/Sources/Shaders_/blender_Instancing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_VCols.frag.glsl rename to Sources/Shaders_/blender_Instancing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Instancing_VCols.vert.glsl b/Sources/Shaders_/blender_Instancing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Instancing_VCols.vert.glsl rename to Sources/Shaders_/blender_Instancing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_NormalMapping.frag.glsl b/Sources/Shaders_/blender_NormalMapping.frag.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping.frag.glsl rename to Sources/Shaders_/blender_NormalMapping.frag.glsl diff --git a/Sources/Shaders/blender_NormalMapping.vert.glsl b/Sources/Shaders_/blender_NormalMapping.vert.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping.vert.glsl rename to Sources/Shaders_/blender_NormalMapping.vert.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Skinning.frag.glsl b/Sources/Shaders_/blender_NormalMapping_Skinning.frag.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Skinning.frag.glsl rename to Sources/Shaders_/blender_NormalMapping_Skinning.frag.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Skinning.vert.glsl b/Sources/Shaders_/blender_NormalMapping_Skinning.vert.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Skinning.vert.glsl rename to Sources/Shaders_/blender_NormalMapping_Skinning.vert.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Skinning_Texturing.frag.glsl b/Sources/Shaders_/blender_NormalMapping_Skinning_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Skinning_Texturing.frag.glsl rename to Sources/Shaders_/blender_NormalMapping_Skinning_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Skinning_Texturing.vert.glsl b/Sources/Shaders_/blender_NormalMapping_Skinning_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Skinning_Texturing.vert.glsl rename to Sources/Shaders_/blender_NormalMapping_Skinning_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Skinning_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_NormalMapping_Skinning_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Skinning_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_NormalMapping_Skinning_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Skinning_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_NormalMapping_Skinning_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Skinning_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_NormalMapping_Skinning_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Skinning_VCols.frag.glsl b/Sources/Shaders_/blender_NormalMapping_Skinning_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Skinning_VCols.frag.glsl rename to Sources/Shaders_/blender_NormalMapping_Skinning_VCols.frag.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Skinning_VCols.vert.glsl b/Sources/Shaders_/blender_NormalMapping_Skinning_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Skinning_VCols.vert.glsl rename to Sources/Shaders_/blender_NormalMapping_Skinning_VCols.vert.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Texturing.frag.glsl b/Sources/Shaders_/blender_NormalMapping_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Texturing.frag.glsl rename to Sources/Shaders_/blender_NormalMapping_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Texturing.vert.glsl b/Sources/Shaders_/blender_NormalMapping_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Texturing.vert.glsl rename to Sources/Shaders_/blender_NormalMapping_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_NormalMapping_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_NormalMapping_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_NormalMapping_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_NormalMapping_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_NormalMapping_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_NormalMapping_VCols.frag.glsl b/Sources/Shaders_/blender_NormalMapping_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_VCols.frag.glsl rename to Sources/Shaders_/blender_NormalMapping_VCols.frag.glsl diff --git a/Sources/Shaders/blender_NormalMapping_VCols.vert.glsl b/Sources/Shaders_/blender_NormalMapping_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_NormalMapping_VCols.vert.glsl rename to Sources/Shaders_/blender_NormalMapping_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Skinning.frag.glsl b/Sources/Shaders_/blender_Skinning.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Skinning.frag.glsl rename to Sources/Shaders_/blender_Skinning.frag.glsl diff --git a/Sources/Shaders/blender_Skinning.vert.glsl b/Sources/Shaders_/blender_Skinning.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Skinning.vert.glsl rename to Sources/Shaders_/blender_Skinning.vert.glsl diff --git a/Sources/Shaders/blender_Skinning_Texturing.frag.glsl b/Sources/Shaders_/blender_Skinning_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Skinning_Texturing.frag.glsl rename to Sources/Shaders_/blender_Skinning_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_Skinning_Texturing.vert.glsl b/Sources/Shaders_/blender_Skinning_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Skinning_Texturing.vert.glsl rename to Sources/Shaders_/blender_Skinning_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_Skinning_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_Skinning_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Skinning_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_Skinning_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Skinning_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_Skinning_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Skinning_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_Skinning_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Skinning_VCols.frag.glsl b/Sources/Shaders_/blender_Skinning_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Skinning_VCols.frag.glsl rename to Sources/Shaders_/blender_Skinning_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Skinning_VCols.vert.glsl b/Sources/Shaders_/blender_Skinning_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Skinning_VCols.vert.glsl rename to Sources/Shaders_/blender_Skinning_VCols.vert.glsl diff --git a/Sources/Shaders/blender_Texturing.frag.glsl b/Sources/Shaders_/blender_Texturing.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Texturing.frag.glsl rename to Sources/Shaders_/blender_Texturing.frag.glsl diff --git a/Sources/Shaders/blender_Texturing.vert.glsl b/Sources/Shaders_/blender_Texturing.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Texturing.vert.glsl rename to Sources/Shaders_/blender_Texturing.vert.glsl diff --git a/Sources/Shaders/blender_Texturing_VCols.frag.glsl b/Sources/Shaders_/blender_Texturing_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_Texturing_VCols.frag.glsl rename to Sources/Shaders_/blender_Texturing_VCols.frag.glsl diff --git a/Sources/Shaders/blender_Texturing_VCols.vert.glsl b/Sources/Shaders_/blender_Texturing_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_Texturing_VCols.vert.glsl rename to Sources/Shaders_/blender_Texturing_VCols.vert.glsl diff --git a/Sources/Shaders/blender_VCols.frag.glsl b/Sources/Shaders_/blender_VCols.frag.glsl similarity index 100% rename from Sources/Shaders/blender_VCols.frag.glsl rename to Sources/Shaders_/blender_VCols.frag.glsl diff --git a/Sources/Shaders/blender_VCols.vert.glsl b/Sources/Shaders_/blender_VCols.vert.glsl similarity index 100% rename from Sources/Shaders/blender_VCols.vert.glsl rename to Sources/Shaders_/blender_VCols.vert.glsl diff --git a/blender/__pycache__/project.cpython-34.pyc b/blender/__pycache__/project.cpython-34.pyc index d536de1a..c3449df6 100644 Binary files a/blender/__pycache__/project.cpython-34.pyc and b/blender/__pycache__/project.cpython-34.pyc differ diff --git a/blender/lib/build.py b/blender/lib/build.py index 088b14cb..e20fde4f 100755 --- a/blender/lib/build.py +++ b/blender/lib/build.py @@ -42,7 +42,8 @@ def build(): kha_path = output node_path = output + "/Tools/nodejs/node-osx" - os.system('node Kha/make -t html5 ' + " --nokrafix") + #os.system('node Kha/make -t html5 ' + " --nokrafix") + os.system('node Kha/make ' + bashCommand) #os.system(bashCommand + " --nokrafix") #os.system(node_path + " " + kha_path + "/make -t html5 --haxe " + haxePath()) #print(subprocess.check_output([node_path + " " + kha_path + "/make -t html5 --haxe " + haxePath()], shell=True)) diff --git a/blender/project.py b/blender/project.py index e6188ef5..353e9ee0 100755 --- a/blender/project.py +++ b/blender/project.py @@ -36,7 +36,8 @@ def initWorldProperties(): ('OSX', 'OSX', 'OSX'), ('Linux', 'Linux', 'Linux'), ('iOS', 'iOS', 'iOS'), - ('Android', 'Android', 'Android')], + ('Android', 'Android', 'Android'), + ('Blender', 'Blender', 'Blender')], name = "Target") bpy.types.World.CGProjectName = StringProperty(name = "Name") bpy.types.World.CGProjectPackage = StringProperty(name = "Package") @@ -181,13 +182,15 @@ def buildProject(self, build_type=0): bashCommand = "-t ios" elif (bpy.data.worlds[0]['CGProjectTarget'] == 5): bashCommand = "-t android_native" + elif (bpy.data.worlds[0]['CGProjectTarget'] == 6): + bashCommand = "-t blender" # Build haxelib_path = "haxelib" if platform.system() == 'Darwin': haxelib_path = "/usr/local/bin/haxelib" - prefix = haxelib_path + " run kha " + prefix = haxelib_path + " run kha " output = subprocess.check_output([haxelib_path + " path cyclesgame"], shell=True) output = str(output).split("\\n")[0].split("'")[1] @@ -195,7 +198,8 @@ def buildProject(self, build_type=0): blender_path = bpy.app.binary_path blend_path = bpy.data.filepath - p = subprocess.Popen([blender_path, blend_path, '-b', '-P', scripts_path + 'lib/build.py', '--', prefix + bashCommand, str(build_type), str(bpy.data.worlds[0]['CGProjectTarget'])]) + p = subprocess.Popen([blender_path, blend_path, '-b', '-P', scripts_path + 'lib/build.py', '--', bashCommand, str(build_type), str(bpy.data.worlds[0]['CGProjectTarget'])]) + #p = subprocess.Popen([blender_path, blend_path, '-b', '-P', scripts_path + 'lib/build.py', '--', prefix + bashCommand, str(build_type), str(bpy.data.worlds[0]['CGProjectTarget'])]) atexit.register(p.terminate) self.report({'INFO'}, "Building, see console...") diff --git a/shader_data/attrib_pass/attrib_pass.frag.glsl b/shader_data/attrib_pass/attrib_pass.frag.glsl index 90898f4d..ae3f3b7a 100644 --- a/shader_data/attrib_pass/attrib_pass.frag.glsl +++ b/shader_data/attrib_pass/attrib_pass.frag.glsl @@ -34,5 +34,7 @@ void kore() { gl_FragData[0] = vec4(position.xyz, 0); gl_FragData[1] = vec4(normal.xyz, 0); + #ifdef _Texturing gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0); + #endif } diff --git a/shader_data/attrib_pass/out/attrib_pass.frag.glsl b/shader_data/attrib_pass/out/attrib_pass.frag.glsl new file mode 100644 index 00000000..90898f4d --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass.frag.glsl @@ -0,0 +1,38 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass.vert.glsl b/shader_data/attrib_pass/out/attrib_pass.vert.glsl new file mode 100644 index 00000000..52a2fdc2 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass.vert.glsl @@ -0,0 +1,135 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing.frag.glsl new file mode 100644 index 00000000..4311c4c2 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing.frag.glsl @@ -0,0 +1,39 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing.vert.glsl new file mode 100644 index 00000000..a47f0f78 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing.vert.glsl @@ -0,0 +1,136 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping.frag.glsl new file mode 100644 index 00000000..3bd38bef --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping.vert.glsl new file mode 100644 index 00000000..0cecb06b --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning.frag.glsl new file mode 100644 index 00000000..b194bd94 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning.vert.glsl new file mode 100644 index 00000000..64ed870a --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing.frag.glsl new file mode 100644 index 00000000..d0eba0b4 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing.frag.glsl @@ -0,0 +1,42 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing.vert.glsl new file mode 100644 index 00000000..6a264419 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing.vert.glsl @@ -0,0 +1,139 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl new file mode 100644 index 00000000..803f81bf --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing_VCols.frag.glsl @@ -0,0 +1,43 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl new file mode 100644 index 00000000..2683eb9e --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_Texturing_VCols.vert.glsl @@ -0,0 +1,140 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_VCols.frag.glsl new file mode 100644 index 00000000..7f52ba13 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_VCols.frag.glsl @@ -0,0 +1,42 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_VCols.vert.glsl new file mode 100644 index 00000000..8ca6183a --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Skinning_VCols.vert.glsl @@ -0,0 +1,139 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing.frag.glsl new file mode 100644 index 00000000..511ce2d2 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing.vert.glsl new file mode 100644 index 00000000..635b5be2 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing_VCols.frag.glsl new file mode 100644 index 00000000..3fd2d116 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing_VCols.frag.glsl @@ -0,0 +1,42 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing_VCols.vert.glsl new file mode 100644 index 00000000..fcba6552 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_Texturing_VCols.vert.glsl @@ -0,0 +1,139 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_VCols.frag.glsl new file mode 100644 index 00000000..7fa7db32 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_VCols.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_VCols.vert.glsl new file mode 100644 index 00000000..a5b70818 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_NormalMapping_VCols.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning.frag.glsl new file mode 100644 index 00000000..9447857a --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning.vert.glsl new file mode 100644 index 00000000..c5f018b2 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing.frag.glsl new file mode 100644 index 00000000..01d8623a --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing.vert.glsl new file mode 100644 index 00000000..4fcbd8de --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing_VCols.frag.glsl new file mode 100644 index 00000000..ffc1c746 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing_VCols.frag.glsl @@ -0,0 +1,42 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing_VCols.vert.glsl new file mode 100644 index 00000000..3e7fd8fe --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_Texturing_VCols.vert.glsl @@ -0,0 +1,139 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_VCols.frag.glsl new file mode 100644 index 00000000..22d8f8d5 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_VCols.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_VCols.vert.glsl new file mode 100644 index 00000000..cf66a69c --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Skinning_VCols.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing.frag.glsl new file mode 100644 index 00000000..6846f9eb --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing.vert.glsl new file mode 100644 index 00000000..e4d7fd5e --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing_VCols.frag.glsl new file mode 100644 index 00000000..71790c81 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing_VCols.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing_VCols.vert.glsl new file mode 100644 index 00000000..feb42c66 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_Texturing_VCols.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_VCols.frag.glsl new file mode 100644 index 00000000..91c06a7b --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_VCols.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Instancing_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Instancing_VCols.vert.glsl new file mode 100644 index 00000000..cce64e8f --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Instancing_VCols.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping.frag.glsl new file mode 100644 index 00000000..0d3b6192 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping.frag.glsl @@ -0,0 +1,39 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping.vert.glsl new file mode 100644 index 00000000..3e717599 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping.vert.glsl @@ -0,0 +1,136 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning.frag.glsl new file mode 100644 index 00000000..25619dde --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning.vert.glsl new file mode 100644 index 00000000..58623c28 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing.frag.glsl new file mode 100644 index 00000000..353ffa0b --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing.vert.glsl new file mode 100644 index 00000000..0643ef89 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing_VCols.frag.glsl new file mode 100644 index 00000000..672531b6 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing_VCols.frag.glsl @@ -0,0 +1,42 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing_VCols.vert.glsl new file mode 100644 index 00000000..25833bd4 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_Texturing_VCols.vert.glsl @@ -0,0 +1,139 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_VCols.frag.glsl new file mode 100644 index 00000000..7147d449 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_VCols.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_VCols.vert.glsl new file mode 100644 index 00000000..3a767b29 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Skinning_VCols.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing.frag.glsl new file mode 100644 index 00000000..fa32444f --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing.vert.glsl new file mode 100644 index 00000000..a7c5e7eb --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing_VCols.frag.glsl new file mode 100644 index 00000000..e7630b2d --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing_VCols.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing_VCols.vert.glsl new file mode 100644 index 00000000..14dda2b3 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_Texturing_VCols.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_VCols.frag.glsl new file mode 100644 index 00000000..94bc950b --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_VCols.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_NormalMapping_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_VCols.vert.glsl new file mode 100644 index 00000000..9b816492 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_NormalMapping_VCols.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Skinning.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Skinning.frag.glsl new file mode 100644 index 00000000..ae92a8be --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Skinning.frag.glsl @@ -0,0 +1,39 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Skinning.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Skinning.vert.glsl new file mode 100644 index 00000000..8d0e36f7 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Skinning.vert.glsl @@ -0,0 +1,136 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing.frag.glsl new file mode 100644 index 00000000..3e418a43 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing.vert.glsl new file mode 100644 index 00000000..4fb5f024 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing_VCols.frag.glsl new file mode 100644 index 00000000..f58d98c7 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing_VCols.frag.glsl @@ -0,0 +1,41 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing_VCols.vert.glsl new file mode 100644 index 00000000..a470fa9b --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Skinning_Texturing_VCols.vert.glsl @@ -0,0 +1,138 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Skinning_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Skinning_VCols.frag.glsl new file mode 100644 index 00000000..1866db63 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Skinning_VCols.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Skinning_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Skinning_VCols.vert.glsl new file mode 100644 index 00000000..d6bf08ba --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Skinning_VCols.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Texturing.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Texturing.frag.glsl new file mode 100644 index 00000000..ee803d3c --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Texturing.frag.glsl @@ -0,0 +1,39 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Texturing.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Texturing.vert.glsl new file mode 100644 index 00000000..6077f21b --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Texturing.vert.glsl @@ -0,0 +1,136 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Texturing_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_Texturing_VCols.frag.glsl new file mode 100644 index 00000000..d2a08747 --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Texturing_VCols.frag.glsl @@ -0,0 +1,40 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_Texturing_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_Texturing_VCols.vert.glsl new file mode 100644 index 00000000..15ed538c --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_Texturing_VCols.vert.glsl @@ -0,0 +1,137 @@ +#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 +} diff --git a/shader_data/attrib_pass/out/attrib_pass_VCols.frag.glsl b/shader_data/attrib_pass/out/attrib_pass_VCols.frag.glsl new file mode 100644 index 00000000..64a7f82b --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_VCols.frag.glsl @@ -0,0 +1,39 @@ +#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); +} diff --git a/shader_data/attrib_pass/out/attrib_pass_VCols.vert.glsl b/shader_data/attrib_pass/out/attrib_pass_VCols.vert.glsl new file mode 100644 index 00000000..da4ed61d --- /dev/null +++ b/shader_data/attrib_pass/out/attrib_pass_VCols.vert.glsl @@ -0,0 +1,136 @@ +#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 +}