quick3d是把qt3d部分以插件的形式导出,在QML中通过包含的形式来进行使用的。
quick3d部分,使用的包含有
import Qt3D 1.0
import Qt3D.Shapes 1.0 |
Import Qt3D是包含主要的一些Qt3D模块,而Qt3D.Shapes包含的是一些立方体,球体,圆柱体等的信息,方便使用各种简单模型。
二.具体的说明(这里没有按照原来的意思翻译,只根据个人理解)
QMLBillboardTransform Element公告牌,实现一个变化使对象一直朝向摄像机。
QMLCameraElement摄像机,定义一个视口的位置和投影3D场景
QMLEffectElement定义一些简单的效果,包含材质 纹理 灯光等
QML FloatingItemElement定义一个二维放置在3D可视化区域内的深度
QMLItem3DElement将存储一个3D对象,并且包含所有简单3D操作的属性和方法
QMLLightElement一些灯光参数的描述
QMLLightModelElement定义场景中灯光的模型
QMLLookAtTransformElement提供一种变化使对象面向摄像机,具体意思需要自己理解
QMLMaterialElement描述OpenGL中的材质属性
QMLMeshElement对载入一些模型文件的支持,还有一些操作等
QMLQt3dElementqt3d全局对象,为3d应用程序提供一些有用的功能
QMLRotation3DElement提供3d空间中的旋转变化
QMLScale3DElement提供3d空间中的缩放变化
QMLShaderProgramElement提供着色器语言的支持,这个需要GPU的支持。
QMLStereoViewElement定义一个布局可以使用左右视角图像,这个的作用是立体视觉效果,他分别从左右眼的方向对3D场景中的物体进行来渲染,需要硬件支持.
QMLTranslation3DElement提供3d空间中的位置变化
QMLViewportElement定义一个合理的3D视口
QMLCapsuleElement 描述一个囊状
QMLCubeElement描述一个立方体
QMLCylinderElement描述一个圆柱体
QMLLineElement描述线 可以是多条线
QMLPointElement描述点 可以是多个点
QMLQuadElement描述四边形
QMLSphereElement描述球体
QMLTeapotElement描述茶壶
简单的quick3d
QMLViewportElement
QMLMeshElement
QMLItem3DElement
import Qt 4.7
import Qt3D 1.0
Viewport {
width: 640; height: 480
camera: Camera {}
light: Light {}
Item3D {
mesh: Mesh { source: "teapot.bez" }
effect: Effect {}
}
} |
QML BillboardTransform Element
没有成功,所以暂时不写
QMLCameraElement
QMLEffectElement
QMLMeshElement
QMLItem3DElement
设置摄像机的位置:0,4,12使用一张图片作为 纹理,使用Mesh载入obj模型
import Qt 4.7
import Qt3D 1.0
Viewport {
id: viewport;
width: 640; height: 480
// 设置摄像机及指向的位置
camera: Camera {
eye: Qt.vector3d(0, 4, 12);
}
// 添加一棵树
Item3D{
id: tree
mesh: Mesh { source: "tree.obj" }
effect: Effect { blending: true; texture: "tree.png"}
position: Qt.vector3d(0, 0, 0)
}
} |
QML FloatingItemElement
在3D场景上使用2D元素
import Qt 4.7
import Qt3D 1.0
Viewport {
id: viewport;
width: 640; height: 480
// 设置摄像机及指向的位置
camera: Camera {
eye: Qt.vector3d(0, 4, 12);
}
// 添加一个2D的东西
FloatingItem {
anchors.fill: parent
depth: -10
Rectangle {
x:100; y: 100; width: 100; height: 30;
color: "#8f00ff00";
Text {anchors.fill: parent; text:"OK"; color: "blue"}
}
}
// 设置地面
Item3D {
id: ground
mesh: Mesh { source:"ground.obj"} // 载入一个obj模型
effect: Effect{
color: "#604000";
useLighting: false;
}
}
// 添加一棵树
Item3D{
id: tree
mesh: Mesh { source: "tree.obj" }
effect: Effect { blending: true; texture: "tree.png"}
position: Qt.vector3d(0, 0, 0)
}
} |
QMLLightElement
可以比对下打开灯光和不打开灯光效果的差别
import Qt 4.7
import Qt3D 1.0
Viewport {
width: 640; height: 480
camera: Camera {
eye: Qt.vector3d(0, 4, 12);
}
light: Light {
position: Qt.vector3d(0, 4, 12);
direction: Qt.vector3d(0, 0, 0);
}
Item3D {
mesh: Mesh { source: "teapot.bez" }
effect: Effect {}
}
} |
QMLQt3dElement
里面包含了一些有用的类型
Qt3d::matrix4x4 ( realm11, realm12, realm13, realm14, realm21, realm22, realm23, realm24, realm31, realm32, realm33, realm34, realm41, realm42, realm43, realm44)
Qt3d::quaternion ( realscalar, realx, realy, realz)
Qt3d::vector2d ( realx, realy)
Qt3d::vector4d ( realx, realy, realz, realw)
QMLRotation3DElement
QMLScale3DElement
QMLTranslation3DElement
直接对一棵树进行缩放 移动 旋转操作
import Qt 4.7
import Qt3D 1.0
Viewport {
width: 640; height: 480
camera: Camera {
eye: Qt.vector3d(0, 4, 12);
}
// 添加地面
Item3D {
id: ground
mesh: Mesh { source: "ground.obj" }
effect: Effect {
color: "#604000"
useLighting: false
}
}
Item3D {
id: mainItem
// 第1棵树旋转
Item3D{
id: tree1
mesh: Mesh { source: "tree.obj" }
effect: Effect {
blending: true
texture: "tree.png"
}
position: Qt.vector3d(0, 0, 0)
transform:[
Rotation3D {id: tree1Rot; axis: Qt.vector3d(0, 1, 0);},
Translation3D {id: tree1Tran; translate: Qt.vector3d(3, 0, 0)},
Scale3D {id: tree1Scale;scale: 0.5 }
]
}
}
ParallelAnimation{
running: true;
NumberAnimation { loops: Animation.Infinite; target: tree1Rot;
property: "angle"; from: 0; to : 360.0; duration: 3000;}
NumberAnimation { loops: Animation.Infinite; target: tree1Tran;
property: "progress"; from: 0; to : 1; duration: 3000;}
NumberAnimation { loops: Animation.Infinite; target: tree1Scale;
property: "scale"; from: 0; to : 1; duration: 3000;}
}
} |
|
|
QMLLookAtTransformElement
未知
QMLLightModelElement
QMLMaterialElement
这里是对茶壶表面的材质进行了光照的设置
import Qt 4.7
import Qt3D 1.0
Viewport {
width: 640; height: 480
camera: Camera {
eye: Qt.vector3d(0, 4, 12);
}
// 灯光
light: Light {
ambientColor: "black"; // 环境光
constantAttenuation: 1;
diffuseColor: "white"; // 慢发射
specularColor: "white"; //镜面光
}
// 设置场景的环境光
lightModel: LightModel {
ambientSceneColor: Qt.rgba(0.2, 0.2, 0.2, 1.0);
}
// 物体
Item3D{
id: teapot
mesh: Mesh { source: "teapot.bez" }
effect: Effect {
blending: true
material: Material {
id: teapotMate
ambientColor: "#cf00f010";
specularColor: "#cf030010";
diffuseColor: "#cf200310";
}
}
}
ParallelAnimation{
running: true;
ColorAnimation { loops: Animation.Infinite; target: teapotMate;
property: "ambientColor"; from: "#cf00f010"; to : "#a33ca326"; duration: 3000;}
ColorAnimation { loops: Animation.Infinite; target: teapotMate;
property: "specularColor"; from: "#cf030010"; to : "#3091f300"; duration: 3000;}
ColorAnimation { loops: Animation.Infinite; target: teapotMate;
property: "diffuseColor"; from: "#cf200310"; to : "#59649350"; duration: 3000;}
}
} |
QMLShaderProgramElement
对于这块我不是很了解具体的例子可以查看
declarative/teapot-shader.qml
QMLStereoViewElement
import Qt 4.7
import Qt3D 1.0
StereoView{
width: 640; height: 480
//layout: StereoView.LeftRight
FloatingItem {
anchors.fill: parent
depth: -10
Image {
anchors.fill: parent
source: "tree.png"
}
}
Viewport {
anchors.fill: parent
navigation: false
camera: Camera {
eye: Qt.vector3d(0, 0, 10)
eyeSeparation: 0.08
}
// 添加地面
Item3D {
id: ground
position: Qt.vector3d(-1.0, -1.0, -5.0)
mesh: Mesh { source: "ground.obj" }
effect: Effect {
color: "#604000"
useLighting: false
}
}
}
} |
QMLCapsuleElement 描述一个囊状
QMLCubeElement描述一个立方体
QMLCylinderElement描述一个圆柱体
QMLLineElement描述线 可以是多条线
QMLPointElement描述点 可以是多个点
QMLQuadElement描述四边形
QMLSphereElement描述球体
QMLTeapotElement描述茶壶
import Qt 4.7
import Qt3D 1.0
import Qt3D.Shapes 1.0
Viewport {
width: 640; height: 480
camera: Camera {
eye: Qt.vector3d(0, 4, 12);
}
// 灯光
light: Light {
ambientColor: "black"; // 环境光
constantAttenuation: 1;
diffuseColor: "white"; // 慢发射
specularColor: "white"; //镜面光
}
// 设置场景的环境光
lightModel: LightModel {
ambientSceneColor: Qt.rgba(0.2, 0.2, 0.2, 1.0);
}
// 囊状
Capsule {
radius: 0.5
length: 3.0
scale: 0.5
position: Qt.vector3d(-2, 1, 0);
effect: Effect {
color: "#aaca00"
}
}
// 立方体
Cube {
scale: 0.5
position: Qt.vector3d(-1, 1, 0);
effect: Effect {
color: "#aaca00"
texture: "qtlogo.png"
}
}
// 圆柱体
Cylinder {
radius: 0.5
length: 3.0
scale: 0.5
position: Qt.vector3d(0, 1, 0);
effect: Effect {
color: "#aaca00"
}
}
// 线
Line {
vertices: [
0, 0, 0,
0, 0, 1,
0, 1, 1
]
position: Qt.vector3d(-2.0, 0, 0);
effect: Effect {
color: "#aaca00"
}
}
// 点
Point {
vertices: [
0, 0, 0,
1, 1, 1,
-1, -1, -1
]
pointSize: 0.5;
position: Qt.vector3d(1, -1, 0);
effect: Effect {
color: "white"
}
}
// 四边形
Quad {
scale: 0.5
position: Qt.vector3d(0, 0, 0);
effect: Effect {
color: "#aaca00"
texture: "qtlogo.png"
}
}
// 球体
Sphere {
radius: 0.5
position: Qt.vector3d(-2, -1, 0);
effect: Effect {
color: "#aaca00"
}
}
// 茶壶
Teapot {
scale: 0.5
position: Qt.vector3d(-1, -1, 0);
effect: Effect {
color: "#aaca00"
texture: "qtlogo.png"
decal: true
}
}
} |
相关推荐
quick bi 最新难得的详尽培训文档,csdn独家上传 QuickBI 培训指南!
QtQuick的中文帮助文档,共75页,清晰明了,帮助用户开发QML程序
顶级包装盒制作软件 ...用户名称: 绿色旗舰站 ... 一款很棒的三维表面制作软件,可以制作专业级的软件包装、电子书籍封面、CD 光盘等项目。 它提供了一系列模板,可以为不同的侧面提供不同的图案/颜色......
在qtquick3d源文件夹中,运行以下命令以获取assimp源代码 git submodule update --init --recursive 建筑 要像其他任何Qt模块一样进行构建: qmake qtquick3d.pro make make install 如果要转换使用关键帧动画的...
NemoInfo Quick 3D Photo是目前市场上最简单易用的3D图像制作软件。你只需要选择左右两张照片,马上就能在电脑上欣赏真实的3维世界。你也可以把它们保存成普通的JPG图片与家人或朋友共同分享,或者把它们冲印出来寄...
NASTRAN2018的官方帮助文档—QUICK REFERENCE GUIDE,涵盖了NASTRAN里的所有关键字的解释和使用方法,是学习ABAQUS必备的官方指导手册之一。
3D-Quick3D.zip,基于qt的地理参考实体三维引擎,3D建模使用专门的软件来创建物理对象的数字模型。它是3D计算机图形的一个方面,用于视频游戏,3D打印和VR,以及其他应用程序。
QtQuick入门学习,给有需要的人,还不错.
书籍封面 软件包装封面制作软件Quick_3D_Cover_3D
12个Lua学习文档(为quick cocos2d-x打基础)
在该示例中简单的实现Qt Quick 3D中鼠标控制三维模型位置和缩放,自定义背景图片,模型动画等
Borland C++ Builder 6 Quick Start 帮助文档 (英文,PDF) Chapter 1 Introduction 1-1 What is C++Builder? ...1-1 Registering C++Builder ...1-2 Finding information ...1-3 Online Help ...1-3 F1 Help ...1-4 ...
文档是我在实际quick-cocos2d-x 操作缩写 内里有说明lua的版本 pkg-config版本 以及相关路径
Qt quick编程手册,专业学习qt quick
Quick Search软件相对于系统自带的搜索功能,该文档搜索软件更加强大,更加快速。软件基于关键词(文件名)来快速定位文件和文件夹,可以快速实现对文件夹、文档、图片、视频、音乐等文件的检索,输入关键词后,即时...
本文档介绍了使用QuickTest Professional6.0测试应用程序的基本操作步骤,通过学习本文档,你将知道如何使用QuickTest Professional6.0创建、运行自动化测试,以及如何分析测试结果。
OpenGL中GLSL 接口和变量快速参考文档,方便及时查看相应的接口。
基于QtQuick的实例,不在是基础的讲解,喜欢可以加入我们的群 关注我的博客就能找到答案
Quick
Qt Quick学习资料.rar