Adding first APK build

This commit is contained in:
ml
2026-07-20 09:45:08 +02:00
parent 8712269b51
commit 9e2c9ffbe6
42 changed files with 10012 additions and 6 deletions
+13
View File
@@ -0,0 +1,13 @@
#version 100
// GLES port of engine/shaders/color.frag - identical logic, just needs an
// explicit precision declaration (required in GLES fragment shaders, not
// valid in desktop GLSL).
precision mediump float;
varying vec4 Color;
varying float Light;
void main() {
gl_FragColor = vec4(Color.r * Light, Color.g * Light, Color.b * Light, Color.a);
}
+38
View File
@@ -0,0 +1,38 @@
#version 100
// GLES port of engine/shaders/main.vert - the one real difference is
// gl_Vertex, a desktop-only compatibility-profile builtin that doesn't
// exist in GLES at all, replaced with an explicit "position" attribute
// (see android/engine-patches/03-android-opengl-es-render.patch's
// CreateShader() change, which binds it to attribute location 0 to match
// the vertex arrays OpenGL.cc's GLES immediate-mode emulation submits).
precision mediump float;
attribute vec4 position;
attribute vec2 texcoords;
attribute float light;
attribute vec4 color;
varying vec2 TexCoords;
varying float Light;
varying vec4 Color;
uniform mat4 view;
uniform mat4 proj;
// GLES has no glPointSize() (desktop-only, set from
// opengl_begin_stars()) - point size must come from this builtin
// instead. Only read by the rasterizer for GL_POINTS draws (i.e. only
// matters for star.frag); harmless left unset for the other two shaders
// built from this same vertex shader (main.vert). See
// android/engine-patches/04-android-opengl-es-render.patch's
// questshock_glPointSize()/questshock_glEnd().
uniform float pointSize;
void main() {
TexCoords = texcoords;
Light = light;
Color = color;
gl_Position = proj * view * position;
gl_PointSize = pointSize;
}
+22
View File
@@ -0,0 +1,22 @@
#version 100
// GLES port of engine/shaders/star.frag - identical logic, plus an
// explicit precision declaration (required in GLES). gl_PointCoord and
// point-sprite rasterization for GL_POINTS both work automatically in
// GLES with no separate enable call (unlike desktop's GL_POINT_SPRITE,
// which doesn't exist in GLES at all - see
// android/engine-patches/03-android-opengl-es-render.patch's
// init_opengl() change).
precision mediump float;
varying float Light;
void main() {
vec2 mid = vec2(0.5, 0.5) - gl_PointCoord;
float dist = 0.5 - length(mid);
dist *= 3.0;
dist = min(dist, 1.0);
gl_FragColor = vec4(dist * Light, dist * Light, dist * Light, 1.0);
}
+49
View File
@@ -0,0 +1,49 @@
#version 100
// GLES port of engine/shaders/texture.frag - same logic, plus:
// - an explicit precision declaration (required in GLES, invalid in
// desktop GLSL).
// - the discard at the end, replacing the fixed-function alpha test
// (glAlphaFunc(GL_GEQUAL, 0.05f) on desktop - GLES has no fixed-function
// pipeline at all, so this is done in the shader instead; see
// android/engine-patches/03-android-opengl-es-render.patch's
// init_opengl() change, which skips the desktop-only glAlphaFunc/
// GL_ALPHA_TEST calls on Android).
precision mediump float;
// The texture alpha value has two separate functions in this shader:
// - Pixels with a zero alpha value are transparent.
// - Pixels with non-zero alpha are opaque, and the alpha value
// defines a minimum light level.
varying vec2 TexCoords;
varying float Light;
uniform sampler2D tex;
uniform bool nightsight;
uniform bool mutant;
void main() {
vec4 t = texture2D(tex, TexCoords);
// Alpha values > 0.5 are emissive
float alpha = t.a > 0.5 ? 1.0 : t.a * 2.0;
if (nightsight) {
// approximate the blue tint of palette colors 0xb0..0xbf
float gray = 0.40 * t.r + 0.59 * t.g + 0.11 * t.b;
float rg = 0.7 * gray;
float b = 0.75 * gray + 0.1;
gl_FragColor = vec4(rg, rg, b, (mutant ? 0.2 * alpha : alpha));
} else {
float emissive = t.a > 0.5 ? (t.a - 0.5) * 2.0 : 0.0;
float light = max(Light * Light, emissive);
if (mutant)
gl_FragColor = vec4(0.5 * t.r * light, 0.5 * t.r * light, 0.5 * t.r * light, 0.2 * alpha);
else
gl_FragColor = vec4(t.r * light, t.g * light, t.b * light, alpha);
}
if (gl_FragColor.a < 0.05)
discard;
}