Pyrogenesis trunk
Public Member Functions | Public Attributes | Private Attributes | List of all members
WaterManager Class Reference

Class WaterManager: Maintain rendering-related water settings and textures Anything that affects gameplay should go in CcmpWaterManager.cpp and passed to this (possibly as copy). More...

#include <WaterManager.h>

Collaboration diagram for WaterManager:
Collaboration graph
[legend]

Public Member Functions

 WaterManager (Renderer::Backend::IDevice *device)
 
 ~WaterManager ()
 
void Initialize ()
 
int LoadWaterTextures ()
 LoadWaterTextures: Load water textures from within the progressive load framework. More...
 
void RecreateOrLoadTexturesIfNeeded ()
 Recreates/loads needed water textures. More...
 
void ReloadWaterNormalTextures ()
 ReloadWaterNormalTextures: Reload the normal textures so that changing water type in Atlas will actually do the right thing. More...
 
void UnloadWaterTextures ()
 UnloadWaterTextures: Free any loaded water textures and reset the internal state so that another call to LoadWaterTextures will begin progressive loading. More...
 
void RecomputeWaterData ()
 RecomputeWaterData: calculates all derived data from the waterheight. More...
 
void RecomputeWindStrength ()
 RecomputeWindStrength: calculates the intensity of waves. More...
 
void RecomputeDistanceHeightmap ()
 RecomputeDistanceHeightmap: recalculates (or calculates) the distance heightmap. More...
 
void CreateWaveMeshes ()
 CreateWaveMeshes: Creates the waves objects (and meshes). More...
 
void SetMapSize (size_t size)
 Updates the map size. More...
 
void UpdateQuality ()
 Updates the settings to the one from the renderer, and sets m_NeedsReloading. More...
 
