The HConstantFrameRate class provides support for maintaining a constant framerate when rendering. More...

#include <HConstantFrameRate.h>

Public Member Functions

void AdjustDefaultDetailLevelToModel ()
 
void AdjustLodOptions ()
 
bool GetActive ()
 
HActivityType GetActivityType ()
 
DetailChangeMode GetDetailDecMode ()
 
DetailChangeMode GetDetailIncMode ()
 
bool GetDetailIncreaseState ()
 
int GetDetailLevelNum ()
 
bool GetMode (HConstFRSimpType ***sd=0L, float *target_framerate=0L, int *length=0L)
 
int GetSimpLevel ()
 
HConstFRSimpTypeGetSimpType (ConstFRType stype)
 
float GetTargetFrameRate ()
 
int GetTotalDetailLevelNum ()
 
HBaseViewGetView ()
 
 HConstantFrameRate (HBaseView *view)
 
void IncreaseDetailTemp ()
 
void Init (float target_framerate=20.0, HConstFRSimpType **sd=0, int length=0, float deadzone=3.0)
 
void InitiateDelay ()
 
void MajorDetailDecrease ()
 
void MajorDetailIncrease ()
 
void ResetListPointers ()
 
void SetActivityType (HActivityType at)
 
void SetDeadZone (float deadzone)
 
void SetDetailDecMode (DetailChangeMode mode)
 
void SetDetailIncMode (DetailChangeMode mode)
 
void SetDetailIncOnIdleMode (DetailChangeMode mode)
 
void SetDetailLevel (int listpos, int simplevel)
 
void SetDisableIncreaseTemp (bool it)
 
void SetEmergencyDetailDecrease (bool detaildecrease)
 
void SetSimpLevel (int simplevel)
 
void SetTargetFrameRate (float framerate)
 
void SetWatchActivity (bool wa)
 
void Shutdown ()
 
void Start ()
 
void Stop ()
 
void UpdateLevel (int SimpLevel, int SimpListPos)
 
bool ViewpointHasChanged (bool update=true)
 
void Watch ()
 

Static Public Member Functions

static bool Tick (float request_time, float actual_time, void *user_data)
 

Protected Member Functions

void AdjustDetail (float FrameRate)
 
void AdjustListPointers (int &SimpLevel, int &SimpListPos)
 
void ChangeDetail (int change, int *SimpLevel=0, int *SimpListPos=0)
 
bool IsLowestDetail ()
 
void SetHoopsSimplificationOptions (int SimpLevel, int SimpListPos)
 
void StartTimer ()
 
void StopTimer ()
 

Protected Attributes

HActivityType m_ActivityType
 
bool m_bConstFRActive
 
bool m_bEmergencyDecrease
 
float m_DeadZone
 
DetailChangeMode m_DetailDecMode
 
DetailChangeMode m_DetailIncMode
 
DetailChangeMode m_DetailIncOnIdleMode
 
int m_FrameRateCounter
 
int m_lastupdown
 
HBaseViewm_pHView
 
bool m_pOwnsList
 
HConstFRSimpType ** m_pSimpList
 
int m_SimpLevel
 
DetailChangeMode m_SimplificationDecrease
 
DetailChangeMode m_SimplificationIncrease
 
DetailChangeMode m_SimplificationIncreaseOnIdle
 
int m_SimpListLength
 
int m_SimpListPos
 
float m_TargetFrameRate
 

Friends

class HConstFRSimpType
 
class HFrNoSimp
 

Detailed Description

The HConstantFrameRate class provides support for maintaining a constant framerate when rendering.

HConstantFrameRate stores and manages 'simplification-level' objects which are used as fallbacks during rendering, in order to maintain a constant framerate. It also includes logic to determine the current framerate and if fallback is necessary and how much.

Constructor & Destructor Documentation

◆ HConstantFrameRate()

HConstantFrameRate::HConstantFrameRate ( HBaseView view)

Constructs a new HConstantFrameRatge Object.

Parameters
viewPointer to HBaseView object

Member Function Documentation

◆ AdjustDefaultDetailLevelToModel()

