summaryrefslogtreecommitdiffstats
path: root/Cuboid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Cuboid.cpp')
-rw-r--r--Cuboid.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/Cuboid.cpp b/Cuboid.cpp
index 5557e39..6569e31 100644
--- a/Cuboid.cpp
+++ b/Cuboid.cpp
@@ -5,10 +5,14 @@
//#include <stdlib.h>
//#include <time.h>
+Cuboid::Cuboid(float width, float height, float depth) {
+ setSize(width, height, depth);
+ setPos(0, 0, 0);
+}
-Cuboid::Cuboid(float height, float width, float depth, float x, float y, float z)
+Cuboid::Cuboid(float width, float height, float depth, float x, float y, float z)
{
- setSize(height, width, depth);
+ setSize(width, height, depth);
setPos(x, y, z);
}
@@ -42,10 +46,10 @@ float Cuboid::getPosZ()
return z;
}
-void Cuboid::setSize(float h, float w, float d)
+void Cuboid::setSize(float w, float h, float d)
{
- height = h;
width = w;
+ height = h;
depth = d;
}
@@ -62,7 +66,7 @@ std::list<Triangle> Cuboid::getTriangles(const Matrix &modelview)
//srand(time(NULL));
// width, height, depth
// Front face
- Color c(0.0, 0.0, 1.0);
+ Color c(0.0, 0.0, 1.0, 0.5);
triangles.push_back(Triangle(Vertex(x , y , z),
Vertex(x+width, y , z),
@@ -73,7 +77,7 @@ std::list<Triangle> Cuboid::getTriangles(const Matrix &modelview)
Vertex(x+width, y-height, z), c));
// Back face
- c = Color(1.0, 1.0, 0.0);
+ c = Color(1.0, 1.0, 0.0, 0.5);
triangles.push_back(Triangle(Vertex(x , y , z-depth),
Vertex(x , y-height, z-depth),
@@ -84,7 +88,7 @@ std::list<Triangle> Cuboid::getTriangles(const Matrix &modelview)
Vertex(x+width, y-height, z-depth), c));
// Left face
- c = Color(0.0, 1.0, 0.0);
+ c = Color(0.0, 1.0, 0.0, 0.5);
triangles.push_back(Triangle(Vertex(x, y , z ),
Vertex(x, y-height, z ),
@@ -105,7 +109,7 @@ std::list<Triangle> Cuboid::getTriangles(const Matrix &modelview)
Vertex(x+width, y-height, z ), c));
// Top face
- c = Color(1.0, 0.0, 0.0);
+ c = Color(1.0, 0.0, 0.0, 0.5);
triangles.push_back(Triangle(Vertex(x , y, z ),
Vertex(x+width, y, z ),