Chira Engine
A customizable MIT-licensed game engine.
MaterialFactory.cpp
1 #include "MaterialFactory.h"
2 
3 using namespace chira;
4 
5 IMaterial::IMaterial(std::string identifier_)
6  : Resource(std::move(identifier_)) {}
7 
8 void IMaterial::compile(const byte buffer[], std::size_t bufferLength) {
9  Serial::loadFromBuffer(this, buffer, bufferLength);
10 
11  this->shader = Resource::getResource<Shader>(this->shaderPath);
12 }
13 
14 void IMaterial::use() const {
15  this->shader->use();
16 }
17 
18 SharedPointer<Shader> IMaterial::getShader() const {
19  return this->shader;
20 }
A chunk of data, usually a file. Is typically cached and shared.
Definition: Resource.h:19