OGRE-Next
4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
Non-physically-based-render (NPR) Atmosphere solution. More...
#include <OgreAtmosphereNpr.h>
Classes | |
struct | Preset |
Public Types | |
enum | AxisConvention { Xup , Yup , Zup , NegationFlag = ( 1u << 2u ) , NegXup = Xup | NegationFlag , NegYup = Yup | NegationFlag , NegZup = Zup | NegationFlag } |
typedef FastArray< Preset > | PresetArray |
Public Member Functions | |
AtmosphereNpr (VaoManager *vaoManager) | |
~AtmosphereNpr () override | |
void | _update (SceneManager *sceneManager, Camera *camera) override |
Called when the scene manager wants to render and needs the component to update its buffers. More... | |
uint32 | bindConstBuffers (CommandBuffer *commandBuffer, size_t slotIdx) override |
Tells the component to bind the buffers Returns getNumConstBuffersSlots. More... | |
void | destroySky (Ogre::SceneManager *sceneManager) |
void | eventOccurred (const String &eventName, const NameValuePairList *parameters) override |
Vector3 | getAtmosphereAt (const Vector3 cameraDir, bool bSkipSun=false) |
uint32 | getNumConstBuffersSlots () const override |
How many additional const buffers are required in our Hlms integration. More... | |
const Preset & | getPreset () const |
const PresetArray & | getPresets () const |
uint32 | preparePassHash (Hlms *hlms, size_t constBufferSlot) override |
Returns getNumConstBuffersSlots. More... | |
void | setLight (Light *ogre_nullable light) |
Links an existing directional to be updated using the Atmosphere's parameters. More... | |
void | setPreset (const Preset &preset) |
Sets a specific preset as current. More... | |
void | setPresets (const PresetArray &presets) |
Sets multiple presets at different times for interpolation We will sort the array. More... | |
void | setSky (Ogre::SceneManager *sceneManager, bool bEnabled) |
void | setSunDir (const Ogre::Vector3 &sunDir, const float normalizedTimeOfDay) |
More direct approach on setting time of day. More... | |
void | setSunDir (const Radian sunAltitude, const Ogre::Radian azimuth=Radian(0.0f)) |
Sets the time of day. More... | |
void | updatePreset (const Ogre::Vector3 &sunDir, const float fTime) |
After having called AtmosphereNpr::setPresets, this function will interpolate between mPresets[fTime] and mPresets[fTime+1]. More... | |
Public Member Functions inherited from Ogre::AtmosphereComponent | |
virtual | ~AtmosphereComponent () |
virtual bool | providesHlmsCode () const |
Indicates Hlms implementations this component has Hlms integration. More... | |
Public Member Functions inherited from Ogre::RenderSystem::Listener | |
Listener () | |
virtual | ~Listener () |
Public Attributes | |
float | mAtmosphereHeight |
How big is the "atmosphere". More... | |
float | mAtmosphereSeaLevel |
When camera's height == mAtmosphereSeaLevel, the camera is considered to be at the ground i.e. More... | |
AxisConvention | mConvention |
PUBLIC VARIABLE. More... | |
Non-physically-based-render (NPR) Atmosphere solution.
This solution is also integrated into HlmsPbs.
It may seem counter-intuitive to include an NPR solution in a PBR solution (HlmsPbs) However it makes sense because it looks nice and is efficient for most cases.
A PBR solution is iterative and requires more resources.
Ogre::AtmosphereNpr::AtmosphereNpr | ( | VaoManager * | vaoManager | ) |
|
override |
|
overridevirtual |
Called when the scene manager wants to render and needs the component to update its buffers.
Implements Ogre::AtmosphereComponent.
|
overridevirtual |
Tells the component to bind the buffers Returns getNumConstBuffersSlots.
Implements Ogre::AtmosphereComponent.
void Ogre::AtmosphereNpr::destroySky | ( | Ogre::SceneManager * | sceneManager | ) |
|
overridevirtual |
Implements Ogre::RenderSystem::Listener.
cameraDir | Point to look at |
bSkipSun | When true, the sun disk is skipped |
|
overridevirtual |
How many additional const buffers are required in our Hlms integration.
Implements Ogre::AtmosphereComponent.
|
inline |
|
inline |
Returns getNumConstBuffersSlots.
Implements Ogre::AtmosphereComponent.
void Ogre::AtmosphereNpr::setLight | ( | Light *ogre_nullable | light | ) |
void Ogre::AtmosphereNpr::setPreset | ( | const Preset & | preset | ) |
Sets a specific preset as current.
void Ogre::AtmosphereNpr::setPresets | ( | const PresetArray & | presets | ) |
Sets multiple presets at different times for interpolation We will sort the array.
You must call AtmosphereNpr::updatePreset to take effect
void Ogre::AtmosphereNpr::setSky | ( | Ogre::SceneManager * | sceneManager, |
bool | bEnabled | ||
) |
void Ogre::AtmosphereNpr::setSunDir | ( | const Ogre::Vector3 & | sunDir, |
const float | normalizedTimeOfDay | ||
) |
More direct approach on setting time of day.
sunDir | Sun's light direction (or moon). Will be normalized. |
normalizedTimeOfDay | In range [0; 1] where 0 is when the sun goes out and 1 when it's gone. |
void Ogre::AtmosphereNpr::setSunDir | ( | const Radian | sunAltitude, |
const Ogre::Radian | azimuth = Radian(0.0f) |
||
) |
Sets the time of day.
sunAltitude | Altitude of the sun. At 90° the sun is facing downards (i.e. 12pm) Must* be in range [0; pi) |
azimuth | Rotation around Y axis. In radians. |
void Ogre::AtmosphereNpr::updatePreset | ( | const Ogre::Vector3 & | sunDir, |
const float | fTime | ||
) |
After having called AtmosphereNpr::setPresets, this function will interpolate between mPresets[fTime] and mPresets[fTime+1].
sunDir | Sun's light direction (or moon). Will be normalized. |
fTime | Param. Should be in range [-1; 1] where [-1; 0] is meant to be night and [0; 1] is day |
float Ogre::AtmosphereNpr::mAtmosphereHeight |
How big is the "atmosphere".
Earth's thermosphere is at about 110 km.
This value must be in "units". If your engine stores the camera in millimeters, this value must be in millimeters. If your engine uses meters, this value must be in meters.
Thus the visible atmosphere is in range [mAtmosphereSeaLevel; mAtmosphereSeaLevel + mAtmosphereHeight)
float Ogre::AtmosphereNpr::mAtmosphereSeaLevel |
When camera's height == mAtmosphereSeaLevel, the camera is considered to be at the ground i.e.
camera_height - mAtmosphereSeaLevel = 0
Regarding the unit of measurement, see mAtmosphereHeight
AxisConvention Ogre::AtmosphereNpr::mConvention |
PUBLIC VARIABLE.
This variable can be altered directly. Changes are reflected immediately.