Пример #1
0
void 
ViewLightGL::setDiffuse(const QColor& color)
{
    if( __diffuse != color){
        __diffuse = color;
        gllightMaterial();
        emit diffuseChanged(__diffuse);
        emit valueChanged();
    }
}
/*!
    Constructs a new Qt3D::QDiffuseSpecularMapMaterial instance with parent object \a parent.
*/
QDiffuseSpecularMapMaterial::QDiffuseSpecularMapMaterial(QNode *parent)
    : QMaterial(*new QDiffuseSpecularMapMaterialPrivate, parent)
{
    Q_D(QDiffuseSpecularMapMaterial);
    QObject::connect(d->m_ambientParameter, SIGNAL(valueChanged()), this, SIGNAL(ambientChanged()));
    QObject::connect(d->m_diffuseParameter, SIGNAL(valueChanged()), this, SIGNAL(diffuseChanged()));
    QObject::connect(d->m_specularParameter, SIGNAL(valueChanged()), this, SIGNAL(specularChanged()));
    QObject::connect(d->m_shininessParameter, SIGNAL(valueChanged()), this, SIGNAL(shininessChanged()));
    QObject::connect(d->m_textureScaleParameter, SIGNAL(valueChanged()), this, SIGNAL(textureScaleChanged()));
    d->init();
}
Пример #3
0
SGOglMaterialNBPage::SGOglMaterialNBPage(SGFixedGLState* glState, QWidget* parent)
    :QWidget(parent),
      m_glState(glState)
{
    QGridLayout* materialSizer = new QGridLayout(this);

    shininessMaterial = new QDoubleSpinBox(this);
    shininessMaterial->setRange(0, 1000);
    connect(shininessMaterial, SIGNAL(valueChanged(double)), SLOT(shininessChanged()));

    ambientMaterial = new QColorButton(this);
    connect(ambientMaterial, SIGNAL(selected(QColor)), SLOT(ambientChanged()));

    diffuseMaterial = new QColorButton(this);
    connect(diffuseMaterial, SIGNAL(selected(QColor)), SLOT(diffuseChanged()));

    specularMaterial = new QColorButton(this);
    connect(specularMaterial, SIGNAL(selected(QColor)), SLOT(specularChanged()));

    emissionMaterial = new QColorButton(this);
    connect(emissionMaterial, SIGNAL(selected(QColor)), SLOT(emissionChanged()));

    QLabel* ambientMatLbl = new QLabel(tr("GL_AMBIENT"), this);
    QLabel* specularMatLbl = new QLabel(tr("GL_SPECULAR"), this);
    QLabel* diffuseMatLbl = new QLabel(tr("GL_DIFFUSE"), this);
    QLabel* shininessLbl = new QLabel(tr("GL_SHININESS"), this);
    QLabel* emissionLbl = new QLabel(tr("GL_EMISSION"), this);

    materialSizer->addWidget(ambientMatLbl, 0, 0);
    materialSizer->addWidget(diffuseMatLbl, 1, 0);
    materialSizer->addWidget(specularMatLbl, 2, 0);

    materialSizer->addWidget(ambientMaterial, 0, 1);
    materialSizer->addWidget(diffuseMaterial, 1, 1);
    materialSizer->addWidget(specularMaterial, 2, 1);

    materialSizer->addWidget(shininessLbl, 0, 2);
    materialSizer->addWidget(emissionLbl, 1, 2);

    materialSizer->addWidget(shininessMaterial, 0, 3);
    materialSizer->addWidget(emissionMaterial, 1, 3);

    materialSizer->setColumnStretch(4, 2);
    materialSizer->setRowStretch(3, 2);

    setup();
}