OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::AtmosphereNpr Class Referencefinal

Non-physically-based-render (NPR) Atmosphere solution. More...

#include <OgreAtmosphereNpr.h>

+ Inheritance diagram for Ogre::AtmosphereNpr:

Classes

struct  Preset
 

Public Types

enum  AxisConvention {
  Xup , Yup , Zup , NegationFlag = ( 1u << 2u ) ,
  NegXup = Xup | NegationFlag , NegYup = Yup | NegationFlag , NegZup = Zup | NegationFlag
}
 
typedef FastArray< PresetPresetArray
 

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 PresetgetPreset () const
 
const PresetArraygetPresets () 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...
 

Detailed Description

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.

Member Typedef Documentation

◆ PresetArray

Member Enumeration Documentation

◆ AxisConvention

Enumerator
Xup 
Yup 
Zup 
NegationFlag 
NegXup 
NegYup 
NegZup 

Constructor & Destructor Documentation

◆ AtmosphereNpr()

Ogre::AtmosphereNpr::AtmosphereNpr ( VaoManager vaoManager)

◆ ~AtmosphereNpr()

Ogre::AtmosphereNpr::~AtmosphereNpr ( )
override

Member Function Documentation

◆ _update()

void Ogre::AtmosphereNpr::_update ( SceneManager sceneManager,
Camera camera 
)
overridevirtual

Called when the scene manager wants to render and needs the component to update its buffers.

Implements Ogre::AtmosphereComponent.

◆ bindConstBuffers()

uint32 Ogre::AtmosphereNpr::bindConstBuffers ( CommandBuffer commandBuffer,
size_t  slotIdx 
)
overridevirtual

Tells the component to bind the buffers Returns getNumConstBuffersSlots.

Implements Ogre::AtmosphereComponent.

◆ destroySky()

void Ogre::AtmosphereNpr::destroySky ( Ogre::SceneManager sceneManager)

◆ eventOccurred()

void Ogre::AtmosphereNpr::eventOccurred ( const String eventName,
const NameValuePairList parameters 
)
overridevirtual

◆ getAtmosphereAt()

Vector3 Ogre::AtmosphereNpr::getAtmosphereAt ( const Vector3  cameraDir,
bool  bSkipSun = false 
)
Remarks
We assume camera displacement is 0.
Parameters
cameraDirPoint to look at
bSkipSunWhen true, the sun disk is skipped
Returns
The value at that camera direction, given the current parameters

◆ getNumConstBuffersSlots()

uint32 Ogre::AtmosphereNpr::getNumConstBuffersSlots ( ) const
overridevirtual

How many additional const buffers are required in our Hlms integration.

Implements Ogre::AtmosphereComponent.

◆ getPreset()

const Preset& Ogre::AtmosphereNpr::getPreset ( ) const
inline

◆ getPresets()

const PresetArray& Ogre::AtmosphereNpr::getPresets ( ) const
inline

◆ preparePassHash()

uint32 Ogre::AtmosphereNpr::preparePassHash ( Hlms hlms,
size_t  constBufferSlot 
)
overridevirtual

Returns getNumConstBuffersSlots.

Implements Ogre::AtmosphereComponent.

◆ setLight()

void Ogre::AtmosphereNpr::setLight ( Light *ogre_nullable  light)

Links an existing directional to be updated using the Atmosphere's parameters.

Parameters
lightLight to associate with. Can be nullptr to unlink it. Light pointer must stay alive while linked (i.e. no dangling pointers)

◆ setPreset()

void Ogre::AtmosphereNpr::setPreset ( const Preset preset)

Sets a specific preset as current.

◆ setPresets()

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

◆ setSky()

void Ogre::AtmosphereNpr::setSky ( Ogre::SceneManager sceneManager,
bool  bEnabled 
)

◆ setSunDir() [1/2]

void Ogre::AtmosphereNpr::setSunDir ( const Ogre::Vector3 sunDir,
const float  normalizedTimeOfDay 
)

More direct approach on setting time of day.

Parameters
sunDirSun's light direction (or moon). Will be normalized.
normalizedTimeOfDayIn range [0; 1] where 0 is when the sun goes out and 1 when it's gone.

◆ setSunDir() [2/2]

void Ogre::AtmosphereNpr::setSunDir ( const Radian  sunAltitude,
const Ogre::Radian  azimuth = Radian(0.0f) 
)

Sets the time of day.

Remarks
Assumes Y is up
Parameters
sunAltitudeAltitude of the sun. At 90° the sun is facing downards (i.e. 12pm) Must* be in range [0; pi)
azimuthRotation around Y axis. In radians.

◆ updatePreset()

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

Parameters
sunDirSun's light direction (or moon). Will be normalized.
fTimeParam. Should be in range [-1; 1] where [-1; 0] is meant to be night and [0; 1] is day

Member Data Documentation

◆ mAtmosphereHeight

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)

◆ mAtmosphereSeaLevel

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

◆ mConvention

AxisConvention Ogre::AtmosphereNpr::mConvention

PUBLIC VARIABLE.

This variable can be altered directly. Changes are reflected immediately.


The documentation for this class was generated from the following file: