Working on fog, dialogs, etc

This commit is contained in:
Vladislav Khorev committed 2026-04-20 00:21:51 +03:00
1 parent fd098e8346
commit d557c4b530
18 files changed
+424 -40

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
{
"root": {
"type": "LinearLayout",
"orientation": "vertical",
"horizontal_align": "center",
"vertical_align": "center",
"spacing": 20,
"x": 0,
"y": 0,
"width": "match_parent",
"height": "match_parent",
"children": [
{
"type": "StaticImage",
"name": "title",
"width": 512,
"height": 512,
"texture": "resources/e/menu/final_loose.png"
},
{
"type": "Button",
"name": "backButton",
"width": 512,
"height": 128,
"textures": {
"normal": "resources/e/menu/restart_button.png",
"hover": "resources/e/menu/restart_button.png",
"pressed": "resources/e/menu/restart_button.png"
}
}
]
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"root": {
"type": "LinearLayout",
"orientation": "vertical",
"horizontal_align": "center",
"vertical_align": "center",
"spacing": 20,
"x": 0,
"y": 0,
"width": "match_parent",
"height": "match_parent",
"children": [
{
"type": "StaticImage",
"name": "title",
"width": 512,
"height": 512,
"texture": "resources/e/menu/final_win.png"
}
]
}
}
+2 -2
View File
@@ -4,8 +4,8 @@ varying vec2 texCoord;
uniform mat4 ProjectionModelViewMatrix;
void main()
void main()
{
gl_Position = ProjectionModelViewMatrix * vec4(vPosition.xyz, 1.0);
texCoord = vTexCoord;
}
}
+5 -5
View File
@@ -2,14 +2,14 @@
uniform sampler2D Texture;
varying vec2 texCoord;
void main()
void main()
{
vec4 color = texture2D(Texture,texCoord).rgba;
//gl_FragColor = vec4(color.rgb*0.1 + vec3(0.9, 0.9, 0.9), 1.0);
if(color.a < 0.1)
discard;
gl_FragColor = color;
}
}
+3 -3
View File
@@ -2,12 +2,12 @@ precision mediump float;
uniform sampler2D Texture;
varying vec2 texCoord;
void main()
void main()
{
vec4 color = texture2D(Texture,texCoord).rgba;
//gl_FragColor = vec4(color.rgb*0.1 + vec3(0.9, 0.9, 0.9), 1.0);
if(color.a < 0.1)
discard;
gl_FragColor = color;
}
}
+15
View File
@@ -0,0 +1,15 @@
attribute vec3 vPosition;
attribute vec2 vTexCoord;
varying vec2 texCoord;
varying float fogDistance;
uniform mat4 ProjectionModelViewMatrix;
uniform mat4 ModelViewMatrix;
void main()
{
vec4 eyePos = ModelViewMatrix * vec4(vPosition.xyz, 1.0);
fogDistance = length(eyePos.xyz);
gl_Position = ProjectionModelViewMatrix * vec4(vPosition.xyz, 1.0);
texCoord = vTexCoord;
}
+18
View File
@@ -0,0 +1,18 @@
//precisionmediump float;
uniform sampler2D Texture;
varying vec2 texCoord;
varying float fogDistance;
void main()
{
vec4 color = texture2D(Texture,texCoord).rgba;
if(color.a < 0.1)
discard;
vec3 fogColor = vec3(0.53, 0.81, 0.92);
float fogFactor = clamp((fogDistance - 90.0) / 30.0, 0.0, 1.0);
vec3 finalColor = mix(color.rgb, fogColor, fogFactor);
gl_FragColor = vec4(finalColor, color.a);
}
+54
View File
@@ -0,0 +1,54 @@
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];
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);
gl_Position = ProjectionModelViewMatrix * skinnedPos;
texCoord = vTexCoord;
}
+18
View File
@@ -0,0 +1,18 @@
precision mediump float;
uniform sampler2D Texture;
varying vec2 texCoord;
varying float fogDistance;
void main()
{
vec4 color = texture2D(Texture,texCoord).rgba;
if(color.a < 0.1)
discard;
vec3 fogColor = vec3(0.53, 0.81, 0.92);
float fogFactor = clamp((fogDistance - 90.0) / 30.0, 0.0, 1.0);
vec3 finalColor = mix(color.rgb, fogColor, fogFactor);
gl_FragColor = vec4(finalColor, color.a);
}