summaryrefslogtreecommitdiff
path: root/engine-ocean/Graphics/shape.cpp
blob: cd0b9b4285f89d1f71232fe7dfb22bea12ff1424 (plain)
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
#include "shape.h"
#include <Eigen/Dense>
#include "Graphics/global.h"
#include "Graphics/material.h"
#include <iostream>

Shape::Shape(std::shared_ptr<VAO> vao):
    m_vao(vao)
{

}

Shape::Shape(std::shared_ptr<VAO> vao, std::shared_ptr<Material> shape_material):
    m_vao(vao),
    m_shape_material(shape_material)
{
    hasShapeSpecificMaterial = true;

}

Shape::~Shape(){

}

std::shared_ptr<Material> Shape::getShapeMaterial(){
    if (hasShapeSpecificMaterial){
       return m_shape_material;
    }
    std::cout << "this shape does not have material." << std::endl;
}

bool Shape::hasMaterial(){
    return hasShapeSpecificMaterial;
}

void Shape::draw(){
    m_vao->draw();
}

void Shape::updateVAO(const std::vector<Eigen::Vector3f> &vertices, const std::vector<Eigen::Vector3i> &faces){


    m_vao = Global::graphics.makeVAOFromData(vertices, faces, true, false).second;


}