summaryrefslogtreecommitdiffstats
path: root/Cubehole.cpp
blob: 0fc32aea5cb88ede87ec57b6bb8c417f7e9c343c (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
#include "Cubehole.h"
#include "gl.h"

std::list<Triangle> Cubehole::getTriangles()
{
  front.setPos(x, y, z+(depth/2-(depth-innerdepth)/4));
  right.setPos(-z, y, x-(width/2-(width-innerwidth)/4));
  back.setPos(-x, y, -z+(depth/2-(depth-innerdepth)/4));
  left.setPos(z, y, -x-(width/2-(width-innerwidth)/4));

  std::list<Triangle> triangles;
  // width, height, depth

  std::list<Triangle> tf = front.getTriangles();
  triangles.splice(triangles.end(), tf);
  std::list<Triangle> tr = right.getTriangles();
  triangles.splice(triangles.end(), tr);
  std::list<Triangle> tb = back.getTriangles();
  triangles.splice(triangles.end(), tb);
  std::list<Triangle> tl = left.getTriangles();
  triangles.splice(triangles.end(), tl);

  return triangles;
}