2013-09-11 08:56:28 -07:00
|
|
|
/* material.h
|
|
|
|
*
|
|
|
|
* Materials are applied to shapes and determine color, texture mapping, shading, etc.
|
|
|
|
*
|
|
|
|
* Eryn Wells <eryn@erynwells.me>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MATERIAL_H__
|
|
|
|
#define __MATERIAL_H__
|
|
|
|
|
|
|
|
#include "basics.h"
|
2014-07-20 16:45:40 -07:00
|
|
|
#include "types.hh"
|
2013-09-11 08:56:28 -07:00
|
|
|
|
2014-07-20 16:45:40 -07:00
|
|
|
namespace charles {
|
2013-09-11 08:56:28 -07:00
|
|
|
|
2014-07-20 16:45:40 -07:00
|
|
|
struct Material
|
2013-09-11 08:56:28 -07:00
|
|
|
{
|
2014-07-20 16:45:40 -07:00
|
|
|
enum class DiffuseShaderModel {
|
|
|
|
Lambert,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class SpecularShaderModel {
|
|
|
|
Blinn,
|
|
|
|
Phong
|
|
|
|
};
|
2013-09-13 18:39:11 -07:00
|
|
|
|
|
|
|
Material();
|
|
|
|
|
2014-07-20 16:45:40 -07:00
|
|
|
Double GetDiffuseIntensity() const;
|
|
|
|
void SetDiffuseIntensity(const Double& kd);
|
|
|
|
|
|
|
|
const Color& GetDiffuseColor() const;
|
|
|
|
void SetDiffuseColor(const Color& c);
|
2013-09-11 08:56:28 -07:00
|
|
|
|
2014-07-20 16:45:40 -07:00
|
|
|
Double GetSpecularIntensity() const;
|
|
|
|
void SetSpecularIntensity(const Double& kd);
|
|
|
|
|
|
|
|
const Color &GetSpecularColor() const;
|
|
|
|
void SetSpecularColor(const Color& c);
|
2013-09-21 15:53:16 -07:00
|
|
|
|
2013-09-11 08:56:28 -07:00
|
|
|
private:
|
2014-07-20 16:45:40 -07:00
|
|
|
void ClampParameter(Double& param);
|
2013-09-13 18:39:11 -07:00
|
|
|
|
2013-09-21 15:53:16 -07:00
|
|
|
// Diffuse parameters.
|
2014-07-20 16:45:40 -07:00
|
|
|
DiffuseShaderModel mDiffuseModel;
|
|
|
|
Double mDiffuseIntensity;
|
|
|
|
Color mDiffuseColor;
|
2013-09-21 15:53:16 -07:00
|
|
|
|
|
|
|
// Specular parameters.
|
2014-07-20 16:45:40 -07:00
|
|
|
SpecularShaderModel mSpecularModel;
|
|
|
|
Double mSpecularIntensity;
|
|
|
|
Color mSpecularColor;
|
2013-09-11 08:56:28 -07:00
|
|
|
};
|
|
|
|
|
2014-07-20 16:45:40 -07:00
|
|
|
} /* namespace charles */
|
|
|
|
|
2013-09-11 08:56:28 -07:00
|
|
|
#endif
|