Files
lilygo-t-deck/floorplan3d-demo/Makefile
T
Dejvino 0f22c6afca Add raylib-esp32 lib and FloorPlan3D demo (3D floor plan via rlsw)
Vendor raylib-esp32 v1.0.3 (63db94b) under lib/ — raylib 6.x core with
the rlsw software renderer plus the ESP32-S3 port layer (SPI display
drivers, async double-buffered flush). raylib/examples, projects, tools
and logo are trimmed (~80 MB of content nothing here compiles); see
lib/raylib-esp32/VENDOR.md for provenance.

New floorplan3d-demo (emulator-template base) renders the NetDeck demo
map (nd_demomap.h) as a 3D floor plan — bulkhead walls, blast door,
cover crates, airlock pad, terminal — through the real on-device 3D
stack on the desktop:

- rcore_emu.c: desktop PLATFORM_CUSTOM layer mirroring rcore_esp32.c,
  flushing the RGB565 sw-renderer buffer into emuGfx::fb instead of SPI
- raylib_emu_config.h: same module/limit defines as the device build
- HUD via 3x5 bitmap font into fb: rlsw's 2D textured-quad path
  (DrawText/DrawRectangle) misplaces/flips quads and samples wrong
  atlas texels in this build; the 3D path is pixel-accurate

Verified: dual build (make netdeck) green, demo smoke test clean at
~59 FPS, 600-frame stability run OK.
2026-11-16 21:46:31 +01:00

75 lines
2.4 KiB
Makefile

# Makefile for the FloorPlan3D demo — emulator-template base + raylib-esp32.
#
# Builds raylib 6.x (from lib/raylib-esp32's raylib submodule) with the rlsw
# SOFTWARE renderer behind a custom platform layer (rcore_emu.c) that blits
# the RGB565 framebuffer into the SDL host — the same library, renderer and
# SwapScreenBuffer flow that runs on the T-Deck's ESP32-S3.
#
# Build & run: make run (from this directory)
# Smoke test: make smoke
APP ?= FloorPlan
APP_DIR := examples/$(APP)
# raylib-esp32 sources (raylib core + software renderer)
RAYLIB := ../lib/raylib-esp32/raylib
# SDL3 flags via pkg-config
SDLFLAGS := $(shell pkg-config --cflags sdl3 sdl3-ttf)
LIBS := $(shell pkg-config --libs sdl3 sdl3-ttf)
CXX ?= g++
CC ?= cc
CXXFLAGS ?= -std=gnu++17 -O2 -Wall -Wextra
CFLAGS := -std=gnu11 -O2 \
-DGRAPHICS_API_OPENGL_SOFTWARE -DPLATFORM_CUSTOM -DEXTERNAL_CONFIG_FLAGS \
-include raylib_emu_config.h \
-Wno-incompatible-pointer-types -Wno-uninitialized -Wno-nonnull \
-Wno-return-type -Wno-unused-variable -Wno-unused-function \
-Wno-unused-label -Wno-stringop-truncation
# Include current dir for shim.h/rcore_emu.c, the sketch dir, raylib, NetDeck
INC := -I . -I $(APP_DIR) -I $(RAYLIB)/src -I ../src/netdeck
# Preprocessor definitions: app name, .ino filename, and the sketch source
# path. main.cpp does `#include APP_SRC`, so switching APP is enough.
DEFS += -DAPP_INO='"$(APP).ino"' -DAPP_NAME='"$(APP)"' \
-DAPP_SRC='"$(APP_DIR)/$(APP).cpp"'
SHIMS := $(wildcard *.h)
# Main entry point for this template (standalone, no HW deps)
EMU_MAIN := src/main.cpp
EMU := $(APP)-emu
# --- raylib core translation units (same set as raylib-esp32 builds) -------
RL_SRCS := rcore.c rshapes.c rtextures.c rtext.c rmodels.c
RL_SRCDIR := $(RAYLIB)/src
RLOBJS := $(addprefix build/,$(RL_SRCS:.c=.o)) build/rcore_emu.o
all: $(EMU)
build/%.o: $(RL_SRCDIR)/%.c
@mkdir -p build
$(CC) $(CFLAGS) $(INC) -c $< -o $@
build/rcore_emu.o: rcore_emu.c $(SHIMS)
@mkdir -p build
$(CC) $(CFLAGS) $(INC) -c $< -o $@
# Compile + link: main.cpp includes the sketch .cpp, forming one TU.
$(EMU): $(EMU_MAIN) $(SHIMS) $(APP_DIR)/$(APP).cpp $(RLOBJS)
$(CXX) $(CXXFLAGS) $(SDLFLAGS) $(INC) $(DEFS) $(EMU_MAIN) $(RLOBJS) -o $@ $(LIBS)
run: $(EMU)
./$(EMU)
smoke: $(EMU)
./$(EMU) --frames 240 --dump smoke_frame.bmp
clean:
rm -rf build $(EMU)
.PHONY: all run smoke clean