-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaterial.cpp
More file actions
48 lines (29 loc) · 879 Bytes
/
Material.cpp
File metadata and controls
48 lines (29 loc) · 879 Bytes
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
#include "Material.h"
#include "TextureManager.h"
Material::Material() {
m_xTexLookup.resize(MATTYPE_LEN);
}
Material::~Material() {
}
void Material::addTexture(const char* filepath, MatType type) {
m_xTextures.push_back(TextureManager::instance()->getTexture2D(filepath));
m_xTexLookup[type].push_back(m_xTextures.size()-1);
}
unsigned int Material::numTexturesTotal() const {
return m_xTextures.size();
}
const Texture* Material::getTexture(unsigned int index) const {
return m_xTextures[index];
}
const std::vector<int>& Material::getIdsOfType( MatType type ) const{
return m_xTexLookup[type];
}
unsigned int Material::numTextures( MatType type ) const {
return m_xTexLookup[type].size();
}
void Material::setShaderProgram( ShaderProgram* prog ) {
m_xShaderProgram = prog;
}
ShaderProgram* Material::getShaderProgram() {
return m_xShaderProgram;
}