Material/Shader manager class.
Definition at line 44 of file MaterialManager.h.
|
| | MaterialManager (Hydrax *h) |
| |
| | ~MaterialManager () |
| |
| bool | createMaterials (const HydraxComponent &Components, const Options &Options) |
| |
| void | removeMaterials () |
| |
| void | removeCompositor () |
| |
| void | reload (const MaterialType &Material) |
| |
| bool | fillGpuProgramsToPass (Ogre::Pass *Pass, const Ogre::String GpuProgramNames[2], const ShaderMode &SM, const Ogre::String EntryPoints[2], const Ogre::String Data[2]) |
| |
| bool | createGpuProgram (const Ogre::String &Name, const ShaderMode &SM, const GpuProgram &GPUP, const Ogre::String &EntryPoint, const Ogre::String &Data) |
| |
| const bool & | isCreated () const |
| |
| Ogre::MaterialPtr & | getMaterial (const MaterialType &Material) |
| |
| Ogre::CompositorPtr & | getCompositor (const CompositorType &Compositor) |
| |
| const bool & | isCompositorEnable (const CompositorType &Compositor) const |
| |
| void | setCompositorEnable (const CompositorType &Compositor, const bool &Enable) |
| |
| const Options & | getLastOptions () const |
| |
| void | addDepthTechnique (Ogre::Technique *Technique, const bool &AutoUpdate=true) |
| |
| void | addDepthTextureTechnique (Ogre::Technique *Technique, const Ogre::String &TextureName, const Ogre::String &AlphaChannel="w", const bool &AutoUpdate=true) |
| |
| std::vector< Ogre::Technique * > & | getDepthTechniques () |
| |
| void | setGpuProgramParameter (const GpuProgram &GpuP, const MaterialType &MType, const Ogre::String &Name, const Ogre::Real &Value) |
| |
| void | setGpuProgramParameter (const GpuProgram &GpuP, const MaterialType &MType, const Ogre::String &Name, const Ogre::Vector2 &Value) |
| |
| void | setGpuProgramParameter (const GpuProgram &GpuP, const MaterialType &MType, const Ogre::String &Name, const Ogre::Vector3 &Value) |
| |
| void | updateAnimatedTextures (float dt) |
| |
|
| bool | _isComponent (const HydraxComponent &List, const HydraxComponent &ToCheck) const |
| |
| bool | _createWaterMaterial (const HydraxComponent &Components, const Options &Options) |
| |
| bool | _createDepthMaterial (const HydraxComponent &Components, const Options &Options) |
| |
| bool | _createDepthTextureGPUPrograms (const HydraxComponent &Components, const Options &Options, const Ogre::String &AlphaChannel) |
| |
| bool | _createUnderwaterMaterial (const HydraxComponent &Components, const Options &Options) |
| |
| bool | _createUnderwaterCompositor (const HydraxComponent &Components, const Options &Options) |
| |
| bool | _createSimpleColorMaterial (const Ogre::ColourValue &MaterialColor, const MaterialType &MT, const Ogre::String &MaterialName, const bool &DepthCheck=true, const bool &DepthWrite=true) |
| |
◆ CompositorType
Compositor type enum.
| Enumerator |
|---|
| COMP_UNDERWATER | |
Definition at line 69 of file MaterialManager.h.
◆ GpuProgram
Gpu program enum.
| Enumerator |
|---|
| GPUP_VERTEX | |
| GPUP_FRAGMENT | |
Definition at line 78 of file MaterialManager.h.
◆ MaterialType
Material type enum.
| Enumerator |
|---|
| MAT_WATER | |
| MAT_DEPTH | |
| MAT_UNDERWATER | |
| MAT_UNDERWATER_COMPOSITOR | |
| MAT_SIMPLE_RED | |
| MAT_SIMPLE_BLACK | |
Definition at line 50 of file MaterialManager.h.
◆ NormalMode
Normal generation mode.
| Enumerator |
|---|
| NM_TEXTURE | |
| NM_VERTEX | |
| NM_RTT | |
Definition at line 100 of file MaterialManager.h.
◆ ShaderMode
◆ MaterialManager()
| Hydrax::MaterialManager::MaterialManager |
( |
Hydrax * |
h | ) |
|
◆ ~MaterialManager()
| Hydrax::MaterialManager::~MaterialManager |
( |
| ) |
|
◆ _createDepthMaterial()
| bool Hydrax::MaterialManager::_createDepthMaterial |
( |
const HydraxComponent & |
Components, |
|
|
const Options & |
Options |
|
) |
| |
|
private |
◆ _createDepthTextureGPUPrograms()
| bool Hydrax::MaterialManager::_createDepthTextureGPUPrograms |
( |
const HydraxComponent & |
Components, |
|
|
const Options & |
Options, |
|
|
const Ogre::String & |
AlphaChannel |
|
) |
| |
|
private |
Create depth texture gpu programs.
- Parameters
-
| Components | Components of the sahder |
| Options | Material options |
| AlphaChannel | "x","y","z","w" or "r","g","b","a" (Channel where alpha information is stored) |
- Returns
- true if no problems had happend, false if yes
Definition at line 1569 of file MaterialManager.cpp.
◆ _createSimpleColorMaterial()
| bool Hydrax::MaterialManager::_createSimpleColorMaterial |
( |
const Ogre::ColourValue & |
MaterialColor, |
|
|
const MaterialType & |
MT, |
|
|
const Ogre::String & |
MaterialName, |
|
|
const bool & |
DepthCheck = true, |
|
|
const bool & |
DepthWrite = true |
|
) |
| |
|
private |
◆ _createUnderwaterCompositor()
| bool Hydrax::MaterialManager::_createUnderwaterCompositor |
( |
const HydraxComponent & |
Components, |
|
|
const Options & |
Options |
|
) |
| |
|
private |
Create underwater compositor.
- Parameters
-
| Components | Components of the shader |
| Options | Material options |
Definition at line 2767 of file MaterialManager.cpp.
◆ _createUnderwaterMaterial()
| bool Hydrax::MaterialManager::_createUnderwaterMaterial |
( |
const HydraxComponent & |
Components, |
|
|
const Options & |
Options |
|
) |
| |
|
private |
Create underwater material.
- Parameters
-
| Components | Components of the shader |
| Options | Material options |
Definition at line 1808 of file MaterialManager.cpp.
◆ _createWaterMaterial()
| bool Hydrax::MaterialManager::_createWaterMaterial |
( |
const HydraxComponent & |
Components, |
|
|
const Options & |
Options |
|
) |
| |
|
private |
◆ _isComponent()
Is component in the given list?
- Parameters
-
| List | Components list |
| ToCheck | Component to check |
- Returns
- true if the component is in the given list.
Definition at line 3538 of file MaterialManager.cpp.
◆ addDepthTechnique()
| void Hydrax::MaterialManager::addDepthTechnique |
( |
Ogre::Technique * |
Technique, |
|
|
const bool & |
AutoUpdate = true |
|
) |
| |
Add depth technique to an especified material.
- Parameters
-
| Technique | Technique where depth technique will be added |
| AutoUpdate | The technique will be automatically updated when water parameters change |
Definition at line 3398 of file MaterialManager.cpp.
◆ addDepthTextureTechnique()
| void Hydrax::MaterialManager::addDepthTextureTechnique |
( |
Ogre::Technique * |
Technique, |
|
|
const Ogre::String & |
TextureName, |
|
|
const Ogre::String & |
AlphaChannel = "w", |
|
|
const bool & |
AutoUpdate = true |
|
) |
| |
Add depth texture technique to an especified material.
- Parameters
-
| Technique | Technique where depth technique will be added |
| TextureName | Texture name |
| AlphaChannel | "x","y","z","w" or "r","g","b","a" (Channel where alpha information is stored) |
| AutoUpdate | The technique will be automatically updated when water parameters change |
Definition at line 3453 of file MaterialManager.cpp.
◆ createGpuProgram()
| bool Hydrax::MaterialManager::createGpuProgram |
( |
const Ogre::String & |
Name, |
|
|
const ShaderMode & |
SM, |
|
|
const GpuProgram & |
GPUP, |
|
|
const Ogre::String & |
EntryPoint, |
|
|
const Ogre::String & |
Data |
|
) |
| |
Create GPU program.
- Parameters
-
| Name | HighLevelGpuProgram name |
| SM | Shader mode |
| GPUP | GpuProgram type |
| EntryPoint | Entry point |
| Data | |
Definition at line 261 of file MaterialManager.cpp.
◆ createMaterials()
◆ fillGpuProgramsToPass()
| bool Hydrax::MaterialManager::fillGpuProgramsToPass |
( |
Ogre::Pass * |
Pass, |
|
|
const Ogre::String |
GpuProgramNames[2], |
|
|
const ShaderMode & |
SM, |
|
|
const Ogre::String |
EntryPoints[2], |
|
|
const Ogre::String |
Data[2] |
|
) |
| |
Fill GPU vertex and fragment program to a pass.
- Parameters
-
| Pass | Pass to fill Gpu programs |
| GpuProgramNames | [0]: Vertex program name, [1]: Fragment program name |
| SM | Shader mode, note: Provided data strings will correspong with selected shader mode |
| EntryPoints | [0]: Vertex program entry point, [1]: Fragment program entry point |
| Data | [0] Vertex program data, [1]: Fragment program data |
Definition at line 239 of file MaterialManager.cpp.
◆ getCompositor()
| Ogre::CompositorPtr & Hydrax::MaterialManager::getCompositor |
( |
const CompositorType & |
Compositor | ) |
|
|
inline |
Get compositor.
- Parameters
-
- Returns
- Compositor to get
Definition at line 230 of file MaterialManager.h.
◆ getDepthTechniques()
| std::vector< Ogre::Technique * > & Hydrax::MaterialManager::getDepthTechniques |
( |
| ) |
|
|
inline |
Get external depth techniques.
- Returns
- std::vector of external depth techniques
Definition at line 285 of file MaterialManager.h.
◆ getLastOptions()
| const Options & Hydrax::MaterialManager::getLastOptions |
( |
| ) |
const |
|
inline |
◆ getMaterial()
| Ogre::MaterialPtr & Hydrax::MaterialManager::getMaterial |
( |
const MaterialType & |
Material | ) |
|
|
inline |
◆ isCompositorEnable()
| const bool & Hydrax::MaterialManager::isCompositorEnable |
( |
const CompositorType & |
Compositor | ) |
const |
|
inline |
Is the compositor enable?
- Parameters
-
| Compositor | compositor to check |
- Returns
- true if it's enabled
Definition at line 239 of file MaterialManager.h.
◆ isCreated()
| const bool & Hydrax::MaterialManager::isCreated |
( |
| ) |
const |
|
inline |
◆ reload()
| void Hydrax::MaterialManager::reload |
( |
const MaterialType & |
Material | ) |
|
◆ removeCompositor()
| void Hydrax::MaterialManager::removeCompositor |
( |
| ) |
|
◆ removeMaterials()
| void Hydrax::MaterialManager::removeMaterials |
( |
| ) |
|
◆ setCompositorEnable()
| void Hydrax::MaterialManager::setCompositorEnable |
( |
const CompositorType & |
Compositor, |
|
|
const bool & |
Enable |
|
) |
| |
Set a compositor enable/disable.
- Parameters
-
| Compositor | compositor to change |
| Enable | true to enable, false to disable |
Definition at line 3523 of file MaterialManager.cpp.
◆ setGpuProgramParameter() [1/3]
| void Hydrax::MaterialManager::setGpuProgramParameter |
( |
const GpuProgram & |
GpuP, |
|
|
const MaterialType & |
MType, |
|
|
const Ogre::String & |
Name, |
|
|
const Ogre::Real & |
Value |
|
) |
| |
Set gpu program Ogre::Real parameter.
- Parameters
-
| GpuP | Gpu program type (Vertex/Fragment) |
| MType | Water/Depth material |
| Name | param name |
| Value | value |
Definition at line 3558 of file MaterialManager.cpp.
◆ setGpuProgramParameter() [2/3]
| void Hydrax::MaterialManager::setGpuProgramParameter |
( |
const GpuProgram & |
GpuP, |
|
|
const MaterialType & |
MType, |
|
|
const Ogre::String & |
Name, |
|
|
const Ogre::Vector2 & |
Value |
|
) |
| |
Set gpu program Ogre::Vector2 parameter.
- Parameters
-
| GpuP | Gpu program type (Vertex/Fragment) |
| MType | Water/Depth material |
| Name | param name |
| Value | value |
Definition at line 3616 of file MaterialManager.cpp.
◆ setGpuProgramParameter() [3/3]
| void Hydrax::MaterialManager::setGpuProgramParameter |
( |
const GpuProgram & |
GpuP, |
|
|
const MaterialType & |
MType, |
|
|
const Ogre::String & |
Name, |
|
|
const Ogre::Vector3 & |
Value |
|
) |
| |
Set gpu program Ogre::Vector3 parameter.
- Parameters
-
| GpuP | Gpu program type (Vertex/Fragment) |
| MType | Water/Depth material |
| Name | param name |
| Value | value |
Definition at line 3674 of file MaterialManager.cpp.
◆ updateAnimatedTextures()
| void Hydrax::MaterialManager::updateAnimatedTextures |
( |
float |
dt | ) |
|
Animated textures must be updated manually to account for variable simulation time.
Definition at line 1547 of file MaterialManager.cpp.
◆ mCausticsAnimCurrentFrame
| unsigned int Hydrax::MaterialManager::mCausticsAnimCurrentFrame = 0 |
|
private |
◆ mCausticsAnimCurrentFrameElapsedTime
| float Hydrax::MaterialManager::mCausticsAnimCurrentFrameElapsedTime = 0.f |
|
private |
Time spent on current animation frame, cumulative.
Definition at line 384 of file MaterialManager.h.
◆ mCausticsAnimTexVec
| std::vector<Ogre::TextureUnitState*> Hydrax::MaterialManager::mCausticsAnimTexVec |
|
private |
◆ mComponents
◆ mCompositors
| Ogre::CompositorPtr Hydrax::MaterialManager::mCompositors[1] |
|
private |
◆ mCompositorsEnable
| bool Hydrax::MaterialManager::mCompositorsEnable[1] |
|
private |
◆ mCompositorsNeedToBeReloaded
| bool Hydrax::MaterialManager::mCompositorsNeedToBeReloaded[1] |
|
private |
◆ mCreated
| bool Hydrax::MaterialManager::mCreated |
|
private |
◆ mDepthTechniques
| std::vector<Ogre::Technique*> Hydrax::MaterialManager::mDepthTechniques |
|
private |
◆ mHydrax
| Hydrax* Hydrax::MaterialManager::mHydrax |
|
private |
◆ mMaterials
| Ogre::MaterialPtr Hydrax::MaterialManager::mMaterials[6] |
|
private |
◆ mOptions
| Options Hydrax::MaterialManager::mOptions |
|
private |
◆ mUnderwaterCompositorListener
The documentation for this class was generated from the following files: