Nebula
Loading...
Searching...
No Matches
Visibility Namespace Reference

Detailed Description

Implements a resource loader for models.

The visibility container stores the visibility results for entities registered with the VisibilityContext.

A visibility system describes some virtual representation of the scene, wherein objects are searchable for visibility.

Quadtree system.

Portal system.

Octree system.

Brute force system.

Box system.

This is coarse grained visibility, and does not account for any pixel-perfect techniques like occlusion culling.

Some systems are procedural (Octree and Quadtree) while other systems require authoring.

Different systems have different strenghts, as described here:

Box system: Fully authored visibility system where objects are grouped into boxes, so if the box is visible, all objects within are too. Useful for big objects, or areas, but for many small objects this might result in drawing too much not in the screen.

Octree system: 3D subdivision of the scene into incrementally smaller regions. Useful for large game worlds, where movement is small or none, such as terrain or static objects. Octrees also support difference in height, meaning they are more suitable than Quadtrees for shooters or platformers.

Portal system: Produces frustums for 'portals', which in a linked-list manner resolves visibility only for things seen through said portals. Useful for indoor environments where there are many occluders.

Quadtree system: Like Octree but 2D, meaning there is only a 2D grid. Useful for big worlds where there is no importance of visibility along one axis (isomorphic RPG, 2D scroller)

Bruteforce system: Doesn't do anything but view frustum culling on everything in the scene.

The idea is to map the list of graphics entities registered with the GraphicsServer against a list of visibility results.

TODO: But how does this map do any kind of sorting? If models are grouped by <shader, material, mesh> for example, how does an ordinary array account for that?

SOLUTION: The array contains results for ALL entities, independent of observer mask, and the visibility status is in the same order as the <shader, material, mesh> grouping would be if it was deflated. The <shader, material, model> list is always static during the frame, since it contains ALL shader, material and mesh groupings. The difference with the old system is that now, the only thing that changes is the flipping of a boolean value, instead of having to reconstruct the triple tuple list every frame. It means however, that everytime a graphics entity is attached, the VisibilityContainer MUST be notified so that it may change the size of the visibility array.

Classes

class  BoxSystem
 
struct  BoxSystemLoadInfo
 
class  BruteforceSystem
 
struct  BruteforceSystemLoadInfo
 
class  ObservableContext
 
class  ObserverContext
 
class  OctreeSystem
 
struct  OctreeSystemLoadInfo
 
class  PortalSystem
 
struct  PortalSystemLoadInfo
 
class  QuadtreeSystem
 
struct  QuadtreeSystemLoadInfo
 
class  VisibilityContainer
 
class  VisibilitySystem
 

Enumerations

enum  ObserverMask : uint8_t { Graphics = (1 << 0) , Observers = (1 << 1) , All = (1 << 2) , NumObserverMasks = 2 }
 
enum  ObserverType : uint8_t {
  Perspective = 0 , Orthographic = 1 , BoundingBox = 2 , Omnipercipient = 3 ,
  NumObserverTypes = 4
}
 
enum  VisibilityEntityType : uint8_t {
  Model , Particle , Camera , Light ,
  LightProbe
}
 
enum  {
  Observer_Matrix , Observer_IsOrtho , Observer_EntityId , Observer_EntityType ,
  Observer_ResultArray , Observer_Dependency , Observer_DependencyMode , Observer_DrawList ,
  Observer_DrawListAllocator
}
 
enum  {
  ObservableAtom_NodeInstanceRange , ObservableAtom_GraphicsEntityId , ObservableAtom_Transform , ObservableAtom_Instance ,
  ObservableAtom_VisibilityEntityType , ObservableAtom_Active
}
 
enum  { Observable_EntityId , Observable_NumNodes }
 
enum  DependencyMode { DependencyMode_Total , DependencyMode_Masked }
 

Functions

void QuadtreeInjectFunction (const Jobs::JobFuncContext &ctx)
 
void QuadtreeResolveFunction (const Jobs::JobFuncContext &ctx)
 
 __ImplementEnumBitOperators (ObserverMask)
 
 __ImplementEnumBitOperators (ObserverType)
 
 __ImplementClass (Visibility::VisibilityContainer, 'VICO', Core::RefCounted)
 
 __ImplementContext (ObserverContext, ObserverContext::observerAllocator)
 
 __ImplementContext (ObservableContext, ObservableContext::observableAllocator)
 
void VisibilityDependencyJob (const Jobs::JobFuncContext &ctx)
 
void VisibilityDrawListUpdateJob (const Jobs::JobFuncContext &ctx)
 

Variables

static Util::Queue< Threading::Event * > waitEvents
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Observer_Matrix 
Observer_IsOrtho 
Observer_EntityId 
Observer_EntityType 
Observer_ResultArray 
Observer_Dependency 
Observer_DependencyMode 
Observer_DrawList 
Observer_DrawListAllocator 

◆ anonymous enum

anonymous enum
Enumerator
ObservableAtom_NodeInstanceRange 
ObservableAtom_GraphicsEntityId 
ObservableAtom_Transform 
ObservableAtom_Instance 
ObservableAtom_VisibilityEntityType 
ObservableAtom_Active 

◆ anonymous enum

anonymous enum
Enumerator
Observable_EntityId 
Observable_NumNodes 

◆ DependencyMode

Enumerator
DependencyMode_Total 
DependencyMode_Masked 

◆ ObserverMask

enum Visibility::ObserverMask : uint8_t
Enumerator
Graphics 
Observers 
All 
NumObserverMasks 

◆ ObserverType

enum Visibility::ObserverType : uint8_t
Enumerator
Perspective 
Orthographic 
BoundingBox 
Omnipercipient 
NumObserverTypes 

◆ VisibilityEntityType

Enumerator
Model 
Particle 
Camera 
Light 
LightProbe 

Function Documentation

◆ __ImplementClass()

Visibility::__ImplementClass ( Visibility::VisibilityContainer ,
'VICO' ,
Core::RefCounted  )

◆ __ImplementContext() [1/2]

Visibility::__ImplementContext ( ObservableContext ,
ObservableContext::observableAllocator  )

◆ __ImplementContext() [2/2]

Visibility::__ImplementContext ( ObserverContext ,
ObserverContext::observerAllocator  )

◆ __ImplementEnumBitOperators() [1/2]

Visibility::__ImplementEnumBitOperators ( ObserverMask )

◆ __ImplementEnumBitOperators() [2/2]

Visibility::__ImplementEnumBitOperators ( ObserverType )

◆ QuadtreeInjectFunction()

void Visibility::QuadtreeInjectFunction ( const Jobs::JobFuncContext & ctx)

◆ QuadtreeResolveFunction()

void Visibility::QuadtreeResolveFunction ( const Jobs::JobFuncContext & ctx)

◆ VisibilityDependencyJob()

void Visibility::VisibilityDependencyJob ( const Jobs::JobFuncContext & ctx)

◆ VisibilityDrawListUpdateJob()

void Visibility::VisibilityDrawListUpdateJob ( const Jobs::JobFuncContext & ctx)

Variable Documentation

◆ waitEvents

Util::Queue<Threading::Event*> Visibility::waitEvents
static