From a109983c194c45ad85f0e481232bc605c7cfd85b Mon Sep 17 00:00:00 2001 From: skal Date: Fri, 13 Feb 2026 08:34:24 +0100 Subject: Remediation: Implement shared common/shaders/ directory Eliminates 36 duplicate shader files across workspaces. Structure: - common/shaders/{math,render,compute}/ - Shared utilities (20 files) - workspaces/*/shaders/ - Workspace-specific only Changes: - Created common/shaders/ with math, render, compute subdirectories - Moved 20 common shaders from workspaces to common/ - Removed duplicates from test workspace - Updated assets.txt: ../../common/shaders/ references - Enhanced asset_packer.cc: filesystem path normalization for ../ resolution Implementation: Option 1 from SHADER_REUSE_INVESTIGATION.md - Single source of truth for common code - Workspace references via relative paths - Path normalization in asset packer handoff(Claude): Common shader directory implemented --- common/shaders/render/lighting_utils.wgsl | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 common/shaders/render/lighting_utils.wgsl (limited to 'common/shaders/render/lighting_utils.wgsl') diff --git a/common/shaders/render/lighting_utils.wgsl b/common/shaders/render/lighting_utils.wgsl new file mode 100644 index 0000000..d2fd2e2 --- /dev/null +++ b/common/shaders/render/lighting_utils.wgsl @@ -0,0 +1,6 @@ +fn calculate_lighting(color: vec3, normal: vec3, pos: vec3, shadow: f32) -> vec3 { + let light_dir = normalize(vec3(1.0, 1.0, 1.0)); + let diffuse = max(dot(normal, light_dir), 0.0); + let lighting = diffuse * (0.1 + 0.9 * shadow) + 0.1; // Ambient + Shadowed Diffuse + return color * lighting; +} -- cgit v1.2.3