unify timeline, world. shadeless schematics.

This commit is contained in:
2026-07-05 17:18:11 -04:00
parent 53a4a5b9c5
commit 1759e89b3b
3 changed files with 265 additions and 186 deletions

View File

@@ -17,6 +17,7 @@ layout(location=9) in vec3 i_color;
uniform mat4 u_viewProj;
uniform vec3 u_lightDir;
uniform vec3 u_viewDir;
uniform vec3 u_upDir;
out vec2 v_uv;
out float v_light;
@@ -32,6 +33,15 @@ void main() {
float head = max(dot(normal, normalize(u_viewDir)), 0.0);
float baseLight = clamp(sun + head * 0.3, 0.0, 1.0) * 0.6 + 0.4;
// Strict Schematic Detection: Both vectors must be perfectly axis-aligned
vec3 absV = abs(u_viewDir);
vec3 absU = abs(u_upDir);
bool isSchematic = (absV.x + absV.y + absV.z == 1.0) && (absU.x + absU.y + absU.z == 1.0);
if (isSchematic && head == 1.0) {
baseLight = 1.0;
}
v_light = mix(1.0, baseLight, a_shade);
v_color = mix(vec3(1.0), i_color, a_tint);
}
@@ -81,6 +91,7 @@ export class Engine {
viewProj: gl.getUniformLocation(this.program, "u_viewProj"),
lightDir: gl.getUniformLocation(this.program, "u_lightDir"),
viewDir: gl.getUniformLocation(this.program, "u_viewDir"),
upDir: gl.getUniformLocation(this.program, "u_upDir"),
texture: gl.getUniformLocation(this.program, "u_texture")
};
@@ -306,8 +317,9 @@ export class Engine {
const viewProj = diorama.updateMatrices(aspect);
gl.uniformMatrix4fv(this.uniforms.viewProj, false, viewProj);
gl.uniform3f(this.uniforms.lightDir, 1.0, 3.0, 2.0);
gl.uniform3f(this.uniforms.lightDir, 1.0, 3.0, -2.0);
gl.uniform3f(this.uniforms.viewDir, diorama.viewDir[0], diorama.viewDir[1], diorama.viewDir[2]);
gl.uniform3f(this.uniforms.upDir, diorama.upDir[0], diorama.upDir[1], diorama.upDir[2]);
const meshes = this.worldMeshes.get(diorama.world) || [];
for (const mesh of meshes) {