Advertisement
Guest User

Untitled

a guest
Oct 8th, 2018
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 2.05 KB | None | 0 0
  1. import QtQuick.Controls 1.4
  2. import QtQuick.Dialogs 1.3
  3. import QtQuick.Scene3D 2.0
  4.  
  5. import Qt3D.Core 2.0
  6. import Qt3D.Render 2.0
  7. import Qt3D.Input 2.0
  8. import Qt3D.Extras 2.0
  9.  
  10. ApplicationWindow
  11. {
  12.     visible: true
  13.     width: 640
  14.     height: 480
  15.     title: qsTr("3D Viewer")
  16.  
  17.     toolBar: ToolBar
  18.         {
  19.             ToolButton
  20.             {
  21.                 text: "Open 3D Model"
  22.                 onClicked:
  23.                 {
  24.                     fileDialog.open()
  25.                 }
  26.             }
  27.         }
  28.  
  29.     FileDialog
  30.     {
  31.         id: fileDialog
  32.         onAccepted:
  33.         {
  34.             sceneLoader.source = fileDialog.fileUrl
  35.         }
  36.     }
  37.  
  38.     Scene3D
  39.     {
  40.         anchors.fill: parent
  41.  
  42.         aspects: ["input", "logic"]
  43.         cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
  44.  
  45.         Entity
  46.         {
  47.             id: sceneRoot
  48.  
  49.             Camera
  50.             {
  51.                 id: camera
  52.                 projectionType: CameraLens.PerspectiveProjection
  53.                 fieldOfView: 30
  54.                 aspectRatio: 16/9
  55.                 nearPlane : 0.1
  56.                 farPlane : 1000.0
  57.                 position: Qt.vector3d( 10.0, 0.0, 0.0 )
  58.                 upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
  59.                 viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
  60.             }
  61.  
  62.             OrbitCameraController
  63.             {
  64.                 camera: camera
  65.             }
  66.  
  67.             components: [
  68.                 RenderSettings
  69.                 {
  70.                     activeFrameGraph: ForwardRenderer
  71.                     {
  72.                         clearColor: Qt.rgba(0, 0.5, 1, 1)
  73.                         camera: camera
  74.                     }
  75.                 },
  76.                 InputSettings
  77.                 {
  78.                 }
  79.             ]
  80.  
  81.             Entity
  82.             {
  83.                 id: monkeyEntity
  84.                 components: [
  85.                     SceneLoader
  86.                     {
  87.                         id: sceneLoader
  88.                     }
  89.                 ]
  90.             }
  91.         }
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement