User Tools

Site Tools


Forest Library Wind Functions

The CForest object provides convenience functions for controlling the wind for all of the base trees without having to access each tree separately. The functions include:

  • CForest::WindEnable(): This is an initialization-level function and shouldn't be called to enable/disable the wind while the rendering loop is active. If wind is to be supported, call this function once during initialization.
  • CForest::WindAdvance(): Advances the wind simulation for all of the base tree objects in the forest. Second parameter, time, is in seconds and represents time since the beginning of the simulation, not the time since the last call or frame. Not free in terms of CPU but not expensive.
  • CForest::WindPreroll(): A convenience function for bypassing the start-up state of the wind simulation. It's common to use a 10-second or so pre-roll.
  • CForest::WindSetStrength(): Updates the strength of all of the base trees in the forest.
  • CForest::WindSetDirection(): Updates the direction of all of the base trees in the forest.

You can still set an individual base tree's wind parameters by querying a CTree's CWind object and setting its parameters directly. All of a CTree's instances share this wind object. Each will have its own slight variation of the wind, as provided by the wind shader's usage of the tree's position as a unique numerical identifier. However, all of the wind parameters set for the base tree in the Modeler application will remain the same across all its instances.