import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Scene3D 2.0
import Qt3D.Core 2.0
import Qt3D.Render 2.0
import Qt3D.Input 2.0
import Qt3D.Extras 2.0
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Rectangle {
id: scene
anchors.fill: parent
anchors.margins: 0
color: "darkGray"
Scene3D {
id: scene3d
anchors.fill: parent
anchors.margins: 0
focus: true
aspects: ["input", "logic"]
cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
visible:true
Entity {
id: sceneRoot
Camera {
id: camera
projectionType: CameraLens.PerspectiveProjection
fieldOfView: 45
nearPlane : 0.1
farPlane : 1000.0
position: Qt.vector3d( 0.0, 0.0, 2.0 )
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
FirstPersonCameraController { camera: camera }
components: [
RenderSettings {
activeFrameGraph: ForwardRenderer {
camera: camera
clearColor: "transparent"
}
},
InputSettings { }
]
SceneLoader
{
id: wheelMesh
source: "qrc:///disk_g.obj"
}
Transform {
id: wheelTransform
property real userAngle: 70
matrix: {
var m = Qt.matrix4x4();
m.rotate(userAngle, Qt.vector3d(0, 1, 0))
m.translate(Qt.vector3d(0, 0, 0));
return m;
}
}
DirectionalLight
{
id: wheelLight
worldDirection: Qt.vector3d(0, -0.707, -0.707)
color:"White"
intensity: 1.0
}
DirectionalLight
{
id: wheelLight1
worldDirection: Qt.vector3d(0, 0.707, -0.707)
color:"White"
intensity: 1.0
}
Entity {
id: sphereEntity
components: [ wheelMesh, wheelLight, /*wheelLight1,*/ wheelTransform ]
}
}
}
}
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Scene3D 2.0
import Qt3D.Core 2.0
import Qt3D.Render 2.0
import Qt3D.Input 2.0
import Qt3D.Extras 2.0
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Rectangle {
id: scene
anchors.fill: parent
anchors.margins: 0
color: "darkGray"
Scene3D {
id: scene3d
anchors.fill: parent
anchors.margins: 0
focus: true
aspects: ["input", "logic"]
cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
visible:true
Entity {
id: sceneRoot
Camera {
id: camera
projectionType: CameraLens.PerspectiveProjection
fieldOfView: 45
nearPlane : 0.1
farPlane : 1000.0
position: Qt.vector3d( 0.0, 0.0, 2.0 )
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
FirstPersonCameraController { camera: camera }
components: [
RenderSettings {
activeFrameGraph: ForwardRenderer {
camera: camera
clearColor: "transparent"
}
},
InputSettings { }
]
SceneLoader
{
id: wheelMesh
source: "qrc:///disk_g.obj"
}
Transform {
id: wheelTransform
property real userAngle: 70
matrix: {
var m = Qt.matrix4x4();
m.rotate(userAngle, Qt.vector3d(0, 1, 0))
m.translate(Qt.vector3d(0, 0, 0));
return m;
}
}
DirectionalLight
{
id: wheelLight
worldDirection: Qt.vector3d(0, -0.707, -0.707)
color:"White"
intensity: 1.0
}
DirectionalLight
{
id: wheelLight1
worldDirection: Qt.vector3d(0, 0.707, -0.707)
color:"White"
intensity: 1.0
}
Entity {
id: sphereEntity
components: [ wheelMesh, wheelLight, /*wheelLight1,*/ wheelTransform ]
}
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks