summaryrefslogtreecommitdiff
path: root/engine-ocean/Game/Components/DrawComponent.cpp
blob: 28640dd3d62902181820c653cc1b1da2832fed22 (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
47
48
49
50
51
52
53
54
#include "drawcomponent.h"
#include <string>

DrawComponent::DrawComponent(std::shared_ptr<Shape> shape, std::string shape_name)
{
    m_shape = shape;
    m_shape_name = shape_name;
}

DrawComponent::DrawComponent(std::shared_ptr<Shape> shape)
{
    m_shape = shape;
}

DrawComponent::DrawComponent(std::vector<std::shared_ptr<Shape>> shapes)
{
    m_shapes = shapes;
    hasMultipleShapes = true;
}


void DrawComponent::addMaterial(std::string material_name, std::string material_filepath){
    Global::graphics.addMaterial(material_name, material_filepath);
    m_material_name = material_name;
    hasMaterial = true;
}

std::shared_ptr<Shape> DrawComponent::getShape(){
    return m_shape;
}

std::vector<std::shared_ptr<Shape>> DrawComponent::getShapesWithMaterials(){
    if (hasMultipleShapes){
        return m_shapes;
    }
}

std::string DrawComponent::getShapeName(){
    return m_shape_name;
}

std::shared_ptr<Material> DrawComponent::getMaterial(){
    return Global::graphics.getMaterial(m_material_name);
}

bool DrawComponent::objHasMaterial(){
    return hasMaterial;
}

bool DrawComponent::objHasMultipleShapes(){
    return hasMultipleShapes;
}