Gazebo Rendering

API Reference

3.7.2
gz/rendering/ogre/OgreMaterial.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef GZ_RENDERING_OGRE_OGREMATERIAL_HH_
18 #define GZ_RENDERING_OGRE_OGREMATERIAL_HH_
19 
20 #include <string>
21 
22 #include <gz/common/SuppressWarning.hh>
23 
27 
28 namespace ignition
29 {
30  namespace rendering
31  {
32  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
33  // TODO(anyone): use a better way to find shader configurations
35  "depth_vertex_shader.glsl";
37  "depth_fragment_shader.glsl";
38 
39  class IGNITION_RENDERING_OGRE_VISIBLE OgreMaterial :
40  public BaseMaterial<OgreObject>
41  {
42  protected: OgreMaterial();
43 
44  public: virtual ~OgreMaterial();
45 
46  // Documentation inherited
47  public: virtual void Destroy() override;
48 
49  public: virtual bool LightingEnabled() const override;
50 
51  public: virtual void SetLightingEnabled(const bool _enabled) override;
52 
53  // Documentation inherited
54  public: virtual bool DepthCheckEnabled() const override;
55 
56  // Documentation inherited
57  public: virtual void SetDepthCheckEnabled(bool _enabled) override;
58 
59  // Documentation inherited
60  public: virtual bool DepthWriteEnabled() const override;
61 
62  // Documentation inherited
63  public: virtual void SetDepthWriteEnabled(bool _enabled) override;
64 
65  public: virtual math::Color Ambient() const override;
66 
67  public: virtual void SetAmbient(const math::Color &_color) override;
68 
69  public: virtual math::Color Diffuse() const override;
70 
71  public: virtual void SetDiffuse(const math::Color &_color) override;
72 
73  public: virtual math::Color Specular() const override;
74 
75  public: virtual void SetSpecular(const math::Color &_color) override;
76 
77  public: virtual math::Color Emissive() const override;
78 
79  public: virtual void SetEmissive(const math::Color &_color) override;
80 
81  public: virtual double Shininess() const override;
82 
83  public: virtual void SetShininess(const double _shininess) override;
84 
85  public: virtual double Transparency() const override;
86 
87  public: virtual void SetTransparency(const double _transparency)
88  override;
89 
90  public: virtual double Reflectivity() const override;
91 
92  public: virtual void SetReflectivity(const double _reflectivity)
93  override;
94 
95  public: virtual bool CastShadows() const override;
96 
97  // Documentation inherited.
98  public: virtual void SetCastShadows(const bool _castShadows) override;
99 
100  public: virtual bool ReceiveShadows() const override;
101 
102  public: virtual void SetReceiveShadows(const bool _receiveShadows)
103  override;
104 
105  public: virtual bool ReflectionEnabled() const override;
106 
107  public: virtual void SetReflectionEnabled(const bool _enabled) override;
108 
109  public: virtual bool HasTexture() const override;
110 
111  public: virtual std::string Texture() const override;
112 
113  // Documentation inherited.
114  public: virtual void SetTexture(const std::string &_texture) override;
115 
116  public: virtual void ClearTexture() override;
117 
118  public: virtual bool HasNormalMap() const override;
119 
120  public: virtual std::string NormalMap() const override;
121 
122  // Documentation inherited.
123  public: virtual void SetNormalMap(const std::string &_normalMap) override;
124 
125  public: virtual void ClearNormalMap() override;
126 
127  public: virtual enum ShaderType ShaderType() const override;
128 
129  // Documentation inherited.
130  public: virtual void SetShaderType(enum ShaderType _type) override;
131 
132  public: virtual Ogre::MaterialPtr Material() const;
133 
134  // Documentation inherited.
135  // \sa Material::Set3DMaterial()
136  public: virtual void SetDepthMaterial(const double far,
137  const double near) override;
138 
139  // Documentation inherited.
140  // \sa Material::SetVertexShader(const std::string &)
141  public: virtual void SetVertexShader(const std::string &_path) override;
142 
143  // Documentation inherited.
144  // \sa Material::VertexShader() const
145  public: virtual std::string VertexShader() const override;
146 
147  // Documentation inherited.
148  // \sa Material::VertexShaderParams()
149  public: virtual ShaderParamsPtr VertexShaderParams() override;
150 
151  // Documentation inherited.
152  // \sa Material::SetFragmentShader(const std::string &)
153  public: virtual void SetFragmentShader(const std::string &_path)
154  override;
155 
156  // Documentation inherited.
157  // \sa Material::FragmentShader() const
158  public: virtual std::string FragmentShader() const override;
159 
160  // Documentation inherited.
161  // \sa Material::FragmentShaderParams()
162  public: virtual ShaderParamsPtr FragmentShaderParams() override;
163 
164  // Documentation inherited.
165  // \sa BaseMaterial::PreRender()
166  public: virtual void PreRender() override;
167 
168  protected: virtual void LoadOneImage(const std::string &_name,
169  Ogre::Image &_image);
170 
173  protected: virtual void SetTextureImpl(const std::string &_texture);
174 
175  protected: virtual Ogre::TexturePtr Texture(const std::string &_name);
176 
177  protected: virtual Ogre::TexturePtr CreateTexture(
178  const std::string &_name);
179 
180  protected: virtual void UpdateTransparency();
181 
182  protected: virtual void UpdateColorOperation();
183 
185  protected: void UpdateShaderParams();
186 
190  protected: void UpdateShaderParams(ConstShaderParamsPtr _params,
191  Ogre::GpuProgramParametersSharedPtr _ogreParams);
192 
193  protected: virtual void Init() override;
194 
196  protected: Ogre::MaterialPtr ogreMaterial;
197 
198  protected: Ogre::Technique *ogreTechnique = nullptr;
199 
200  protected: Ogre::Pass *ogrePass = nullptr;
201 
202  protected: Ogre::TextureUnitState *ogreTexState = nullptr;
203 
204  protected: Ogre::String ogreGroup;
205 
206 #if OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR <= 7
207  protected: math::Color emissiveColor;
208 #endif
210 
212 
213  protected: enum ShaderType shaderType = ST_PIXEL;
214 
217 
220 
223 
227 
228  private: friend class OgreScene;
229  };
230  }
231  }
232 }
233 #endif
std::string vertexShaderPath
Path to vertex shader program.
Definition: gz/rendering/ogre/OgreMaterial.hh:216
STL class.
STL class.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
Definition: gz/rendering/ogre/OgreScene.hh:39
std::string normalMapName
Definition: gz/rendering/ogre/OgreMaterial.hh:211
const std::string depth_fragment_shader_file
Definition: gz/rendering/ogre/OgreMaterial.hh:36
Definition: gz/rendering/ogre/OgreMaterial.hh:39
Definition: gz/rendering/base/BaseMaterial.hh:38
std::string textureName
Definition: gz/rendering/ogre/OgreMaterial.hh:209
ShaderParamsPtr vertexShaderParams
Parameters to be bound to the vertex shader.
Definition: gz/rendering/ogre/OgreMaterial.hh:222
std::string fragmentShaderPath
Path to fragment shader program.
Definition: gz/rendering/ogre/OgreMaterial.hh:219
Ogre::String ogreGroup
Definition: gz/rendering/ogre/OgreMaterial.hh:204
Ogre::MaterialPtr ogreMaterial
Definition: gz/rendering/ogre/OgreMaterial.hh:196
@ ST_PIXEL
Per pixel lighting shader.
Definition: gz/rendering/ShaderType.hh:40
ShaderParamsPtr fragmentShaderParams
Parameters to be bound to the fragment shader.
Definition: gz/rendering/ogre/OgreMaterial.hh:225
ShaderType
Available types of shaders. Note that not all rendering-engines will be able to use each type....
Definition: gz/rendering/ShaderType.hh:34
Represents a surface material of a Geometry.
Definition: gz/rendering/Material.hh:47
const std::string depth_vertex_shader_file
Definition: gz/rendering/ogre/OgreMaterial.hh:34
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING