Added darklands
This commit is contained in:
1 parent
4e9eef1863
commit
c086fe1ef0
16 files changed
+351
-4
No files matched your search
@@ -27,6 +27,7 @@
|
||||
{
|
||||
"name": "inai",
|
||||
"texturePath": "resources/w/exterior/Building_work014.png",
|
||||
"textureDarkandsPath" : "resources/w/interior/darklands_generated_building001.png",
|
||||
"meshPath": "resources/w/interior/Building_002.txt",
|
||||
"rotationX": 0.0,
|
||||
"rotationY": 0.0,
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
uniform float uAlpha;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(1.0, 1.0, 1.0, uAlpha);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
precision mediump float;
|
||||
uniform float uAlpha;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(1.0, 1.0, 1.0, uAlpha);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
attribute vec3 vPosition;
|
||||
attribute vec2 vTexCoord;
|
||||
varying vec2 texCoord;
|
||||
varying float fogDistance;
|
||||
|
||||
uniform mat4 ProjectionModelViewMatrix;
|
||||
uniform mat4 ModelViewMatrix;
|
||||
uniform vec3 uPlayerEyePos;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 eyePos = ModelViewMatrix * vec4(vPosition.xyz, 1.0);
|
||||
fogDistance = length(eyePos.xyz - uPlayerEyePos);
|
||||
gl_Position = ProjectionModelViewMatrix * vec4(vPosition.xyz, 1.0);
|
||||
texCoord = vTexCoord;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//precisionmediump float;
|
||||
uniform sampler2D Texture;
|
||||
uniform float uAlpha;
|
||||
varying vec2 texCoord;
|
||||
varying float fogDistance;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture2D(Texture, texCoord).rgba;
|
||||
|
||||
if (color.a < 0.1)
|
||||
discard;
|
||||
|
||||
vec3 tinted = mix(color.rgb, vec3(0.5, 0.5, 0.8), 0.3);
|
||||
|
||||
vec3 fogColor = vec3(0.05, 0.05, 0.2);
|
||||
float fogFactor = clamp((fogDistance - 5.0) / 10.0, 0.0, 1.0);
|
||||
vec3 finalColor = mix(tinted, fogColor, fogFactor);
|
||||
|
||||
gl_FragColor = vec4(finalColor, color.a * uAlpha);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
attribute vec3 vPosition;
|
||||
attribute vec2 vTexCoord;
|
||||
attribute vec4 aBoneIndices0;
|
||||
attribute vec2 aBoneIndices1;
|
||||
attribute vec4 aBoneWeights0;
|
||||
attribute vec2 aBoneWeights1;
|
||||
|
||||
varying vec2 texCoord;
|
||||
varying float fogDistance;
|
||||
|
||||
uniform mat4 ProjectionModelViewMatrix;
|
||||
uniform mat4 ModelViewMatrix;
|
||||
uniform mat4 uBoneMatrices[64];
|
||||
uniform vec3 uPlayerEyePos;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 skinnedPos = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 originalPos = vec4(vPosition, 1.0);
|
||||
float totalWeight = 0.0;
|
||||
|
||||
if (aBoneWeights0.x > 0.0) {
|
||||
skinnedPos += uBoneMatrices[int(aBoneIndices0.x)] * originalPos * aBoneWeights0.x;
|
||||
totalWeight += aBoneWeights0.x;
|
||||
}
|
||||
if (aBoneWeights0.y > 0.0) {
|
||||
skinnedPos += uBoneMatrices[int(aBoneIndices0.y)] * originalPos * aBoneWeights0.y;
|
||||
totalWeight += aBoneWeights0.y;
|
||||
}
|
||||
if (aBoneWeights0.z > 0.0) {
|
||||
skinnedPos += uBoneMatrices[int(aBoneIndices0.z)] * originalPos * aBoneWeights0.z;
|
||||
totalWeight += aBoneWeights0.z;
|
||||
}
|
||||
if (aBoneWeights0.w > 0.0) {
|
||||
skinnedPos += uBoneMatrices[int(aBoneIndices0.w)] * originalPos * aBoneWeights0.w;
|
||||
totalWeight += aBoneWeights0.w;
|
||||
}
|
||||
if (aBoneWeights1.x > 0.0) {
|
||||
skinnedPos += uBoneMatrices[int(aBoneIndices1.x)] * originalPos * aBoneWeights1.x;
|
||||
totalWeight += aBoneWeights1.x;
|
||||
}
|
||||
if (aBoneWeights1.y > 0.0) {
|
||||
skinnedPos += uBoneMatrices[int(aBoneIndices1.y)] * originalPos * aBoneWeights1.y;
|
||||
totalWeight += aBoneWeights1.y;
|
||||
}
|
||||
|
||||
if (totalWeight < 0.001) {
|
||||
skinnedPos = originalPos;
|
||||
}
|
||||
|
||||
vec4 eyePos = ModelViewMatrix * skinnedPos;
|
||||
fogDistance = length(eyePos.xyz - uPlayerEyePos);
|
||||
gl_Position = ProjectionModelViewMatrix * skinnedPos;
|
||||
texCoord = vTexCoord;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
precision mediump float;
|
||||
uniform sampler2D Texture;
|
||||
uniform float uAlpha;
|
||||
varying vec2 texCoord;
|
||||
varying float fogDistance;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture2D(Texture, texCoord).rgba;
|
||||
|
||||
if (color.a < 0.1)
|
||||
discard;
|
||||
|
||||
vec3 tinted = mix(color.rgb, vec3(0.5, 0.5, 0.8), 0.3);
|
||||
|
||||
vec3 fogColor = vec3(0.05, 0.05, 0.2);
|
||||
float fogFactor = clamp((fogDistance - 5.0) / 10.0, 0.0, 1.0);
|
||||
vec3 finalColor = mix(tinted, fogColor, fogFactor);
|
||||
|
||||
gl_FragColor = vec4(finalColor, color.a * uAlpha);
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user