The HConstantFrameRate class provides support for maintaining a constant framerate when rendering.
More...
#include <HConstantFrameRate.h>
|
static bool | Tick (float request_time, float actual_time, void *user_data) |
|
|
class | HConstFRSimpType |
|
class | HFrNoSimp |
|
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.
HConstantFrameRate::HConstantFrameRate |
( |
HBaseView * |
view | ) |
|
Constructs a new HConstantFrameRatge Object.
- Parameters
-
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
-
FrameRate | The 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
-
SimpLevel | Pass by reference. This method returns with the simplification level adjusted to be within simplification range. |
SimpListPos | Pass 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.
- Returns
- The state of the activity flag which can be NoActivity, MovementActivity, CuttingPlaneActivity or GeneralActivity. This flag affects the constant framerate logic.
- 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.
- 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
-
sd | If 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_framerate | If target_framerate is not 0, the method returns the desired update rate for the scene, in frames per second. |
length | If 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.
This method returns a pointer to the object in the simplification list that correctsponds to given ConstFRType.
- Parameters
-
stype | The 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 |
( |
void |
| ) |
|
|
inline |
- Returns
- Target framerate which we want the scene to maintain.
HBaseView* HConstantFrameRate::GetView |
( |
void |
| ) |
|
|
inline |
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_framerate | The desired update rate for the scene, in frames per second. |
sd | A pointer to an array of simplification types. Passed by reference. |
length | The length of the simplification list. |
deadzone | Allowed variance from target framerate |
void HConstantFrameRate::ResetListPointers |
( |
| ) |
|
|
inline |
Resets the simplification list and level pionters.
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
-
at | Pass 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
-
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
-
mode | New Detail decrease mode |
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
-
mode | New Detail change mode |
void HConstantFrameRate::SetDetailLevel |
( |
int |
listpos, |
|
|
int |
simplevel |
|
) |
| |
|
inline |
Sets the default detail level before the framerate logic is started.
- Parameters
-
listpos | simplification type |
simplevel | simplification 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
-
detaildecrease | Turn 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
-
SimpLevel | Simplification level inside the current simplification type |
SimpListPos | Current position in the Simplification list - determines current simplification type. |
void HConstantFrameRate::SetSimpLevel |
( |
int |
simplevel | ) |
|
|
inline |
Sets the current simplification level.
- Parameters
-
simplevel | simplification 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
-
framerate | New 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_time | Timer Parameter |
actual_time | Timer Parameter |
user_data | User 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
-
SimpLevel | Simplification Level |
SimpListPos | Position in current Simplification Level |
bool HConstantFrameRate::ViewpointHasChanged |
( |
bool |
update = true | ) |
|
Determines if the viewpoint has changed for the associated scene.
- Parameters
-
update | Pass 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.
Flag that indicates whether an event like a user interaction has occurred that would effect the framerate. If it false, then no event occurred.
bool HConstantFrameRate::m_bConstFRActive |
|
protected |
This value indicates whether the constant frame rate mode is currently active.
bool HConstantFrameRate::m_bEmergencyDecrease |
|
protected |
Flag that indicates if detail level should be significantly reduced if framerate has fallen below a critical threshold.
float HConstantFrameRate::m_DeadZone |
|
protected |
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.
int HConstantFrameRate::m_FrameRateCounter |
|
protected |
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.
int HConstantFrameRate::m_SimpLevel |
|
protected |
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.
int HConstantFrameRate::m_SimpListLength |
|
protected |
Length of the object simplification list used by the constant frame rate logic.
int HConstantFrameRate::m_SimpListPos |
|
protected |
Current object simplification type used by the constant frame rate logic.
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: