# HConstantFrameRate

## Functions

| `HConstantFrameRate`
| `~HConstantFrameRate`
HBaseView * | `GetView`
void | `UpdateLevel`
bool | `GetMode`
HConstFRSimpType const *const * | `GetList`
float | `GetTargetFramerate`
int | `GetLength`
void | `Init`
void | `Shutdown`
bool | `GetActive`
void | `Watch`
void | `Start`
void | `Stop`
void | `IncreaseDetailTemp`
bool | `ViewpointHasChanged`
void | `SetDetailIncMode`
void | `SetDetailIncOnIdleMode`
`DetailChangeMode` | `GetDetailIncMode`
void | `SetDetailDecMode`
`DetailChangeMode` | `GetDetailDecMode`
void | `ResetListPointers`
float | `GetTargetFrameRate`
void | `SetTargetFrameRate`
void | `SetDeadZone`
void | `SetEmergencyDetailDecrease`
void | `SetActivityType`
`HActivityType` | `GetActivityType`
int | `GetSimpLevel`
void | `AdjustLodOptions`
bool | `GetDetailIncreaseState`
void | `SetDetailLevel`
HConstFRSimpType * | `GetSimpType`
void | `SetSimpLevel`
void | `AdjustDefaultDetailLevelToModel`
void | `SetDisableIncreaseTemp`
void | `InitiateDelay`
int | `GetDetailLevelNum`
int | `GetTotalDetailLevelNum`
void | `SetWatchActivity`
void | `MajorDetailDecrease`
void | `MajorDetailIncrease`
bool | `Tick`

## Detailed Description

class `HConstantFrameRate`

  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.

  Public Functions

  `HConstantFrameRate`(HBaseView *view)

    Constructs a new HConstantFrameRatge Object.

    Parameters: | view – Pointer to HBaseView object

  virtual `~HConstantFrameRate`()
  inline HBaseView *`GetView`()

    Returns: | A pointer to the HBaseView object.

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

        \param 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.
        \param target_framerate If target_framerate is not 0, the method returns the desired update rate for the scene, in frames

    per second.
    Deprecated:

      use GetList() GetTargetFramerate() or GetLength() instead

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

  inline HConstFRSimpType const *const *`GetList`() const

    This method lets you retrieve the simplification type list. This is a read- only array. If you want to update the list, use the Init() method.

    Returns: | a pointer to the simplification type list.

  inline float `GetTargetFramerate`() const

    The method returns the desired update rate for the scene, in frames per second.

    Returns: | the desired update rate for the scene

  inline int `GetLength`() const

    The method returns the length of the simplification array.

    Returns: | the length of the simplification array.

  void `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 `Shutdown`()

    This method clears the simplification types list.

  inline bool `GetActive`() const

    Returns: | True if constant framerate watch is activated and false if otherwise.

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

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

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

  inline void `SetDetailIncMode`(DetailChangeMode 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

  inline void `SetDetailIncOnIdleMode`(DetailChangeMode mode)
  inline DetailChangeMode `GetDetailIncMode`()

    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.

  inline void `SetDetailDecMode`(DetailChangeMode mode)

    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

  inline DetailChangeMode `GetDetailDecMode`()

    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.

  inline void `ResetListPointers`()

    Resets the simplification list and level pionters.

  inline float `GetTargetFrameRate`()

    Returns: | Target framerate which we want the scene to maintain.

  inline void `SetTargetFrameRate`(float framerate)

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

    Parameters: | framerate – New target framerate

  inline void `SetDeadZone`(float deadzone)

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

    Parameters: | deadzone – new dead zone

  inline void `SetEmergencyDetailDecrease`(bool detaildecrease)

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

    Parameters: | detaildecrease – Turn detaildecrease on/off

  inline void `SetActivityType`(HActivityType at)

    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.

  inline HActivityType `GetActivityType`()

    Returns: | The state of the activity flag which can be NoActivity, MovementActivity, CuttingPlaneActivity or GeneralActivity. This flag affects the constant framerate logic.

  inline int `GetSimpLevel`()

    Returns: | Current simplification level.

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

  inline bool `GetDetailIncreaseState`()
  inline void `SetDetailLevel`(int listpos, int simplevel)

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

    Parameters: | listpos – simplification type simplevel – simplification level for given type

  HConstFRSimpType *`GetSimpType`(ConstFRType stype)

    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.

  inline void `SetSimpLevel`(int simplevel)

    Sets the current simplification level.

    Parameters: | simplevel – simplification level for the scene

  void `AdjustDefaultDetailLevelToModel`()

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

  inline void `SetDisableIncreaseTemp`(bool it)
  inline void `InitiateDelay`()
  int `GetDetailLevelNum`()
  int `GetTotalDetailLevelNum`()
  inline void `SetWatchActivity`(bool wa)
  void `MajorDetailDecrease`()
  void `MajorDetailIncrease`()

  Public Static Functions

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

    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.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Visualize 3DF or choose a sample question below to start a conversation:

What is HOOPS Visualize 3DF?
What are the latest release notes for HOOPS Visualize 3DF?
How do I start evaluating HOOPS Visualize 3DF?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...