Material.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <etk/math/Vector3D.hpp>
10 #include <etk/math/Vector4D.hpp>
11 #include <gale/resource/Program.hpp>
12 #include <ewol/resource/Image.hpp>
13 
14 namespace ege {
18  class MaterialGlId {
19  public:
20  // GL index
21  int32_t m_GL_ambientFactor;
22  int32_t m_GL_diffuseFactor;
23  int32_t m_GL_specularFactor;
24  int32_t m_GL_shininess;
25  int32_t m_GL_texture0;
26  MaterialGlId();
27  void link(ememory::SharedPtr<gale::resource::Program> _prog, const std::string& _baseName);
28  };
29 
30 
31  class Material {
32  private:
33  // values
34  vec4 m_ambientFactor;
35  vec4 m_diffuseFactor;
36  vec4 m_specularFactor;
37  float m_shininess;
38  enum gale::openGL::renderMode m_renderMode; // Select Render mode (triangle/Line/point ...)
40  public:
41  std::vector<uint32_t> m_listIndexFaces;
42  public:
43  Material();
44  ~Material();
46  void setAmbientFactor(const vec4& _val) {
47  m_ambientFactor = _val;
48  }
49  void setDiffuseFactor(const vec4& _val) {
50  m_diffuseFactor = _val;
51  }
52  void setSpecularFactor(const vec4& _val) {
53  m_specularFactor = _val;
54  }
55  void setShininess(float _val) {
56  m_shininess = _val;
57  }
58  void setRenderMode(enum gale::openGL::renderMode _val);
59  enum gale::openGL::renderMode getRenderModeOpenGl();
60  enum gale::openGL::renderMode getRenderMode() {
61  return m_renderMode;
62  }
63  void setTexture0(const std::string& _filename);
64  void setTexture0Magic(const ivec2& _size);
65 
66  void setImageSize(const ivec2& _newSize) {
67  if (m_texture0 == nullptr){
68  return;
69  }
70  m_texture0->setImageSize(_newSize);
71  };
72  // get the reference on this image to draw nomething on it ...
73  egami::Image* get() {
74  if (m_texture0 == nullptr){
75  return nullptr;
76  }
77  return &m_texture0->get();
78  };
79  // flush the data to send it at the openGl system
80  void flush() {
81  if (m_texture0 == nullptr){
82  return;
83  }
84  m_texture0->flush();
85  };
86  };
87 }
88 
89 
const EMEMORY_TYPE * get() const
Definition: AudioElement.hpp:8
Definition: Material.hpp:18
Definition: Material.hpp:31