bool WillRenderFancyWater () const
 Returns true if fancy water shaders will be used (i.e. More...
 
void RenderWaves (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CFrustum &frustrum)
 
size_t GetCurrentTextureIndex (const double &period) const
 Returns an index of the current texture that should be used for rendering water. More...
 
size_t GetNextTextureIndex (const double &period) const
 

Public Attributes

CTexturePtr m_WaterTexture [60]
 
CTexturePtr m_NormalMap [60]
 
std::unique_ptr< float[]> m_WindStrength
 
std::unique_ptr< float[]> m_DistanceHeightmap
 
std::vector< std::unique_ptr< WaveObject > > m_ShoreWaves
 
CVertexBufferManager::Handle m_ShoreWavesVBIndices
 
Renderer::Backend::IVertexInputLayoutm_ShoreVertexInputLayout = nullptr
 
size_t m_MapSize
 
ssize_t m_TexSize
 
CTexturePtr m_WaveTex
 
CTexturePtr m_FoamTex
 
std::unique_ptr< Renderer::Backend::ITexturem_FancyTexture
 
std::unique_ptr< Renderer::Backend::ITexturem_FancyTextureDepth
 
std::unique_ptr< Renderer::Backend::ITexturem_ReflFboDepthTexture
 
std::unique_ptr< Renderer::Backend::ITexturem_RefrFboDepthTexture
 
u32 m_updatei0
 
u32 m_updatej0
 
u32 m_updatei1
 
u32 m_updatej1
 
bool m_RenderWater
 
bool m_WaterEffects
 
bool m_WaterRealDepth
 
bool m_WaterFancyEffects
 
bool m_WaterRefraction
 
bool m_WaterReflection
 
bool m_NeedsReloading
 
bool m_NeedInfoUpdate
 
float m_WaterHeight
 
double m_WaterTexTimer
 
float m_RepeatPeriod
 
std::unique_ptr< Renderer::Backend::ITexturem_ReflectionTexture
 
std::unique_ptr< Renderer::Backend::ITexturem_RefractionTexture
 
size_t m_RefTextureSize
 
std::unique_ptr< Renderer::Backend::IFramebufferm_RefractionFramebuffer
 
std::unique_ptr< Renderer::Backend::IFramebufferm_ReflectionFramebuffer
 
std::unique_ptr< Renderer::Backend::IFramebufferm_FancyEffectsFramebuffer
 
std::unique_ptr< Renderer::Backend::IFramebufferm_FancyEffectsOccludersFramebuffer
 
CMatrix3D m_ReflectionMatrix
 
CMatrix3D m_RefractionMatrix
 
CMatrix3D m_RefractionProjInvMatrix
 
CMatrix3D m_RefractionViewInvMatrix
 
std::wstring m_WaterType
 
CColor m_WaterColor
 
CColor m_WaterTint
 
float m_Waviness
 
float m_Murkiness
 
float m_WindAngle
 

Private Attributes

Renderer::Backend::IDevicem_Device = nullptr
 

Detailed Description

Class WaterManager: Maintain rendering-related water settings and textures Anything that affects gameplay should go in CcmpWaterManager.cpp and passed to this (possibly as copy).

Constructor & Destructor Documentation

◆ WaterManager()

WaterManager::WaterManager ( Renderer::Backend::IDevice device)

◆ ~WaterManager()

WaterManager::~WaterManager ( )

Member Function Documentation

◆ CreateWaveMeshes()

void WaterManager::CreateWaveMeshes ( )

CreateWaveMeshes: Creates the waves objects (and meshes).

◆ GetCurrentTextureIndex()

size_t WaterManager::GetCurrentTextureIndex ( const double &  period) const

Returns an index of the current texture that should be used for rendering water.

◆ GetNextTextureIndex()

size_t WaterManager::GetNextTextureIndex ( const double &  period) const

◆ Initialize()

void WaterManager::Initialize ( )

◆ LoadWaterTextures()

int WaterManager::LoadWaterTextures ( )

LoadWaterTextures: Load water textures from within the progressive load framework.

Returns
0 if loading has completed, a value from 1 to 100 (in percent of completion) if more textures need to be loaded and a negative error value on failure.

◆ RecomputeDistanceHeightmap()

void WaterManager::RecomputeDistanceHeightmap ( )

RecomputeDistanceHeightmap: recalculates (or calculates) the distance heightmap.

◆ RecomputeWaterData()

void WaterManager::RecomputeWaterData ( )

RecomputeWaterData: calculates all derived data from the waterheight.

◆ RecomputeWindStrength()

void WaterManager::RecomputeWindStrength ( )

RecomputeWindStrength: calculates the intensity of waves.

◆ RecreateOrLoadTexturesIfNeeded()

void WaterManager::RecreateOrLoadTexturesIfNeeded ( )

Recreates/loads needed water textures.

◆ ReloadWaterNormalTextures()

void WaterManager::ReloadWaterNormalTextures ( )

ReloadWaterNormalTextures: Reload the normal textures so that changing water type in Atlas will actually do the right thing.

◆ RenderWaves()

void WaterManager::RenderWaves ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CFrustum frustrum 
)

◆ SetMapSize()

void WaterManager::SetMapSize ( size_t  size)

Updates the map size.

Will trigger a complete recalculation of fancy water information the next turn.

◆ UnloadWaterTextures()

void WaterManager::UnloadWaterTextures ( )

UnloadWaterTextures: Free any loaded water textures and reset the internal state so that another call to LoadWaterTextures will begin progressive loading.

◆ UpdateQuality()

void WaterManager::UpdateQuality ( )

Updates the settings to the one from the renderer, and sets m_NeedsReloading.

◆ WillRenderFancyWater()

bool WaterManager::WillRenderFancyWater ( ) const

