Arbeiten aus dem URlaub

This commit is contained in:
2026-05-19 12:55:05 +02:00
parent b8a0234ad2
commit 4f48834e2c
403 changed files with 23402 additions and 6389 deletions

View File

@@ -0,0 +1,5 @@
// Gemeinsame Spiel-Assets kein Java-Quellcode, nur Ressourcen.
// Alle Projekte binden dieses Subprojekt ein, um Zugang zu den
// geteilten Assets (MatDefs, Shaders, Textures) auf dem Classpath zu erhalten.
//
// Editor-spezifische Assets (Tool-Icons etc.) verbleiben in blight-editor.

View File

@@ -0,0 +1,28 @@
MaterialDef Grass {
MaterialParameters {
Color Color (Color) : 1.0 1.0 1.0 1.0
Texture2D ColorMap
Float WindSpeed : 0.5
Float WindStrength : 0.12
}
Technique {
VertexShader GLSL150: Shaders/Grass.vert
FragmentShader GLSL150: Shaders/Grass.frag
WorldParameters {
WorldViewProjectionMatrix
WorldMatrix
Time
}
RenderState {
FaceCull Off
}
Defines {
HAS_COLORMAP : ColorMap
}
}
}

View File

@@ -0,0 +1,21 @@
MaterialDef Tree {
MaterialParameters {
Color Diffuse (Color) : 0.42 0.26 0.10 1.0
Float WindStrength : 0.15
Float WindSpeed : 0.5
Texture2D BarkMap
Boolean HasBarkMap : false
}
Technique {
VertexShader GLSL150 : Shaders/Tree.vert
FragmentShader GLSL150 : Shaders/Tree.frag
WorldParameters {
WorldViewProjectionMatrix
WorldMatrix
Time
}
}
}

View File

@@ -0,0 +1,83 @@
MaterialDef TreeLeaf {
MaterialParameters {
Color Diffuse (Color) : 0.18 0.60 0.10 1.0
Float WindStrength : 0.30
Float WindSpeed : 0.7
Texture2D LeafMap
Boolean HasLeafMap : false
// Vom Shadow-Renderer befüllt (PostShadow-Pass) — vollständige Liste aus PostShadow.j3md
Int BoundDrawBuffer
Int FilterMode
Boolean HardwareShadows
Texture2D ShadowMap0
Texture2D ShadowMap1
Texture2D ShadowMap2
Texture2D ShadowMap3
Texture2D ShadowMap4
Texture2D ShadowMap5
Float ShadowIntensity : 1.0
Vector4 Splits
Vector2 FadeInfo
Matrix4 LightViewProjectionMatrix0
Matrix4 LightViewProjectionMatrix1
Matrix4 LightViewProjectionMatrix2
Matrix4 LightViewProjectionMatrix3
Matrix4 LightViewProjectionMatrix4
Matrix4 LightViewProjectionMatrix5
Vector3 LightPos
Vector3 LightDir
Float PCFEdge
Float ShadowMapSize
Boolean BackfaceShadows : false
}
Technique {
VertexShader GLSL150 : Shaders/Tree.vert
FragmentShader GLSL150 : Shaders/TreeLeaf.frag
WorldParameters {
WorldViewProjectionMatrix
WorldMatrix
Time
}
RenderState {
FaceCull Off
}
}
Technique PostShadow {
VertexShader GLSL150 : Shaders/LeafPostShadow.vert
FragmentShader GLSL150 : Shaders/LeafPostShadow.frag
WorldParameters {
WorldViewProjectionMatrix
WorldMatrix
}
ForcedRenderState {
Blend Modulate
FaceCull Off
DepthWrite Off
}
}
Technique PreShadow {
VertexShader GLSL150 : Shaders/LeafPreShadow.vert
FragmentShader GLSL150 : Shaders/LeafPreShadow.frag
WorldParameters {
WorldViewProjectionMatrix
}
ForcedRenderState {
FaceCull Off
DepthTest On
DepthWrite On
PolyOffset 5 3
ColorWrite Off
}
}
}

