Automate generating shader variations
This commit is contained in:
parent
6f50e4cd70
commit
4c3468b6f4
|
@ -208,10 +208,10 @@ def make_deferred_pipeline():
|
|||
|
||||
gbuffer_node = nodes.new('TargetNodeType')
|
||||
gbuffer_node.location = 0, -step * 1
|
||||
drawgbuffer_node.inputs[0].default_value = 'gbuffer' # Id
|
||||
drawgbuffer_node.inputs[3].default_value = 3 # Color buffers
|
||||
drawgbuffer_node.inputs[4].default_value = True # Depth
|
||||
drawgbuffer_node.inputs[5].default_value = 'RGBA128' # Format
|
||||
gbuffer_node.inputs[0].default_value = 'gbuffer' # Id
|
||||
gbuffer_node.inputs[3].default_value = 3 # Color buffers
|
||||
gbuffer_node.inputs[4].default_value = True # Depth
|
||||
gbuffer_node.inputs[5].default_value = 'RGBA128' # Format
|
||||
|
||||
setgbuffer_node = nodes.new('SetTargetNodeType')
|
||||
setgbuffer_node.location = step * 1, 0
|
||||
|
@ -294,6 +294,8 @@ def buildNodeTree(node_group):
|
|||
res.stages = []
|
||||
|
||||
rn = getRootNode(node_group)
|
||||
if rn == None:
|
||||
return
|
||||
buildNode(res, rn, node_group)
|
||||
|
||||
with open(path + node_group_name + '.json', 'w') as f:
|
|
@ -10,7 +10,7 @@ import atexit
|
|||
import webbrowser
|
||||
import write_data
|
||||
import nodes
|
||||
import pipeline_nodes
|
||||
import nodes_pipeline
|
||||
from armory import ArmoryExporter
|
||||
|
||||
def defaultSettings():
|
||||
|
@ -162,7 +162,7 @@ def buildProject(self, build_type=0):
|
|||
|
||||
# Auto-build nodes # TODO: only if needed
|
||||
nodes.buildNodeTrees()
|
||||
pipeline_nodes.buildNodeTrees()
|
||||
nodes_pipeline.buildNodeTrees()
|
||||
|
||||
# Set dir
|
||||
s = bpy.data.filepath.split(os.path.sep)
|
||||
|
|
|
@ -2,7 +2,7 @@ import shutil
|
|||
import bpy
|
||||
import os
|
||||
import json
|
||||
import pipeline_nodes
|
||||
import nodes_pipeline
|
||||
from bpy.types import Menu, Panel, UIList
|
||||
from bpy.props import *
|
||||
|
||||
|
@ -74,7 +74,7 @@ class OBJECT_OT_RESETPIPELINESButton(bpy.types.Operator):
|
|||
bl_label = "Reset Pipelines"
|
||||
|
||||
def execute(self, context):
|
||||
pipeline_nodes.reset_pipelines()
|
||||
nodes_pipeline.reset_pipelines()
|
||||
return{'FINISHED'}
|
||||
|
||||
# Menu in materials region
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import project
|
||||
import nodes
|
||||
import pipeline_nodes
|
||||
import nodes_pipeline
|
||||
import armory
|
||||
import traits_animation
|
||||
import traits_params
|
||||
|
@ -10,7 +10,7 @@ import props
|
|||
def register():
|
||||
project.register()
|
||||
nodes.register()
|
||||
pipeline_nodes.register()
|
||||
nodes_pipeline.register()
|
||||
armory.register()
|
||||
traits_animation.register()
|
||||
traits_params.register()
|
||||
|
@ -20,7 +20,7 @@ def register():
|
|||
def unregister():
|
||||
project.unregister()
|
||||
nodes.unregister()
|
||||
pipeline_nodes.unregister()
|
||||
nodes_pipeline.unregister()
|
||||
armory.unregister()
|
||||
traits_animation.unregister()
|
||||
traits_params.unregister()
|
||||
|
|
|
@ -22,9 +22,10 @@ project.addAssets('Libraries/cyclesgame/Assets/**');
|
|||
|
||||
for ref in shader_references:
|
||||
# ArmoryExporter.pipeline_pass instead of split
|
||||
f.write("project.addAssets('Libraries/cyclesgame/compiled/ShaderResources/" + ref.split('_', 1)[0] + "/" + ref + ".json');\n")
|
||||
f.write("project.addShaders('Libraries/cyclesgame/compiled/Shaders/" + ref + ".frag.glsl');\n")
|
||||
f.write("project.addShaders('Libraries/cyclesgame/compiled/Shaders/" + ref + ".vert.glsl');\n")
|
||||
base_name = ref.split('_', 1)[0] + "/"
|
||||
f.write("project.addAssets('Libraries/cyclesgame/compiled/ShaderResources/" + base_name + "" + ref + ".json');\n")
|
||||
f.write("project.addShaders('Libraries/cyclesgame/compiled/Shaders/" + base_name + "" + ref + ".frag.glsl');\n")
|
||||
f.write("project.addShaders('Libraries/cyclesgame/compiled/Shaders/" + base_name + "" + ref + ".vert.glsl');\n")
|
||||
|
||||
if bpy.data.worlds[0]['CGPhysics'] != 0:
|
||||
f.write("\nproject.addDefine('WITH_PHYSICS')\n")
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Instancing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _Instancing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _NormalMapping
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Instancing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Skinning
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _NormalMapping
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Skinning
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _Skinning
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Skinning
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _Texturing
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _Texturing
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#define _Texturing
|
||||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
#define _Texturing
|
||||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#define _VCols
|
||||
#extension GL_EXT_draw_buffers : require
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _Texturing
|
||||
uniform sampler2D stex;
|
||||
#endif
|
||||
uniform sampler2D shadowMap;
|
||||
#ifdef _NormalMapping
|
||||
uniform sampler2D normalMap;
|
||||
#endif
|
||||
uniform bool lighting;
|
||||
uniform bool receiveShadow;
|
||||
uniform float roughness;
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
void kore() {
|
||||
|
||||
gl_FragData[0] = vec4(position.xyz, 0);
|
||||
gl_FragData[1] = vec4(normal.xyz, 0);
|
||||
#ifdef _Texturing
|
||||
gl_FragData[2] = vec4(texture2D(stex, texCoord).rgb, 0);
|
||||
#endif
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
#define _VCols
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
#define _Texturing
|
||||
#endif
|
||||
|
||||
attribute vec3 pos;
|
||||
attribute vec3 nor;
|
||||
#ifdef _Texturing
|
||||
attribute vec2 tex;
|
||||
#endif
|
||||
#ifdef _VCols
|
||||
attribute vec4 col;
|
||||
#endif
|
||||
#ifdef _NormalMapping
|
||||
attribute vec3 tan;
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
attribute vec4 bone;
|
||||
attribute vec4 weight;
|
||||
#endif
|
||||
#ifdef _Instancing
|
||||
attribute vec3 off;
|
||||
#endif
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 NM;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 lightMVP;
|
||||
uniform vec4 diffuseColor;
|
||||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
#ifdef _Skinning
|
||||
uniform float skinBones[50 * 12];
|
||||
#endif
|
||||
|
||||
varying vec3 position;
|
||||
#ifdef _Texturing
|
||||
varying vec2 texCoord;
|
||||
#endif
|
||||
varying vec3 normal;
|
||||
varying vec4 lPos;
|
||||
varying vec4 matColor;
|
||||
varying vec3 lightDir;
|
||||
varying vec3 eyeDir;
|
||||
|
||||
#ifdef _NormalMapping
|
||||
mat3 transpose(mat3 m) {
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
mat4 getBoneMat(const int boneIndex) {
|
||||
vec4 v0 = vec4(skinBones[boneIndex * 12 + 0],
|
||||
skinBones[boneIndex * 12 + 1],
|
||||
skinBones[boneIndex * 12 + 2],
|
||||
skinBones[boneIndex * 12 + 3]);
|
||||
vec4 v1 = vec4(skinBones[boneIndex * 12 + 4],
|
||||
skinBones[boneIndex * 12 + 5],
|
||||
skinBones[boneIndex * 12 + 6],
|
||||
skinBones[boneIndex * 12 + 7]);
|
||||
vec4 v2 = vec4(skinBones[boneIndex * 12 + 8],
|
||||
skinBones[boneIndex * 12 + 9],
|
||||
skinBones[boneIndex * 12 + 10],
|
||||
skinBones[boneIndex * 12 + 11]);
|
||||
return mat4(v0.x, v0.y, v0.z, v0.w,
|
||||
v1.x, v1.y, v1.z, v1.w,
|
||||
v2.x, v2.y, v2.z, v2.w,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
mat4 getSkinningMat() {
|
||||
return weight.x * getBoneMat(int(bone.x)) +
|
||||
weight.y * getBoneMat(int(bone.y)) +
|
||||
weight.z * getBoneMat(int(bone.z)) +
|
||||
weight.w * getBoneMat(int(bone.w));
|
||||
}
|
||||
|
||||
mat3 getSkinningMatVec(const mat4 skinningMat) {
|
||||
return mat3(skinningMat[0].xyz, skinningMat[1].xyz, skinningMat[2].xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kore() {
|
||||
|
||||
#ifdef _Instancing
|
||||
vec4 sPos = (vec4(pos + off, 1.0));
|
||||
#else
|
||||
vec4 sPos = (vec4(pos, 1.0));
|
||||
#endif
|
||||
#ifdef _Skinning
|
||||
mat4 skinningMat = getSkinningMat();
|
||||
mat3 skinningMatVec = getSkinningMatVec(skinningMat);
|
||||
sPos = sPos * skinningMat;
|
||||
#endif
|
||||
vec4 mPos = M * sPos;
|
||||
lPos = lightMVP * sPos;
|
||||
|
||||
gl_Position = P * V * mPos;
|
||||
position = mPos.xyz / mPos.w;
|
||||
|
||||
#ifdef _Texturing
|
||||
texCoord = tex;
|
||||
#endif
|
||||
|
||||
#ifdef _Skinning
|
||||
normal = normalize(mat3(NM) * (nor * skinningMatVec));
|
||||
#else
|
||||
normal = normalize(mat3(NM) * nor);
|
||||
#endif
|
||||
|
||||
matColor = diffuseColor;
|
||||
|
||||
#ifdef _VCols
|
||||
matColor *= col;
|
||||
#endif
|
||||
|
||||
#ifdef _NormalMapping
|
||||
vec3 vtan = (tan);
|
||||
vec3 vbitan = cross(normal, vtan) * 1.0;//tangent.w;
|
||||
|
||||
mat3 TBN = transpose(mat3(vtan, vbitan, normal));
|
||||
lightDir = normalize(TBN * lightDir);
|
||||
eyeDir = normalize(TBN * eyeDir);
|
||||
#else
|
||||
lightDir = normalize(light - position);
|
||||
eyeDir = normalize(eye - position);
|
||||
#endif
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
#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);
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#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);
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#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));
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
#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);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue