Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. qml qt3d documentation
Forum Updated to NodeBB v4.3 + New Features

qml qt3d documentation

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 822 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tanshihaj
    wrote on last edited by
    #1

    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 ]
                }
            }
        }
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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)

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved