Service Architecture
EntropyPortal is built on a Service-Oriented Architecture (SOA). Each major system is encapsulated as an EntropyService, managed by the central application. This promotes modularity, testability, and clear lifecycle management.
Core Services
Section titled “Core Services”RenderService
Section titled “RenderService”The heart of the graphics engine.
- Responsibilities:
- Owns the
GpuRenderDeviceand swapchain. - Manages the rendering loop (
beginFrame,renderFrame,endFrame). - Orchestrates the
RenderGraphandWorkGraph. - Handles per-object resource management (buffers).
- Owns the
- Dependencies:
SceneService(for data),MesherService(for assets),MaterialService.
SceneService
Section titled “SceneService”The bridge between the network and the ECS.
- Responsibilities:
- Maintains the local Flecs world.
- Receives snapshots/deltas from the
NetworkSession. - Manages entity lifecycle (creation, destruction).
- Provides spatial queries via
VisibilityService.
- Integration: It exposes the
RenderWorld(a double-buffered extraction of scene state) for the renderer to consume safely.
Feature Services
Section titled “Feature Services”VisibilityService
Section titled “VisibilityService”Handles spatial indexing and culling.
- Mechanism: Uses a loose octree (or similar spatial structure) to track dynamic and static objects.
- Culling:
- CPU Frustum Culling: Extracting potentially visible sets for the main camera.
- GPU Culling: Uploading bounds buffer for compute-shader based culling.
- PVS: Optional Potential Visibility Set checks.
MaterialService
Section titled “MaterialService”Manages material assets and shader variants.
- Responsibilities:
- Creates and caches
Materialinstances. - Compiles shader variants on demand via
ShaderCompilerService. - Manages the
ShaderMaterialRegistryfor batched rendering.
- Creates and caches
ProbeVolumeService
Section titled “ProbeVolumeService”Manages Global Illumination.
- Responsibilities:
- Captures and integrates Spherical Gaussian (SG) light probes.
- Manages the 3D probe grid structure on the GPU.
- Handles streaming and update scheduling for probes.
VirtualShadowMapService
Section titled “VirtualShadowMapService”Manages high-fidelity shadows.
- Responsibilities:
- Allocates and updates the virtual shadow map atlas.
- Manages page tables for shadow memory.
- Handles shadow caster culling and rendering.
Service Dependency Graph
Section titled “Service Dependency Graph”graph TD
App[Application] --> Render[RenderService]
App --> Scene[SceneService]
Render --> Device[GpuRenderDevice]
Render --> Mat[MaterialService]
Render --> Mesh[MeshService]
Render --> VSM[VirtualShadowMapService]
Render --> Probes[ProbeVolumeService]
Scene --> Visibility[VisibilityService]
Scene --> Input[InputService]
Render -.->|Reads| Scene
Mat -.->|Uses| Device