Shadow mapping
This commit is contained in:
12
Object.hh
12
Object.hh
@@ -10,23 +10,27 @@ class Object {
|
||||
public:
|
||||
Object(VBOManager& vboManager, std::vector<objVertexAttribs> const& vas, std::vector<uint16_t> const& indices,
|
||||
Program& prog)
|
||||
: _vboManager(vboManager), _prog(prog), _indices(indices) {
|
||||
: _vboManager(vboManager), _prog(prog), _indices(indices), _vaID(0) {
|
||||
construct(vas);
|
||||
}
|
||||
|
||||
Object(VBOManager& vboManager, std::string const& filename, Program& prog)
|
||||
: _vboManager(vboManager), _prog(prog) {
|
||||
: _vboManager(vboManager), _prog(prog), _vaID(0) {
|
||||
auto tmp = readObject(filename);
|
||||
_indices = std::get<1>(tmp);
|
||||
construct(std::get<0>(tmp));
|
||||
}
|
||||
|
||||
~Object() {
|
||||
glDeleteVertexArrays(1, &_vaID);
|
||||
}
|
||||
|
||||
void draw(glm::mat4 const& modelview) const {
|
||||
void draw(glm::mat4 const& modelview, Program *override = nullptr) const {
|
||||
glBindVertexArray(_vaID);
|
||||
_prog.use();
|
||||
if (override)
|
||||
override->use();
|
||||
else
|
||||
_prog.use();
|
||||
glUniformMatrix4fv(_prog.getUniformLocation("model_matrix"), 1, GL_FALSE,
|
||||
glm::value_ptr(modelview));
|
||||
glDrawElements(GL_TRIANGLES, _indices.size(), GL_UNSIGNED_SHORT, _indices.data());
|
||||
|
||||
Reference in New Issue
Block a user