void HConstantFrameRate::AdjustDefaultDetailLevelToModel ( )

This method adjusts the default detail level by calculating the complexity of the model of the associated view.

◆ AdjustDetail()

void HConstantFrameRate::AdjustDetail ( float  FrameRate)
protected

This method increases or lowers the simplification level as necessary in order to achieve the target framerate.

Parameters
FrameRateThe rendering time for the last frame in frames per second.

◆ AdjustListPointers()

void HConstantFrameRate::AdjustListPointers ( int &  SimpLevel,
int &  SimpListPos 
)
protected

This method adjusts simplification level and simplification list pointers to valid values inside the simplification ranges.

Parameters
SimpLevelPass by reference. This method returns with the simplification level adjusted to be within simplification range.
SimpListPosPass by reference. This method returns with the simplification list position adjusted to be within simplification range.

◆ AdjustLodOptions()

void HConstantFrameRate::AdjustLodOptions ( )

This method adjusts the LOD rendering settings. If there is a ConstFRLodClampType in the simplification list, this method sets the LOD clamp value to the simple level maximum. If there is a ConstFRLodThresholdType in the simplification list, then this method performs a calculation based on the simple level maximum to set the LOD threshold.

Returns
State of detail increase flag.

◆ GetActive()

bool HConstantFrameRate::GetActive ( )
inline
Returns
True if constant framerate watch is activated and false if otherwise.

◆ GetActivityType()

HActivityType HConstantFrameRate::GetActivityType ( )
inline
Returns
The state of the activity flag which can be NoActivity, MovementActivity, CuttingPlaneActivity or GeneralActivity. This flag affects the constant framerate logic.

◆ GetDetailDecMode()

DetailChangeMode HConstantFrameRate::GetDetailDecMode ( )
inline
Returns
The state of detail decrease mode which determines if the framerate logic should be allowed to try increase the simplification level if the actual framerate is less than the target framerate.

◆ GetDetailIncMode()

DetailChangeMode HConstantFrameRate::GetDetailIncMode ( )
inline
Returns
The current state of detail increase mode which determines if the framerate logic should be allowed to try a lower simplification level if the actual framerate exceeds the target framerate.

◆ GetMode()

bool HConstantFrameRate::GetMode ( HConstFRSimpType ***  sd = 0L,
float *  target_framerate = 0L,
int *  length = 0L 
)

This method lets you retrieve the simplification type list, its length and the target frame rate. Please do NOT use the pointers to the objects returned to change the their values. If you want to modify the target frame rate, use the SetTargetFrameRate() method. If you want to update the simplification type list, please use the Init() method.

Parameters
sdIf sd is not 0, the method returns a pointer to the simplification type list.
This is a read- only array. If you want to update the list, use the Init() method.
target_framerateIf target_framerate is not 0, the method returns the desired update rate for the scene, in frames per second.
lengthIf length is not 0, the method returns the length of the simplification array.
Returns
True if there is a simplification type list and false if none has been set up.

◆ GetSimpLevel()

int HConstantFrameRate::GetSimpLevel ( )
inline
Returns
Current simplification level.

◆ GetSimpType()

HConstFRSimpType* HConstantFrameRate::GetSimpType ( ConstFRType  stype)

This method returns a pointer to the object in the simplification list that correctsponds to given ConstFRType.

Parameters
stypeThe ConstFRType type you are looking for in the simplification list.
Returns
The HConstFRSimpType object in the simplification list whose type is the given stype.

◆ GetTargetFrameRate()

float HConstantFrameRate::GetTargetFrameRate ( )
inline
Returns
Target framerate which we want the scene to maintain.

◆ GetView()

HBaseView* HConstantFrameRate::GetView ( )
inline
Returns
A pointer to the HBaseView object.

◆ IncreaseDetailTemp()

void HConstantFrameRate::IncreaseDetailTemp ( )

Temporarily bumps up the detail level if e.g. no mouse movement has occured Also adjust the base detail level based on the draw time of the frames This function is usually called from a timer event in the main application.

◆ Init()

void HConstantFrameRate::Init ( float  target_framerate = 20.0,
HConstFRSimpType **  sd = 0,
int  length = 0,
float  deadzone = 3.0 
)

Initializes constant frame rate mode, sets the target framerate, and supplies a list of geometry simplification levels.
The levels are used by the internal framereate logic to degrade the visual quality of the geometry in the scene in order to maintain the target framerate. If no list of simplification levels is provided, a default list is used.

Parameters
target_framerateThe desired update rate for the scene, in frames per second.
sdA pointer to an array of simplification types. Passed by reference.
lengthThe length of the simplification list.
deadzoneAllowed variance from target framerate

◆ ResetListPointers()

void HConstantFrameRate::ResetListPointers ( )
inline

Resets the simplification list and level pionters.

◆ SetActivityType()

void HConstantFrameRate::SetActivityType ( HActivityType  at)
inline

This method sets the status of the activity flag. The information is used by this class to determine how to maintain the framerate. This method supersedes SetNoActivity().

Parameters
atPass the current activity type which can be NoActivity, MovementActivity, CuttingPlaneActivity or GeneralActivity.

◆ SetDeadZone()

void HConstantFrameRate::SetDeadZone ( float  deadzone)
inline

Sets the new dead zone around the target framerate. Framerate changes in that area will not result in detail level changes

Parameters
deadzonenew dead zone

◆ SetDetailDecMode()

void HConstantFrameRate::SetDetailDecMode ( DetailChangeMode  mode)
inline

Sets the state of the detail decrease mode which determines if the framerate logic should be allowed to try increase the simplification level if the actual framerate is less than the target framerate.

Parameters
modeNew Detail decrease mode

◆ SetDetailIncMode()

void HConstantFrameRate::SetDetailIncMode ( DetailChangeMode  mode)
inline

This method sets the state of detail increase mode which tells the framerate logic whether to try a lower simplification level when the actual framerate exceeds the target frame rate.

Parameters
modeNew Detail change mode

◆ SetDetailLevel()

void HConstantFrameRate::SetDetailLevel ( int  listpos,
int  simplevel 
)
inline

Sets the default detail level before the framerate logic is started.

Parameters
listpossimplification type
simplevelsimplification level for given type

◆ SetEmergencyDetailDecrease()

void HConstantFrameRate::SetEmergencyDetailDecrease ( bool  detaildecrease)
inline

Sets the emergency decrease feature which allows sharp drops in detail level if the framerate is very low.

Parameters
detaildecreaseTurn detaildecrease on/off

◆ SetHoopsSimplificationOptions()

void HConstantFrameRate::SetHoopsSimplificationOptions ( int  SimpLevel,
int  SimpListPos 
)
protected

Sets HOOPS rendering and driver options for the given simplification type and level.

Parameters
SimpLevelSimplification level inside the current simplification type
SimpListPosCurrent position in the Simplification list - determines current simplification type.

◆ SetSimpLevel()

void HConstantFrameRate::SetSimpLevel ( int  simplevel)
inline

Sets the current simplification level.

Parameters
simplevelsimplification level for the scene

◆ SetTargetFrameRate()

void HConstantFrameRate::SetTargetFrameRate ( float  framerate)
inline

Sets the new target framerate which we want the scene to maintain during rendering.

Parameters
framerateNew target framerate

◆ Shutdown()

void HConstantFrameRate::Shutdown ( )

This method clears the simplification types list.

◆ Start()

void HConstantFrameRate::Start ( )

If the simplification type list is set along with the deadzone and target framerate, this method activates the constant framerate functionality. It starts the timer. The watch function will also begin making adjustments to the scene according to the state variables that have been set. This function is normally called when an operator is started (e.g. mouse down event on rotate).

◆ StartTimer()

void HConstantFrameRate::StartTimer ( )
protected

This method creates a new detail increase timer and starts it so that the Tick() method will be called periodically.

◆ Stop()

void HConstantFrameRate::Stop ( )

Deactivates the constant frame rate functionality. This function is normally called if an operator is stopped (e.g. mouse up event on rotate).

