forked from lokesh-sharma/GameEngine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMatrial.h
More file actions
82 lines (71 loc) · 1.99 KB
/
Matrial.h
File metadata and controls
82 lines (71 loc) · 1.99 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef MATRIAL_H_INCLUDED
#define MATRIAL_H_INCLUDED
#include<glm/glm.hpp>
#include<map>
#include<iostream>
#include"texture.h"
enum Materials
{
SIMPLE_COLOR,
SIMPLE_TEXTURE,
SIMPLE_LIGHTS,
LIGHTS_WITH_SHADOWS,
LIGHTS_WITH_SHADOWS_WITH_NRM_AND_DISP_MAPS,
TERRAIN,
TERRAIN_WITH_SHADOWS
};
class Material
{
public:
Material()
{
specPower = 1.0f;
specIntensity=0.00f;
ambient = glm::vec4(0.2f , 0.2f , 0.2f , 1.0f);
dispMapScale = 0.03f;
dispMapOffset = -0.3;
//texture_map["normal"] = new Texture("./res/default_normal.jpg");
}
Texture* getTexture(const std::string& uName)
{
return texture_map[uName];
}
Texture* getDiffuseTexture()
{
return texture_map["diffuse"];
}
Texture* getNormalMap()
{
return texture_map["normal"];
}
Texture* getDispMap()
{
return texture_map["dispMap"];
}
void addTexture(const std::string& uName , const std::string fName)
{
texture_map[uName] = new Texture(fName);
}
void addTexture(const std::string& uName , Texture* tex)
{
texture_map[uName] = tex;
}
float getSpecularPower() const { return specPower;}
float getSpecularIntensity() const { return specIntensity;}
float getDispMapScale() const { return dispMapScale;}
float getDispMapOffset() const { return dispMapOffset;}
glm::vec4 getAmbientColor() const { return ambient;}
void setAmbientColor(glm::vec4 color) { ambient = color; }
void setSpecularPower(float specPw) { specPower = specPw;}
void setSpecularIntensity(float specI) { specIntensity = specI;}
void setDispMapScale(float dispS) { dispMapScale = dispS;}
void setDispMapOffset(float dispO) { dispMapOffset = dispO;}
private:
float specPower;
float specIntensity;
float dispMapScale;
float dispMapOffset;
glm::vec4 ambient;
std::map<std::string , Texture*> texture_map;
};
#endif // MATRIAL_H_INCLUDED