qml qt3d documentation



  • Is there any documentation to qt3d module? 5.6rc documentation isn't complete enough.

    The question is about materials. I'm trying to change color of entity like that:

    Material {
        id: material
        effect: Effect { }
        parameters: [
            Parameter { name: "ambient";   value: Qt.vector3d(0.0, 1.0, 0.0) },
            Parameter { name: "diffuse";   value: Qt.vector3d(0.0, 1.0, 0.0) },
            Parameter { name: "specular";  value: Qt.vector3d(0.0, 1.0, 0.0) },
            Parameter { name: "shininess"; value: 150.0 }
        ]
     }
    

    But the color is still standard orange. The full qml file:

    import QtQuick 2.3
    import QtQuick.Controls 1.2
    import QtQuick.Window 2.2
    import QtQuick.Scene3D 2.0
    import Qt3D 2.0
    import Qt3D.Renderer 2.0
     
    ApplicationWindow {
        visible: true
        width: 1000
        height: 500
        title: qsTr("Test")
        color: "#333333"
     
        MouseArea {
            id: mouseArea
            anchors.fill: parent
            property real old_x : 0
            property real old_y : 0
            onPressed: {
                old_x = mouse.x;
                old_y = mouse.y;
            }
            onPositionChanged: {
                var delta_x = mouse.x - old_x;
                var delta_y = mouse.y - old_y;
                camera.position.x += delta_x/10;
                camera.position.y += delta_y/10;
                camera.viewCenter.x += delta_x/10;
                camera.viewCenter.y += delta_y/10;
                old_x = mouse.x;
                old_y = mouse.y;
            }
        }
     
     
        Scene3D {
            anchors.fill: parent
            focus: true
            z: 0
            id: sc
     
            Entity {
                id: sceneRoot
     
                Camera {
                    id: camera
                    projectionType: CameraLens.PerspectiveProjection
                    fieldOfView: 45
                    aspectRatio: sc.width/sc.height
                    nearPlane : 0.1
                    farPlane : 1000.0
                    position: Qt.vector3d( 0.0, 0.0, -20.0 )
                    upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
                    viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
                }
     
                Configuration {
                    controlledCamera: camera
                }
     
                FrameGraph {
                    id : external_forward_renderer
                    activeFrameGraph : ForwardRenderer {
                        camera: camera
                        clearColor: "white"
                    }
                }
     
                components: [external_forward_renderer]
     
                CylinderMesh {
                    id: mesh
                    radius: 1
                    length: 3
                    rings: 100
                    slices: 20
                }
     
                Transform {
                    id: transform
                    Scale { scale3D: Qt.vector3d(1.5, 1.5, 1.5) }
                    Rotate {
                        angle: 45
                        axis: Qt.vector3d(1, 0, 0)
                    }
                }
     
                Material {
                    id: material
                    effect: Effect { }
                    parameters: [
                        Parameter { name: "ambient";   value: Qt.vector3d(0.1, 0.1, 0.1) },
                        Parameter { name: "diffuse";   value: Qt.vector3d(0.7, 0.7, 0.9) },
                        Parameter { name: "specular";  value: Qt.vector3d(0.1, 0.1, 0.1) },
                        Parameter { name: "shininess"; value: 150.0 }
                    ]
                }
     
                Entity {
                    id: mainEntity
                    objectName: "mainEntity"
                    components: [ mesh, material, transform ]
                }
            }
        }
    }
    

  • Lifetime Qt Champion

    Hi,

    The module being in tech preview, currently the best place to ask Qt3D related question is the interest mailing list. You'll find there Qt3D's developers/maintainers (this forum is more user oriented)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.