25#ifndef _Hydrax_MaterialManager_H_
26#define _Hydrax_MaterialManager_H_
191 const Ogre::String GpuProgramNames[2],
193 const Ogre::String EntryPoints[2],
194 const Ogre::String Data[2]);
206 const Ogre::String& EntryPoint,
207 const Ogre::String& Data);
223 return mMaterials[
static_cast<int>(Material)];
267 void addDepthTechnique(Ogre::Technique *Technique,
const bool& AutoUpdate =
true);
280 void addDepthTextureTechnique(Ogre::Technique *Technique,
const Ogre::String& TextureName,
const Ogre::String& AlphaChannel =
"w",
const bool& AutoUpdate =
true);
358 bool _createSimpleColorMaterial(
const Ogre::ColourValue& MaterialColor,
const MaterialType& MT,
const Ogre::String& MaterialName,
const bool& DepthCheck =
true,
const bool& DepthWrite =
true);
Underwater compositor listener.
void notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat)
On material render.
MaterialManager * mMaterialManager
Material manager parent pointer.
void notifyMaterialSetup(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat)
On material setup.
Material/Shader manager class.
~MaterialManager()
Destructor.
bool _isComponent(const HydraxComponent &List, const HydraxComponent &ToCheck) const
Is component in the given list?
void 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.
bool _createDepthTextureGPUPrograms(const HydraxComponent &Components, const Options &Options, const Ogre::String &AlphaChannel)
Create depth texture gpu programs.
void removeCompositor()
Remove compositor.
Options mOptions
Actual material options.
bool _createWaterMaterial(const HydraxComponent &Components, const Options &Options)
Create water material.
float mCausticsAnimCurrentFrameElapsedTime
Time spent on current animation frame, cumulative.
Ogre::CompositorPtr mCompositors[1]
Hydrax compositors vector.
bool _createUnderwaterMaterial(const HydraxComponent &Components, const Options &Options)
Create underwater material.
bool mCompositorsNeedToBeReloaded[1]
Hydrax compositors boolean: Need to be reloaded?
void reload(const MaterialType &Material)
Reload material.
const bool & isCompositorEnable(const CompositorType &Compositor) const
Is the compositor enable?
bool _createUnderwaterCompositor(const HydraxComponent &Components, const Options &Options)
Create underwater compositor.
Ogre::MaterialPtr & getMaterial(const MaterialType &Material)
Get material.
bool _createSimpleColorMaterial(const Ogre::ColourValue &MaterialColor, const MaterialType &MT, const Ogre::String &MaterialName, const bool &DepthCheck=true, const bool &DepthWrite=true)
bool mCompositorsEnable[1]
Hydrax compostor enable vector.
Ogre::CompositorPtr & getCompositor(const CompositorType &Compositor)
Get compositor.
std::vector< Ogre::TextureUnitState * > mCausticsAnimTexVec
Caustics animated texture, for manual updating.
std::vector< Ogre::Technique * > mDepthTechniques
Technique vector for addDepthTechnique(...)
void setCompositorEnable(const CompositorType &Compositor, const bool &Enable)
Set a compositor enable/disable.
bool createMaterials(const HydraxComponent &Components, const Options &Options)
Create materials.
bool mCreated
Is createMaterials() already called?
const Options & getLastOptions() const
Get the last MaterialManager::Options used in a material generation.
HydraxComponent mComponents
Actual material components.
const bool & isCreated() const
Is createMaterials() already called?
bool 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.
void removeMaterials()
Remove materials.
CompositorType
Compositor type enum.
GpuProgram
Gpu program enum.
NormalMode
Normal generation mode.
std::vector< Ogre::Technique * > & getDepthTechniques()
Get external depth techniques.
Hydrax * mHydrax
Hydrax main pointer.
void addDepthTechnique(Ogre::Technique *Technique, const bool &AutoUpdate=true)
Add depth technique to an especified material.
bool createGpuProgram(const Ogre::String &Name, const ShaderMode &SM, const GpuProgram &GPUP, const Ogre::String &EntryPoint, const Ogre::String &Data)
Create GPU program.
Ogre::MaterialPtr mMaterials[6]
Hydrax materials vector.
MaterialType
Material type enum.
@ MAT_UNDERWATER_COMPOSITOR
bool _createDepthMaterial(const HydraxComponent &Components, const Options &Options)
Create depth material.
unsigned int mCausticsAnimCurrentFrame
void updateAnimatedTextures(float dt)
Animated textures must be updated manually to account for variable simulation time.
void setGpuProgramParameter(const GpuProgram &GpuP, const MaterialType &MType, const Ogre::String &Name, const Ogre::Real &Value)
Set gpu program Ogre::Real parameter.
UnderwaterCompositorListener mUnderwaterCompositorListener
Underwater compositor listener.
HydraxComponent
Hydrax flags to select components wich we want to use.
NormalMode NM
Normal map generation mode.
ShaderMode SM
Shader mode.
Options()
Default constructor.
Options(const ShaderMode &_SM, const NormalMode &_NM)
Constructor.