Beispiel #1
0
void BoxObject::render() const {

    // TODO: switch to using VAR to radically improve performance.

    // Draw the six faces
    Vector3 v0, v1, v2, v3;

    glDiffuse();
    app->renderDevice->setColor(color);
    app->renderDevice->setObjectToWorldMatrix(CoordinateFrame());
    app->renderDevice->beginPrimitive(RenderDevice::QUADS);
    for (int f = 0; f < 6; ++f) {
        box.getFaceCorners(f, v0, v1, v2, v3);
        app->renderDevice->setNormal((v1 - v0).cross(v3 - v0).direction());
        app->renderDevice->sendVertex(v0);
        app->renderDevice->sendVertex(v1);
        app->renderDevice->sendVertex(v2);
        app->renderDevice->sendVertex(v3);
    }
    app->renderDevice->endPrimitive();

    /* Messes up the shadow map for some reason.
    app->renderDevice->pushState();
        Draw::box(box, app->renderDevice, color, Color4::clear());
    app->renderDevice->popState();
    */
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    ui->setupUi(this);
    ui->tab_2->setEnabled(false);
    ui->pushButton_3->setEnabled(false);
    ui->btnSmooth->setEnabled(false);
    ui->menuExperimenta->setEnabled(false);
    ui->actionSave_Laplace_Matrix->setEnabled(false);
    connect(ui->glWidget, SIGNAL(faceCount(int)), ui->faceCount, SLOT(display(int)));
    connect(ui->glWidget, SIGNAL(vertexCount(int)), ui->vertexCount, SLOT(display(int)));
    connect(ui->radioButton, SIGNAL(toggled(bool)), ui->glWidget, SLOT(Light0State(bool)));
    connect(ui->radioButton_2, SIGNAL(toggled(bool)), ui->glWidget, SLOT(Light1State(bool)));
    connect(ui->radioButton_3, SIGNAL(toggled(bool)), ui->glWidget, SLOT(Light2State(bool)));

    connect(ui->glWidget,SIGNAL(SendVector(VectorXd)), &plotWin, SLOT(getVector(VectorXd)));

    connect(&posLight, SIGNAL(posX(int)), ui->glWidget, SLOT(LightPosX(int)));
    connect(&posLight, SIGNAL(posY(int)), ui->glWidget, SLOT(LightPosY(int)));
    connect(&posLight, SIGNAL(posZ(int)), ui->glWidget, SLOT(LightPosZ(int)));

    connect(&matWin, SIGNAL(amb(QColor)), ui->glWidget, SLOT(glAmb(QColor)));
    connect(&matWin, SIGNAL(diffuse(QColor)), ui->glWidget, SLOT(glDiffuse(QColor)));
    connect(&matWin, SIGNAL(spec(QColor)), ui->glWidget, SLOT(glSpec(QColor)));
    connect(&posLight, SIGNAL(sendLightColor(QColor)), ui->glWidget, SLOT(LightColor(QColor)));


    connect(&selectLaplacian, SIGNAL(selectKind(int)), ui->glWidget, SLOT(SelectLaplace(int)));
    connect(this, SIGNAL(sendEigenIndex(int)), ui->glWidget, SLOT(SeekEigen(int)));
    connect(this, SIGNAL(sendCompressionVolume(int)), ui->glWidget, SLOT(AdjustCompression(int)));
    connect(this, SIGNAL(analyseCurve()), ui->glWidget, SLOT(AnalyseCurve()));
    connect(ui->glWidget, SIGNAL(Status(QString)), this, SLOT(setStatus(QString)));
    connect(this, SIGNAL(shadingMode(int)), ui->glWidget, SLOT(selectShade(int)));
}