Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HConstantFrameRate Class Reference

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

#include <HConstantFrameRate.h>

List of all members.

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 ( HBaseView view)

Constructs a new HConstantFrameRatge Object.

Parameters:
viewPointer to HBaseView object

Member Function Documentation

void HConstantFrameRate::AdjustDefaultDetailLevelToModel ( )

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

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.
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.
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.
bool HConstantFrameRate::GetActive ( ) [inline]
Returns:
True if constant framerate watch is activated and false if otherwise.
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.
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.
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.
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.
int HConstantFrameRate::GetSimpLevel ( ) [inline]
Returns:
Current simplification level.
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.
float HConstantFrameRate::GetTargetFrameRate ( ) [inline]
Returns:
Target framerate which we want the scene to maintain.
HBaseView* HConstantFrameRate::GetView ( ) [inline]
Returns:
A pointer to the HBaseView object.
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.

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
void HConstantFrameRate::ResetListPointers ( ) [inline]

Resets the simplification list and level pionters.

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.
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
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
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
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
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
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.
void HConstantFrameRate::SetSimpLevel ( int  simplevel) [inline]

Sets the current simplification level.

Parameters:
simplevelsimplification level for the scene
void HConstantFrameRate::SetTargetFrameRate ( float  framerate) [inline]

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

Parameters:
framerateNew target framerate
void HConstantFrameRate::Shutdown ( )

This method clears the simplification types list.

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).

void HConstantFrameRate::StartTimer ( ) [protected]

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

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).

void HConstantFrameRate::StopTimer ( ) [protected]

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

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.
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
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.
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

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

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

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

float HConstantFrameRate::m_DeadZone [protected]

Tolerance around target framerate.

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

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

Counter for number of frames passed before framerate is calculated.

A pointer to the the associated view object.

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.

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

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

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

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

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

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

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: