Implemented cylinder shape, also fixed the coordinate system (again). I fucking hate...
[fail.git] / scenegraph / Material.h
blobee7180041e3746c38ad07f3cb7313ed83e479b9a
1 #ifndef AWFUL_SCENEGRAPH_MATERIAL_H_
2 #define AWFUL_SCENEGRAPH_MATERIAL_H_
4 #include "core/core.h"
5 #include "Vector4fInput.h"
6 #include <GL/gl.h>
8 namespace awful { namespace scenegraph
10 class Material : public Serializable
12 public:
13 enum Channel
15 c_None = -1,
16 c_Emission = GL_EMISSION,
17 c_Ambient = GL_AMBIENT,
18 c_Diffuse = GL_DIFFUSE,
19 c_Specular = GL_SPECULAR,
20 c_AmbientAndDiffuse = GL_AMBIENT_AND_DIFFUSE
23 Material() :
24 m_VertexColorChannel( c_None ),
25 m_Shininess( 0.0f ),
26 m_bLighting( true ),
27 m_bDepthTest( true ),
28 m_bSmoothShading( true ),
29 m_bBackfaceCulling( true )
31 m_Ambient.value() = math::Vector4f( 0.f, 0.f, 0.f, 1.f );
32 m_Diffuse.value() = math::Vector4f( 0.f, 0.f, 0.f, 1.f );
35 Material( const Serialization_tag& ) {}
37 bool operator==( const Material& b ) const;
38 bool operator<( const Material& b ) const;
40 const Vector4fInput& getAmbient() const { return m_Ambient; }
41 Vector4fInput& getAmbient() { return m_Ambient; }
42 void setAmbient( const Vector4fInput& x ) { m_Ambient = x; }
44 const Vector4fInput& getDiffuse() const { return m_Diffuse; }
45 Vector4fInput& getDiffuse() { return m_Diffuse; }
46 void setDiffuse( const Vector4fInput& x ) { m_Diffuse = x; }
48 const Vector4fInput& getSpecular() const { return m_Specular; }
49 Vector4fInput& getSpecular() { return m_Specular; }
50 void setSpecular( const Vector4fInput& x ) { m_Specular = x; }
52 const Vector4fInput& getEmission() const { return m_Emission; }
53 Vector4fInput& getEmission() { return m_Emission; }
54 void setEmission( const Vector4fInput& x ) { m_Emission = x; }
56 const float& getShininess() const { return m_Shininess; }
57 void setShininess( const float& x ) { m_Shininess = x; }
59 const Channel& getVertexColorChannel() const { return m_VertexColorChannel; }
60 void setVertexColorChannel( const Channel& x ) { m_VertexColorChannel = x; }
62 const bool& getbLighting() const { return m_bLighting; }
63 void setbLighting( const bool& x ) { m_bLighting = x; }
65 const bool& getbDepthTest() const { return m_bDepthTest; }
66 void setbDepthTest( const bool& x ) { m_bDepthTest = x; }
68 const bool& getbSmoothShading() const { return m_bSmoothShading; }
69 void setbSmoothShading( const bool& x ) { m_bSmoothShading = x; }
71 const bool& getbBackfaceCulling() const { return m_bBackfaceCulling; }
72 void setbBackfaceCulling( const bool& x ) { m_bBackfaceCulling = x; }
74 void renderSetup() const;
76 private:
77 template< class C, typename T > friend struct awful::attribute_traits;
79 Channel m_VertexColorChannel;
81 Vector4fInput m_Ambient;
82 Vector4fInput m_Diffuse;
83 Vector4fInput m_Specular;
84 Vector4fInput m_Emission;
85 float m_Shininess;
87 bool m_bLighting;
88 bool m_bDepthTest;
89 bool m_bSmoothShading;
90 bool m_bBackfaceCulling;
94 #endif