-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderModel.cpp
More file actions
82 lines (76 loc) · 1.51 KB
/
RenderModel.cpp
File metadata and controls
82 lines (76 loc) · 1.51 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// Created by Ben Dickson on 5/4/17.
//
#include "RenderModel.h"
map<string,ConType> RenderModel::conImport = {{"origin_x",DOUBLE},{"origin_y",DOUBLE},{"box_top",DOUBLE},{"box_bottom",DOUBLE},
{"box_left",DOUBLE},{"box_right",DOUBLE},{"circle_radius",DOUBLE},{"color",COLOR}};
bool RenderModel::importDouble(string var,double value)
{
if(var == "origin_x")
{
origin_x = value;
}
else if(var == "origin_y")
{
origin_y = value;
}
else if(var == "box_top")
{
box_top = value;
}
else if(var == "box_bottom")
{
box_bottom = value;
}
else if(var == "box_left")
{
box_left = value;
}
else if(var == "box_right")
{
box_right = value;
}
else if(var == "circle_radius")
{
circle_radius = value;
}
else
{
return false;
}
return true;
}
bool RenderModel::importColor(string var, unsigned char r, unsigned char g, unsigned char b)
{
if (var == "color") {
if(color== nullptr)
{
color = new Color(r,g,b);
}
else
{
color->setColor(r,g,b);
}
}
else
{
return false;
}
return true;
}
inline void RenderPipeline::addModel(RenderModel* model)
{
pipeline.push_back(model);
++size;
}
inline RenderModel* RenderPipeline::retrieveModel()
{
if(size==0)
{
return nullptr;
}
RenderModel* r = pipeline.back();
pipeline.pop_back();
--size;
return r;
}