BlueGit

timfa raytracer

Files

raytracer / src / build.sh

build.sh

build.sh 1.2 KiB Download Raw
1#!/usr/bin/env bash
2set -euo pipefail
3ROOT="$(cd "$(dirname "$0")/.." && pwd)"
4BUILD_FILE="$ROOT/build/game.js"
5EDITOR_FILE="$ROOT/build/editor.js"
6SRC_DIR="$ROOT/src"
7
8printf "Build started, output file: %s\n" "$BUILD_FILE"
9rm -f "$BUILD_FILE"
10
11FILES=(
12 "$SRC_DIR/textureColumn.js"
13 "$SRC_DIR/ppda/depthDecode.js"
14 "$SRC_DIR/ppda/viewFrame.js"
15 "$SRC_DIR/ppda/compositor.js"
16 "$SRC_DIR/ppda/loadPpda.js"
17 "$SRC_DIR/ppda/atlasRuntime.js"
18 "$SRC_DIR/levelFormat.js"
19 "$SRC_DIR/camera.js"
20 "$SRC_DIR/floorCast.js"
21 "$SRC_DIR/floorGpu.js"
22 "$SRC_DIR/lighting.js"
23 "$SRC_DIR/levels.js"
24 "$SRC_DIR/tiles.js"
25 "$SRC_DIR/world.js"
26 "$SRC_DIR/player.js"
27 "$SRC_DIR/npc.js"
28 "$SRC_DIR/raycastScene.js"
29 "$SRC_DIR/main.js"
30)
31
32for file in "${FILES[@]}"
33do
34 if [[ ! -f "$file" ]]
35 then
36 printf "Missing source file: %s\n" "$file" >&2
37 exit 1
38 fi
39 printf "\n/*\n * Start File:\n * %s\n */ \n" "$file" >> "$BUILD_FILE"
40 printf "Building %s\n" "$file"
41 cat "$file" >> "$BUILD_FILE"
42 printf "\n/*\n * End File:\n * %s\n */ \n" "$file" >> "$BUILD_FILE"
43done
44
45printf "Building editor.js\n"
46rm -f "$EDITOR_FILE"
47for file in "$SRC_DIR/levelFormat.js" "$SRC_DIR/editorApp.js"
48do
49 printf "\n/* %s */\n" "$file" >> "$EDITOR_FILE"
50 cat "$file" >> "$EDITOR_FILE"
51done
52
53printf "DONE\n"