You.i Engine
YiMaterial.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_MATERIAL_H_
3 #define _YI_MATERIAL_H_
4 
7 #include "framework/YiPredef.h"
11 #include "utility/YiColor.h"
12 
13 #include <glm/fwd.hpp>
14 
27 {
28 public:
32  CYIMaterial();
33 
37  ~CYIMaterial();
38 
43  std::shared_ptr<CYIAssetTextureBase> GetTexture(uint32_t slot) const;
44 
58  void SetTexture(uint32_t slot, const std::shared_ptr<CYIAssetTextureBase> &pTexture, float *pTextureMatrix = nullptr);
59  void SetTexture(uint32_t slot, const std::shared_ptr<CYIAssetTextureBase> &pTexture, const glm::mat3 textureMatrix);
60 
64  const glm::mat3 &GetTextureMatrix(uint32_t slot) const;
65 
70  const std::shared_ptr<CYIAssetShaderProgram> &GetShaderProgram() const;
71 
76  const std::shared_ptr<IYIUniformBufferObject> &GetShaderUniforms() const;
77 
81  void SetShaderProgram(const std::shared_ptr<CYIAssetShaderProgram> &pShaderProgram);
82 
86  const std::map<uint32_t, std::shared_ptr<CYIAssetTextureBase>> &GetTextureBindings() const;
87 
92  void ClearTextureSlot(uint32_t slot);
93 
98 
103 
107  void SetColor(const CYIColor &color);
108 
112  const CYIColor &GetColor() const;
113 
117  void SetCullFace(CYIRenderSystem::CullFace cullingMode);
118 
123 
127  bool IsLoaded() const;
128 
129 private:
130  uint32_t GetMaxTexUnits() const;
131 
132  std::map<uint32_t, std::shared_ptr<CYIAssetTextureBase>> m_textureBindings;
133  std::map<uint32_t, glm::mat3> m_textureMatrix;
134  std::shared_ptr<IYIUniformBufferObject> m_pShaderUniforms;
135  std::shared_ptr<CYIAssetShaderProgram> m_pShaderProgram;
136  uint32_t m_maxTexUnits;
137  CYIRenderSystem::BlendMode m_BlendMode;
138  CYIRenderSystem::CullFace m_cullFace;
139  CYIColor m_Color;
140  mutable bool m_isLoaded;
141 };
142 
145 #endif /* _YI_MATERIAL_H_ */
std::shared_ptr< CYIAssetTextureBase > GetTexture(uint32_t slot) const
BlendMode
Definition: YiRenderSystem.h:34
const std::shared_ptr< IYIUniformBufferObject > & GetShaderUniforms() const
void ClearTextureSlot(uint32_t slot)
CYIMaterial is a place holder for all the drawing parameters required by the renderer to draw a mesh/...
Definition: YiMaterial.h:26
const CYIColor & GetColor() const
const std::shared_ptr< CYIAssetShaderProgram > & GetShaderProgram() const
void SetBlendMode(CYIRenderSystem::BlendMode mode)
void SetColor(const CYIColor &color)
CullFace
Definition: YiRenderSystem.h:111
bool IsLoaded() const
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
void SetCullFace(CYIRenderSystem::CullFace cullingMode)
const glm::mat3 & GetTextureMatrix(uint32_t slot) const
A class used to represent a color value.
Definition: YiColor.h:31
CYIRenderSystem::CullFace GetCullFace() const
void SetShaderProgram(const std::shared_ptr< CYIAssetShaderProgram > &pShaderProgram)
CYIRenderSystem::BlendMode GetBlendMode() const