◆ StopTimer()

void HConstantFrameRate::StopTimer ( )
protected

This method stops the detail increase timer. The Tick() method will no longer be called by the timer.

◆ Tick()

static bool HConstantFrameRate::Tick ( float  request_time,
float  actual_time,
void *  user_data 
)
static

Tick function called from timer manager.

Parameters
request_timeTimer Parameter
actual_timeTimer Parameter
user_dataUser Data
Returns
True if the event was processed.

◆ UpdateLevel()

void HConstantFrameRate::UpdateLevel ( int  SimpLevel,
int  SimpListPos 
)

This method calls update on the simplication type associated with SimpListPos with the given SimpLevel.

Parameters
SimpLevelSimplification Level
SimpListPosPosition in current Simplification Level

◆ ViewpointHasChanged()

bool HConstantFrameRate::ViewpointHasChanged ( bool  update = true)

Determines if the viewpoint has changed for the associated scene.

Parameters
updatePass true if you want the new viewpoint to be recorded if it has changed. Default is true.
Returns
True if the viewpoint has changed and false if otherwise.

◆ Watch()

void HConstantFrameRate::Watch ( )

This method checks the update time for every frame and calls AdjustDetail() with a frames per second value. This method updates the scene if the view position has changed since the last update OR different activity that is relevant for the framerate has occured.

Member Data Documentation

◆ m_ActivityType

HActivityType HConstantFrameRate::m_ActivityType
protected

Flag that indicates whether an event like a user interaction has occurred that would effect the framerate. If it false, then no event occurred.

◆ m_bConstFRActive

bool HConstantFrameRate::m_bConstFRActive
protected

This value indicates whether the constant frame rate mode is currently active.

◆ m_bEmergencyDecrease

bool HConstantFrameRate::m_bEmergencyDecrease
protected

Flag that indicates if detail level should be significantly reduced if framerate has fallen below a critical threshold.

◆ m_DeadZone

float HConstantFrameRate::m_DeadZone
protected

Tolerance around target framerate.

◆ m_DetailDecMode

DetailChangeMode HConstantFrameRate::m_DetailDecMode
protected

Determines if a detail decrease is allowed after the constant framerate logic has been activated.

◆ m_DetailIncMode

DetailChangeMode HConstantFrameRate::m_DetailIncMode
protected

Determines if a detail increase is allowed after the constant framerate logic has been activated.

◆ m_FrameRateCounter

int HConstantFrameRate::m_FrameRateCounter
protected

Counter for number of frames passed before framerate is calculated.

◆ m_pHView

HBaseView* HConstantFrameRate::m_pHView
protected

A pointer to the the associated view object.

◆ m_pSimpList

HConstFRSimpType** HConstantFrameRate::m_pSimpList
protected

List of object simplification types used by the constant frame rate logic to simplify the scene and increase rendering speed.
The list should be in order of increasing simplification.

◆ m_SimpLevel

int HConstantFrameRate::m_SimpLevel
protected

Current object simplification level used by the constant frame rate logic.

◆ m_SimplificationDecrease

DetailChangeMode HConstantFrameRate::m_SimplificationDecrease
protected

State variable that reflects if a detail decrease is still allowed.

◆ m_SimplificationIncrease

DetailChangeMode HConstantFrameRate::m_SimplificationIncrease
protected

State variable that reflects if a detail increase is still allowed.

◆ m_SimplificationIncreaseOnIdle

DetailChangeMode HConstantFrameRate::m_SimplificationIncreaseOnIdle
protected

State variable that reflects if a detail increase is still allowed.

◆ m_SimpListLength

int HConstantFrameRate::m_SimpListLength
protected

Length of the object simplification list used by the constant frame rate logic.

◆ m_SimpListPos

int HConstantFrameRate::m_SimpListPos
protected

Current object simplification type used by the constant frame rate logic.

◆ m_TargetFrameRate

float HConstantFrameRate::m_TargetFrameRate
protected

Target frame rate in frames per second. The system will try to achieve this frame rate if the constant frame rate mode has been activated.


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