improved 3d rendering, minor changes

added support for thick 3d walls
This commit is contained in:
2017-08-02 14:30:01 +02:00
parent 6f06984c4e
commit 29d5ce19ff
10 changed files with 234 additions and 18 deletions

View File

@@ -9,21 +9,38 @@ class Cube {
private:
Point3 pos;
float size;
Point3 size;
Point3 rot;
public:
Cube(Point3 pos, float size) : pos(pos), size(size) {
Cube(Point3 pos, float size) : pos(pos), size(size,size,size), rot(0,0,0) {
}
Cube(Point3 pos, Point3 size, Point3 rot) : pos(pos), size(size), rot(rot) {
}
void paintGL() {
float s = size;
float s = 1;
glPushMatrix();
glTranslatef(pos.x, pos.z, pos.y);
// 3) move to destination
glTranslatef(pos.x, pos.z, pos.y); // swap yz
// 2) rotate
glRotatef(rot.x, 1, 0, 0);
glRotatef(rot.y, 0, 0, 1); // swap yz
glRotatef(rot.z, 0, 1, 0);
// 1) scale
glScalef(size.x, size.z, size.y); // swap yz
glBegin(GL_QUADS);