You.i Engine
YiMaterial.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_MATERIAL_H_
3 #define _YI_MATERIAL_H_
4 
8 #include "framework/YiPredef.h"
12 #include "utility/YiColor.h"
13 
14 #include <glm/fwd.hpp>
15 
28 {
29 public:
33  CYIMaterial();
34 
38  ~CYIMaterial();
39 
44  std::shared_ptr<CYIAssetTextureBase> GetTexture(uint32_t slot) const;
45 
59  void SetTexture(uint32_t slot, const std::shared_ptr<CYIAssetTextureBase> &pTexture, float *pTextureMatrix = nullptr);
60  void SetTexture(uint32_t slot, const std::shared_ptr<CYIAssetTextureBase> &pTexture, const glm::mat3 textureMatrix);
61 
65  const glm::mat3 &GetTextureMatrix(uint32_t slot) const;
66 
71  const std::shared_ptr<CYIAssetShaderProgram> &GetShaderProgram() const;
72 
77  const std::shared_ptr<IYIUniformBufferObject> &GetShaderUniforms() const;
78 
82  void SetShaderProgram(const std::shared_ptr<CYIAssetShaderProgram> &pShaderProgram);
83 
87  const std::map<uint32_t, std::shared_ptr<CYIAssetTextureBase>> &GetTextureBindings() const;
88 
93  void ClearTextureSlot(uint32_t slot);
94 
99 
104 
108  void SetColor(const CYIColor &color);
109 
113  const CYIColor &GetColor() const;
114 
118  void SetCullFace(CYIRenderSystem::YI_CULL_FACE eCullingMode);
119 
124 
128  bool IsLoaded() const;
129 
130 private:
131  uint32_t GetMaxTexUnits() const;
132 
133  std::map<uint32_t, std::shared_ptr<CYIAssetTextureBase>> m_textureBindings;
134  std::map<uint32_t, glm::mat3> m_textureMatrix;
135  std::shared_ptr<IYIUniformBufferObject> m_pShaderUniforms;
136  std::shared_ptr<CYIAssetShaderProgram> m_pShaderProgram;
137  uint32_t m_nMaxTexUnits;
138  CYIRenderSystem::YI_BLEND_MODE m_BlendMode;
139  CYIRenderSystem::YI_CULL_FACE m_eCullFace;
140  CYIColor m_Color;
141  mutable bool m_bIsLoaded;
142 };
143 
146 #endif /* _YI_MATERIAL_H_ */
YI_BLEND_MODE
Definition: YiRenderSystem.h:36
const std::shared_ptr< IYIUniformBufferObject > & GetShaderUniforms() const
void ClearTextureSlot(uint32_t slot)
const CYIColor & GetColor() const
CYIMaterial is a place holder for all the drawing parameters required by the renderer to draw a mesh/...
Definition: YiMaterial.h:27
The base class for an object accessible from script source code.
Definition: YiScriptableObject.h:28
CYIRenderSystem::YI_BLEND_MODE GetBlendMode() const
CYIRenderSystem::YI_CULL_FACE GetCullFace() const
const glm::mat3 & GetTextureMatrix(uint32_t slot) const
YI_CULL_FACE
Definition: YiRenderSystem.h:113
void SetColor(const CYIColor &color)
const std::shared_ptr< CYIAssetShaderProgram > & GetShaderProgram() const
bool IsLoaded() const
void SetCullFace(CYIRenderSystem::YI_CULL_FACE eCullingMode)
void SetBlendMode(CYIRenderSystem::YI_BLEND_MODE mode)
void SetTexture(uint32_t slot, const std::shared_ptr< CYIAssetTextureBase > &pTexture, float *pTextureMatrix=nullptr)
const std::map< uint32_t, std::shared_ptr< CYIAssetTextureBase > > & GetTextureBindings() const
A class used to represent a color value.
Definition: YiColor.h:31
void SetShaderProgram(const std::shared_ptr< CYIAssetShaderProgram > &pShaderProgram)
std::shared_ptr< CYIAssetTextureBase > GetTexture(uint32_t slot) const