CarChallenge 3D Demo
import Qt3D.Core 2.0
import Qt3D.Render 2.0
import QtQuick.Scene3D 2.0
import QtQuick 2.0 as QQ2
Entity {
id: sceneRootEntity
property alias cameraPosition: camera.position
property alias cameraUpVector: camera.upVector
property alias cameraViewCenter: camera.viewCenter
property alias frameGraph: frameGraph
FrameGraph {
id : frameGraph
Viewport {
id : mainViewport
rect: Qt.rect(0, 0, 1, 1)
clearColor: "cyan"
ClearBuffer {
buffers : ClearBuffer.ColorDepthBuffer
}
Viewport {
id : fullscreenViewport
rect : Qt.rect(0, 0, 1, 1)
CameraSelector {camera : cameraViewport1}
}
Viewport {
id : topdownViewport
rect : Qt.rect(0.8, 0.8, 1, 1)
CameraSelector {camera : cameraTopDown}
}
}
}
CameraLens {
id : cameraLens
projectionType: CameraLens.PerspectiveProjection
fieldOfView: 45
aspectRatio: 16/9
nearPlane : 0.01
farPlane : 2000.0
}
Entity {
id : cameraViewport1
property Transform transform : Transform {
LookAt {
id: camera
position: Qt.vector3d( 0,0,-1000 )
upVector: Qt.vector3d( 1,0,0 )
viewCenter: Qt.vector3d( 0,0,0 )
}
}
components : [cameraLens, transform]
}
Entity {
id : cameraViewport2
property Transform transform : Transform {
LookAt {
position: Qt.vector3d( 1000,0,0 )
upVector: Qt.vector3d( 0,1,0 )
viewCenter: Qt.vector3d( 0,0,0 )
}
}
components : [cameraLens, transform]
}
Entity {
id : cameraViewport3
property Transform transform : Transform {
LookAt {
position: Qt.vector3d( 0,1000,0 )
upVector: Qt.vector3d( -1,0,0 )
viewCenter: Qt.vector3d( 0,0,0 )
}
}
components : [cameraLens, transform]
}
Entity {
id : cameraTopDown
property Transform transform : Transform {
LookAt {
position: Qt.vector3d( -level.width/2, -level.height/2, -500 )
upVector: Qt.vector3d( 0, 1, -1 )
viewCenter: Qt.vector3d( -level.width/2, -level.height/2, 0 )
}
}
components : [cameraLens, transform]