OGRE-Next: Ogre::AtmosphereNpr Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Ogre::AtmosphereNpr Class Referencefinal
Component » Material

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

`#include <OgreAtmosphereNpr.h>`

Inheritance diagram for Ogre::AtmosphereNpr:
[legend]

## 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.
uint32 | bindConstBuffers (CommandBuffer *commandBuffer, size_t slotIdx) override
| Tells the component to bind the buffers Returns getNumConstBuffersSlots.
void | destroySky (Ogre::SceneManager *sceneManager)
Vector3 | getAtmosphereAt (const Vector3 cameraDir, bool bSkipSun=false)
uint32 | getNumConstBuffersSlots () const override
| How many additional const buffers are required in our Hlms integration.
const Preset & | getPreset () const
const PresetArray & | getPresets () const
uint32 | preparePassHash (Hlms *hlms, size_t constBufferSlot) override
| Returns getNumConstBuffersSlots.
void | setLight (Light *ogre_nullable light)
| Links an existing directional to be updated using the Atmosphere's parameters.
void | setPreset (const Preset &preset)
| Sets a specific preset as current.
void | setPresets (const PresetArray &presets)
| Sets multiple presets at different times for interpolation We will sort the array.
void | setSky (Ogre::SceneManager *sceneManager, bool bEnabled)
void | setSunDir (const Ogre::Vector3 &sunDir, const float normalizedTimeOfDay)
| More direct approach on setting time of day.
void | setSunDir (const Radian sunAltitude, const Ogre::Radian azimuth=Radian(0.0f))
| Sets the time of day.
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].
Public Member Functions inherited from Ogre::AtmosphereComponent
virtual | ~AtmosphereComponent ()
virtual bool | providesHlmsCode () const
| Indicates Hlms implementations this component has Hlms integration.

## Public Attributes
float | mAtmosphereHeight
| How big is the "atmosphere".
float | mAtmosphereSeaLevel
| When camera's height == mAtmosphereSeaLevel, the camera is considered to be at the ground i.e.
AxisConvention | mConvention
| PUBLIC VARIABLE.

## 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

typedef FastArray<Preset> Ogre::AtmosphereNpr::PresetArray

## Member Enumeration Documentation

## ◆ AxisConvention

enum Ogre::AtmosphereNpr::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 | ) |

## ◆ getAtmosphereAt()

Vector3 Ogre::AtmosphereNpr::getAtmosphereAt | ( | const Vector3 | cameraDir,
|  | bool | bSkipSun = false )

Remarks
  We assume camera displacement is 0.

Parameters

  cameraDir | Point to look at
  bSkipSun | When 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

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

References ogre_nullable.

## ◆ 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

  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.

## ◆ 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

  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.

## ◆ 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

  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

## 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:

- OgreAtmosphereNpr.h