Separates the 3D-to-2D render pipeline from the game client into its own minimal Godot project. No autoloads, no plugins, no game code — just the render scene, models, textures, and export script. Eliminates SimBridge parse errors and gdUnit4 scanning during renders. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1.5 KiB
Bash
Executable File
48 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Render a 3D model to 2D sprites at 3 resolutions from 4 cardinal directions.
|
|
# Usage: render.sh <model_name> [godot_path]
|
|
# Example: render.sh wall_structural
|
|
set -euo pipefail
|
|
|
|
MODEL_NAME="${1:?Usage: render.sh <model_name> [godot_path]}"
|
|
GODOT="${2:-$HOME/bin/godot}"
|
|
REPO_ROOT="$(cd "$(dirname "$0")" && git rev-parse --show-toplevel)"
|
|
PROJECT="$REPO_ROOT/renderer"
|
|
SCENE="res://render_scene.tscn"
|
|
OUTPUT="$PROJECT/output"
|
|
|
|
# Verify model exists
|
|
MODEL_FILE="$PROJECT/models/${MODEL_NAME}.tscn"
|
|
if [ ! -f "$MODEL_FILE" ]; then
|
|
echo "ERROR: Model not found: $MODEL_FILE"
|
|
echo "Available models:"
|
|
ls "$PROJECT/models/"*.tscn 2>/dev/null | xargs -I{} basename {} .tscn
|
|
exit 1
|
|
fi
|
|
|
|
echo "Rendering: $MODEL_NAME"
|
|
echo "Godot: $GODOT"
|
|
echo "Project: $PROJECT"
|
|
|
|
# Ensure resources are imported (headless, no display needed)
|
|
echo "Importing resources..."
|
|
"$GODOT" --path "$PROJECT" --headless --import 2>&1 || echo "Warning: import step had errors (may be non-fatal)"
|
|
|
|
# Run Godot with the render scene, passing model name as user arg
|
|
"$GODOT" --path "$PROJECT" "$SCENE" -- "$MODEL_NAME" 2>&1
|
|
|
|
# Check output
|
|
EXPECTED_FILES=0
|
|
for dir in north east south west; do
|
|
for res in 1024 256 64; do
|
|
f="$OUTPUT/${MODEL_NAME}_${dir}_${res}.png"
|
|
if [ -f "$f" ]; then
|
|
EXPECTED_FILES=$((EXPECTED_FILES + 1))
|
|
fi
|
|
done
|
|
done
|
|
|
|
echo ""
|
|
echo "Generated $EXPECTED_FILES/12 files in $OUTPUT/"
|
|
ls -la "$OUTPUT/${MODEL_NAME}"_*.png 2>/dev/null || echo "No output files found."
|