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 GZ_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,
119 public:
virtual void ClearTexture()
override;
122 public:
virtual bool HasNormalMap()
const override;
125 public:
virtual std::string NormalMap()
const override;
132 public:
virtual void SetNormalMap(
const std::string &_normalMap,
136 public:
virtual void ClearNormalMap()
override;
139 public:
virtual bool HasRoughnessMap()
const override;
142 public:
virtual std::string RoughnessMap()
const override;
149 public:
virtual void SetRoughnessMap(
const std::string &_roughnessMap,
153 public:
virtual void ClearRoughnessMap()
override;
156 public:
virtual bool HasMetalnessMap()
const override;
159 public:
virtual std::string MetalnessMap()
const override;
166 public:
virtual void SetMetalnessMap(
const std::string &_metalnessMap,
170 public:
virtual void ClearMetalnessMap()
override;
173 public:
virtual bool HasEnvironmentMap()
const override;
176 public:
virtual std::string EnvironmentMap()
const override;
183 public:
virtual void SetEnvironmentMap(
188 public:
virtual void ClearEnvironmentMap()
override;
191 public:
virtual void SetRoughness(
const float _roughness)
override;
194 public:
virtual bool HasEmissiveMap()
const override;
197 public:
virtual std::string EmissiveMap()
const override;
204 public:
virtual void SetEmissiveMap(
209 public:
virtual void ClearEmissiveMap()
override;
212 public:
virtual bool HasLightMap()
const override;
215 public:
virtual std::string LightMap()
const override;
218 public:
virtual unsigned int LightMapTexCoordSet()
const override;
221 public:
virtual void SetLightMap(
const std::string &_lightMap,
223 unsigned int _uvSet = 0u)
override;
230 public:
virtual void ClearLightMap()
override;
233 public:
virtual float Roughness()
const override;
236 public:
virtual void SetMetalness(
const float _roughness)
override;
239 public:
virtual float Metalness()
const override;
243 public:
virtual Ogre::MaterialPtr
Material();
247 public:
virtual Ogre::HlmsPbsDatablock *Datablock()
const;
251 public:
virtual Ogre::HlmsUnlitDatablock *UnlitDatablock();
256 public:
virtual void FillUnlitDatablock(
257 Ogre::HlmsUnlitDatablock *_datablock)
const;
261 public:
virtual void PreRender()
override;
264 public:
virtual enum MaterialType Type()
const override;
267 public:
virtual bool DepthCheckEnabled()
const override;
270 public:
virtual void SetDepthCheckEnabled(
bool _enabled)
override;
273 public:
virtual bool DepthWriteEnabled()
const override;
276 public:
virtual void SetDepthWriteEnabled(
bool _enabled)
override;
280 public:
virtual void SetVertexShader(
const std::string &_path)
override;
284 public:
virtual std::string VertexShader()
const override;
292 public:
virtual void SetFragmentShader(
const std::string &_path)
297 public:
virtual std::string FragmentShader()
const override;
307 protected:
virtual void SetTextureMapImpl(
const std::string &_texture,
308 Ogre::PbsTextureTypes _type);
316 protected:
void SetTextureMapDataImpl(
const std::string& _texture,
318 Ogre::PbsTextureTypes _type);
322 protected:
virtual Ogre::TextureGpu *Texture(
const std::string &_name);
326 protected:
virtual void UpdateTransparency();
329 protected:
virtual void Init()
override;
332 protected:
void UpdateShaderParams();
338 Ogre::GpuProgramParametersSharedPtr _ogreParams);
344 protected: Ogre::HlmsPbsDatablock *ogreDatablock =
nullptr;
347 protected: Ogre::HlmsUnlitDatablock *ogreUnlitDatablock =
nullptr;
350 protected: Ogre::HlmsPbs *ogreHlmsPbs =
nullptr;
374 protected:
unsigned int lightMapUvSet = 0u;