Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

Overview of Qt3D 2.0 - Part 2

import Qt3D 2.0
import Qt3D.Render 2.0

Entity {
    id: root

    property alias x: translation.dx
    property alias y: translation.dy
    property alias z: translation.dz
    property alias scale: scaleTransform.scale
    property alias theta: thetaRotation.angle
    property alias phi: phiRotation.angle
    property Material material

    components: [ transform, mesh, root.material ]

    Transform {
        id: transform
        Translate { id: translation }
        Scale { id: scaleTransform }
        Rotate{ id: thetaRotation; axis: Qt.vector3d( 1.0, 0.0, 0.0 ) }
        Rotate{ id: phiRotation;   axis: Qt.vector3d( 0.0, 1.0, 0.0 ) }
    }

    Mesh {
        id: mesh
        source: ":/assets/obj/trefoil.obj"
    }
}
import Qt3D 2.0
import Qt3D.Render 2.0
import QtQuick 2.1 as QQ2

Entity {
    id: root

    // Use the renderer configuration specified in ForwardRenderer.qml
    // and render from the mainCamera
    components: [
        FrameGraph {
            activeFrameGraph: ForwardRenderer {
                camera: mainCamera
            }
        }
    ]

    BasicCamera {
        id: mainCamera
        position: Qt.vector3d( 0.0, 0.0, 25.0 )
    }

    Configuration  {
        controlledCamera: mainCamera
    }

    WireframeMaterial {
        id: wireframeMaterial
        effect: WireframeEffect {}
        ambient: Qt.rgba( 0.2, 0.0, 0.0, 1.0 )
        diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )
    }

    TrefoilKnot {
        id: trefoilKnot
        material: wireframeMaterial
    }
}
WireframeMaterial {
    id: wireframeMaterial
    effect: WireframeEffect {}
    ambient: Qt.rgba( 0.2, 0.0, 0.0, 1.0 )
    diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )

    QQ2.SequentialAnimation {
        loops: QQ2.Animation.Infinite
        running: true

        QQ2.NumberAnimation {
            target: wireframeMaterial;
            property: "lineWidth";
            duration: 1000;
            from: 1.0
            to: 3.0
        }

        QQ2.NumberAnimation {
            target: wireframeMaterial;
            property: "lineWidth";
            duration: 1000;
            from: 3.0
            to: 1.0
        }

        QQ2.PauseAnimation{ duration: 1500 }
    }
}

About KDAB


67 Comments

8 - Jan - 2015

Philip

8 - Jan - 2015

Sean Harmer

8 - Jan - 2015

Philip

8 - Jan - 2015

Sean Harmer

8 - Jan - 2015

Sean Harmer

8 - Jan - 2015

Philip

9 - Jan - 2015

Stephane

12 - Jan - 2015

Jasem Mutlaq

13 - Jan - 2015

Cera

17 - Jan - 2015

jiangcaiyang

17 - Jan - 2015

Sean Harmer

21 - Jan - 2015

jiangcaiyang

1 - Apr - 2015

H.O.

1 - Apr - 2015

Sean Harmer

1 - Apr - 2015

H.O.

1 - Apr - 2015

Sean Harmer

1 - Apr - 2015

H.O.

Failed to compile shader: []
QOpenGLShader::compile(Fragment) []
*** Problematic Fragment shader source code ***
#version 150
#define lowp
#define mediump
#define highp
#line 2

1 - Apr - 2015

Sean Harmer

1 - Apr - 2015

H.O.

1 - Apr - 2015

H.O.

10 - Apr - 2015

H.O.

14 - Apr - 2015

miaorui

14 - Apr - 2015

Sean Harmer

27 - Apr - 2015

Bramastyo Harimukti

27 - Apr - 2015

Sean Harmer

27 - Apr - 2015

Sean Harmer

28 - Apr - 2015

Bramastyo Harimukti

28 - Apr - 2015

Sean Harmer

30 - Apr - 2015

Bramastyo Harimukti

30 - Apr - 2015

Sean Harmer

15 - Jun - 2015

Bramastyo Harimukti

15 - Jun - 2015

Sean Harmer

28 - Jul - 2015

Bramstyo Harimukti

28 - Jul - 2015

Sean Harmer

31 - Aug - 2015

Bramstyo Harimukti

31 - Aug - 2015

Bramstyo Harimukti

22 - May - 2015

Ramesh Y

3 - Jun - 2015

Dave Anderson

9 - Jun - 2015

Sean Harmer

9 - Jun - 2015

kang

12 - Jun - 2015

Sean Harmer

11 - Jun - 2015

GHIAT houssem

12 - Jun - 2015

Sean Harmer

12 - Jun - 2015

GHIAT Houssem

12 - Jun - 2015

Sean Harmer

12 - Jun - 2015

GHIAT houssem

15 - Jun - 2015

Sean Harmer

9 - Jul - 2015

Michel

20 - Jul - 2015

Jakub

31 - Aug - 2015

Bramstyo Harimukti

22 - Jul - 2015

Ram

23 - Aug - 2015

uauaua

30 - Aug - 2015

Sean Harmer

28 - Jul - 2015

Lena

28 - Jul - 2015

Sean Harmer

29 - Jul - 2015

Lena

29 - Jul - 2015

Sean Harmer

6 - Oct - 2015

Lena

18 - Aug - 2015

YL

(Qt3D.Renderer.Jobs: virtual Qt3D::QMeshDataPtr Qt3D::MeshFunctor::operator()() OBJ load failure for: ":/assets/chest/Chest.obj"
Failed to load image :  ":/assets/textures/pattern_09/diffuse.webp"
Texture data is null, texture data failed to load)

21 - Aug - 2015

YL

30 - Aug - 2015

Sean Harmer

29 - Jun - 2017

Shinu

27 - Nov - 2015

geaggle

24 - Sept - 2015

nonamepalmer

8 - Oct - 2015

Toye onikoyi

12 - Nov - 2015

Khanh

7 - Jun - 2017

Issam

SeanHarmer

Sean Harmer

Managing Director KDAB UK