Qt3D 接口整体介绍

  • 1 整体介绍

转自 http://surfsky.cnblogs.com

1 整体介绍

----------------------------------------------
概述
- 请阅读QtHelp: Qt 3D Overviewhttps://www.kdab.com/overview-qt3d-2-0-part-1/http://blog.csdn.net/iron_lzn/article/details/51363959
- 上youtube 搜索 Qt 3D 视频
- 上kdab公司的网站,Qt3D的主要代码都是kdab公司提供的
- 建模示例:https://www.kdab.com/qt-3d-animation-easter-teaser/
----------------------------------------------
功能2D and 3D rendering     : 2d/3d渲染Meshes and Geometry     : 面片和坐标Materials               : 材质Shaders                 : 着色器Shadow mapping          : 阴影贴图(一种实时阴影技术)Ambient occlusion       : 环境光遮蔽(一种全局光技术)High dynamic range      : 高动态范围(HDR)Deferred rendering      : 延迟渲染(一种多光源渲染技术)Multitexturing          : 多材质Instanced rendering     : 实例渲染Uniform Buffer Objects  : 统一缓冲对象(HBO)相关库QT += 3dcore 3drender 3dinput 3dlogic 3dextras#include <Qt3DCore>#include <Qt3DRender>#include <Qt3DInput>#include <Qt3DLogic>#include <Qt3DExtras>QT += 3dcore 3drender 3dinput 3dlogic 3dextras qml quick 3dquickimport Qt3D.Core 2.0      // 节点实体模型,基础变化import Qt3D.Render 2.0    // 相机,缓冲,滤镜,图层,面片,光照,特效,材质,Shader,import Qt3D.Input 2.0     // 输入import Qt3D.Logic 2.0     // 每帧动画控制import Qt3D.Extras 2.0    // 第一人称相机,轨道相机,反射贴图,基础模型等继承关系Node                            // qt3d 所有类的基类Entity                      //Camera                  //Component3D                 //Layer                   //Transform               //CameraLens              //ComputeCommand          //FrameAction             //InputSettings           //KeyboardHandler         //GeometryRenderer        //Mesh                // 面片ConeMesh            // 圆锥体 ConeMesh {bottomRadius: 0.05; topRadius: 0; length : 0.1; rings : 10; slices: 10},CuboidMesh          // 长方体CylinderMesh        // 圆柱体 CylinderMesh{length : size; radius : 0.05; rings : 10; slices: 10}PlaneMesh           // 平面  PlaneMesh {width: 1.0; height: 1.0; meshResolution: Qt.size(2, 2)}SphereMesh          // 球体  SphereMesh {radius: 1}TorusMesh           // 三叶体Light                   // 光照基类DirectionLight      // 方向光(如太阳)PointLight          // 电光源(如灯泡)SportLight          // 聚光Material                               //Texture2D                          //DiffuseMapMaterial                 // 漫反射贴图材质DiffuseSpecularMapMaterial         // 漫反射高光贴图材质GoochMaterial                      // Gooch shading model, popular in CAD and CAM applicationsNormalDiffuseMapMaterial           //NormalDiffuseMapAlphaMaterial      //NormalDiffuseSpecularMapMaterial   //PhongMaterial                      //PhongAlphaMaterial                 //PerVertexColorMaterial             //AbstractTextureImage        //Effect                      //FilterKey                   //FrameGraphNode              // FrameGraph 配置基类,用于控制渲染LayerFilter             // 层过滤(只显示指定层的对象)CameraSelector          // 相机选择器ClearBuffers            // enables clearing of the specific render target buffers with specific valuesDispatchCompute         // FrameGraph node to issue work for the compute shader on GPUFrustumCulling          // enables frustum culling of the drawable entities based on the camera view and Geometry bounds of the entitiesNoDraw                  // Prevents from drawing anythingRenderCapture           // Used to request render capture. User can specify a captureId to identify the request.RenderSurfaceSelector   // be used to select the surfaceRenderTargetSelector    // s used to select active RenderTarget for the FrameGraphRenderPassFilter        //RenderStateSet          //SortPolicy              //TechniqueFilter         //Viewport                //KeyboardDevice              //RenderPass                  //RenderState                 //RenderTargetOutput          //ShaderProgrameCameraControllerFirstPersonCameraController  // 第一人称相机控制器(类似cs)OrbitCameraController        // 轨道相机控制器(围绕物体旋转)Geometry                    //ConeGeometry            // allows creation of a cone in 3D spaceCuboidGeometry          // allows creation of a cuboid in 3D space.CylinderGeometry        //PlaneGeometry           //SphereGeometry          //TorusGeometry           //egCuboidMesh {id: meshproperty real multiplier: 0.0256xExtent: 512 * multiplieryExtent: 768 * multiplierzExtent: 2.0yzMeshResolution: Qt.size(20, 20)xzMeshResolution: Qt.size(20, 20)xyMeshResolution: Qt.size(20, 20)}显示OpenGL版本Rectangle {color: "black"Text {color: "white"anchors.centerIn: parenttext: "Open%4 %1.%2 %3".arg(OpenGLInfo.majorVersion).arg(OpenGLInfo.minorVersion).arg({0: "NoProfile", 1: "CoreProfile", 2: "CompatibilityProfile"}[OpenGLInfo.profile]).arg({0: "Unspecified", 1: "GL", 2: "GLES"}[OpenGLInfo.renderableType])styleColor: "#8b8b8b"style: Text.Sunkenfont.pointSize: 24onTextChanged: {Resources.setGlInfo(OpenGLInfo);}}}----------------------------------------------
Scene3D
提供3d运行场景,嵌在普通qml中
----------------------------------------------
属性activeCamera : Camera3DactiveLight : Light3DdevicePixelRatio : floatgraphPositionQuery : pointinvalidSelectionPoint : pointprimarySubViewport : rectsecondarySubViewport : rectsecondarySubviewOnTop : boolselectionQueryPosition : pointslicingActive : boolviewport : rect示例Scene3D {id: scene3danchors.fill: parentanchors.margins: 10focus: trueaspects: ["input", "logic"]cameraAspectRatioMode: Scene3D.AutomaticAspectRatioAnimatedEntity {}}----------------------------------------------
Entity
Entity有个属性component,里面可以容纳 Mesh, Transformation, Audio, Material.....,
这是一种很灵活的方式,可简化3d对象类的层次,也便于扩展。
----------------------------------------------
标准写法Entity {components: [Mesh {source: "assets/obj/toyplane.obj"},PhongMaterial {diffuse: "white"; shininess: 50}]}从文件中加载场景Entity {components: [SceneLoader {source: "qrc:/assets/test_scene.dae"}]}----------------------------------------------
Camera
import Qt3D.Core 2.0
import Qt3D.Render 2.0
----------------------------------------------
第一人称三角透视相机Camera {id: mainCameraobjectName: "mainCamera"projectionType: CameraLens.PerspectiveProjectionfieldOfView: 22.5aspectRatio: _window.width / _window.heightonAspectRatioChanged: console.log( "aspectRatio = " + aspectRatio )nearPlane:   0.01farPlane:    1000.0viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )upVector:   Qt.vector3d( 0.0, 1.0, 0.0 )}FirstPersonCameraController { camera: mainCamera }轨道透视相机(右键按住拖动,可对准原点旋转相机)components: [RenderSettings {activeFrameGraph: ForwardRenderer {clearColor: Qt.rgba(0, 0.5, 1, 1)camera: camera}},InputSettings { }]Camera {id: cameraprojectionType: CameraLens.PerspectiveProjectionfieldOfView: 45aspectRatio: 16/9nearPlane : 0.1farPlane : 1000.0position: Qt.vector3d( 0.0, 0.0, -40.0 )upVector: Qt.vector3d( 0.0, 1.0, 0.0 )viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )}OrbitCameraController { camera: camera}多角度观测Viewport {id: mainViewportnormalizedRect: Qt.rect(0, 0, 1, 1)ClearBuffers {buffers: ClearBuffers.ColorDepthBuffer}Viewport {id: topLeftViewportnormalizedRect: Qt.rect(0, 0, 0.5, 0.5)CameraSelector { id: cameraSelectorTopLeftViewport }}Viewport {id: topRightViewportnormalizedRect: Qt.rect(0.5, 0, 0.5, 0.5)CameraSelector { id: cameraSelectorTopRightViewport }}Viewport {id: bottomLeftViewportnormalizedRect: Qt.rect(0, 0.5, 0.5, 0.5)CameraSelector { id: cameraSelectorBottomLeftViewport }}Viewport {id: bottomRightViewportnormalizedRect: Qt.rect(0.5, 0.5, 0.5, 0.5)CameraSelector { id: cameraSelectorBottomRightViewport }}}----------------------------------------------
Light
----------------------------------------------
方向光(平行光,如太阳)Enity {components: [DirectionalLight {worldDirection: Qt.vector3d(0.3, -3.0, 0.0).normalized();color: "#fbf9ce"intensity: 0.3}]}点光源(如灯泡)Entity {components: [PointLight {color: "red"intensity: 0.3constantAttenuation: 1.0linearAttenuation: 0.0quadraticAttenuation: 0.0025}]}聚光(如舞台聚光灯)Entity {components: [SpotLight {localDirection: Qt.vector3d(0.0, -1.0, 0.0)color: "white"intensity: 0.6}]}----------------------------------------------
Material(材质)
贴图相关概念https://zhidao.baidu.com/question/167602912.htmlhttp://www.cnblogs.com/xiuj/p/5875461.html-------------------------------------------ambient                 : 环境色。物体自己发出的光。diffuse map             : 漫反射贴图(色彩贴图), 它的作用是给模型上颜色和材质specular map            : 高光贴图,不同材质,在光照下,它们的反射光的强弱都不同normal map              : 法线贴图.用来表现凹凸-------------------------------------------gloss map               : 指示着色器对物体的表面的某些部分着色更亮一点,某些部分更暗一点,因为Gloss Maps只需要单通道, 可用alpha通道的图或灰度图emboss bump map         : 做表面的浮雕效果的opacity map             : 透明贴图。透明通道制作头发或者损坏的衣服布料等等可以用到shininess               : 光泽(0-1)lighting map 和 AO map  : 让材质制作更加逼真,更加方便
Qt3D中材质用Material组件编写提供了几种材质组件,通常是几种贴图方式的组合PhongMaterialDiffuseMapMaterialNormalDiffuseMapMaterialGoochMaterial
----------------------------------------------
简单色彩材质色彩材质ColorMaterial{diffuseColor: Qt.rgba(0.2, 0.5, 0.3, 1.0)specularColor: Qt.rgba(0, 0, 0, 1.0)}Phong 基础光照模型材质PhongMaterial {ambient: Qt.rgba( 0.02, 0.02, 0.02, 1.0 )diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )specular: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )shininess: 1.0}PhongAlphaMaterial(带透明通道的基础Phong光照模型材质)PhongMaterial {ambient: Qt.rgba( 0.02, 0.02, 0.02, 1.0 )diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )specular: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )shininess: 1.0alpha: 0.8}GoochMaterialGooch光照渲染模型。常用于CAD和CAM程序,完全拟真不是该模型的目标,该模型同时使用 color 和 brightness 来显示3d表面的弯曲部分;该模型混合了漫反射光/冷光/暖光来产生渐变色带,冷光和暖光分别由alpha和beta参数影响。色带区间:[cool + alpha * diffuse, warm + beta * diffuse]参数shininess : realdiffuse : colorspecular : colorcoolColor : colorwarmColor : coloralpha : realbeta : realPerVertexColorMaterialDefault implementation for rendering the color properties set for each vertex帮助上没有任何参数漫反射贴图材质(Phong光照模型)漫反射贴图材质(漫反射由贴图提供)DiffuseMapMaterial {diffuse: "assets/chest/diffuse.webp"specular: Qt.rgba( 0.2, 0.2, 0.2, 1.0 )shininess: 2.0ambient: colortextureScale: 1.0}漫反射高光贴图材质(漫反射和高光均有贴图提供)DiffuseSpecularMapMaterial{diffuse: "assets/chest/diffuse.webp"specular: "assets/chest/specular.webp"shininess: 2.0ambient: colortextureScale: 1.0}凹凸贴图材质(用贴图来模拟细节,减小建模复杂度)法线漫反射贴图材质(实现了phong光照和凹凸贴图模型)NormalDiffuseMapMaterial {ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )shininess: 5.0textureScale: 1.0diffuse: "assets/houseplants/pot.webp"normal: "assets/houseplants/pot_normal.webp"specular: Qt.rgba( 0.75, 0.75, 0.75, 1.0 )}法线漫反射贴图质(和前一个的区别?)NormalDiffuseMapAlphaMaterial {ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )shininess: 1.0textureScale: 1.0diffuse: "qrc:/images/songtitle.png"normal: "qrc:/images/normalmap.png"specular: color}法线漫反射高光贴图材质(高光可以指定贴图)NormalDiffuseSpecularMapMaterial {ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )shininess: 10.0textureScale: 10.0diffuse:  "assets/textures/pattern_09/diffuse.webp"normal:   "assets/textures/pattern_09/normal.webp"specular: "assets/textures/pattern_09/specular.webp"}自定义材质(使用Shader技术实现)示例1Material {id: instancedPhongMaterialeffect: Effect {techniques: Technique {graphicsApiFilter {api: GraphicsApiFilter.OpenGLprofile: GraphicsApiFilter.CoreProfileminorVersion: 2majorVersion: 3}filterKeys: FilterKey { name: "renderingStyle"; value: "forward" }renderPasses: RenderPass {shaderProgram: ShaderProgram {vertexShaderCode: loadSource("qrc:/instanced.vert")fragmentShaderCode: loadSource("qrc:/instanced.frag")}}}}}线框材质请查看官方示例“Wireframe qml example”WireframeMaterial {id: wireframeMaterialeffect: WireframeEffect {}ambient: Qt.rgba( 0.2, 0.0, 0.0, 1.0 )diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )}详见官方示例:Planets qml exampleTexture2D {id: diffuseTextureminificationFilter: Texture.LinearMipMapLinearmagnificationFilter: Texture.LinearwrapMode {x: WrapMode.Repeaty: WrapMode.Repeat}generateMipMaps: truemaximumAnisotropy: 16.0TextureImage {source: "qrc:/texturePalette.png"}}----------------------------------------------
Layer(QLayer>)
类似ps中的图层,可在程序中控制某些图层显示隐藏
----------------------------------------------import Qt3D.Core 2.0import Qt3D.Render 2.0Entity {id: rootcomponents: RenderSettings {Viewport {ClearBuffers {buffers: ClearBuffers.ColorDepthBufferCameraSelector {camera: mainCameraLayerFilter {layers: [layer1]}}}}}Camera { id: mainCamera }// sceneEntity {id: renderableEntitycomponents: [ mesh, layer1 ]}Layer { id: layer1 }GeometryRenderer { id: mesh }}----------------------------------------------
TechniqueFilter e
----------------------------------------------
import Qt3D.Core 2.0
import Qt3D.Render 2.0
TechniqueFilter {property alias camera: cameraSelector.cameraproperty alias window: surfaceSelector.surfaceid: rootobjectName : "techniqueFilter"matchAll: [ FilterKey { name: "renderingStyle"; value: "forward" } ]  // Select the forward rendering Technique of any used EffectRenderSurfaceSelector {id: surfaceSelectorViewport {id: viewportobjectName : "viewport"normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)CameraSelector {id : cameraSelectorobjectName : "cameraSelector"ClearBuffers {buffers : ClearBuffers.ColorDepthBufferclearColor: "black"SortPolicy {sortTypes: [SortPolicy.StateChangeCost,SortPolicy.Material]}}}}}
}----------------------------------------------
AspectEngine
----------------------------------------------
3d模拟是AspectEngine来执行等
AbstractAspectBehavior 处理组件数据RenderAspect
InputAspect
LoginAspect----------------------------------------------
FrameGraph & ViewPort & Layer
描述了后期处理逻辑,如:阴影/透明/后期处理/多视图/选择渲染
import Qt3D.Core 2.0
import Qt3D.Render 2.0
----------------------------------------------
默认的RenderSettingEntity {Camera { id:camera ... }FirstPersonCameraController {camera:camera}components: [RenderSetting{activeFrameGraph : ForwardRenderer {camera:camera, clearColor:"transparent"},InputSetting{}}]...}自定义RenderSetting(多视图)RenderSettings {id: quadViewportFrameGraphproperty alias topLeftCamera: cameraSelectorTopLeftViewport.camera;property alias topRightCamera: cameraSelectorTopRightViewport.camera;property alias bottomLeftCamera: cameraSelectorBottomLeftViewport.camera;property alias bottomRightCamera: cameraSelectorBottomRightViewport.camera;property alias window: surfaceSelector.surfaceactiveFrameGraph: RenderSurfaceSelector {id: surfaceSelectorViewport {id: mainViewportnormalizedRect: Qt.rect(0, 0, 1, 1)ClearBuffers {buffers: ClearBuffers.ColorDepthBuffer}Viewport {id: topLeftViewportnormalizedRect: Qt.rect(0, 0, 0.5, 0.5)CameraSelector { id: cameraSelectorTopLeftViewport }}Viewport {id: topRightViewportnormalizedRect: Qt.rect(0.5, 0, 0.5, 0.5)CameraSelector { id: cameraSelectorTopRightViewport }}Viewport {id: bottomLeftViewportnormalizedRect: Qt.rect(0, 0.5, 0.5, 0.5)CameraSelector { id: cameraSelectorBottomLeftViewport }}Viewport {id: bottomRightViewportnormalizedRect: Qt.rect(0.5, 0.5, 0.5, 0.5)CameraSelector { id: cameraSelectorBottomRightViewport }}}}}选择图层渲染RenderSurfaceSelector{RenderTargetSelector{target: sceneTargetCameraSelector{camera: mainCameraClearBuffer {buffers: ClearBuffers.ColorDepthBufferclearColor: "white"NoDraw{}}LayerFilter{layers: [objectsLayer]RenderPassFilter{matchAny: FilterKey{name: "renderPass"; value: "allObjects"}}}LayerFilter{layers: [enviromentLayer]}}}}----------------------------------------------
CustomMaterial & Effect
----------------------------------------------
import Qt3D.Core 2.0
import Qt3D.Render 2.0
Material {// 定义材质的参数id: rootproperty color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )property color specular: Qt.rgba( 0.95, 0.95, 0.95, 1.0 )property real shininess: 150.0property real lineWidth: 0.8property color lineColor: Qt.rgba( 0.0, 0.0, 0.0, 1.0 )parameters: [Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },Parameter { name: "shininess"; value: root.shininess },Parameter { name: "line.width"; value: root.lineWidth },Parameter { name: "line.color"; value: root.lineColor }]// 具体的效果实现逻辑(使用Shader实现)effect: Effect {parameters: [Parameter { name: "ka";  value: Qt.vector3d( 0.1, 0.1, 0.1 ) },Parameter { name: "kd";  value: Qt.vector3d( 0.7, 0.7, 0.7 ) },Parameter { name: "ks";  value: Qt.vector3d( 0.95, 0.95, 0.95 ) },Parameter { name: "shininess"; value: 150.0 }]techniques: [Technique {graphicsApiFilter {api: GraphicsApiFilter.OpenGLprofile: GraphicsApiFilter.CoreProfilemajorVersion: 3minorVersion: 1}filterKeys: [ FilterKey { name: "renderingStyle"; value: "forward" } ]parameters: [Parameter { name: "light.position"; value: Qt.vector4d( 0.0, 0.0, 0.0, 1.0 ) },Parameter { name: "light.intensity"; value: Qt.vector3d( 1.0, 1.0, 1.0 ) },Parameter { name: "line.width"; value: 1.0 },Parameter { name: "line.color"; value: Qt.vector4d( 1.0, 1.0, 1.0, 1.0 ) }]// 渲染通道renderPasses: [RenderPass {shaderProgram: ShaderProgram {vertexShaderCode:   loadSource("qrc:/Materials/Shaders/robustwireframe.vert")geometryShaderCode: loadSource("qrc:/Materials/Shaders/robustwireframe.geom")fragmentShaderCode: loadSource("qrc:/Materials/Shaders/robustwireframe.frag")}}]}]}
}
shader 详见Qt3D.Shader章节----------------------------------------------
ObjectPicker & animation(5.9)
https://www.kdab.com/qt-3d-animation-easter-teaser/
ClipAnimator 5.9 提供。可加载设计好的动画
----------------------------------------------
Entity {id: cubecomponents: [Transform {id: cubeTransform},Mesh {source: "qrc:/assets/egg/egg.obj"},TexturedMetalRoughMaterial {baseColor: TextureLoader {format: Texture.SRGB8_Alpha8source: "qrc:/assets/egg/basecolor.png"}metalness: TextureLoader { source: "qrc:/assets/egg/metalness.png" }roughness: TextureLoader { source: "qrc:/assets/egg/roughness.png" }normal: TextureLoader { source: "qrc:/assets/egg/normal.png" }ambientOcclusion: TextureLoader { source: "qrc:/assets/egg/ambientocclusion.png" }},ObjectPicker {onClicked: animator.running = true},ClipAnimator {id: animatorloops: 3clip: AnimationClipLoader { source: "qrc:/jumpinganimation.json" }channelMapper: ChannelMapper {mappings: [ChannelMapping { channelName: "Location"; target: cubeTransform; property: "translation" },ChannelMapping { channelName: "Rotation"; target: cubeTransform; property: "rotation" },ChannelMapping { channelName: "Scale"; target: cubeTransform; property: "scale3D" }]}}]
}----------------------------------------------
-- 批量生成对象
----------------------------------------------NodeInstantiator {id: collectionproperty int maxCount: parent.numberOfBarsmodel: maxCountdelegate: BarEntity {id: cubicEntityentityMesh: CuboidMesh {xExtent: 0.1; yExtent: 0.1; zExtent: 0.1}rotationTimeMs: sceneRoot.barRotationTimeMsentityIndex: indexentityCount: sceneRoot.numberOfBarsentityAnimationsState: animationStatemagnitude: 0}}NodeInstantiator {id: gridmodel: rows * columnsproperty int rows: 6property int columns: 11Entity {property int _row: index / grid.columnsproperty int _col: index % grid.columnscomponents: [ sphereTransform, sphereMesh, sphereMaterial ]SphereMesh {id: sphereMeshslices: 60rings: 60radius: 0.65}Transform {id: sphereTransformtranslation: Qt.vector3d(-7.5 + _col * 1.5, -4.0 + _row * 1.5, 0)}MetalRoughMaterial {id: sphereMaterialbaseColor: scene.baseColormetalness: 0.2 * _rowroughness: 0.1 * _col}}}----------------------------------------------
-- 杂
----------------------------------------------
KeyboardInput可响应键盘消息LogicComponent可设置逻辑。如物体位置/精灵创建/离屏销毁等。FrameGraph如何渲染场景CameraSelector NoDrawViewport {CameraSelector {ClearBuffers {buffers: ClearBuffers.ColorDepthBufferNoDraw { } // Prevents from drawing anything}RenderPassFilter {...}RenderPassFilter {...}}}ClearBuffersClearBuffers {buffers: ClearBuffers.DepthBufferCameraSelector {id: lightCameraSelector}}--------------------------------------------------
三维旋转控制
--------------------------------------------------// 旋转Transform {id: modelTransformproperty real angle: 0matrix: {var m = cameraMatrix.inverted();m.translate(Qt.vector3d(6,-4 - (1.0 - showDetailsTransitionState) * 10,-20 * showDetailsTransitionState));m.rotate(modelTransform.angle, Qt.vector3d(0, 1, 0));  // 动画绕y轴旋转360度m.rotate(15, Qt.vector3d(0, 0, 1)); // 沿z轴倾斜15度return m;}}//Transform {id: cameraRotationTransformmatrix: {var m = Qt.matrix4x4();m.rotate(-19 * window.carouselOffset, Qt.vector3d(0.0, 1.0, 0.0));m.rotate(5 * mainCamera.roll, Qt.vector3d(0.0, 0.0, 1.0));m.lookAt(Qt.vector3d( 0.0, 0.0, 0.0 ),Qt.vector3d(-40 * Math.sin(mainCamera.yaw), mainCamera.roll * 3, -40 * Math.cos(mainCamera.yaw) ),Qt.vector3d( 0.0, 1.0, 0.0 ));return m;}}Transform {id: modelTransformmatrix: {var m = cameraMatrix.inverted();m.translate(Qt.vector3d(0.0, -1.5 + (1.5 * showDetailsTransitionState), -40));m.rotate(40 * Math.min(1.0, showDetailsTransitionState * 1.5), Qt.vector3d(0, 1, 0));m.translate(Qt.vector3d(-25 * Math.max(0, showDetailsTransitionState - 0.4), 0.0, 0.0));return m;}}
--------------------------------------------------
贴图位置的控制
--------------------------------------------------
import Qt3D.Core 2.0
import Qt3D.Render 2.0
Texture2D {property alias source: image.sourceminificationFilter: Texture.LinearMipMapLinearmagnificationFilter: Texture.LineargenerateMipMaps: truewrapMode {x: WrapMode.ClampToEdgey: WrapMode.ClampToEdge}TextureImage {id: image}
}

Qt3D 接口整体介绍 [好]相关推荐

  1. JAVA中常用接口的介绍及使用示例 java lang Comparable

    分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章.分享知识,造福人民,实现我们中华民族伟大复兴! JAVA ...

  2. FusionSphere整体介绍

    FusionSphere整体介绍 分类专栏: 云计算 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.cs ...

  3. 瑞吉外卖01-项目整体介绍

    瑞吉外卖-项目整体介绍 前言 软件开发整体介绍(了解) 软件开发流程 第1阶段: 需求分析 第2阶段: 设计 第3阶段: 编码 第4阶段: 测试 第5阶段: 上线运维 角色分工 软件环境 开发环境(d ...

  4. 软件架构--架构设计的整体介绍

    软件架构--架构设计的整体介绍 1 介绍 1.1 概述 1.2 复杂系统 1.3 架构目标 1.4 架构过程(引用<系统架构:复杂系统的产品设计与开发>) 1.5 系统预测方式 经验 实验 ...

  5. 会员徽章系统 - 整体介绍及方案设计

    本文主要从整体介绍了新版会员徽章系统的设计方案以及未来规划,主要描述了等级模型的设计思路,读者可以通过本文对徽章系统的核心功能有初步的了解. 背景介绍 1.1 关于会员系统 众所周知,任何一款APP的 ...

  6. Mysql整体介绍(适用于5.X版本)(上)(标贝科技)

    标贝科技 https://ai.data-baker.com/#/?source=qwer12 填写邀请码fwwqgs,每日免费调用量还可以翻倍 Mysql整体介绍(适用于5.X版本)(标贝科技) M ...

  7. (兼容正点原子引脚)OV7670 FIFO 30W摄像头介绍(一) --- 整体介绍/SCCB时序

    在介绍OV7670之前先附上模块链接:点击购买OV7670摄像头模块 1. OV7670摄像头介绍 整体介绍 OV7670 是 OV(OmniVision)公司生产的一颗 1/6 寸的 CMOS VG ...

  8. 基于ARM+LINUX的无线视频采集系统设计----------项目整体介绍

    开发平台: ARM板:TQ2440/GQ2440 内核:linux-2.6.30 硬件配置: 无线路由器 无线网卡 Usb摄像头 电机驱动模块+小车 整体介绍: 本项目选用S3C2440作为主控制器, ...

  9. Hadoop学习之整体介绍及环境搭建

    Hadoop学习之整体介绍及环境搭建 1 大数据概述 1.1 什么是大数据 数据(data)是事实或观察的结果,是对客观事物的逻辑归纳,是用于表示客观事物的未经加 工的的原始素材. 大数据:传统处理方 ...

最新文章

  1. python字符照片_python图片转字符图片
  2. 网络营销——网络营销专员如何加强企业网站推广能力
  3. 前端学习(1514):vue-router使用步骤
  4. mikrotik dhcp server
  5. php手册+w3c,W3C 教程
  6. 基于JAVA+Spring+MYSQL的公共自行车管理系统
  7. 软件工程专插本_2021年广东专插本8所学校招生专业(拟),华师停招专插本?...
  8. crbug/1173575, non-JS module files deprecated.
  9. Tcl Tutorial 笔记 ·ubuntu命令行运行tcl 命令
  10. visio2010取消连接线交叉出的跨线
  11. es文件搜索不到win7服务器,ES文件浏览器Win7局域网共享错误解决方案
  12. 计算机专业自考本需要学哪几门,自考本科都考哪些科目?一次考几门?
  13. #SATA# SATA 实际管脚接线图
  14. 计算机系统安全启动,安装Win11提示该电脑必须支持安全启动的解决方法
  15. Java序列化连环炮:是什么?为什么需要?如何实现?
  16. 云计算概念及Linux系统详解
  17. python web项目打包部署_打包package
  18. 服务器性能计时器如何关闭,如何在游戏关闭时继续倒数计时器?
  19. vue pc端web页面微信支付和支付宝支付
  20. SPSS进行数据分析的一般步骤

热门文章

  1. Android Nginx + RTMP流媒体服务器搭建
  2. 音量增强器和均衡器Boom 3D mac中文版
  3. 【U8+】用友U8同一个账套使用了好多年,需要将以前年度进行分离、删除。
  4. 北斗三号短报文功能手机成果发布,前景如何?
  5. TRIZ创新方法——导论
  6. 敏捷开发与中医理论系列之二:古法教学(软件教育,松结对编程,师徒制度)
  7. 小小破解一下百度MP3的加密URL链接
  8. linux下载imagenet1k 指令
  9. 【Windows Server 2019】发布服务器 | 远程桌面服务的安装与配置 Ⅱ——配置RemoteAPP和访问
  10. 关于网络营销步骤简单介绍