MeshBaker
Public Member Functions | Public Attributes | List of all members
DigitalOpus.MB.Lod.LODCheckScheduler Class Reference

The purpose of this class is to efficiently schedule when LODs check if the LOD needs to change. More...

Public Member Functions

int GetNextFrameCheckOffset ()
 
void Init (MB2_LODManager m)
 
int GetNumFramesBetweenChecks (LODCluster cell)
 
void CheckIfLODsNeedToChange ()
 
void ForceCheckIfLODsNeedToChange ()
 

Public Attributes

bool FORCE_CHECK_EVERY_FRAME = false
 

Detailed Description

The purpose of this class is to efficiently schedule when LODs check if the LOD needs to change.

All LODs in a cluster should be checked at the same time. This will result in one bake that changes a lot of LODs rather than many bakes that change a few LODs. Also distant clusters should be checked less frequently than close clusters.

This class also triggers the checking on the assigned schedules.

HOW IT WORKS each cluster has a variables numFramesBetweenChecks and numFramesBetweenChecksOffset that determine when it is checked to see if its LODs need to change. These variables are assigned in such a way to distribute baking evenly across frames.

GridClusters close to the camera are assigned a low value for numFramesBetweenChecks. GridClusters far from the camera are assigned a high value. SimpleClusters are all have the same "numFramesBetweenChecks".

Since the camera(s) may be moving then the cluster shedules will need to be updated periodically. This is done by recording the camera position(s) of the last schedule update. When the camera has moved a certain distance from its last update position then the schedules are re-calculated.

The LOD_Manager has one instance of the LODCheckScheduler. In LOD_Manager.Update, the LOD_Manager calls

 checkScheduler.CheckIfLODsNeedToChange();

 CheckIfLODsNeedToChange:
     Updates the cluster schedules if the camera has moved.
     Checks each cluster to see if it needs to be checked this frame.

Member Function Documentation

§ CheckIfLODsNeedToChange()

void DigitalOpus.MB.Lod.LODCheckScheduler.CheckIfLODsNeedToChange ( )

§ ForceCheckIfLODsNeedToChange()

void DigitalOpus.MB.Lod.LODCheckScheduler.ForceCheckIfLODsNeedToChange ( )

§ GetNextFrameCheckOffset()

int DigitalOpus.MB.Lod.LODCheckScheduler.GetNextFrameCheckOffset ( )

§ GetNumFramesBetweenChecks()

int DigitalOpus.MB.Lod.LODCheckScheduler.GetNumFramesBetweenChecks ( LODCluster  cell)

§ Init()

void DigitalOpus.MB.Lod.LODCheckScheduler.Init ( MB2_LODManager  m)

Member Data Documentation

§ FORCE_CHECK_EVERY_FRAME

bool DigitalOpus.MB.Lod.LODCheckScheduler.FORCE_CHECK_EVERY_FRAME = false

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