Returns true if fancy water shaders will be used (i.e.

the hardware is capable and it hasn't been configured off)

Member Data Documentation

◆ m_Device

Renderer::Backend::IDevice* WaterManager::m_Device = nullptr
private

◆ m_DistanceHeightmap

std::unique_ptr<float[]> WaterManager::m_DistanceHeightmap

◆ m_FancyEffectsFramebuffer

std::unique_ptr<Renderer::Backend::IFramebuffer> WaterManager::m_FancyEffectsFramebuffer

◆ m_FancyEffectsOccludersFramebuffer

std::unique_ptr<Renderer::Backend::IFramebuffer> WaterManager::m_FancyEffectsOccludersFramebuffer

◆ m_FancyTexture

std::unique_ptr<Renderer::Backend::ITexture> WaterManager::m_FancyTexture

◆ m_FancyTextureDepth

std::unique_ptr<Renderer::Backend::ITexture> WaterManager::m_FancyTextureDepth

◆ m_FoamTex

CTexturePtr WaterManager::m_FoamTex

◆ m_MapSize

size_t WaterManager::m_MapSize

◆ m_Murkiness

float WaterManager::m_Murkiness

◆ m_NeedInfoUpdate

bool WaterManager::m_NeedInfoUpdate

◆ m_NeedsReloading

bool WaterManager::m_NeedsReloading

◆ m_NormalMap

CTexturePtr WaterManager::m_NormalMap[60]

◆ m_ReflectionFramebuffer

std::unique_ptr<Renderer::Backend::IFramebuffer> WaterManager::m_ReflectionFramebuffer

◆ m_ReflectionMatrix

CMatrix3D WaterManager::m_ReflectionMatrix

◆ m_ReflectionTexture

std::unique_ptr<Renderer::Backend::ITexture> WaterManager::m_ReflectionTexture

◆ m_ReflFboDepthTexture

std::unique_ptr<Renderer::Backend::ITexture> WaterManager::m_ReflFboDepthTexture

◆ m_RefractionFramebuffer

std::unique_ptr<Renderer::Backend::IFramebuffer> WaterManager::m_RefractionFramebuffer

◆ m_RefractionMatrix

CMatrix3D WaterManager::m_RefractionMatrix

◆ m_RefractionProjInvMatrix

CMatrix3D WaterManager::m_RefractionProjInvMatrix

◆ m_RefractionTexture

std::unique_ptr<Renderer::Backend::ITexture> WaterManager::m_RefractionTexture

◆ m_RefractionViewInvMatrix

CMatrix3D WaterManager::m_RefractionViewInvMatrix

◆ m_RefrFboDepthTexture

std::unique_ptr<Renderer::Backend::ITexture> WaterManager::m_RefrFboDepthTexture

◆ m_RefTextureSize

size_t WaterManager::m_RefTextureSize

◆ m_RenderWater

bool WaterManager::m_RenderWater

◆ m_RepeatPeriod

float WaterManager::m_RepeatPeriod

◆ m_ShoreVertexInputLayout

Renderer::Backend::IVertexInputLayout* WaterManager::m_ShoreVertexInputLayout = nullptr

◆ m_ShoreWaves

std::vector<std::unique_ptr<WaveObject> > WaterManager::m_ShoreWaves

◆ m_ShoreWavesVBIndices

CVertexBufferManager::Handle WaterManager::m_ShoreWavesVBIndices

◆ m_TexSize

ssize_t WaterManager::m_TexSize

◆ m_updatei0

u32 WaterManager::m_updatei0

◆ m_updatei1

u32 WaterManager::m_updatei1

◆ m_updatej0

u32 WaterManager::m_updatej0

◆ m_updatej1

u32 WaterManager::m_updatej1

◆ m_WaterColor

CColor WaterManager::m_WaterColor

◆ m_WaterEffects

bool WaterManager::m_WaterEffects

◆ m_WaterFancyEffects

bool WaterManager::m_WaterFancyEffects

◆ m_WaterHeight

float WaterManager::m_WaterHeight

◆ m_WaterRealDepth

bool WaterManager::m_WaterRealDepth

◆ m_WaterReflection

bool WaterManager::m_WaterReflection

◆ m_WaterRefraction

bool WaterManager::m_WaterRefraction

◆ m_WaterTexTimer

double WaterManager::m_WaterTexTimer

◆ m_WaterTexture

CTexturePtr WaterManager::m_WaterTexture[60]

◆ m_WaterTint

CColor WaterManager::m_WaterTint

◆ m_WaterType

std::wstring WaterManager::m_WaterType

◆ m_WaveTex

CTexturePtr WaterManager::m_WaveTex

◆ m_Waviness

float WaterManager::m_Waviness

◆ m_WindAngle

float WaterManager::m_WindAngle

◆ m_WindStrength

std::unique_ptr<float[]> WaterManager::m_WindStrength

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