예제 #1
0
QDebug operator<<(QDebug dbg, const QGLMaterial &material)
{
    dbg << &material <<
            "-- Amb:" << material.ambientColor() <<
            "-- Diff:" << material.diffuseColor() <<
            "-- Spec:" << material.specularColor() <<
            "-- Shin:" << material.shininess();
    for (int i = 0; i < material.textureLayerCount(); ++i)
        if (material.texture(i) != 0)
            dbg << "\n    -- Tex" << i << ":" << material.texture(i)
            << material.texture(i)->objectName();
    dbg << "\n";
    return dbg;
}
예제 #2
0
파일: tank.cpp 프로젝트: Distrotech/qt3d
Tank::Tank(QObject *parent)
    : QGLSceneNode(parent)
    , m_texture(0)
{
    QSequentialAnimationGroup *seq = new QSequentialAnimationGroup(this);
    QGraphicsScale3D *scale = new QGraphicsScale3D(this);
    addTransform(scale);
    QPropertyAnimation *anim = new QPropertyAnimation(scale, "scale");
    anim->setDuration(10000);
    anim->setStartValue(QVector3D(1.0f, 0.1f, 1.0f));
    anim->setEndValue(QVector3D(1.0f, 1.2f, 1.0f));
    anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad));
    seq->addAnimation(anim);
    seq->addPause(2000);
    anim = new QPropertyAnimation(scale, "scale");
    anim->setDuration(10000);
    anim->setStartValue(QVector3D(1.0f, 1.2f, 1.0f));
    anim->setEndValue(QVector3D(1.0f, 0.1f, 1.0f));
    anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad));
    seq->addAnimation(anim);
    seq->setLoopCount(-1);
    seq->start();

    addNode(tankObject());

    QGLMaterial *mat = qCreateFluid();
    m_texture = mat->texture();
    setMaterial(mat);
}