rahulch

Untitled

Mar 7th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 2.21 KB | None | 0 0
  1. import Qt3D.Core 2.12
  2. import Qt3D.Render 2.12
  3. import Qt3D.Extras 2.12
  4. import Qt3D.Input 2.12
  5. import QtQuick.Scene3D 2.12
  6. import QtQuick 2.12 as QQ2
  7.  
  8. Scene3D {
  9.     id: scene3d
  10.     anchors.fill: parent
  11.     focus: true
  12.     aspects: ["input", "logic"]
  13.     cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
  14.     Entity {
  15.         id: sceneRoot
  16.  
  17.         Camera {
  18.             id: camera
  19.             projectionType: CameraLens.PerspectiveProjection
  20.             fieldOfView: 45
  21.             nearPlane: 0.1
  22.             farPlane: 1000.0
  23.             position: Qt.vector3d(0.0, 0.0, 40.0)
  24.             upVector: Qt.vector3d(0.0, 1.0, 0.0)
  25.             viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
  26.         }
  27.  
  28.         FirstPersonCameraController {
  29.             camera: camera
  30.         }
  31.  
  32.         components: [
  33.             RenderSettings {
  34.                 activeFrameGraph: ForwardRenderer {
  35.                     camera: camera
  36.                     clearColor: "transparent"
  37.                 }
  38.             },
  39.             InputSettings {
  40.             }
  41.         ]
  42.  
  43.         PhongMaterial {
  44.             id: material
  45.         }
  46.  
  47.         Mesh {
  48.             id: sphereMesh
  49. //             source: "images/face3d/face_bse_mesh.obj"
  50.             source: "images/robo-obj-pose4/source/d2f0cff60afc40f5afe79156ec7db657.obj"
  51.         }
  52.  
  53.         Transform {
  54.             id: modelTransform
  55.             property real userAngle: 0.0
  56.             matrix: {
  57.                 var m = Qt.matrix4x4()
  58.                 m.rotate(userAngle, Qt.vector3d(0, 1, 0))
  59. //                 m.translate(Qt.vector3d(20, 0, 0))
  60.                 return m
  61.             }
  62.         }
  63.        
  64.         QQ2.NumberAnimation {
  65.             target: modelTransform
  66.             property: "userAngle"
  67.             duration: 10000
  68.             from: 0
  69.             to: 360
  70.            
  71.             loops: QQ2.Animation.Infinite
  72.             running: true
  73.         }
  74.        
  75.         Entity {
  76.             id: sphereEntity
  77.             components: [sphereMesh, material, modelTransform]
  78.         }
  79.  
  80.         InputSettings {
  81.             id: inputSettings
  82.         }
  83.    
  84.         OrbitCameraController{
  85.             id: orbitCamera
  86.             camera: camera
  87.         }
  88.     }
  89. }
Add Comment
Please, Sign In to add comment