Files
OpenRA3/shaders/compile.sh
T
EnderTheCoder 70f35d8382 render map objects: decode compiled W3DMesh art, skin and draw over terrain
Read the buildings and props a map places from its compiled art (the
uncompressed worldbuilder stream + embedded DDS textures):

- ra3.models: BAB asset-stream parser (lazy slices), W3DMesh + D3DHierarchy
  decode, DDS (DXT1/3/5 + uncompressed) decode, per-mesh bone remap and
  bind-pose single-joint skinning, flattened to one world-space triangle soup.
- ra3.map: parse the ObjectsList chunk into (type, x, y, z, angle).
- ra3.terrain: render3d rasterises the scene over the raymarched terrain with
  a z-buffer; gpu_terrain carries the scene for the GPU backends.
- ra3.vulkan: second pipeline + depth attachment, terrain.frag writes
  gl_FragDepth, and a small depth bias keeps ground decals from z-fighting.
- objects.fx shaders (compiled to SPIR-V), embedded like scene/terrain.

Only opaque parts are drawn: FX-light billboards (DefaultW3D.fx / BasicW3D.fx)
and damage-fill shells (BuildingsGenericDamageFill.fx) are skipped, since the
latter paint the wrecked interior (e.g. orange CBBuilding_Wood) over the shell.

Ground-decal meshes with no diffuse role and the Road templates themselves are
still not drawn.
2026-09-29 18:08:11 +08:00

34 lines
1007 B
Bash

#!/usr/bin/env sh
# Regenerate the committed SPIR-V blobs under shaders/generated/.
#
# The build embeds the .spv files directly (see CMakeLists.txt), so no shader
# compiler is needed to build OpenRA3. Run this only after editing a .vert/.frag.
#
# Needs one of: glslc (shaderc) or glslangValidator (glslang-tools). On a host
# without either, use a throwaway container:
# docker run --rm -v "$PWD/shaders:/s" ubuntu:26.04 bash -c \
# "apt-get update -qq && apt-get install -y -qq glslang-tools && \
# cd /s && sh ./compile.sh"
set -eu
DIR="$(cd "$(dirname "$0")" && pwd)"
OUT="$DIR/generated"
mkdir -p "$OUT"
compile() {
src="$1"
dst="$2"
if command -v glslc >/dev/null 2>&1; then
glslc "$src" -o "$dst"
else
glslangValidator -V "$src" -o "$dst"
fi
}
for name in scene terrain object; do
compile "$DIR/$name.vert" "$OUT/$name.vert.spv"
compile "$DIR/$name.frag" "$OUT/$name.frag.spv"
done
echo "wrote $OUT/{scene,terrain,object}.{vert,frag}.spv"