View File

@@ -0,0 +1,18 @@
uniform vec4 m_Color;
#ifdef HAS_COLORMAP
uniform sampler2D m_ColorMap;
#endif
in vec2 texCoord;
out vec4 outFragColor;
void main() {
vec4 color = m_Color;
#ifdef HAS_COLORMAP
color *= texture(m_ColorMap, texCoord);
#endif
// Alpha-Discard: transparente Pixel sofort verwerfen, Z-Buffer bleibt sauber
if (color.a < 0.5) discard;
outFragColor = color;
}

View File

@@ -0,0 +1,33 @@
uniform mat4 g_WorldViewProjectionMatrix;
uniform mat4 g_WorldMatrix;
uniform float g_Time;
uniform float m_WindSpeed;
uniform float m_WindStrength;
in vec3 inPosition;
in vec2 inTexCoord;
out vec2 texCoord;
void main() {
vec4 pos = vec4(inPosition, 1.0);
// Nur obere Hälfte des Halms bewegen (inTexCoord.y = 0 unten, 1 oben)
if (inTexCoord.y > 0.05) {
vec2 worldXZ = (g_WorldMatrix * pos).xz;
float t = g_Time * m_WindSpeed;
// Zwei überlagerte Sinuswellen für organische Bewegung
float sway = sin(t * 2.1 + worldXZ.x * 0.08 + worldXZ.y * 0.06) * 0.6
+ sin(t * 1.4 - worldXZ.x * 0.05 + worldXZ.y * 0.09) * 0.4;
// Quadratische Gewichtung: Spitze bewegt sich mehr als Basis
float bend = sway * m_WindStrength * inTexCoord.y * inTexCoord.y;
pos.x += bend;
pos.z += bend * 0.3;
}
texCoord = inTexCoord;
gl_Position = g_WorldViewProjectionMatrix * pos;
}

View File

@@ -0,0 +1,20 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform sampler2D m_ShadowMap0;
uniform float m_ShadowIntensity;
uniform sampler2D m_LeafMap;
uniform bool m_HasLeafMap;
in vec4 shadowCoord;
in vec2 texCoord;
void main() {
// Transparente Blattbereiche empfangen keinen Schatten
if (m_HasLeafMap && texture2D(m_LeafMap, texCoord).a < 0.5) discard;
vec3 coord = shadowCoord.xyz / shadowCoord.w;
float mapDepth = texture2D(m_ShadowMap0, coord.xy).r;
float lit = (coord.z > mapDepth + 0.001) ? (1.0 - m_ShadowIntensity) : 1.0;
gl_FragColor = vec4(lit, lit, lit, 1.0);
}

View File

@@ -0,0 +1,18 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform mat4 g_WorldViewProjectionMatrix;
uniform mat4 g_WorldMatrix;
uniform mat4 m_LightViewProjectionMatrix0;
in vec3 inPosition;
in vec2 inTexCoord;
out vec4 shadowCoord;
out vec2 texCoord;
void main() {
gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
vec4 worldPos = g_WorldMatrix * vec4(inPosition, 1.0);
shadowCoord = m_LightViewProjectionMatrix0 * worldPos;
texCoord = inTexCoord;
}

View File

@@ -0,0 +1,15 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform sampler2D m_LeafMap;
uniform bool m_HasLeafMap;
in vec2 texCoord;
void main() {
if (m_HasLeafMap) {
vec4 tex = texture2D(m_LeafMap, texCoord);
if (tex.a < 0.5) discard;
}
// Nur Tiefe schreiben — ColorWrite ist per ForcedRenderState deaktiviert
gl_FragColor = vec4(1.0);
}

View File

@@ -0,0 +1,13 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform mat4 g_WorldViewProjectionMatrix;
in vec3 inPosition;
in vec2 inTexCoord;
out vec2 texCoord;
void main() {
gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
texCoord = inTexCoord;
}

View File

