Commit dd531f25 by Alisa Jung

well... at least this shit is compiling

parent 0122e0aa
#include "box.h"
Box::Box(int ID, char* name, int tesselation) : Primitive(ID, name, tesselation)
{
}
Box::~Box(){
}
void Box::drawPrimitive(){
//tesselation
double qubeWidth = 1.0;
double dist = qubeWidth / (double)tesselation;
//4.1.1 Unit Qube + Tesselation + Diffuse Material
GLfloat specularColor[] = { 1, 1, 1 };
GLfloat shininess[] = { 128 };//specular exponent
glMaterialfv(GL_FRONT, GL_SPECULAR, specularColor);
glMaterialfv(GL_FRONT, GL_SHININESS, shininess);
// //vorne // z-Achse
// // glColor3f(0,0,1);//blau //alt und doof
// GLfloat blue[] = { 0, 0, 1 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, blue);
// glNormal3f(0, 0, 1);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5 - dist*i, 0.5 - dist*j, 0.5);
// glVertex3f(0.5 - dist*(i + 1), 0.5 - dist*j, 0.5);
// glVertex3f(0.5 - dist*(i + 1), 0.5 - dist*(j + 1), 0.5);
// glVertex3f(0.5 - dist*i, 0.5 - dist*(j + 1), 0.5);
// }
// }
// glEnd();
// //oben // y-Achse
// GLfloat green[] = { 0, 1, 0 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, green);
// glNormal3f(0, 1, 0);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5 - dist*(i + 1), 0.5, 0.5 - dist*(j + 1));
// glVertex3f(0.5 - dist*(i + 1), 0.5, 0.5 - dist*j);
// glVertex3f(0.5 - dist*i, 0.5, 0.5 - dist*j);
// glVertex3f(0.5 - dist*i, 0.5, 0.5 - dist*(j + 1));
// }
// }
// glEnd();
// //rechts //x-Achse
// GLfloat red[] = { 1, 0, 0 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, red);
// glNormal3f(1, 0, 0);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5, 0.5 - dist*i, 0.5 - dist*j);
// glVertex3f(0.5, 0.5 - dist*(i + 1), 0.5 - dist*j);
// glVertex3f(0.5, 0.5 - dist*(i + 1), 0.5 - dist*(j + 1));
// glVertex3f(0.5, 0.5 - dist*i, 0.5 - dist*(j + 1));
// }
// }
// glEnd();
// //hinten // z-Achse
// GLfloat yellow[] = { 1, 0.9f, 0 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, yellow);
// glNormal3f(0, 0, -1);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5 - dist*i, 0.5 - dist*(j + 1), -0.5);//4
// glVertex3f(0.5 - dist*(i + 1), 0.5 - dist*(j + 1), -0.5);//3
// glVertex3f(0.5 - dist*(i + 1), 0.5 - dist*j, -0.5);//2
// glVertex3f(0.5 - dist*i, 0.5 - dist*j, -0.5);//1
// }
// }
// glEnd();
// //links
// GLfloat cyan[] = { 0, 1, 1 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, cyan);
// glNormal3f(-1, 0, 0);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(-0.5, 0.5 - dist*i, 0.5 - dist*(j + 1));
// glVertex3f(-0.5, 0.5 - dist*(i + 1), 0.5 - dist*(j + 1));
// glVertex3f(-0.5, 0.5 - dist*(i + 1), 0.5 - dist*j);
// glVertex3f(-0.5, 0.5 - dist*i, 0.5 - dist*j);
// }
// }
// glEnd();
// //unten //-y
// GLfloat magenta[] = { 1, 0, 1 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, magenta);
// glNormal3f(0, -1, 0);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5 - dist*i, -0.5, 0.5 - dist*(j + 1));
// glVertex3f(0.5 - dist*i, -0.5, 0.5 - dist*j);
// glVertex3f(0.5 - dist*(i + 1), -0.5, 0.5 - dist*j);
// glVertex3f(0.5 - dist*(i + 1), -0.5, 0.5 - dist*(j + 1));
// }
// }
// glEnd();
}
#ifndef BOX_H
#define BOX_H
#include <primitive.h>
#include <QDebug>
class Box : public Primitive
{
public:
Box(int ID, char* name, int tesselation);
~Box();
void drawPrimitive() override;
};
#endif // BOX_H
......@@ -18,14 +18,16 @@ SOURCES += main.cpp\
scenegraph.cpp \
primitive.cpp \
rigidbodytransformation.cpp \
controller.cpp
controller.cpp \
box.cpp
HEADERS += mainwindow.h \
myglwidget.h \
scenegraph.h \
primitive.h \
rigidbodytransformation.h \
controller.h
controller.h \
box.h
RESOURCES += \
helloqube.qrc
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2015-11-15T21:45:35. -->
<!-- Written by QtCreator 3.5.1, 2015-11-19T23:00:19. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
......@@ -5,3 +5,16 @@ Primitive::Primitive()
}
Primitive::~Primitive(){
}
Primitive::Primitive(int ID, char* name, int tesselation){
this->ID = ID;
this->name = name;
this->tesselation = tesselation;
}
void Primitive::drawPrimitive(){
}
#ifndef PRIMITIVE_H
#define PRIMITIVE_H
#include <QtOpenGL>
class Primitive
{
public:
Primitive();
~Primitive();
Primitive(int ID, char* name, int tesselation);
virtual void drawPrimitive();
protected:
int ID;
char* name;
int tesselation;
};
#endif // PRIMITIVE_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment