V-ART
material.h
Go to the documentation of this file.
1 
5 #ifndef VART_MATERIAL_H
6 #define VART_MATERIAL_H
7 
8 #include "vart/texture.h"
9 #include "vart/color.h"
10 
11 namespace VART {
16  class Material {
17  public:
18  // Public Methods
19  Material();
20 
22  Material(const Material& m);
23 
25  Material(const Color& c);
26 
28  Material(const Texture& t);
29 
31  Material(const Color& c, float spc, float amb, float ems, float shi);
32 
34  Material& operator=(const Material& m);
35 
37 
40  void SetPlasticColor(const VART::Color& c);
41 
43  void SetDiffuseColor(const Color& c) { color = c; }
44 
46  const Color& GetDiffuseColor() const { return color; }
47 
49  void SetSpecularColor(const Color& c) { specular = c; }
50 
52  const Color& GetSpecularColor() const { return specular; }
53 
55  void SetAmbientColor(const Color& c) { ambient = c; }
56 
58  const Color& GetAmbientColor() const { return ambient; }
59 
61  void SetEmissiveColor(const Color& c) { emissive = c; }
62 
64  const Color& GetEmissiveColor() const { return emissive; }
65 
67  void SetTexture(const Texture& t);
68 
70  bool HasTexture() const { return texture.HasData(); }
71 
73  const VART::Texture& GetTexture() const { return texture; }
74 
76 
79  void SetShininess(float newValue) { shininess = newValue; }
80 
82  float GetShininess() const { return shininess; }
83 
86  bool DrawOGL() const;
87 
88  // Public Static Methods
89  static const Material& LIGHT_PLASTIC_GRAY();
90  static const Material& DARK_PLASTIC_GRAY();
91  static const Material& PLASTIC_WHITE();
92  static const Material& PLASTIC_RED();
93  static const Material& PLASTIC_GREEN();
94  static const Material& PLASTIC_BLUE();
95  static const Material& PLASTIC_BLACK();
96  private:
98  Color color;
100  Color emissive;
102  Color ambient;
104  Color specular;
106  Texture texture;
108  float shininess;
109  }; // end class declaration
110 } // end namespace
111 
112 #endif
Material & operator=(const Material &m)
Copies all texture data from one to another.
Definition: material.cpp:44
const Color & GetEmissiveColor() const
Returns the emissive color of the material.
Definition: material.h:64
const Color & GetSpecularColor() const
Returns the specular color of the material.
Definition: material.h:52
void SetEmissiveColor(const Color &c)
Sets the emissive color of the material.
Definition: material.h:61
void SetPlasticColor(const VART::Color &c)
Makes the material to have a plastic-looking of given color.
Definition: material.cpp:55
const Color & GetAmbientColor() const
Returns the ambient color of the material.
Definition: material.h:58
static const Material & PLASTIC_BLUE()
Definition: material.cpp:94
void SetShininess(float newValue)
Set the shininess of the material.
Definition: material.h:79
static const Material & DARK_PLASTIC_GRAY()
Definition: material.cpp:70
bool HasData() const
Indicates if a texture object contains data.
Definition: texture.h:92
void SetAmbientColor(const Color &c)
Sets the ambient color of the material.
Definition: material.h:55
RGBA color representation.
Definition: color.h:24
const Color & GetDiffuseColor() const
Returns the diffuse color.
Definition: material.h:46
Header file for V-ART class "Texture".
static const Material & PLASTIC_WHITE()
Definition: material.cpp:76
void SetTexture(const Texture &t)
Sets the texture of material.
Definition: material.cpp:106
void SetSpecularColor(const Color &c)
Sets the specular color (highlight color) of the material.
Definition: material.h:49
static const Material & LIGHT_PLASTIC_GRAY()
Definition: material.cpp:64
static const Material & PLASTIC_BLACK()
Definition: material.cpp:100
2D image to use as texture.
Definition: texture.h:48
void SetDiffuseColor(const Color &c)
Sets the diffuse color (main color) of the material.
Definition: material.h:43
float GetShininess() const
Return the shininess of the material.
Definition: material.h:82
Material properties for graphical objects.
Definition: material.h:16
Header file for V-ART class "Color".
static const Material & PLASTIC_RED()
Definition: material.cpp:82
bool DrawOGL() const
Draws the material using OpenGL engine.
Definition: material.cpp:111
bool HasTexture() const
Indicates if a material contains texture.
Definition: material.h:70
static const Material & PLASTIC_GREEN()
Definition: material.cpp:88
const VART::Texture & GetTexture() const
Returns the current texture of material.
Definition: material.h:73