Nebula
Loading...
Searching...
No Matches
Terrain::TerrainContext Class Reference

#include <terraincontext.h>

Inherits Graphics::GraphicsContext.

Classes

struct  TerrainLoadInfo
 
struct  TerrainRuntimeInfo
 

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 (const TerrainSetupSettings &settings)
 create terrain context
 
static void Discard ()
 destroy terrain context
 
static void SetupTerrain (const Graphics::GraphicsEntityId entity, const Resources::ResourceName &heightMap, const Resources::ResourceName &decisionMap, bool enableRayTracing)
 setup new terrain surface from texture and settings
 
static TerrainBiomeId CreateBiome (const BiomeSettings &settings)
 setup a new biome
 
static void SetBiomeSlopeThreshold (TerrainBiomeId id, float threshold)
 set biome slope threshold
 
static void SetBiomeHeightThreshold (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 Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
 cull terrain patches
 
static void UpdateLOD (const Ptr< Graphics::View > &view, 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 void OnRenderDebug (uint32_t flags)
 debug rendering
 

Private Types

enum  { Terrain_LoadInfo , Terrain_RuntimeInfo }
 
enum  { TerrainBiome_Settings , TerrainBiome_Index , TerrainBiome_MaskTexture }
 
typedef Ids::IdAllocator< TerrainLoadInfo, TerrainRuntimeInfoTerrainAllocator
 
typedef Ids::IdAllocator< BiomeSettings, uint32_t > TerrainBiomeAllocator
 

Private Member Functions

 __DeclareContext ()
 

Static Private Member Functions

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)
 

Member Typedef Documentation

◆ TerrainAllocator

◆ TerrainBiomeAllocator

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
Terrain_LoadInfo 
Terrain_RuntimeInfo 

◆ anonymous enum

anonymous enum
private
Enumerator
TerrainBiome_Settings 
TerrainBiome_Index 
TerrainBiome_MaskTexture 

Constructor & Destructor Documentation

◆ TerrainContext()

Terrain::TerrainContext::TerrainContext ( )

constructor

◆ ~TerrainContext()

Terrain::TerrainContext::~TerrainContext ( )
virtual

destructor

Member Function Documentation

◆ __DeclareContext()

Terrain::TerrainContext::__DeclareContext ( )
private

◆ Alloc()

Graphics::ContextEntityId Terrain::TerrainContext::Alloc ( )
staticprivate

allocate a new slice for this context

◆ ClearCache()

void Terrain::TerrainContext::ClearCache ( )
static

clear the tile cache (use when we need to force update the terrain)

◆ Create()

void Terrain::TerrainContext::Create ( const TerrainSetupSettings & settings)
static

create terrain context

Adaptive terrain virtual texturing setup

Passes:

  1. Clear page update buffer.
  2. Rasterize geometry and update page buffer.
  3. Read back on CPU and generate terrain tile jobs
  4. Splat terrain tiles into to physical texture cache.
  5. Render full-screen pass to put terrain pixels on the screen.

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.

◆ CreateBiome()

TerrainBiomeId Terrain::TerrainContext::CreateBiome ( const BiomeSettings & settings)
static

setup a new biome

◆ CullPatches()

void Terrain::TerrainContext::CullPatches ( const Ptr< Graphics::View > & view,
const Graphics::FrameContext & ctx )
static

cull terrain patches

◆ Dealloc()

void Terrain::TerrainContext::Dealloc ( Graphics::ContextEntityId id)
staticprivate

deallocate a slice

◆ Discard()

void Terrain::TerrainContext::Discard ( )
static

destroy terrain context

◆ OnRenderDebug()

void Terrain::TerrainContext::OnRenderDebug ( uint32_t flags)
static

debug rendering

◆ RenderUI()

void Terrain::TerrainContext::RenderUI ( const Graphics::FrameContext & ctx)
static

render IMGUI

◆ SetBiomeHeightThreshold()

void Terrain::TerrainContext::SetBiomeHeightThreshold ( TerrainBiomeId id,
float threshold )
static

set biome height threshold

◆ SetBiomeSlopeThreshold()

void Terrain::TerrainContext::SetBiomeSlopeThreshold ( TerrainBiomeId id,
float threshold )
static

set biome slope threshold

◆ SetSun()

void Terrain::TerrainContext::SetSun ( const Graphics::GraphicsEntityId sun)
static

Set the sun entity for terrain shadows.

◆ SetupTerrain()

void Terrain::TerrainContext::SetupTerrain ( const Graphics::GraphicsEntityId entity,
const Resources::ResourceName & heightMap,
const Resources::ResourceName & decisionMap,
bool enableRayTracing )
static

setup new terrain surface from texture and settings

Setup with raytracing

◆ UpdateLOD()

void Terrain::TerrainContext::UpdateLOD ( const Ptr< Graphics::View > & view,
const Graphics::FrameContext & ctx )
static

update sparse texture mips

Member Data Documentation

◆ terrainAllocator

TerrainContext::TerrainAllocator Terrain::TerrainContext::terrainAllocator
staticprivate

◆ terrainBiomeAllocator

TerrainContext::TerrainBiomeAllocator Terrain::TerrainContext::terrainBiomeAllocator
staticprivate

The documentation for this class was generated from the following files: