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
|
#ifndef _CUBEHOLE_H_
#define _CUBEHOLE_H_
#include "Trapezocube.h"
#include "Triangle.h"
#include <list>
class Cubehole
{
public:
Cubehole(): width(0), height(0), depth(0), x(0), y(0), z(0), innerwidth(0), innerdepth(0) {
setColor(vmml::vec4f::ONE, vmml::vec4f::ONE, vmml::vec4f::ONE, vmml::vec4f::ONE);
front.setRotate(0);
right.setRotate(90);
back.setRotate(180);
left.setRotate(270);
}
Cubehole(float width0, float height0, float depth0, float x0, float y0, float z0,
float innerwidth0, float innerdepth0,
const vmml::vec4f &colorfront0, const vmml::vec4f &colorright0,
const vmml::vec4f &colorback0, const vmml::vec4f &colorleft0) {
setSize(width0, height0, depth0, innerwidth0, innerdepth0);
setPos(x0, y0, z0);
setColor(colorfront0, colorright0, colorback0, colorleft0);
front.setRotate(0);
right.setRotate(90);
back.setRotate(180);
left.setRotate(270);
}
float getHeight() {return height;}
float getWidth() {return width;}
float getDepth() {return depth;}
float getPosX() {return x;}
float getPosY() {return y;}
float getPosZ() {return z;}
float getInnerWidth() {return innerwidth;}
float getInnerDepth() {return innerdepth;}
void setSize(float w, float h, float d, float iw, float id){
width = w;
height = h;
depth = d;
innerwidth = iw;
innerdepth = id;
front.setSize(width, innerwidth, height, (depth-innerdepth)/2);
right.setSize(innerdepth, depth, height, (width-innerwidth)/2);
back.setSize(width, innerwidth, height, (depth-innerdepth)/2);
left.setSize(innerdepth, depth, height, (width-innerwidth)/2);
}
void setPos(float x0, float y0, float z0) {
x = x0;
y = y0;
z = z0;
}
void setColor(const vmml::vec4f &cf, const vmml::vec4f &cr, const vmml::vec4f &cb, const vmml::vec4f &cl) {
front.setColor(cf);
right.setColor(cr);
back.setColor(cb);
left.setColor(cl);
}
std::list<Triangle> getTriangles();
private:
float x, y, z, width, height, depth, innerwidth, innerdepth;
vmml::vec4f colorfront, colorleft, colorback, colorright;
Trapezocube front, right, back, left;
};
#endif /*_CUBEHOLE_H_*/
|