Commit vor Voxel Update für die Klippen
This commit is contained in:
25
blight-assets/src/main/resources/MatDefs/Voxel.j3md
Normal file
25
blight-assets/src/main/resources/MatDefs/Voxel.j3md
Normal file
@@ -0,0 +1,25 @@
|
||||
MaterialDef Voxel {
|
||||
|
||||
MaterialParameters {
|
||||
Texture2D Tex0
|
||||
Texture2D Tex1
|
||||
Texture2D Tex2
|
||||
Texture2D Tex3
|
||||
Float TexScale : 4.0
|
||||
}
|
||||
|
||||
Technique {
|
||||
VertexShader GLSL150 : Shaders/Voxel.vert
|
||||
FragmentShader GLSL150 : Shaders/Voxel.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
WorldMatrix
|
||||
NormalMatrix
|
||||
}
|
||||
|
||||
RenderState {
|
||||
FaceCull Off
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
54
blight-assets/src/main/resources/Shaders/Voxel.frag
Normal file
54
blight-assets/src/main/resources/Shaders/Voxel.frag
Normal file
@@ -0,0 +1,54 @@
|
||||
uniform sampler2D m_Tex0;
|
||||
uniform sampler2D m_Tex1;
|
||||
uniform sampler2D m_Tex2;
|
||||
uniform sampler2D m_Tex3;
|
||||
uniform float m_TexScale;
|
||||
|
||||
in vec3 vWorldPos;
|
||||
in vec3 vNormal;
|
||||
in vec4 vMatWeights;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
vec3 blendWeights = abs(vNormal);
|
||||
blendWeights = max(blendWeights - 0.2, 0.0);
|
||||
blendWeights /= (blendWeights.x + blendWeights.y + blendWeights.z + 0.001);
|
||||
|
||||
vec2 uvX = vWorldPos.yz / m_TexScale;
|
||||
vec2 uvY = vWorldPos.xz / m_TexScale;
|
||||
vec2 uvZ = vWorldPos.xy / m_TexScale;
|
||||
|
||||
vec4 col = vec4(0.0);
|
||||
|
||||
float w0 = vMatWeights.r;
|
||||
if (w0 > 0.001) {
|
||||
col += w0 * (texture(m_Tex0, uvX) * blendWeights.x
|
||||
+ texture(m_Tex0, uvY) * blendWeights.y
|
||||
+ texture(m_Tex0, uvZ) * blendWeights.z);
|
||||
}
|
||||
float w1 = vMatWeights.g;
|
||||
if (w1 > 0.001) {
|
||||
col += w1 * (texture(m_Tex1, uvX) * blendWeights.x
|
||||
+ texture(m_Tex1, uvY) * blendWeights.y
|
||||
+ texture(m_Tex1, uvZ) * blendWeights.z);
|
||||
}
|
||||
float w2 = vMatWeights.b;
|
||||
if (w2 > 0.001) {
|
||||
col += w2 * (texture(m_Tex2, uvX) * blendWeights.x
|
||||
+ texture(m_Tex2, uvY) * blendWeights.y
|
||||
+ texture(m_Tex2, uvZ) * blendWeights.z);
|
||||
}
|
||||
float w3 = vMatWeights.a;
|
||||
if (w3 > 0.001) {
|
||||
col += w3 * (texture(m_Tex3, uvX) * blendWeights.x
|
||||
+ texture(m_Tex3, uvY) * blendWeights.y
|
||||
+ texture(m_Tex3, uvZ) * blendWeights.z);
|
||||
}
|
||||
|
||||
vec3 lightDir = normalize(vec3(0.5, 1.0, 0.3));
|
||||
float diff = max(dot(vNormal, lightDir), 0.0) * 0.7 + 0.3;
|
||||
|
||||
outColor = vec4(col.rgb * diff, col.a);
|
||||
if (outColor.a < 0.1) discard;
|
||||
}
|
||||
19
blight-assets/src/main/resources/Shaders/Voxel.vert
Normal file
19
blight-assets/src/main/resources/Shaders/Voxel.vert
Normal file
@@ -0,0 +1,19 @@
|
||||
uniform mat4 g_WorldViewProjectionMatrix;
|
||||
uniform mat4 g_WorldMatrix;
|
||||
uniform mat3 g_NormalMatrix;
|
||||
|
||||
in vec3 inPosition;
|
||||
in vec3 inNormal;
|
||||
in vec4 inColor; // material blend weights (r=tex0, g=tex1, b=tex2, a=tex3)
|
||||
|
||||
out vec3 vWorldPos;
|
||||
out vec3 vNormal;
|
||||
out vec4 vMatWeights;
|
||||
|
||||
void main() {
|
||||
vec4 worldPos = g_WorldMatrix * vec4(inPosition, 1.0);
|
||||
vWorldPos = worldPos.xyz;
|
||||
vNormal = normalize(g_NormalMatrix * inNormal);
|
||||
vMatWeights = inColor;
|
||||
gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
|
||||
}
|
||||
@@ -7,7 +7,8 @@
|
||||
"sprint",
|
||||
"stand_up",
|
||||
"tpose",
|
||||
"walking"
|
||||
"walking",
|
||||
"pickup"
|
||||
],
|
||||
"actionMap": {
|
||||
"DEFAULT": "tpose",
|
||||
@@ -16,6 +17,7 @@
|
||||
"RUN": "running",
|
||||
"SPRINT": "sprint",
|
||||
"JUMP": "idle_jump",
|
||||
"RUNNING_JUMP": "running_jump"
|
||||
"RUNNING_JUMP": "running_jump",
|
||||
"PICK_UP": "pickup"
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
blight-assets/src/main/resources/audio/static/pickup.ogg
Normal file
BIN
blight-assets/src/main/resources/audio/static/pickup.ogg
Normal file
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"itemId": "blutagave",
|
||||
"category": "MISC",
|
||||
"category": "CRAFTING_ITEMS",
|
||||
"subCategory": "PLANT",
|
||||
"name": {
|
||||
"id": "blutagave.name"
|
||||
},
|
||||
@@ -10,5 +11,12 @@
|
||||
"worthGold": 25,
|
||||
"modelRef": {
|
||||
"path": "Models/plants/usable/blutagave.j3o"
|
||||
}
|
||||
},
|
||||
"consumable": true,
|
||||
"effects": [
|
||||
{
|
||||
"stat": "CURRENT_HP",
|
||||
"value": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"itemId": "erzmoss",
|
||||
"category": "MISC",
|
||||
"category": "CRAFTING_ITEMS",
|
||||
"subCategory": "PLANT",
|
||||
"name": {
|
||||
"id": "erzmoss.name"
|
||||
},
|
||||
@@ -10,5 +11,12 @@
|
||||
"worthGold": 100,
|
||||
"modelRef": {
|
||||
"path": "Models/plants/usable/erzmoss.j3o"
|
||||
}
|
||||
},
|
||||
"consumable": true,
|
||||
"effects": [
|
||||
{
|
||||
"stat": "MAX_STAMINA",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user