Phongo Clap RT  1.0
Simple Raytracing Renderer
Material.h
Go to the documentation of this file.
1 #ifndef _MATERIAL_H_
2 #define _MATERIAL_H_
3 
7 
8 #include <ngl/Colour.h>
9 #include <cmath>
10 #include "Ray.h"
11 
12 class Material
13 {
14 public:
15  /* METHODS */
16  //--------------------------------------------------------------------------------------------------------------------
18  // -------------------------------------------------------------------------------------------------------------------
19  Material();
20  //--------------------------------------------------------------------------------------------------------------------
23  // -------------------------------------------------------------------------------------------------------------------
24  Material(ngl::Colour _c);
25  //--------------------------------------------------------------------------------------------------------------------
28  // -------------------------------------------------------------------------------------------------------------------
29  Material(ngl::Colour _c1, ngl::Colour _c2 );
30  //--------------------------------------------------------------------------------------------------------------------
32  // -------------------------------------------------------------------------------------------------------------------
33  bool isReflective();
34  //--------------------------------------------------------------------------------------------------------------------
36  // -------------------------------------------------------------------------------------------------------------------
37  bool isRefractive();
38  //--------------------------------------------------------------------------------------------------------------------
40  // -------------------------------------------------------------------------------------------------------------------
41  void setHardness(float _highlight_size);
42  //--------------------------------------------------------------------------------------------------------------------
46  // -------------------------------------------------------------------------------------------------------------------
47  void setReflection(float _refl_intensity, float _diffuse_intensity);
48  //--------------------------------------------------------------------------------------------------------------------
53  // -------------------------------------------------------------------------------------------------------------------
54  void setRefraction(float _ior, float _transparency, float _diffuse_intensity);
55  //--------------------------------------------------------------------------------------------------------------------
58  // -------------------------------------------------------------------------------------------------------------------
59  float getReflIntensity();
60  //--------------------------------------------------------------------------------------------------------------------
63  // -------------------------------------------------------------------------------------------------------------------
64  float getIOR();
65  //--------------------------------------------------------------------------------------------------------------------
68  // -------------------------------------------------------------------------------------------------------------------
69  float getTransparency();
70  //--------------------------------------------------------------------------------------------------------------------
73  // -------------------------------------------------------------------------------------------------------------------
74  float getDiffuseIntensity();
75  //--------------------------------------------------------------------------------------------------------------------
78  // -------------------------------------------------------------------------------------------------------------------
79  ngl::Colour objColour();
80  //--------------------------------------------------------------------------------------------------------------------
84  // -------------------------------------------------------------------------------------------------------------------
85  ngl::Colour objColour(ngl::Vec3 &_isect);
86 
87 
88  /* ATTRIBUTES */
89  //--------------------------------------------------------------------------------------------------------------------
91  // -------------------------------------------------------------------------------------------------------------------
92  bool m_isReflective = false;
93  //--------------------------------------------------------------------------------------------------------------------
95  // -------------------------------------------------------------------------------------------------------------------
96  bool m_isRefractive = false;
97  //--------------------------------------------------------------------------------------------------------------------
99  // -------------------------------------------------------------------------------------------------------------------
101  //--------------------------------------------------------------------------------------------------------------------
103  // -------------------------------------------------------------------------------------------------------------------
105  //--------------------------------------------------------------------------------------------------------------------
107  // -------------------------------------------------------------------------------------------------------------------
108  float m_ior;
109  //--------------------------------------------------------------------------------------------------------------------
111  // -------------------------------------------------------------------------------------------------------------------
113  //--------------------------------------------------------------------------------------------------------------------
115  // -------------------------------------------------------------------------------------------------------------------
116  float m_spec_hardness = 40;
117 
118  //--------------------------------------------------------------------------------------------------------------------
120  // -------------------------------------------------------------------------------------------------------------------
121  ngl::Colour m_colour1;
122  //--------------------------------------------------------------------------------------------------------------------
124  // -------------------------------------------------------------------------------------------------------------------
125  ngl::Colour m_colour2;
126  //--------------------------------------------------------------------------------------------------------------------
128  // -------------------------------------------------------------------------------------------------------------------
130 };
131 
132 #endif // Material.h
Material()
Material constructor.
Definition: Material.cpp:7
bool m_isRefractive
Specifies whether object is transparent.
Definition: Material.h:96
float m_ior
Index of refraction.
Definition: Material.h:108
void setHardness(float _highlight_size)
Sets the specular modulator for the specular contribution in the Phong shader.
Definition: Material.cpp:32
float getIOR()
Returns index of refraction.
Definition: Material.cpp:57
float m_refl_intensity
Amount of reflection.
Definition: Material.h:104
float getDiffuseIntensity()
Returns amount of diffuse contribution.
Definition: Material.cpp:67
float m_transparency
Amount of refraction, in other words 'transparency'.
Definition: Material.h:112
float m_spec_hardness
This will drive the spreadness of the specular highlights.
Definition: Material.h:116
bool m_isReflective
Tells whether the object is reflective.
Definition: Material.h:92
float getTransparency()
Returns transparency.
Definition: Material.cpp:62
ngl::Colour m_colour1
Colour of the object.
Definition: Material.h:121
float m_diffuse_intensity
Diffuse intensity, self-explanatory.
Definition: Material.h:100
bool isRefractive()
Returns whether the material is reflective or not.
Definition: Material.cpp:27
float getReflIntensity()
Returns amount of reflection.
Definition: Material.cpp:52
void setReflection(float _refl_intensity, float _diffuse_intensity)
Sets the reflection parameters.
Definition: Material.cpp:37
void setRefraction(float _ior, float _transparency, float _diffuse_intensity)
Sets the refraction settings.
Definition: Material.cpp:44
ngl::Colour m_colour2
For checker materials we will have colour1 and colour2, for plain ones just colour1.
Definition: Material.h:125
This class handles the implementation of ray: an object with an origin and a direction.
bool isReflective()
Returns whether the material is reflective or not.
Definition: Material.cpp:22
ngl::Colour objColour()
Returns the object colour.
Definition: Material.cpp:72
bool m_isChecker
Specifies whether it is checker or not.
Definition: Material.h:129