|
Nebula
|
#include <terraincontext.h>
Inherits Graphics::GraphicsContext.
Classes | |
| struct | TerrainLoadInfo |
| struct | TerrainRuntimeInfo |
| struct | TerrainInstanceInfo |
Public Member Functions | |
| TerrainContext () | |
| constructor | |
| virtual | ~TerrainContext () |
| destructor | |
| Public Member Functions inherited from Graphics::GraphicsContext | |
| GraphicsContext () | |
| constructor | |
| virtual | ~GraphicsContext () |
| destructor | |
Static Public Member Functions | |
| static void | Create () |
| create terrain context | |
| static void | Discard () |
| destroy terrain context | |
| static void | SetupTerrain (const Graphics::GraphicsEntityId entity, const TerrainCreateInfo &createInfo) |
| setup new terrain surface from texture and settings | |
| static TerrainBiomeId | CreateBiome (const Graphics::GraphicsEntityId entity, const BiomeSettings &settings) |
| setup a new biome | |
| static void | DestroyBiome (const Graphics::GraphicsEntityId entity, TerrainBiomeId id) |
| Destroy biome. | |
| static void | SetBiomeSlopeThreshold (const Graphics::GraphicsEntityId entity, TerrainBiomeId id, float threshold) |
| set biome slope threshold | |
| static void | SetBiomeHeightThreshold (const Graphics::GraphicsEntityId entity, TerrainBiomeId id, float threshold) |
| set biome height threshold | |
| static void | SetSun (const Graphics::GraphicsEntityId sun) |
| Set the sun entity for terrain shadows. | |
| static void | CullPatches (const Graphics::ViewId view, const Graphics::FrameContext &ctx) |
| cull terrain patches | |
| static void | UpdateLOD (const Graphics::FrameContext &ctx) |
| update sparse texture mips | |
| static void | RenderUI (const Graphics::FrameContext &ctx) |
| render IMGUI | |
| static void | ClearCache () |
| clear the tile cache (use when we need to force update the terrain) | |
| static CoreGraphics::TextureId | GetHeightMap (const Graphics::GraphicsEntityId entity) |
| Get height map. | |
| static void | GetHeightBounds (const Graphics::GraphicsEntityId entity, float &min, float &max) |
| Get the min-max height values. | |
| static void | GetWorldSize (const Graphics::GraphicsEntityId entity, float &sizeX, float &sizeZ) |
| Get the world size. | |
| static void | SetVisible (bool visible) |
| static bool | GetVisible () |
| static void | OnRenderDebug (uint32_t flags) |
| debug rendering | |
Private Types | |
| enum | { Terrain_LoadInfo , Terrain_RuntimeInfo , Terrain_InstanceInfo } |
| enum | { TerrainBiome_Settings , TerrainBiome_MaskTexture } |
| typedef Ids::IdAllocator< TerrainLoadInfo, TerrainRuntimeInfo, TerrainInstanceInfo > | TerrainAllocator |
| typedef Ids::IdAllocator< BiomeSettings > | TerrainBiomeAllocator |
Private Member Functions | |
| __DeclareContext () | |
Static Private Member Functions | |
| static void | DestroyTerrain (Ids::Id32 id) |
| release what SetupTerrain and CreateBiome made for a terrain, the slot stays allocated | |
| static Graphics::ContextEntityId | Alloc () |
| allocate a new slice for this context | |
| static void | Dealloc (Graphics::ContextEntityId id) |
| deallocate a slice | |
Static Private Attributes | |
| static TerrainAllocator | terrainAllocator |
| static TerrainBiomeAllocator | terrainBiomeAllocator |
Additional Inherited Members | |
| Static Protected Member Functions inherited from Graphics::GraphicsContext | |
| static void | InternalRegisterEntity (const Graphics::GraphicsEntityId id, Graphics::GraphicsContextState &&state) |
| static void | InternalDeregisterEntity (const Graphics::GraphicsEntityId id, Graphics::GraphicsContextState &&state) |
| template<class ID_ALLOCATOR> | |
| static void | InternalDefragment (ID_ALLOCATOR &allocator, Graphics::GraphicsContextState &&state) |
|
private |
|
private |
| Terrain::TerrainContext::TerrainContext | ( | ) |
constructor
|
virtual |
destructor
|
private |
|
staticprivate |
allocate a new slice for this context
|
static |
clear the tile cache (use when we need to force update the terrain)
|
static |
create terrain context
Adaptive terrain virtual texturing setup
Passes:
Why don't we just render the terrain directly and sample our input textures? Well, it would require a lot of work for the terrain splatting shader, especially if we want to have features like roads and procedural decals. This is called an optimization. LOL.
|
static |
setup a new biome
|
static |
cull terrain patches
|
staticprivate |
deallocate a slice
|
static |
Destroy biome.
|
staticprivate |
release what SetupTerrain and CreateBiome made for a terrain, the slot stays allocated
The jobs of the frame that still run are waited for first, they read the instance.
GPU objects are destroyed delayed, so the frames in flight still have them.
The shadow map is kept for the next terrain, the light context holds on to it. The biome masks loaded from files stay with the resource server, only their handles are known here.
|
static |
destroy terrain context
|
static |
Get the min-max height values.
|
static |
Get height map.
|
static |
|
static |
Get the world size.
|
static |
debug rendering
|
static |
render IMGUI
|
static |
set biome height threshold
|
static |
set biome slope threshold
|
static |
Set the sun entity for terrain shadows.
|
static |
setup new terrain surface from texture and settings
Setup with raytracing
|
static |
|
static |
update sparse texture mips
|
staticprivate |
|
staticprivate |