您的位置:首页 > 产品设计 > UI/UE

Qt公司宣布其新的高级3D API - Qt Quick 3D

2019-08-14 00:00 1676 查看

从最近的Qt6工具包的技术愿景继续,Qt公司现在宣布他们为Qt的下一个主要版本开发的新的高级3D API。

Qt Quick 3D是这个新的高级API,用于从Qt Quick中为用户界面创建3D内容,而无需任何外部引擎。 Qt Quick 3D将使用Qt 3D STUDIO目前使用的渲染器。

该公司希望Qt Quick 3D能够提供统一的图形支持,易于使用的API,具有现有Qt Quick的统一工具,跨平台性能/兼容性以及其他功能。 Qt Quick 3D将由Vulkan,Metal,Direct3D或OpenGL在后端呈现,具体取决于平台。这款新的Qt Quick 3D API不能替代现有的Qt 3D。

在考虑Qt6的同时,Qt公司的目标是将Qt Quick 3D作为Qt 5.14的技术预览添加,他们已经拥有了一个可用于Qt 5.12 LTS和更新版本的外部组件。

Qt Quick 3D不是Qt 3D的替代品,而是Qt Quick功能的扩展,使用高级API渲染3D内容。

这是一个非常简单的项目,其中包含一些有用的注释:

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick3D 1.0
 
Window {
  id: window
  visible: true
  width: 1280
  height: 720
     
  // Viewport for 3D content
  View3D {
    id: view
         
    anchors.fill: parent
    // Scene to view
    Node {
      id: scene
         
      Light {
             
        id: directionalLight
               
      }
 
      Camera {
        id: camera
        // It's important that your camera is not inside
        // your model so move it back along the z axis
        // The Camera is implicitly facing up the z axis,
        // so we should be looking towards (0, 0, 0)
        z: -600
      }
 
      Model {
        id: cubeModel
        // #Cube is one of the "built-in" primitive meshes
        // Other Options are:
        // #Cone, #Sphere, #Cylinder, #Rectangle
        source: "#Cube"
                 
        // When using a Model, it is not enough to have a
        // mesh source (ie "#Cube")
        // You also need to define what material to shade
        // the mesh with. A Model can be built up of
        // multiple sub-meshes, so each mesh needs its own
        // material. Materials are defined in an array,
        // and order reflects which mesh to shade
                 
        // All of the default primitive meshes contain one
        // sub-mesh, so you only need 1 material.
                 
        materials: [
                     
          DefaultMaterial {
                         
            // We are using the DefaultMaterial which
            // dynamically generates a shader based on what
            // properties are set. This means you don't
            // need to write any shader code yourself. 
            // In this case we just want the cube to have
            // a red diffuse color.
            id: cubeMaterial
            diffuseColor: "red"
          }
        ]
      }
    }
  }
}

有关Qt Quick 3D的更多详细信息,请参见今天的公告邮件列表帖子

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  3D API Qt Quick 3D Qt 3D