-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaterial.h
50 lines (42 loc) · 1.27 KB
/
Material.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "Shader.h"
#pragma once
class Material :public EngineObject
{
public:
Material() : EngineObject(), specularExponent("specularExponent0", 1), specularIntensity("specularIntensity0", 1)
{
_specularExponent = 0.0f;
_specularIntensity = 0.0f;
_ID = -1;
}
Material(unsigned int ID) : EngineObject(), specularExponent("specularExponent" + to_string(ID), 1), specularIntensity("specularIntensity" + to_string(ID), 1)
{
_specularExponent = 0.0f;
_specularIntensity = 0.0f;
_ID = ID;
}
Material(unsigned int ID, float intensity, float exponent) : EngineObject(), specularExponent("specularExponent" + to_string(ID), 1), specularIntensity("specularIntensity" + to_string(ID), 1)
{
_specularIntensity = intensity;
_specularExponent = exponent;
_ID = ID;
}
void render(Shader& s, RenderingEngine::RenderState firstPass)
{
s.setUniform(specularIntensity, &_specularIntensity);
s.setUniform(specularExponent, &_specularExponent);
EngineObject::render(s, firstPass);
}
void operator=(Material& m)
{
_specularIntensity = m._specularIntensity;
_specularExponent = m._specularExponent;
}
~Material(void) {}
private:
float _specularIntensity;
const string specularIntensity;
float _specularExponent;
const string specularExponent;
unsigned int _ID;
};