Go to the documentation of this file.
17 #ifndef GZ_RENDERING_OGRE2_OGRE2MATERIAL_HH_
18 #define GZ_RENDERING_OGRE2_OGRE2MATERIAL_HH_
27 #pragma warning(push, 0)
29 #include <Hlms/Pbs/OgreHlmsPbsPrerequisites.h>
30 #include <OgreGpuProgramParams.h>
31 #include <OgreMaterial.h>
38 class HlmsPbsDatablock;
39 class HlmsUnlitDatablock;
46 inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
49 class Ogre2MaterialPrivate;
62 public:
virtual void Destroy()
override;
65 public:
virtual math::Color Diffuse()
const override;
68 public:
virtual void SetDiffuse(
const math::Color &_color)
override;
71 public:
virtual math::Color Specular()
const override;
74 public:
virtual void SetSpecular(
const math::Color &_color)
override;
77 public:
virtual math::Color Emissive()
const override;
80 public:
virtual void SetEmissive(
const math::Color &_color)
override;
83 public:
virtual void SetTransparency(
const double _transparency)
override;
86 public:
virtual void SetAlphaFromTexture(
bool _enabled,
87 double _alpha = 0.5,
bool _twoSided =
true)
override;
90 public:
virtual float RenderOrder()
const override;
95 public:
virtual void SetRenderOrder(
const float _renderOrder)
override;
98 public:
virtual bool ReceiveShadows()
const override;
101 public:
virtual void SetReceiveShadows(
const bool _receiveShadows)
105 public:
virtual bool HasTexture()
const override;
108 public:
virtual std::string Texture()
const override;
111 public:
virtual void SetTexture(
const std::string &_texture)
override;
114 public:
virtual void ClearTexture()
override;
117 public:
virtual bool HasNormalMap()
const override;
120 public:
virtual std::string NormalMap()
const override;
123 public:
virtual void SetNormalMap(
const std::string &_normalMap)
override;
126 public:
virtual void ClearNormalMap()
override;
129 public:
virtual bool HasRoughnessMap()
const override;
132 public:
virtual std::string RoughnessMap()
const override;
135 public:
virtual void SetRoughnessMap(
139 public:
virtual void ClearRoughnessMap()
override;
142 public:
virtual bool HasMetalnessMap()
const override;
145 public:
virtual std::string MetalnessMap()
const override;
148 public:
virtual void SetMetalnessMap(
152 public:
virtual void ClearMetalnessMap()
override;
155 public:
virtual bool HasEnvironmentMap()
const override;
158 public:
virtual std::string EnvironmentMap()
const override;
161 public:
virtual void SetEnvironmentMap(
165 public:
virtual void ClearEnvironmentMap()
override;
168 public:
virtual void SetRoughness(
const float _roughness)
override;
171 public:
virtual bool HasEmissiveMap()
const override;
174 public:
virtual std::string EmissiveMap()
const override;
177 public:
virtual void SetEmissiveMap(
181 public:
virtual void ClearEmissiveMap()
override;
184 public:
virtual bool HasLightMap()
const override;
187 public:
virtual std::string LightMap()
const override;
190 public:
virtual unsigned int LightMapTexCoordSet()
const override;
193 public:
virtual void SetLightMap(
const std::string &_lightMap,
194 unsigned int _uvSet = 0u)
override;
197 public:
virtual void ClearLightMap()
override;
200 public:
virtual float Roughness()
const override;
203 public:
virtual void SetMetalness(
const float _roughness)
override;
206 public:
virtual float Metalness()
const override;
210 public:
virtual Ogre::MaterialPtr
Material();
214 public:
virtual Ogre::HlmsPbsDatablock *Datablock()
const;
218 public:
virtual Ogre::HlmsUnlitDatablock *UnlitDatablock();
223 public:
virtual void FillUnlitDatablock(
224 Ogre::HlmsUnlitDatablock *_datablock)
const;
228 public:
virtual void PreRender()
override;
231 public:
virtual enum MaterialType Type()
const override;
234 public:
virtual bool DepthCheckEnabled()
const override;
237 public:
virtual void SetDepthCheckEnabled(
bool _enabled)
override;
240 public:
virtual bool DepthWriteEnabled()
const override;
243 public:
virtual void SetDepthWriteEnabled(
bool _enabled)
override;
247 public:
virtual void SetVertexShader(
const std::string &_path)
override;
251 public:
virtual std::string VertexShader()
const override;
259 public:
virtual void SetFragmentShader(
const std::string &_path)
264 public:
virtual std::string FragmentShader()
const override;
274 protected:
virtual void SetTextureMapImpl(
const std::string &_texture,
275 Ogre::PbsTextureTypes _type);
279 protected:
virtual Ogre::TextureGpu *Texture(
const std::string &_name);
283 protected:
virtual void UpdateTransparency();
286 protected:
virtual void Init()
override;
289 protected:
void UpdateShaderParams();
295 Ogre::GpuProgramParametersSharedPtr _ogreParams);
301 protected: Ogre::HlmsPbsDatablock *ogreDatablock =
nullptr;
304 protected: Ogre::HlmsUnlitDatablock *ogreUnlitDatablock =
nullptr;
307 protected: Ogre::HlmsPbs *ogreHlmsPbs =
nullptr;
331 protected:
unsigned int lightMapUvSet = 0u;
MaterialType
An enum for the type of material.
Definition: gz/rendering/Material.hh:36
Definition: gz/rendering/ogre/OgreCamera.hh:27
std::string environmentMapName
Name of the environment map.
Definition: gz/rendering/ogre2/Ogre2Material.hh:322
std::string metalnessMapName
Name of the metalness map.
Definition: gz/rendering/ogre2/Ogre2Material.hh:319
std::string emissiveMapName
Name of the emissive map.
Definition: gz/rendering/ogre2/Ogre2Material.hh:325
std::string lightMapName
Name of the light map.
Definition: gz/rendering/ogre2/Ogre2Material.hh:328
std::string normalMapName
Name of the normal map.
Definition: gz/rendering/ogre2/Ogre2Material.hh:313
Definition: gz/rendering/base/BaseMaterial.hh:38
std::string textureName
Name of the texture.
Definition: gz/rendering/ogre2/Ogre2Material.hh:310
std::string roughnessMapName
Name of the roughness map.
Definition: gz/rendering/ogre2/Ogre2Material.hh:316
Ogre2.x implementation of the scene class.
Definition: gz/rendering/ogre2/Ogre2Scene.hh:57
Ogre 2.x implementation of the material class.
Definition: gz/rendering/ogre2/Ogre2Material.hh:52
std::string ogreDatablockId
Unique id assigned to ogre hlms datablock.
Definition: gz/rendering/ogre2/Ogre2Material.hh:334
Represents a surface material of a Geometry.
Definition: gz/rendering/Material.hh:47
Ogre::MaterialPtr ogreMaterial
Ogre material. Mainly used for render targets.
Definition: gz/rendering/ogre2/Ogre2Material.hh:298