17 #ifndef IGNITION_RENDERING_BASE_BASEMATERIAL_HH_ 18 #define IGNITION_RENDERING_BASE_BASEMATERIAL_HH_ 40 public:
virtual void SetAmbient(
const double _r,
const double _g,
41 const double _b,
const double _a = 1.0);
43 public:
virtual void SetAmbient(
const math::Color &_color) = 0;
45 public:
virtual void SetDiffuse(
const double _r,
const double _g,
46 const double _b,
const double _a = 1.0);
48 public:
virtual void SetDiffuse(
const math::Color &_color) = 0;
50 public:
virtual void SetSpecular(
const double _r,
const double _g,
51 const double _b,
const double _a = 1.0);
53 public:
virtual void SetSpecular(
const math::Color &_color) = 0;
55 public:
virtual void SetEmissive(
const double _r,
const double _g,
56 const double _b,
const double _a = 1.0);
58 public:
virtual void SetEmissive(
const math::Color &_color) = 0;
60 public:
virtual void SetReceiveShadows(
const bool _receiveShadows) = 0;
62 public:
virtual void ClearTexture() = 0;
64 public:
virtual void ClearNormalMap() = 0;
66 public:
virtual void SetShaderType(
enum ShaderType _type) = 0;
70 public:
virtual void CopyFrom(
const common::Material &_material);
72 public:
virtual void PreRender();
74 protected:
virtual void Reset();
92 const double _b,
const double _a)
94 this->SetAmbient(math::Color(_r, _g, _b, _a));
100 const double _b,
const double _a)
102 this->SetDiffuse(math::Color(_r, _g, _b, _a));
108 const double _b,
const double _a)
110 this->SetSpecular(math::Color(_r, _g, _b, _a));
116 const double _b,
const double _a)
118 this->SetEmissive(math::Color(_r, _g, _b, _a));
125 auto baseShared = this->shared_from_this();
130 MaterialPtr material = T::Scene()->CreateMaterial(_name);
131 material->CopyFrom(thisShared);
139 this->SetLightingEnabled(_material->LightingEnabled());
140 this->SetAmbient(_material->Ambient());
141 this->SetDiffuse(_material->Diffuse());
142 this->SetSpecular(_material->Specular());
143 this->SetEmissive(_material->Emissive());
144 this->SetShininess(_material->Shininess());
145 this->SetTransparency(_material->Transparency());
146 this->SetReflectivity(_material->Reflectivity());
147 this->SetCastShadows(_material->CastShadows());
148 this->SetReceiveShadows(_material->ReceiveShadows());
149 this->SetReflectionEnabled(_material->ReflectionEnabled());
150 this->SetTexture(_material->Texture());
151 this->SetNormalMap(_material->NormalMap());
152 this->SetShaderType(_material->ShaderType());
159 this->SetLightingEnabled(_material.Lighting());
160 this->SetAmbient(_material.Ambient());
161 this->SetDiffuse(_material.Diffuse());
162 this->SetSpecular(_material.Specular());
163 this->SetEmissive(_material.Emissive());
164 this->SetShininess(_material.Shininess());
165 this->SetTransparency(_material.Transparency());
167 this->SetReflectivity(0);
168 this->SetTexture(_material.TextureImage());
170 this->SetCastShadows(
true);
172 this->SetReceiveShadows(
true);
174 this->SetReflectionEnabled(
true);
176 this->ClearNormalMap();
192 this->SetLightingEnabled(
true);
193 this->SetAmbient(0.3, 0.3, 0.3);
194 this->SetDiffuse(0.7, 0.7, 0.7);
195 this->SetSpecular(0.01, 0.01, 0.01);
196 this->SetEmissive(0, 0, 0);
197 this->SetShininess(1.5);
198 this->SetTransparency(0);
199 this->SetReflectivity(0);
200 this->SetCastShadows(
true);
201 this->SetReceiveShadows(
true);
202 this->SetReflectionEnabled(
true);
203 this->ClearTexture();
204 this->ClearNormalMap();
virtual void SetDiffuse(const double _r, const double _g, const double _b, const double _a=1.0)
Set the diffuse color.
Definition: BaseMaterial.hh:99
virtual void Reset()
Definition: BaseMaterial.hh:190
BaseMaterial()
Definition: BaseMaterial.hh:79
virtual void SetAmbient(const double _r, const double _g, const double _b, const double _a=1.0)
Set the ambient color.
Definition: BaseMaterial.hh:91
virtual void PreRender()
Prepare this object and any of its children for rendering. This should be called for each object in a...
Definition: BaseMaterial.hh:183
virtual void CopyFrom(ConstMaterialPtr _material)
Copy properties from given Material.
Definition: BaseMaterial.hh:137
virtual void SetEmissive(const double _r, const double _g, const double _b, const double _a=1.0)
Set the emissive color.
Definition: BaseMaterial.hh:115
T dynamic_pointer_cast(T... args)
virtual ~BaseMaterial()
Definition: BaseMaterial.hh:85
ShaderType
Available types of shaders. Note that not all rendering-engines will be able to use each type...
Definition: ShaderType.hh:31
Definition: BaseMaterial.hh:30
Shader shader.
Definition: ShaderType.hh:37
virtual void SetSpecular(const double _r, const double _g, const double _b, const double _a=1.0)
Set the specular color.
Definition: BaseMaterial.hh:107
Definition: ArrowVisual.hh:22
Represents a surface material of a Geometry.
Definition: Material.hh:34
virtual MaterialPtr Clone(const std::string &_name="") const
Clone this material.
Definition: BaseMaterial.hh:123