Files
VoxelForge/Standalone/Source/VoxelForge/Private/VoxelForgeModule.cpp
T
Fr0zkaandClaude Opus 5.5 05f62cff36 standalone: the owner's world outside Unreal -- bit-identical density, D3D11 fly-through viewer
Standalone/ (C++20, MSVC /O2 /arch:AVX2 /fp:precise, Build.ps1): copied density pipeline, op stack,
cave morphology, passages, strate manager/composer, noise, DetSinCos, mesher, clipmap selection,
with a UE compatibility layer (Compat/). Owner data exported once to Standalone/data/owner_world.json
by a default-off explore-commandlet exporter (the only plugin-source change). 25 cm voxels.
Parity: seed 0, 3,436 samples (strate edges, negative/far coords, rooms, tunnels, passages,
landings): bit-identical. Viewer: full 7-level clipmap, per-level toggles 1-7, T = round winding
tunnels (standalone option), N/P seed, F wireframe.
Timing NOT yet a baseline: 515 s for 12,054 tiles (L0 70 s, L6 296 s); the compat TMap/TSet are
vector-backed with linear lookup, which the plugin's caches do not expect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
2026-10-02 12:14:04 +02:00

55 lines
1.8 KiB
C++

// VoxelForgeModule.cpp
// Module implementation - boilerplate
#include "VoxelForgeModule.h"
#include "VoxelStackSampler.h"
#include "VoxelGenerator.h"
#include "VoxelMarchingCubesMesher.h"
#include "Misc/CommandLine.h"
#include "Misc/Parse.h"
#if PLATFORM_WINDOWS
#include <math.h>
#endif
// This macro registers our module with Unreal
// "VoxelForge" must match the module name in VoxelForge.Build.cs and .uplugin
IMPLEMENT_MODULE(FVoxelForgeModule, VoxelForge)
void FVoxelForgeModule::StartupModule()
{
// Called when plugin loads
// Keep this diagnostic before any plugin-owned generation can begin. The UCRT may select
// its FMA3 math implementations during process startup; this switch lets the canonical export
// compare that path with the non-FMA3 implementation on the same machine.
#if PLATFORM_WINDOWS
const int32 Fma3Before = _get_FMA3_enable();
int32 RequestedFma3 = 0;
const bool bHasFma3Override = FParse::Value(
FCommandLine::Get(), TEXT("voxel.CrtFma3="), RequestedFma3);
if (bHasFma3Override)
{
_set_FMA3_enable(RequestedFma3 != 0 ? 1 : 0);
}
const int32 Fma3After = _get_FMA3_enable();
UE_LOG(LogTemp, Log,
TEXT("VoxelForge CRT FMA3 diagnostic: before=%d override=%s requested=%d after=%d"),
Fma3Before,
bHasFma3Override ? TEXT("yes") : TEXT("no"),
RequestedFma3,
Fma3After);
#endif
// Resolve the command line once while the module is starting, before any generation task is
// submitted, instead of lazily from worker-side density/mesher calls.
VoxelGenLOD::InitializeConsoleSwitches();
UVoxelMarchingCubesMesher::InitializeConsoleSwitches();
UE_LOG(LogTemp, Log, TEXT("VoxelForge module started!"));
}
void FVoxelForgeModule::ShutdownModule()
{
// Called when plugin unloads
FVoxelStackSampler::Get().Shutdown();
UE_LOG(LogTemp, Log, TEXT("VoxelForge module shutdown."));
}