Replaces the 2D-only demo pipeline with a 3D cell-based blobber generator. Per-cell face walls, per-material mesh emission, and a GDExtension binding that returns a Dictionary with ArrayMesh surfaces the demo consumes directly. - src/blobber/: cell3d_t data model, dungeon container, pipeline that wraps the 2D generator per level and materializes into cell3d - src/mesh/: face-quad emitter with per-material groups + .obj dump - src/genesis3d_main.c: new CLI driving the blobber + mesh - godot/: BrogueGen.generate_dungeon(seed, num_levels, depth) binding with dungeon_to_dict packing cells + mesh surfaces - demo/: demo_blobber.tscn + dungeon_builder.gd, func_godot addon for the .map export path, point/entity templates, TrenchBroom docs - Retired: old arcade/FPS demo scenes and their scripts, unused meshlib Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
69 lines
2.1 KiB
Python
69 lines
2.1 KiB
Python
#!/usr/bin/env python
|
|
"""
|
|
SConstruct for the brogue_gen GDExtension.
|
|
|
|
Build: cd godot && scons target=template_debug
|
|
(or target=template_release for optimized)
|
|
|
|
Output: ../demo/bin/libbrogue_gen.<platform>.<target>.<arch>.so
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
env = SConscript("godot-cpp/SConstruct")
|
|
|
|
# Where to find our C generator library headers.
|
|
env.Append(CPPPATH=["src/", "../src/"])
|
|
|
|
# Compile all of our C generator sources directly into the extension — the
|
|
# generator is a pure C99 library with no Godot deps. This avoids needing a
|
|
# separate libbroguegen.a.
|
|
c_sources = [
|
|
"../src/gen/rng.c",
|
|
"../src/gen/grid.c",
|
|
"../src/gen/events.c",
|
|
"../src/gen/room_types.c",
|
|
"../src/gen/accretion.c",
|
|
"../src/gen/dijkstra.c",
|
|
"../src/gen/loops.c",
|
|
"../src/gen/ca.c",
|
|
"../src/gen/lakes.c",
|
|
"../src/gen/walls.c",
|
|
"../src/gen/stairs.c",
|
|
"../src/gen/chokepoints.c",
|
|
"../src/gen/machines.c",
|
|
"../src/gen/blueprints_data.c",
|
|
"../src/blobber/dungeon.c",
|
|
"../src/blobber/pipeline.c",
|
|
"../src/mesh/face_mesh.c",
|
|
]
|
|
|
|
# Ensure C files compile with C99; don't inherit godot-cpp's C++ flags verbatim.
|
|
c_env = env.Clone()
|
|
c_env.Replace(CFLAGS=["-std=c99", "-Wall", "-Wpedantic", "-Werror=implicit",
|
|
"-O2", "-g", "-fPIC"])
|
|
c_objects = [c_env.SharedObject(target="build/" + os.path.basename(s).replace(".c", ""),
|
|
source=s) for s in c_sources]
|
|
|
|
cpp_sources = Glob("src/*.cpp")
|
|
|
|
library_name = "libbrogue_gen{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
|
|
|
|
# Godot plugin layout convention: addons/<plugin_name>/
|
|
# brogue_gen.gdextension — manifest, references the .so path relative to res://
|
|
# bin/<name>.so — binaries per platform/target
|
|
import os as _os
|
|
import shutil as _shutil
|
|
_ADDON_DIR = "../demo/addons/brogue_gen"
|
|
_os.makedirs(_ADDON_DIR + "/bin", exist_ok=True)
|
|
|
|
library = env.SharedLibrary(
|
|
_ADDON_DIR + "/bin/" + library_name,
|
|
source=cpp_sources + c_objects,
|
|
)
|
|
|
|
_shutil.copyfile("brogue_gen.gdextension",
|
|
_ADDON_DIR + "/brogue_gen.gdextension")
|
|
|
|
Default(library)
|