@@ -0,0 +1,17 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform sampler2D m_LeafMap;
uniform float m_AlphaDiscardThreshold;
varying vec2 texCoord;
void main() {
#ifdef HAS_LEAFMAP
float alpha = texture2D(m_LeafMap, texCoord).a;
if (alpha < m_AlphaDiscardThreshold) {
discard;
}
#endif
// Wir schreiben nur die Tiefe, die Farbe ist egal.
gl_FragColor = vec4(1.0);
}

View File

@@ -0,0 +1,29 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform vec4 m_Diffuse;
uniform sampler2D m_BarkMap;
uniform bool m_HasBarkMap;
in vec2 texCoord;
in vec3 worldNormal;
void main() {
vec3 n = normalize(worldNormal);
// Sun at ~45° elevation from SE — good contrast on vertical cylinders
vec3 sunDir = normalize(vec3(0.6, 0.7, 0.4));
vec3 fillDir = normalize(vec3(-0.5, 0.3, -0.4));
vec3 rimDir = normalize(vec3(-0.3, 0.5, 0.7));
float sun = max(dot(n, sunDir), 0.0);
float fill = max(dot(n, fillDir), 0.0) * 0.22;
float rim = max(dot(n, rimDir), 0.0) * 0.14;
float sky = dot(n, vec3(0.0, 1.0, 0.0)) * 0.4 + 0.4; // [0.0, 0.8]
float light = sun * 0.75 + fill + rim + sky * 0.09 + 0.05;
vec3 baseColor = m_HasBarkMap
? texture2D(m_BarkMap, texCoord).rgb * m_Diffuse.rgb
: m_Diffuse.rgb;
gl_FragColor = vec4(baseColor * clamp(light, 0.0, 1.0), m_Diffuse.a);
}

View File

@@ -0,0 +1,33 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform mat4 g_WorldViewProjectionMatrix;
uniform mat4 g_WorldMatrix;
uniform float g_Time;
uniform float m_WindStrength;
uniform float m_WindSpeed;
in vec3 inPosition;
in vec3 inNormal;
in vec2 inTexCoord;
in vec4 inColor; // R = Wind-Gewicht (0 = Wurzel, 1 = Spitze)
out vec2 texCoord;
out vec3 worldNormal;
void main() {
float windW = inColor.r;
float t = g_Time * m_WindSpeed;
// Welt-Position für orts-abhängige Phase (verhindert synchrones Schwingen)
vec4 worldPos = g_WorldMatrix * vec4(inPosition, 1.0);
float phase = worldPos.x * 0.08 + worldPos.z * 0.06;
float swayX = sin(t + phase) * windW * m_WindStrength;
float swayZ = cos(t * 0.73 + phase) * windW * m_WindStrength * 0.55;
vec3 animPos = inPosition + vec3(swayX, 0.0, swayZ);
gl_Position = g_WorldViewProjectionMatrix * vec4(animPos, 1.0);
texCoord = inTexCoord;
worldNormal = normalize((g_WorldMatrix * vec4(inNormal, 0.0)).xyz);
}

View File

@@ -0,0 +1,27 @@
#import "Common/ShaderLib/GLSLCompat.glsllib"
uniform vec4 m_Diffuse;
uniform sampler2D m_LeafMap;
uniform bool m_HasLeafMap;
in vec2 texCoord;
in vec3 worldNormal;
void main() {
vec3 baseColor;
if (m_HasLeafMap) {
vec4 tex = texture2D(m_LeafMap, texCoord);
if (tex.a < 0.5) discard;
baseColor = tex.rgb * m_Diffuse.rgb;
} else {
// Fallback: kreisförmiger Clip
vec2 uv = texCoord * 2.0 - 1.0;
if (dot(uv, uv) > 0.95) discard;
float edge = 1.0 - dot(uv, uv);
baseColor = m_Diffuse.rgb * (0.7 + 0.3 * edge);
}
// Leaves transmit light — no directional shading, uniform brightness
gl_FragColor = vec4(baseColor, 1.0);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB