mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
Merging and tweaking issues 1 and 11
This commit is contained in:
commit
c5fbaac3fd
1
.gitignore
vendored
1
.gitignore
vendored
@ -48,3 +48,4 @@ release
|
|||||||
*_LOCAL_*
|
*_LOCAL_*
|
||||||
*_BASE_*
|
*_BASE_*
|
||||||
*_REMOTE_*
|
*_REMOTE_*
|
||||||
|
*.orig
|
||||||
|
|||||||
@ -2,43 +2,16 @@
|
|||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QVector4D>
|
#include <QVector4D>
|
||||||
|
|
||||||
void Square::accept(Visitor &v) {
|
void Cube::accept(Visitor &v) {
|
||||||
v.visit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Circle::accept(Visitor &v) {
|
|
||||||
v.visit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Triangle::accept(Visitor &v) {
|
|
||||||
v.visit(*this);
|
v.visit(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***
|
// ***
|
||||||
|
|
||||||
void Square::setColor(QColor& c) {
|
void Cube::setColor(QColor& c) {
|
||||||
color = QColor(c);
|
color = QColor(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Circle::setColor(QColor& c) {
|
QColor Cube::getColor(){
|
||||||
color = QColor(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Triangle::setColor(QColor& c) {
|
|
||||||
color = QColor(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QColor Triangle::getColor(){
|
|
||||||
return color;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
QColor Circle::getColor(){
|
|
||||||
return color;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
QColor Square::getColor(){
|
|
||||||
return color;
|
return color;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -11,28 +11,10 @@ public:
|
|||||||
virtual QColor getColor() = 0;
|
virtual QColor getColor() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Circle : public Shape
|
class Cube : public Shape
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Circle(){}
|
Cube(){}
|
||||||
QColor color;
|
|
||||||
void accept(Visitor& v) override;
|
|
||||||
void setColor(QColor& c);
|
|
||||||
QColor getColor();
|
|
||||||
};
|
|
||||||
class Triangle : public Shape
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Triangle(){}
|
|
||||||
QColor color;
|
|
||||||
void accept(Visitor& v) override;
|
|
||||||
void setColor(QColor& c);
|
|
||||||
QColor getColor();
|
|
||||||
};
|
|
||||||
class Square : public Shape
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Square(){}
|
|
||||||
QColor color;
|
QColor color;
|
||||||
void accept(Visitor& v) override;
|
void accept(Visitor& v) override;
|
||||||
void setColor(QColor& c);
|
void setColor(QColor& c);
|
||||||
|
|||||||
@ -1,15 +1,11 @@
|
|||||||
#ifndef VISITOR_H
|
#ifndef VISITOR_H
|
||||||
#define VISITOR_H
|
#define VISITOR_H
|
||||||
class SceneGroup;
|
class SceneGroup;
|
||||||
class Square;
|
class Cube;
|
||||||
class Circle;
|
|
||||||
class Triangle;
|
|
||||||
|
|
||||||
class Visitor {
|
class Visitor {
|
||||||
public:
|
public:
|
||||||
virtual void visit(SceneGroup &n) = 0;
|
virtual void visit(SceneGroup &n) = 0;
|
||||||
virtual void visit(Square &s) = 0;
|
virtual void visit(Cube &s) = 0;
|
||||||
virtual void visit(Circle &s) = 0;
|
|
||||||
virtual void visit(Triangle &s) = 0;
|
|
||||||
};
|
};
|
||||||
#endif // VISITOR_H
|
#endif // VISITOR_H
|
||||||
|
|||||||
@ -20,9 +20,6 @@ int main(int argc, char *argv[])
|
|||||||
// Instantiate and layout the viewer.
|
// Instantiate and layout the viewer.
|
||||||
Viewer *v = new Viewer();
|
Viewer *v = new Viewer();
|
||||||
w.addViewer(v);
|
w.addViewer(v);
|
||||||
|
|
||||||
//w.setFixedSize(dw.width() * 0.7, dw.height() * 0.7);
|
|
||||||
|
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|||||||
@ -41,9 +41,7 @@ using namespace std;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const int numVerticesSquare = 5;
|
const int numVerticesCube = 12*3;
|
||||||
const int numVerticesTriangle = 3;
|
|
||||||
const int numVerticesCircle = 26;
|
|
||||||
const double frame_limit = 5;
|
const double frame_limit = 5;
|
||||||
const double inc_mult = 5;
|
const double inc_mult = 5;
|
||||||
const double inc_offset = 1.05;
|
const double inc_offset = 1.05;
|
||||||
@ -90,10 +88,16 @@ void Viewer::draw()
|
|||||||
// Prepare a transformation stack
|
// Prepare a transformation stack
|
||||||
|
|
||||||
// stack<QMatrix4x4> modelStack;
|
// stack<QMatrix4x4> modelStack;
|
||||||
|
|
||||||
modelViewMatrix.translate(-4.5, -4.5);
|
|
||||||
modelViewMatrix.scale(0.95);
|
modelViewMatrix.scale(0.95);
|
||||||
|
|
||||||
|
//modelViewMatrix.rotate(45, 0, 1, 0);
|
||||||
|
// uncomment this and the cube translation in init()
|
||||||
|
// to see the cube spin
|
||||||
|
/*rot = QQuaternion::fromAxisAndAngle(1, 0, 1, 90/60 * frame);
|
||||||
|
modelViewMatrix.rotate(rot);
|
||||||
|
projectionMatrix.translate(0, -5, 0);
|
||||||
|
projectionMatrix.rotate(15, 1, 0, 0);//*/
|
||||||
|
|
||||||
m_program->setUniformValue(m_projMatrixLocation, projectionMatrix);
|
m_program->setUniformValue(m_projMatrixLocation, projectionMatrix);
|
||||||
m_program->setUniformValue(m_mvMatrixLocation, modelViewMatrix);
|
m_program->setUniformValue(m_mvMatrixLocation, modelViewMatrix);
|
||||||
|
|
||||||
@ -101,6 +105,7 @@ void Viewer::draw()
|
|||||||
|
|
||||||
modelStack.push(modelViewMatrix);
|
modelStack.push(modelViewMatrix);
|
||||||
root.accept(*this);
|
root.accept(*this);
|
||||||
|
frame++;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +117,8 @@ void Viewer::mouseMoveEvent(QMouseEvent* e) {
|
|||||||
|
|
||||||
void Viewer::mousePressEvent(QMouseEvent* e) {
|
void Viewer::mousePressEvent(QMouseEvent* e) {
|
||||||
// Auto Return, but old code left in as reference
|
// Auto Return, but old code left in as reference
|
||||||
|
|
||||||
|
// TODO: figure out how to get this weird offset ↓↓ frame position maybe?
|
||||||
int x = this->x() + e->x() + 10;
|
int x = this->x() + e->x() + 10;
|
||||||
int y = this->parentWidget()->height() - e->y() + 21;
|
int y = this->parentWidget()->height() - e->y() + 21;
|
||||||
std::cout << "--------------------------------------------------\nPicking shape at " << x << " (" << this->x() << " + " << e->x() << "), " << y << endl;
|
std::cout << "--------------------------------------------------\nPicking shape at " << x << " (" << this->x() << " + " << e->x() << "), " << y << endl;
|
||||||
@ -162,15 +169,19 @@ void Viewer::init()
|
|||||||
// Init shaders & geometry
|
// Init shaders & geometry
|
||||||
initShaders();
|
initShaders();
|
||||||
initGeometries();
|
initGeometries();
|
||||||
//initGrid();
|
|
||||||
|
|
||||||
/*QColor* color = new QColor(255, 128, 0, 255);
|
{
|
||||||
Circle* c = new Circle;
|
Shape* cube = new Cube();
|
||||||
c->setColor(*color);
|
cube->setColor(*activeColor);
|
||||||
SceneGroup* cell = new SceneGroup;
|
|
||||||
cell->addChild(c);
|
// uncomment this and the quaternion transformation in draw()
|
||||||
root.addChild(cell);//*/
|
// to see the cube rotate. This is how we can easily make the sun.
|
||||||
//update();
|
// cube->transform.translate(3, 0, 0);
|
||||||
|
|
||||||
|
SceneGroup *c = new SceneGroup();
|
||||||
|
c->addChild(cube);
|
||||||
|
root.addChild(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::initShaders()
|
void Viewer::initShaders()
|
||||||
@ -237,8 +248,12 @@ void Viewer::initShaders()
|
|||||||
// Creates the basic shapes in memory. We only have 3, so we just prep them all in advance.
|
// Creates the basic shapes in memory. We only have 3, so we just prep them all in advance.
|
||||||
void Viewer::initGeometries()
|
void Viewer::initGeometries()
|
||||||
{
|
{
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable( GL_BLEND ); glClearColor(0.0,0.0,0.0,0.0);
|
glEnable( GL_BLEND );
|
||||||
|
glEnable( GL_CULL_FACE );
|
||||||
|
glFrontFace( GL_CCW );
|
||||||
|
glCullFace( GL_BACK );
|
||||||
|
glClearColor(0.0,0.0,0.0,0.0);
|
||||||
|
|
||||||
// Create our VertexArrays Objects and VertexBuffer Objects
|
// Create our VertexArrays Objects and VertexBuffer Objects
|
||||||
glGenVertexArrays(NumVAOs, m_VAOs);
|
glGenVertexArrays(NumVAOs, m_VAOs);
|
||||||
@ -246,92 +261,47 @@ void Viewer::initGeometries()
|
|||||||
|
|
||||||
// Create our pentagone object, store its vertices on the graphic card, and
|
// Create our pentagone object, store its vertices on the graphic card, and
|
||||||
// bind the data to the vPosition attribute of the shader
|
// bind the data to the vPosition attribute of the shader
|
||||||
GLfloat verticesSquare[numVerticesSquare][3] = {
|
GLfloat verticesCube[numVerticesCube][3] = { // 12 triangles == 6 squares
|
||||||
{ -0.5, 0.5, 0 },
|
//Front, if Z is towards us
|
||||||
{ -0.5, -0.5, 0 },
|
{ -0.5, 0.5, 0.5 }, { -0.5, -0.5, 0.5 }, { 0.5, -0.5, 0.5 },
|
||||||
{ 0.5, -0.5, 0 },
|
{ 0.5, -0.5, 0.5 }, { 0.5, 0.5, 0.5 }, { -0.5, 0.5, 0.5 },
|
||||||
{ 0.5, 0.5, 0 },
|
//Back
|
||||||
{ -0.5, 0.5, 0 }
|
{ -0.5, 0.5, -0.5 }, { 0.5, 0.5, -0.5 }, { 0.5, -0.5, -0.5 },
|
||||||
|
{ 0.5, -0.5, -0.5 }, { -0.5, -0.5, -0.5 }, { -0.5, 0.5, -0.5 },
|
||||||
|
//Right
|
||||||
|
{ -0.5, 0.5, 0.5 }, { -0.5, 0.5, -0.5 }, { -0.5, -0.5, -0.5 },
|
||||||
|
{ -0.5, -0.5, -0.5 }, { -0.5, -0.5, 0.5 }, { -0.5, 0.5, 0.5 },
|
||||||
|
//Left
|
||||||
|
{ 0.5, 0.5, 0.5 }, { 0.5, -0.5, -0.5 }, { 0.5, 0.5, -0.5 },
|
||||||
|
{ 0.5, -0.5, -0.5 }, { 0.5, 0.5, 0.5 }, { 0.5, -0.5, 0.5 },
|
||||||
|
//Top
|
||||||
|
{ -0.5, 0.5, 0.5 }, { 0.5, 0.5, 0.5 }, { 0.5, 0.5, -0.5 },
|
||||||
|
{ 0.5, 0.5, -0.5 }, { -0.5, 0.5, -0.5 }, { -0.5, 0.5, 0.5 },
|
||||||
|
//Bottom
|
||||||
|
{ -0.5, -0.5, 0.5 }, { 0.5, -0.5, -0.5 }, { 0.5, -0.5, 0.5 },
|
||||||
|
{ 0.5, -0.5, -0.5 }, { -0.5, -0.5, 0.5 }, { -0.5, -0.5, -0.5 }
|
||||||
};
|
};
|
||||||
|
|
||||||
glBindVertexArray(m_VAOs[VAO_Square]);
|
glBindVertexArray(m_VAOs[VAO_Cube]);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[VBO_Square]);
|
glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[VBO_Cube]);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(verticesSquare), verticesSquare, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(verticesCube), verticesCube, GL_STATIC_DRAW);
|
||||||
|
|
||||||
glVertexAttribPointer(m_vPositionLocation, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));
|
|
||||||
glEnableVertexAttribArray(m_vPositionLocation);
|
|
||||||
|
|
||||||
// Create our triangle object, store its vertices on the graphic card, and
|
|
||||||
// bind the data to the vPosition attribute of the shader
|
|
||||||
GLfloat verticesTriangle[numVerticesTriangle][3] = {
|
|
||||||
{ -0.5, -0.5, 0.0 },
|
|
||||||
{ 0.5, -0.5, 0.0 },
|
|
||||||
{ 0.0, 0.5, 0.0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
glBindVertexArray(m_VAOs[VAO_Triangle]);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[VBO_Triangle]);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(verticesTriangle), verticesTriangle, GL_STATIC_DRAW);
|
|
||||||
|
|
||||||
glVertexAttribPointer(m_vPositionLocation, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));
|
|
||||||
glEnableVertexAttribArray(m_vPositionLocation);
|
|
||||||
|
|
||||||
// Create our Circle Object, and store its vertices with its bindings
|
|
||||||
|
|
||||||
GLfloat verticesCircle[numVerticesCircle][3];
|
|
||||||
|
|
||||||
const float PI = 3.1415926f;
|
|
||||||
double increment = 2.0f * PI / (numVerticesCircle - 2);
|
|
||||||
|
|
||||||
verticesCircle[0][0] = 0;
|
|
||||||
verticesCircle[0][1] = 0;
|
|
||||||
verticesCircle[0][2] = 0;
|
|
||||||
|
|
||||||
for(int i = 1; i < numVerticesCircle; i++) {
|
|
||||||
double angle = increment * (i);
|
|
||||||
|
|
||||||
verticesCircle[i][0] = 0.5 * cos(angle);
|
|
||||||
verticesCircle[i][1] = 0.5 * sin(angle);
|
|
||||||
verticesCircle[i][2] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
glBindVertexArray(m_VAOs[VAO_Circle]);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, m_Buffers[VBO_Circle]);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(verticesCircle), verticesCircle, GL_STATIC_DRAW);
|
|
||||||
|
|
||||||
glVertexAttribPointer(m_vPositionLocation, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));
|
glVertexAttribPointer(m_vPositionLocation, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));
|
||||||
glEnableVertexAttribArray(m_vPositionLocation);
|
glEnableVertexAttribArray(m_vPositionLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::visit(Square &s)
|
void Viewer::visit(Cube &s)
|
||||||
{
|
{
|
||||||
QMatrix4x4 modelViewMatrix = modelStack.top() * QMatrix4x4(s.transform);
|
QMatrix4x4 modelViewMatrix = modelStack.top() * QMatrix4x4(s.transform);
|
||||||
|
|
||||||
glBindVertexArray(m_VAOs[VAO_Square]);
|
int faces = floor(numVerticesCube/6);
|
||||||
|
for(int i = 0; i < faces; i++){ // 6 vertexes par face
|
||||||
|
glBindVertexArray(m_VAOs[VAO_Cube]);
|
||||||
m_program->setUniformValue(m_mvMatrixLocation, modelViewMatrix);
|
m_program->setUniformValue(m_mvMatrixLocation, modelViewMatrix);
|
||||||
m_program->setUniformValue(m_colorLocation, s.color);
|
m_program->setUniformValue(m_colorLocation, s.getColor());
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, numVerticesSquare);
|
glDrawArrays(GL_TRIANGLES, i*6, 6);
|
||||||
}
|
}
|
||||||
void Viewer::visit(Circle &s)
|
|
||||||
{
|
|
||||||
QMatrix4x4 modelViewMatrix = modelStack.top() * QMatrix4x4(s.transform);
|
|
||||||
|
|
||||||
glBindVertexArray(m_VAOs[VAO_Circle]);
|
|
||||||
m_program->setUniformValue(m_mvMatrixLocation, modelViewMatrix);
|
|
||||||
m_program->setUniformValue(m_colorLocation, s.color);
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, numVerticesCircle);
|
|
||||||
}
|
|
||||||
void Viewer::visit(Triangle &s)
|
|
||||||
{
|
|
||||||
QMatrix4x4 modelViewMatrix = modelStack.top() * QMatrix4x4(s.transform);
|
|
||||||
|
|
||||||
glBindVertexArray(m_VAOs[VAO_Triangle]);
|
|
||||||
m_program->setUniformValue(m_mvMatrixLocation, modelViewMatrix);
|
|
||||||
m_program->setUniformValue(m_colorLocation, s.color);
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, numVerticesTriangle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::visit(SceneGroup &s)
|
void Viewer::visit(SceneGroup &s)
|
||||||
@ -364,7 +334,7 @@ void Viewer::changeColor(QColor c){
|
|||||||
Shape* Viewer::pickGeom(int x, int y){
|
Shape* Viewer::pickGeom(int x, int y){
|
||||||
QMap<QRgb, Shape*> mapColorToShape;
|
QMap<QRgb, Shape*> mapColorToShape;
|
||||||
QColor c;
|
QColor c;
|
||||||
QRgb startColor = 0xFFFF00ee; // alpha must be 100%, glReadPixels doesn't resturn alpha
|
QRgb startColor = 0xFF0001; // alpha must be 100%, glReadPixels doesn't resturn alpha
|
||||||
unsigned char pixelData[3];
|
unsigned char pixelData[3];
|
||||||
// Traverse tree
|
// Traverse tree
|
||||||
/* TODO: Make this recurse through SceneGroups, with like "populateMap(map, root, color)"
|
/* TODO: Make this recurse through SceneGroups, with like "populateMap(map, root, color)"
|
||||||
@ -390,35 +360,34 @@ Shape* Viewer::pickGeom(int x, int y){
|
|||||||
|
|
||||||
if(currentCube)
|
if(currentCube)
|
||||||
{
|
{
|
||||||
c.setRgba(startColor);
|
c.setRgb(startColor);
|
||||||
mapColorToShape.insert(c.rgba(), currentCube);
|
mapColorToShape.insert(c.rgb(), currentCube);
|
||||||
std::cout << "Setting " << currentCube << " to " << c.red() << " " << c.green() << " " << c.blue() << " " << c.alpha() << endl;
|
std::cout << "Setting " << currentCube << " to " << c.red() << " " << c.green() << " " << c.blue() << " " << c.alpha() << endl;
|
||||||
currentCube->setColor(c);
|
currentCube->setColor(c);
|
||||||
startColor++;
|
startColor+=6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.accept(*this);
|
|
||||||
update();
|
update();
|
||||||
draw();
|
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
// for debugging purposes
|
// for debugging purposes
|
||||||
/*QImage *im = new QImage(64, 64, QImage::Format_RGB32);
|
/*QImage *im = new QImage(128,128, QImage::Format_RGB32);
|
||||||
for(int i = 0; i< 64; i++){
|
for(int i = 0; i< 128; i++){
|
||||||
for(int j = 0; j< 64; j++){
|
for(int j = 0; j< 128; j++){
|
||||||
glReadPixels(x-31+i, y+31-j, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
|
glReadPixels(x-64+i, y+64-j, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
|
||||||
QColor* pickedColor = new QColor(pixelData[0], pixelData[1], pixelData[2]);
|
QColor* pickedColor = new QColor(pixelData[0], pixelData[1], pixelData[2]);
|
||||||
if(i==32&&j==32) pickedColor->setRgba(0xFFFFFFFF);
|
if(i==64&&j==64) pickedColor->setRgba(0xFFFFFFFF);
|
||||||
im->setPixelColor(i, j, pickedColor->rgb());
|
im->setPixelColor(i, j, pickedColor->rgb());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
im->save("./screenshot.bmp");//*/
|
im->save("./screenshot.bmp");//*/
|
||||||
|
|
||||||
// TODO: figure out how to get this weird offset ↓↓ frame position maybe?
|
|
||||||
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
|
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
|
||||||
QColor* pickedColor = new QColor(pixelData[0], pixelData[1], pixelData[2]);
|
QColor* pickedColor = new QColor(pixelData[0], pixelData[1], pixelData[2]);
|
||||||
Shape* pickedShape = mapColorToShape.value(pickedColor->rgba());
|
unsigned int pickedInt = pickedColor->rgb();
|
||||||
|
Shape* pickedShape = mapColorToShape.value(pickedInt - (pickedInt % 6) + 1);
|
||||||
std::cout << "Picked Color: " << pickedColor->red() << " " << pickedColor->green() << " " << pickedColor->blue() << " " << pickedColor->alpha() << endl;
|
std::cout << "Picked Color: " << pickedColor->red() << " " << pickedColor->green() << " " << pickedColor->blue() << " " << pickedColor->alpha() << endl;
|
||||||
std::cout << "Picked Shape: " << pickedShape << endl;
|
std::cout << "Picked Shape: " << pickedShape << endl;
|
||||||
|
|
||||||
|
|||||||
@ -46,9 +46,7 @@ public:
|
|||||||
~Viewer();
|
~Viewer();
|
||||||
|
|
||||||
virtual void visit(SceneGroup &s);
|
virtual void visit(SceneGroup &s);
|
||||||
virtual void visit(Square &s);
|
virtual void visit(Cube &s);
|
||||||
virtual void visit(Circle &s);
|
|
||||||
virtual void visit(Triangle &s);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void cleanup();
|
void cleanup();
|
||||||
@ -83,19 +81,20 @@ private:
|
|||||||
int m_projMatrixLocation;
|
int m_projMatrixLocation;
|
||||||
int m_mvMatrixLocation;
|
int m_mvMatrixLocation;
|
||||||
|
|
||||||
|
|
||||||
SceneGroup* activeCell;
|
SceneGroup* activeCell;
|
||||||
QColor* activeColor;
|
QColor* activeColor;
|
||||||
int activeShape;
|
int activeShape;
|
||||||
|
|
||||||
enum VAO_IDs { VAO_Square, VAO_Triangle, VAO_Circle, NumVAOs };
|
enum VAO_IDs { VAO_Cube, NumVAOs };
|
||||||
enum Buffer_IDs { VBO_Square, VBO_Triangle, VBO_Circle, NumBuffers };
|
enum Buffer_IDs { VBO_Cube, NumBuffers };
|
||||||
|
|
||||||
GLuint m_VAOs[NumVAOs];
|
GLuint m_VAOs[NumVAOs];
|
||||||
GLuint m_Buffers[NumBuffers];
|
GLuint m_Buffers[NumBuffers];
|
||||||
|
|
||||||
Shape* generateShapeFromIndex(int);
|
Shape* generateShapeFromIndex(int);
|
||||||
|
|
||||||
|
QQuaternion rot;
|
||||||
|
unsigned int frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SIMPLEVIEWER_H
|
#endif // SIMPLEVIEWER_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user