summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/assimp/main.qml1
-rw-r--r--examples/bigmodel-qml/main.qml7
-rw-r--r--examples/cylinder-qml/main.qml7
-rw-r--r--examples/deferred-renderer-qml/SceneEffect.qml6
-rw-r--r--examples/deferred-renderer-qml/main.qml1
-rw-r--r--examples/gltf/main.qml6
-rw-r--r--examples/playground-qml/main.qml7
-rw-r--r--examples/rollerball/AdsEffect.qml7
-rw-r--r--examples/rollerball/main.qml7
-rw-r--r--examples/shadow-map-qml/AdsEffect.qml7
-rw-r--r--examples/shadow-map-qml/AdsMaterial.qml6
-rw-r--r--examples/shadow-map-qml/GroundPlane.qml7
-rw-r--r--examples/shadow-map-qml/Light.qml7
-rw-r--r--examples/shadow-map-qml/ShadowMapFrameGraph.qml7
-rw-r--r--examples/shadow-map-qml/Toyplane.qml6
-rw-r--r--examples/shadow-map-qml/Trefoil.qml6
-rw-r--r--examples/shadow-map-qml/main.qml8
-rw-r--r--examples/simple-qml/main.qml7
-rw-r--r--examples/tessellation-modes/BasicCamera.qml6
-rw-r--r--examples/tessellation-modes/TessellatedQuad.qml6
-rw-r--r--examples/tessellation-modes/TessellatedWireframeEffect.qml6
-rw-r--r--examples/tessellation-modes/TessellatedWireframeMaterial.qml6
-rw-r--r--examples/tessellation-modes/main.qml6
-rw-r--r--examples/torus-qml/main.qml7
-rw-r--r--examples/wireframe/BasicCamera.qml6
-rw-r--r--examples/wireframe/TrefoilKnot.qml6
-rw-r--r--examples/wireframe/WireframeEffect.qml6
-rw-r--r--examples/wireframe/WireframeMaterial.qml6
-rw-r--r--examples/wireframe/main.qml6
-rw-r--r--src/quick3d/imports/core/importscore.pro2
-rw-r--r--src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp3
-rw-r--r--src/quick3d/quick3d/qt3dquick_global.cpp853
-rw-r--r--src/quick3d/quick3d/qt3dquick_global_p.h63
-rw-r--r--src/quick3d/quick3d/qt3dquickvaluetypes.cpp611
-rw-r--r--src/quick3d/quick3d/qt3dquickvaluetypes_p.h293
-rw-r--r--src/quick3d/quick3d/quick3d.pro10
36 files changed, 1834 insertions, 178 deletions
diff --git a/examples/assimp/main.qml b/examples/assimp/main.qml
index b2af7c938..cbcef849d 100644
--- a/examples/assimp/main.qml
+++ b/examples/assimp/main.qml
@@ -41,7 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-import QtQuick 2.1 as QQ2
Entity
{
diff --git a/examples/bigmodel-qml/main.qml b/examples/bigmodel-qml/main.qml
index eb8c7927f..db27905dc 100644
--- a/examples/bigmodel-qml/main.qml
+++ b/examples/bigmodel-qml/main.qml
@@ -41,14 +41,7 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.2 as QQ2
-import QtQml 2.2
Entity {
id: sceneRoot
diff --git a/examples/cylinder-qml/main.qml b/examples/cylinder-qml/main.qml
index 0d5595d47..0b8665d9d 100644
--- a/examples/cylinder-qml/main.qml
+++ b/examples/cylinder-qml/main.qml
@@ -42,13 +42,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
Entity {
id: sceneRoot
diff --git a/examples/deferred-renderer-qml/SceneEffect.qml b/examples/deferred-renderer-qml/SceneEffect.qml
index 0540c8ba1..ef9884822 100644
--- a/examples/deferred-renderer-qml/SceneEffect.qml
+++ b/examples/deferred-renderer-qml/SceneEffect.qml
@@ -1,6 +1,3 @@
-import Qt3D 2.0
-import Qt3D.Render 2.0
-
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
@@ -42,6 +39,9 @@ import Qt3D.Render 2.0
**
****************************************************************************/
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
Effect {
id : sceneMaterialEffect
techniques : [
diff --git a/examples/deferred-renderer-qml/main.qml b/examples/deferred-renderer-qml/main.qml
index 27c03489a..4cb8c9fb1 100644
--- a/examples/deferred-renderer-qml/main.qml
+++ b/examples/deferred-renderer-qml/main.qml
@@ -39,7 +39,6 @@
**
****************************************************************************/
-import QtQuick 2.2 as QQ2
import Qt3D 2.0
import Qt3D.Render 2.0
diff --git a/examples/gltf/main.qml b/examples/gltf/main.qml
index 857465565..850124cfd 100644
--- a/examples/gltf/main.qml
+++ b/examples/gltf/main.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Entity {
diff --git a/examples/playground-qml/main.qml b/examples/playground-qml/main.qml
index c819a04c5..f47c509b6 100644
--- a/examples/playground-qml/main.qml
+++ b/examples/playground-qml/main.qml
@@ -41,13 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.2 as QQ2
import QtQml 2.2
diff --git a/examples/rollerball/AdsEffect.qml b/examples/rollerball/AdsEffect.qml
index aa7c265af..146fac14d 100644
--- a/examples/rollerball/AdsEffect.qml
+++ b/examples/rollerball/AdsEffect.qml
@@ -42,13 +42,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1
-
Effect {
id: root
diff --git a/examples/rollerball/main.qml b/examples/rollerball/main.qml
index 950085d3e..7c88a11a2 100644
--- a/examples/rollerball/main.qml
+++ b/examples/rollerball/main.qml
@@ -42,13 +42,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
Entity {
id: root
objectName: "root"
diff --git a/examples/shadow-map-qml/AdsEffect.qml b/examples/shadow-map-qml/AdsEffect.qml
index 88d38294d..d92144593 100644
--- a/examples/shadow-map-qml/AdsEffect.qml
+++ b/examples/shadow-map-qml/AdsEffect.qml
@@ -42,13 +42,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1
-
Effect {
id: root
diff --git a/examples/shadow-map-qml/AdsMaterial.qml b/examples/shadow-map-qml/AdsMaterial.qml
index c9ce2f5d5..1f98c9425 100644
--- a/examples/shadow-map-qml/AdsMaterial.qml
+++ b/examples/shadow-map-qml/AdsMaterial.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1
Material {
diff --git a/examples/shadow-map-qml/GroundPlane.qml b/examples/shadow-map-qml/GroundPlane.qml
index e42adb72f..919fb9640 100644
--- a/examples/shadow-map-qml/GroundPlane.qml
+++ b/examples/shadow-map-qml/GroundPlane.qml
@@ -42,13 +42,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
Entity {
id: root
property Material material
diff --git a/examples/shadow-map-qml/Light.qml b/examples/shadow-map-qml/Light.qml
index 190cfdf14..625a8e677 100644
--- a/examples/shadow-map-qml/Light.qml
+++ b/examples/shadow-map-qml/Light.qml
@@ -42,13 +42,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
Entity {
id: root
diff --git a/examples/shadow-map-qml/ShadowMapFrameGraph.qml b/examples/shadow-map-qml/ShadowMapFrameGraph.qml
index 04cc97cbe..8aec562fd 100644
--- a/examples/shadow-map-qml/ShadowMapFrameGraph.qml
+++ b/examples/shadow-map-qml/ShadowMapFrameGraph.qml
@@ -41,14 +41,7 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.2 as QQ2
-import QtQml 2.2
FrameGraph {
id: root
diff --git a/examples/shadow-map-qml/Toyplane.qml b/examples/shadow-map-qml/Toyplane.qml
index bb0533126..a35826adf 100644
--- a/examples/shadow-map-qml/Toyplane.qml
+++ b/examples/shadow-map-qml/Toyplane.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Entity {
diff --git a/examples/shadow-map-qml/Trefoil.qml b/examples/shadow-map-qml/Trefoil.qml
index 0f97fb9a2..e4c0cbf1d 100644
--- a/examples/shadow-map-qml/Trefoil.qml
+++ b/examples/shadow-map-qml/Trefoil.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Entity {
diff --git a/examples/shadow-map-qml/main.qml b/examples/shadow-map-qml/main.qml
index fc782dcf2..8c0c24fdb 100644
--- a/examples/shadow-map-qml/main.qml
+++ b/examples/shadow-map-qml/main.qml
@@ -42,14 +42,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.2 as QQ2
-import QtQml 2.2
-
Entity {
id: sceneRoot
diff --git a/examples/simple-qml/main.qml b/examples/simple-qml/main.qml
index 8ed3750e8..1c394815e 100644
--- a/examples/simple-qml/main.qml
+++ b/examples/simple-qml/main.qml
@@ -41,14 +41,7 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.2 as QQ2
-import QtQml 2.2
Entity {
id: sceneRoot
diff --git a/examples/tessellation-modes/BasicCamera.qml b/examples/tessellation-modes/BasicCamera.qml
index fbd263639..9c9f9583b 100644
--- a/examples/tessellation-modes/BasicCamera.qml
+++ b/examples/tessellation-modes/BasicCamera.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Camera {
diff --git a/examples/tessellation-modes/TessellatedQuad.qml b/examples/tessellation-modes/TessellatedQuad.qml
index 8842a4539..17fa0f3fd 100644
--- a/examples/tessellation-modes/TessellatedQuad.qml
+++ b/examples/tessellation-modes/TessellatedQuad.qml
@@ -42,12 +42,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
import Qt3D.Examples 1.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Entity {
diff --git a/examples/tessellation-modes/TessellatedWireframeEffect.qml b/examples/tessellation-modes/TessellatedWireframeEffect.qml
index d8908ee1d..5fd3ded2c 100644
--- a/examples/tessellation-modes/TessellatedWireframeEffect.qml
+++ b/examples/tessellation-modes/TessellatedWireframeEffect.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1
Effect {
diff --git a/examples/tessellation-modes/TessellatedWireframeMaterial.qml b/examples/tessellation-modes/TessellatedWireframeMaterial.qml
index 307c8b31b..7173ebd1a 100644
--- a/examples/tessellation-modes/TessellatedWireframeMaterial.qml
+++ b/examples/tessellation-modes/TessellatedWireframeMaterial.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Material {
diff --git a/examples/tessellation-modes/main.qml b/examples/tessellation-modes/main.qml
index 843f31b9b..fd3158d54 100644
--- a/examples/tessellation-modes/main.qml
+++ b/examples/tessellation-modes/main.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Entity {
diff --git a/examples/torus-qml/main.qml b/examples/torus-qml/main.qml
index 12c6e360d..60304880d 100644
--- a/examples/torus-qml/main.qml
+++ b/examples/torus-qml/main.qml
@@ -42,13 +42,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
Entity {
id: sceneRoot
diff --git a/examples/wireframe/BasicCamera.qml b/examples/wireframe/BasicCamera.qml
index fbd263639..9c9f9583b 100644
--- a/examples/wireframe/BasicCamera.qml
+++ b/examples/wireframe/BasicCamera.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Camera {
diff --git a/examples/wireframe/TrefoilKnot.qml b/examples/wireframe/TrefoilKnot.qml
index 899ebbb32..c3b6acb70 100644
--- a/examples/wireframe/TrefoilKnot.qml
+++ b/examples/wireframe/TrefoilKnot.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Entity {
diff --git a/examples/wireframe/WireframeEffect.qml b/examples/wireframe/WireframeEffect.qml
index e4b8578dc..a5401439b 100644
--- a/examples/wireframe/WireframeEffect.qml
+++ b/examples/wireframe/WireframeEffect.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1
Effect {
diff --git a/examples/wireframe/WireframeMaterial.qml b/examples/wireframe/WireframeMaterial.qml
index cecf8c338..80f65bd6b 100644
--- a/examples/wireframe/WireframeMaterial.qml
+++ b/examples/wireframe/WireframeMaterial.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Material {
diff --git a/examples/wireframe/main.qml b/examples/wireframe/main.qml
index 10546d5b4..ccb34d8b3 100644
--- a/examples/wireframe/main.qml
+++ b/examples/wireframe/main.qml
@@ -41,12 +41,6 @@
import Qt3D 2.0
import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
import QtQuick 2.1 as QQ2
Entity {
diff --git a/src/quick3d/imports/core/importscore.pro b/src/quick3d/imports/core/importscore.pro
index 8d866c902..887a72147 100644
--- a/src/quick3d/imports/core/importscore.pro
+++ b/src/quick3d/imports/core/importscore.pro
@@ -2,7 +2,7 @@ CXX_MODULE = qml
TARGET = quick3dcoreplugin
TARGETPATH = Qt3D
-QT += qml 3dcore 3dquick
+QT += qml 3dcore 3dquick 3dquick-private
HEADERS += \
qt3dquick3dcoreplugin.h
diff --git a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp
index b53aa02fc..2da408812 100644
--- a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp
+++ b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp
@@ -51,11 +51,14 @@
#include <Qt3DQuick/quick3dentity.h>
#include <Qt3DQuick/quick3dtransform.h>
#include <Qt3DQuick/quick3dconfiguration.h>
+#include <private/qt3dquick_global_p.h>
QT_BEGIN_NAMESPACE
void Qt3DQuick3DCorePlugin::registerTypes(const char *uri)
{
+ Qt3D::Quick::Quick3D_initializeProviders();
+
qmlRegisterUncreatableType<Qt3D::QComponent>(uri, 2, 0, "Component", QStringLiteral(""));
qmlRegisterUncreatableType<Qt3D::QAbstractTransform>(uri, 2, 0, "QAbstractTransform", QStringLiteral("QAbstractTransform is abstract"));
diff --git a/src/quick3d/quick3d/qt3dquick_global.cpp b/src/quick3d/quick3d/qt3dquick_global.cpp
new file mode 100644
index 000000000..5ce361cf6
--- /dev/null
+++ b/src/quick3d/quick3d/qt3dquick_global.cpp
@@ -0,0 +1,853 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qt3dquick_global_p.h"
+#include <private/qqmlglobal_p.h>
+#include <private/qt3dquickvaluetypes_p.h>
+#include <private/qv8engine_p.h>
+#include <private/qv4engine_p.h>
+#include <private/qv4object_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+namespace Quick {
+
+class Quick3DColorProvider : public QQmlColorProvider
+{
+public:
+ QVariant colorFromString(const QString &s, bool *ok)
+ {
+ QColor c(s);
+ if (c.isValid()) {
+ if (ok) *ok = true;
+ return QVariant(c);
+ }
+
+ if (ok) *ok = false;
+ return QVariant();
+ }
+
+ unsigned rgbaFromString(const QString &s, bool *ok)
+ {
+ QColor c(s);
+ if (c.isValid()) {
+ if (ok) *ok = true;
+ return c.rgba();
+ }
+
+ if (ok) *ok = false;
+ return 0;
+ }
+
+ QString stringFromRgba(unsigned rgba)
+ {
+ QColor c(QColor::fromRgba(rgba));
+ if (c.isValid()) {
+ return QVariant(c).toString();
+ }
+
+ return QString();
+ }
+
+ QVariant fromRgbF(double r, double g, double b, double a)
+ {
+ return QVariant(QColor::fromRgbF(r, g, b, a));
+ }
+
+ QVariant fromHslF(double h, double s, double l, double a)
+ {
+ return QVariant(QColor::fromHslF(h, s, l, a));
+ }
+
+ QVariant lighter(const QVariant &var, qreal factor)
+ {
+ QColor color = var.value<QColor>();
+ color = color.lighter(int(qRound(factor*100.)));
+ return QVariant::fromValue(color);
+ }
+
+ QVariant darker(const QVariant &var, qreal factor)
+ {
+ QColor color = var.value<QColor>();
+ color = color.darker(int(qRound(factor*100.)));
+ return QVariant::fromValue(color);
+ }
+
+ QVariant tint(const QVariant &baseVar, const QVariant &tintVar)
+ {
+ QColor tintColor = tintVar.value<QColor>();
+
+ int tintAlpha = tintColor.alpha();
+ if (tintAlpha == 0xFF) {
+ return tintVar;
+ } else if (tintAlpha == 0x00) {
+ return baseVar;
+ }
+
+ // tint the base color and return the final color
+ QColor baseColor = baseVar.value<QColor>();
+ qreal a = tintColor.alphaF();
+ qreal inv_a = 1.0 - a;
+
+ qreal r = tintColor.redF() * a + baseColor.redF() * inv_a;
+ qreal g = tintColor.greenF() * a + baseColor.greenF() * inv_a;
+ qreal b = tintColor.blueF() * a + baseColor.blueF() * inv_a;
+
+ return QVariant::fromValue(QColor::fromRgbF(r, g, b, a + inv_a * baseColor.alphaF()));
+ }
+};
+
+
+// Note: The functions in this class provide handling only for the types
+// that the QML engine will currently actually call them for, so many
+// appear incompletely implemented. For some functions, the implementation
+// would be obvious, but for others (particularly create and createFromString)
+// the exact semantics are unknown. For this reason unused functionality
+// has been omitted.
+
+class Quick3DValueTypeProvider : public QQmlValueTypeProvider
+{
+public:
+
+#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
+ #define ASSERT_VALID_SIZE(size, min) Q_UNUSED(size)
+#else
+ #define ASSERT_VALID_SIZE(size, min) Q_ASSERT(size >= min)
+#endif
+
+ static QVector2D vector2DFromString(const QString &s, bool *ok)
+ {
+ if (s.count(QLatin1Char(',')) == 1) {
+ int index = s.indexOf(QLatin1Char(','));
+
+ bool xGood, yGood;
+ float xCoord = s.left(index).toFloat(&xGood);
+ float yCoord = s.mid(index+1).toFloat(&yGood);
+
+ if (xGood && yGood) {
+ if (ok) *ok = true;
+ return QVector2D(xCoord, yCoord);
+ }
+ }
+
+ if (ok) *ok = false;
+ return QVector2D();
+ }
+
+ static QVector3D vector3DFromString(const QString &s, bool *ok)
+ {
+ if (s.count(QLatin1Char(',')) == 2) {
+ int index = s.indexOf(QLatin1Char(','));
+ int index2 = s.indexOf(QLatin1Char(','), index+1);
+
+ bool xGood, yGood, zGood;
+ float xCoord = s.left(index).toFloat(&xGood);
+ float yCoord = s.mid(index+1, index2-index-1).toFloat(&yGood);
+ float zCoord = s.mid(index2+1).toFloat(&zGood);
+
+ if (xGood && yGood && zGood) {
+ if (ok) *ok = true;
+ return QVector3D(xCoord, yCoord, zCoord);
+ }
+ }
+
+ if (ok) *ok = false;
+ return QVector3D();
+ }
+
+ static QVector4D vector4DFromString(const QString &s, bool *ok)
+ {
+ if (s.count(QLatin1Char(',')) == 3) {
+ int index = s.indexOf(QLatin1Char(','));
+ int index2 = s.indexOf(QLatin1Char(','), index+1);
+ int index3 = s.indexOf(QLatin1Char(','), index2+1);
+
+ bool xGood, yGood, zGood, wGood;
+ float xCoord = s.left(index).toFloat(&xGood);
+ float yCoord = s.mid(index+1, index2-index-1).toFloat(&yGood);
+ float zCoord = s.mid(index2+1, index3-index2-1).toFloat(&zGood);
+ float wCoord = s.mid(index3+1).toFloat(&wGood);
+
+ if (xGood && yGood && zGood && wGood) {
+ if (ok) *ok = true;
+ return QVector4D(xCoord, yCoord, zCoord, wCoord);
+ }
+ }
+
+ if (ok) *ok = false;
+ return QVector4D();
+ }
+
+ static QQuaternion quaternionFromString(const QString &s, bool *ok)
+ {
+ if (s.count(QLatin1Char(',')) == 3) {
+ int index = s.indexOf(QLatin1Char(','));
+ int index2 = s.indexOf(QLatin1Char(','), index+1);
+ int index3 = s.indexOf(QLatin1Char(','), index2+1);
+
+ bool sGood, xGood, yGood, zGood;
+ qreal sCoord = s.left(index).toDouble(&sGood);
+ qreal xCoord = s.mid(index+1, index2-index-1).toDouble(&xGood);
+ qreal yCoord = s.mid(index2+1, index3-index2-1).toDouble(&yGood);
+ qreal zCoord = s.mid(index3+1).toDouble(&zGood);
+
+ if (sGood && xGood && yGood && zGood) {
+ if (ok) *ok = true;
+ return QQuaternion(sCoord, xCoord, yCoord, zCoord);
+ }
+ }
+
+ if (ok) *ok = false;
+ return QQuaternion();
+ }
+
+ static QMatrix4x4 matrix4x4FromString(const QString &s, bool *ok)
+ {
+ if (s.count(QLatin1Char(',')) == 15) {
+ float matValues[16];
+ bool vOK = true;
+ QString mutableStr = s;
+ for (int i = 0; vOK && i < 16; ++i) {
+ int cidx = mutableStr.indexOf(QLatin1Char(','));
+ matValues[i] = mutableStr.left(cidx).toDouble(&vOK);
+ mutableStr = mutableStr.mid(cidx + 1);
+ }
+
+ if (vOK) {
+ if (ok) *ok = true;
+ return QMatrix4x4(matValues);
+ }
+ }
+
+ if (ok) *ok = false;
+ return QMatrix4x4();
+ }
+
+ static QMatrix4x4 matrix4x4FromObject(QQmlV4Handle object, QV8Engine *e, bool *ok)
+ {
+ if (ok) *ok = false;
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(e);
+ QV4::Scope scope(v4);
+ QV4::ScopedArrayObject array(scope, object);
+ if (!array)
+ return QMatrix4x4();
+
+ if (array->getLength() != 16)
+ return QMatrix4x4();
+
+ float matVals[16];
+ QV4::ScopedValue v(scope);
+ for (quint32 i = 0; i < 16; ++i) {
+ v = array->getIndexed(i);
+ if (!v->isNumber())
+ return QMatrix4x4();
+ matVals[i] = v->asDouble();
+ }
+
+ if (ok) *ok = true;
+ return QMatrix4x4(matVals);
+ }
+
+ template<typename T>
+ bool typedCreate(QQmlValueType *&v)
+ {
+ v = new T;
+ return true;
+ }
+
+ bool create(int type, QQmlValueType *&v)
+ {
+ switch (type) {
+ case QMetaType::QColor:
+ return typedCreate<Quick3DColorValueType>(v);
+ case QMetaType::QVector2D:
+ return typedCreate<Quick3DVector2DValueType>(v);
+ case QMetaType::QVector3D:
+ return typedCreate<Quick3DVector3DValueType>(v);
+ case QMetaType::QVector4D:
+ return typedCreate<Quick3DVector4DValueType>(v);
+ case QMetaType::QQuaternion:
+ return typedCreate<Quick3DQuaternionValueType>(v);
+ case QMetaType::QMatrix4x4:
+ return typedCreate<Quick3DMatrix4x4ValueType>(v);
+ default:
+ break;
+ }
+
+ return false;
+ }
+
+ template<typename T>
+ bool typedInit(void *data, size_t dataSize)
+ {
+ ASSERT_VALID_SIZE(dataSize, sizeof(T));
+ T *t = reinterpret_cast<T *>(data);
+ new (t) T();
+ return true;
+ }
+
+ bool init(int type, void *data, size_t dataSize)
+ {
+ switch (type) {
+ case QMetaType::QColor:
+ return typedInit<QColor>(data, dataSize);
+ case QMetaType::QVector2D:
+ return typedInit<QVector2D>(data, dataSize);
+ case QMetaType::QVector3D:
+ return typedInit<QVector3D>(data, dataSize);
+ case QMetaType::QVector4D:
+ return typedInit<QVector4D>(data, dataSize);
+ case QMetaType::QQuaternion:
+ return typedInit<QQuaternion>(data, dataSize);
+ case QMetaType::QMatrix4x4:
+ {
+ if (dataSize >= sizeof(QMatrix4x4))
+ return typedInit<QMatrix4x4>(data, dataSize);
+
+ // special case: init matrix-containing qvariant.
+ Q_ASSERT(dataSize >= sizeof(QVariant));
+ QVariant *matvar = reinterpret_cast<QVariant *>(data);
+ new (matvar) QVariant(QMatrix4x4());
+ return true;
+ }
+ default: break;
+ }
+
+ return false;
+ }
+
+ template<typename T>
+ bool typedDestroy(void *data, size_t dataSize)
+ {
+ ASSERT_VALID_SIZE(dataSize, sizeof(T));
+ T *t = reinterpret_cast<T *>(data);
+ t->~T();
+ return true;
+ }
+
+ bool destroy(int type, void *data, size_t dataSize)
+ {
+ switch (type) {
+ case QMetaType::QColor:
+ return typedDestroy<QColor>(data, dataSize);
+ case QMetaType::QVector2D:
+ return typedDestroy<QVector2D>(data, dataSize);
+ case QMetaType::QVector3D:
+ return typedDestroy<QVector3D>(data, dataSize);
+ case QMetaType::QVector4D:
+ return typedDestroy<QVector4D>(data, dataSize);
+ case QMetaType::QQuaternion:
+ return typedDestroy<QQuaternion>(data, dataSize);
+ case QMetaType::QMatrix4x4:
+ {
+ if (dataSize >= sizeof(QMatrix4x4))
+ return typedDestroy<QMatrix4x4>(data, dataSize);
+
+ // special case: destroying matrix-containing qvariant.
+ Q_ASSERT(dataSize >= sizeof(QVariant));
+ QVariant *matvar = reinterpret_cast<QVariant *>(data);
+ matvar->~QVariant();
+ return true;
+ }
+ default: break;
+ }
+
+ return false;
+ }
+
+ template<typename T>
+ bool typedCopyConstruct(const void *src, void *dst, size_t dstSize)
+ {
+ ASSERT_VALID_SIZE(dstSize, sizeof(T));
+ const T *srcT = reinterpret_cast<const T *>(src);
+ T *destT = reinterpret_cast<T *>(dst);
+ new (destT) T(*srcT);
+ return true;
+ }
+
+ bool copy(int type, const void *src, void *dst, size_t dstSize)
+ {
+ switch (type) {
+ case QMetaType::QColor:
+ return typedCopyConstruct<QColor>(src, dst, dstSize);
+ case QMetaType::QVector2D:
+ return typedCopyConstruct<QVector2D>(src, dst, dstSize);
+ case QMetaType::QVector3D:
+ return typedCopyConstruct<QVector3D>(src, dst, dstSize);
+ case QMetaType::QVector4D:
+ return typedCopyConstruct<QVector4D>(src, dst, dstSize);
+ case QMetaType::QQuaternion:
+ return typedCopyConstruct<QQuaternion>(src, dst, dstSize);
+ case QMetaType::QMatrix4x4:
+ {
+ if (dstSize >= sizeof(QMatrix4x4))
+ return typedCopyConstruct<QMatrix4x4>(src, dst, dstSize);
+
+ // special case: copying matrix into variant.
+ Q_ASSERT(dstSize >= sizeof(QVariant));
+ const QMatrix4x4 *srcMatrix = reinterpret_cast<const QMatrix4x4 *>(src);
+ QVariant *dstMatrixVar = reinterpret_cast<QVariant *>(dst);
+ new (dstMatrixVar) QVariant(*srcMatrix);
+ return true;
+ }
+ default: break;
+ }
+
+ return false;
+ }
+
+ bool create(int type, int argc, const void *argv[], QVariant *v)
+ {
+ switch (type) {
+ case QMetaType::QVector2D:
+ if (argc == 1) {
+ const float *xy = reinterpret_cast<const float*>(argv[0]);
+ QVector2D v2(xy[0], xy[1]);
+ *v = QVariant(v2);
+ return true;
+ }
+ break;
+ case QMetaType::QVector3D:
+ if (argc == 1) {
+ const float *xyz = reinterpret_cast<const float*>(argv[0]);
+ QVector3D v3(xyz[0], xyz[1], xyz[2]);
+ *v = QVariant(v3);
+ return true;
+ }
+ break;
+ case QMetaType::QVector4D:
+ if (argc == 1) {
+ const float *xyzw = reinterpret_cast<const float*>(argv[0]);
+ QVector4D v4(xyzw[0], xyzw[1], xyzw[2], xyzw[3]);
+ *v = QVariant(v4);
+ return true;
+ }
+ break;
+ case QMetaType::QQuaternion:
+ if (argc == 1) {
+ const qreal *sxyz = reinterpret_cast<const qreal*>(argv[0]);
+ QQuaternion q(sxyz[0], sxyz[1], sxyz[2], sxyz[3]);
+ *v = QVariant(q);
+ return true;
+ }
+ break;
+ case QMetaType::QMatrix4x4:
+ if (argc == 1) {
+ const qreal *vals = reinterpret_cast<const qreal*>(argv[0]);
+ QMatrix4x4 m(vals[0], vals[1], vals[2], vals[3],
+ vals[4], vals[5], vals[6], vals[7],
+ vals[8], vals[9], vals[10], vals[11],
+ vals[12], vals[13], vals[14], vals[15]);
+ *v = QVariant(m);
+ return true;
+ }
+ break;
+ default: break;
+ }
+
+ return false;
+ }
+
+ template<typename T>
+ bool createFromStringTyped(void *data, size_t dataSize, T initValue)
+ {
+ ASSERT_VALID_SIZE(dataSize, sizeof(T));
+ T *t = reinterpret_cast<T *>(data);
+ new (t) T(initValue);
+ return true;
+ }
+
+ bool createFromString(int type, const QString &s, void *data, size_t dataSize)
+ {
+ bool ok = false;
+
+ switch (type) {
+ case QMetaType::QColor:
+ return createFromStringTyped<QColor>(data, dataSize, QColor(s));
+ case QMetaType::QVector2D:
+ return createFromStringTyped<QVector2D>(data, dataSize, vector2DFromString(s, &ok));
+ case QMetaType::QVector3D:
+ return createFromStringTyped<QVector3D>(data, dataSize, vector3DFromString(s, &ok));
+ case QMetaType::QVector4D:
+ return createFromStringTyped<QVector4D>(data, dataSize, vector4DFromString(s, &ok));
+ case QMetaType::QQuaternion:
+ return createFromStringTyped<QQuaternion>(data, dataSize, quaternionFromString(s, &ok));
+ case QMetaType::QMatrix4x4:
+ {
+ if (dataSize >= sizeof(QMatrix4x4))
+ return createFromStringTyped<QMatrix4x4>(data, dataSize, matrix4x4FromString(s, &ok));
+
+ Q_ASSERT(dataSize >= sizeof(QVariant));
+ QVariant *matVar = reinterpret_cast<QVariant *>(data);
+ new (matVar) QVariant(matrix4x4FromString(s, &ok));
+ return true;
+ }
+ default: break;
+ }
+
+ return false;
+ }
+
+ bool createStringFrom(int type, const void *data, QString *s)
+ {
+ if (type == QMetaType::QColor) {
+ const QColor *color = reinterpret_cast<const QColor *>(data);
+ new (s) QString(QVariant(*color).toString());
+ return true;
+ }
+
+ return false;
+ }
+
+ bool variantFromString(const QString &s, QVariant *v)
+ {
+ QColor c(s);
+ if (c.isValid()) {
+ *v = QVariant::fromValue(c);
+ return true;
+ }
+
+ bool ok = false;
+
+ QVector2D v2 = vector2DFromString(s, &ok);
+ if (ok) {
+ *v = QVariant::fromValue(v2);
+ return true;
+ }
+
+ QVector3D v3 = vector3DFromString(s, &ok);
+ if (ok) {
+ *v = QVariant::fromValue(v3);
+ return true;
+ }
+
+ QVector4D v4 = vector4DFromString(s, &ok);
+ if (ok) {
+ *v = QVariant::fromValue(v4);
+ return true;
+ }
+
+ QQuaternion q = quaternionFromString(s, &ok);
+ if (ok) {
+ *v = QVariant::fromValue(q);
+ return true;
+ }
+
+ QMatrix4x4 m = matrix4x4FromString(s, &ok);
+ if (ok) {
+ *v = QVariant::fromValue(m);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool variantFromString(int type, const QString &s, QVariant *v)
+ {
+ bool ok = false;
+
+ switch (type) {
+ case QMetaType::QColor:
+ {
+ QColor c(s);
+ *v = QVariant::fromValue(c);
+ return true;
+ }
+ case QMetaType::QVector2D:
+ {
+ *v = QVariant::fromValue(vector2DFromString(s, &ok));
+ return true;
+ }
+ case QMetaType::QVector3D:
+ {
+ *v = QVariant::fromValue(vector3DFromString(s, &ok));
+ return true;
+ }
+ case QMetaType::QVector4D:
+ {
+ *v = QVariant::fromValue(vector4DFromString(s, &ok));
+ return true;
+ }
+ case QMetaType::QQuaternion:
+ {
+ *v = QVariant::fromValue(quaternionFromString(s, &ok));
+ return true;
+ }
+ case QMetaType::QMatrix4x4:
+ {
+ *v = QVariant::fromValue(matrix4x4FromString(s, &ok));
+ return true;
+ }
+ default:
+ break;
+ }
+
+ return false;
+ }
+
+ bool variantFromJsObject(int type, QQmlV4Handle object, QV8Engine *e, QVariant *v)
+ {
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(e);
+ QV4::Scope scope(v4);
+#ifndef QT_NO_DEBUG
+ QV4::ScopedObject obj(scope, object);
+ Q_ASSERT(obj);
+#endif
+ bool ok = false;
+ switch (type) {
+ case QMetaType::QMatrix4x4:
+ *v = QVariant::fromValue(matrix4x4FromObject(object, e, &ok));
+ default: break;
+ }
+
+ return ok;
+ }
+
+ template<typename T>
+ bool typedEqual(const void *lhs, const void *rhs)
+ {
+ return (*(reinterpret_cast<const T *>(lhs)) == *(reinterpret_cast<const T *>(rhs)));
+ }
+
+ bool equal(int type, const void *lhs, const void *rhs, size_t rhsSize)
+ {
+ switch (type) {
+ case QMetaType::QColor:
+ return typedEqual<QColor>(lhs, rhs);
+ case QMetaType::QVector2D:
+ return typedEqual<QVector2D>(lhs, rhs);
+ case QMetaType::QVector3D:
+ return typedEqual<QVector3D>(lhs, rhs);
+ case QMetaType::QVector4D:
+ return typedEqual<QVector4D>(lhs, rhs);
+ case QMetaType::QQuaternion:
+ return typedEqual<QQuaternion>(lhs, rhs);
+ case QMetaType::QMatrix4x4:
+ {
+ if (rhsSize >= sizeof(QMatrix4x4))
+ return typedEqual<QMatrix4x4>(lhs, rhs);
+
+ Q_ASSERT(rhsSize >= sizeof(QVariant));
+ QMatrix4x4 rhsmat = reinterpret_cast<const QVariant *>(rhs)->value<QMatrix4x4>();
+ return typedEqual<QMatrix4x4>(lhs, &rhsmat);
+ }
+ default: break;
+ }
+
+ return false;
+ }
+
+ template<typename T>
+ bool typedStore(const void *src, void *dst, size_t dstSize)
+ {
+ ASSERT_VALID_SIZE(dstSize, sizeof(T));
+ const T *srcT = reinterpret_cast<const T *>(src);
+ T *dstT = reinterpret_cast<T *>(dst);
+ new (dstT) T(*srcT);
+ return true;
+ }
+
+ bool store(int type, const void *src, void *dst, size_t dstSize)
+ {
+ switch (type) {
+ case QMetaType::QColor:
+ {
+ Q_ASSERT(dstSize >= sizeof(QColor));
+ const QRgb *rgb = reinterpret_cast<const QRgb *>(src);
+ QColor *color = reinterpret_cast<QColor *>(dst);
+ new (color) QColor(QColor::fromRgba(*rgb));
+ return true;
+ }
+ case QMetaType::QVector2D:
+ return typedStore<QVector2D>(src, dst, dstSize);
+ case QMetaType::QVector3D:
+ return typedStore<QVector3D>(src, dst, dstSize);
+ case QMetaType::QVector4D:
+ return typedStore<QVector4D>(src, dst, dstSize);
+ case QMetaType::QQuaternion:
+ return typedStore<QQuaternion>(src, dst, dstSize);
+ case QMetaType::QMatrix4x4:
+ {
+ if (dstSize >= sizeof(QMatrix4x4))
+ return typedStore<QMatrix4x4>(src, dst, dstSize);
+
+ // special case: storing matrix into variant
+ // eg, QVMEMO QVMEVariant data cell is big enough to store
+ // QVariant, but not large enough to store QMatrix4x4.
+ Q_ASSERT(dstSize >= sizeof(QVariant));
+ const QMatrix4x4 *srcMat = reinterpret_cast<const QMatrix4x4 *>(src);
+ QVariant *dstMatVar = reinterpret_cast<QVariant *>(dst);
+ new (dstMatVar) QVariant(*srcMat);
+ return true;
+ }
+ default: break;
+ }
+
+ return false;
+ }
+
+ template<typename T>
+ bool typedRead(int srcType, const void *src, size_t srcSize, int dstType, void *dst)
+ {
+ T *dstT = reinterpret_cast<T *>(dst);
+ if (srcType == dstType) {
+ ASSERT_VALID_SIZE(srcSize, sizeof(T));
+ const T *srcT = reinterpret_cast<const T *>(src);
+ *dstT = *srcT;
+ } else {
+ *dstT = T();
+ }
+ return true;
+ }
+
+ bool read(int srcType, const void *src, size_t srcSize, int dstType, void *dst)
+ {
+ switch (dstType) {
+ case QMetaType::QColor:
+ return typedRead<QColor>(srcType, src, srcSize, dstType, dst);
+ case QMetaType::QVector2D:
+ return typedRead<QVector2D>(srcType, src, srcSize, dstType, dst);
+ case QMetaType::QVector3D:
+ return typedRead<QVector3D>(srcType, src, srcSize, dstType, dst);
+ case QMetaType::QVector4D:
+ return typedRead<QVector4D>(srcType, src, srcSize, dstType, dst);
+ case QMetaType::QQuaternion:
+ return typedRead<QQuaternion>(srcType, src, srcSize, dstType, dst);
+ case QMetaType::QMatrix4x4:
+ {
+ if (srcSize >= sizeof(QMatrix4x4))
+ return typedRead<QMatrix4x4>(srcType, src, srcSize, dstType, dst);
+
+ // the source data may be stored in a QVariant.
+ QMatrix4x4 *dstMat = reinterpret_cast<QMatrix4x4 *>(dst);
+ if (srcType == dstType) {
+ Q_ASSERT(srcSize >= sizeof(QVariant));
+ const QVariant *srcMatVar = reinterpret_cast<const QVariant *>(src);
+ *dstMat = srcMatVar->value<QMatrix4x4>();
+ } else {
+ *dstMat = QMatrix4x4();
+ }
+ return true;
+ }
+ default: break;
+ }
+
+ return false;
+ }
+
+ template<typename T>
+ bool typedWrite(const void *src, void *dst, size_t dstSize)
+ {
+ ASSERT_VALID_SIZE(dstSize, sizeof(T));
+ const T *srcT = reinterpret_cast<const T *>(src);
+ T *dstT = reinterpret_cast<T *>(dst);
+ if (*dstT != *srcT) {
+ *dstT = *srcT;
+ return true;
+ }
+ return false;
+ }
+
+ bool write(int type, const void *src, void *dst, size_t dstSize)
+ {
+ switch (type) {
+ case QMetaType::QColor:
+ return typedWrite<QColor>(src, dst, dstSize);
+ case QMetaType::QVector2D:
+ return typedWrite<QVector2D>(src, dst, dstSize);
+ case QMetaType::QVector3D:
+ return typedWrite<QVector3D>(src, dst, dstSize);
+ case QMetaType::QVector4D:
+ return typedWrite<QVector4D>(src, dst, dstSize);
+ case QMetaType::QQuaternion:
+ return typedWrite<QQuaternion>(src, dst, dstSize);
+ case QMetaType::QMatrix4x4:
+ {
+ if (dstSize >= sizeof(QMatrix4x4))
+ return typedWrite<QMatrix4x4>(src, dst, dstSize);
+
+ // special case: storing matrix into variant
+ // eg, QVMEMO QVMEVariant data cell is big enough to store
+ // QVariant, but not large enough to store QMatrix4x4.
+ Q_ASSERT(dstSize >= sizeof(QVariant));
+ const QMatrix4x4 *srcMat = reinterpret_cast<const QMatrix4x4 *>(src);
+ QVariant *dstMatVar = reinterpret_cast<QVariant *>(dst);
+ QMatrix4x4 dstMatVal = dstMatVar->value<QMatrix4x4>();
+ if (dstMatVal != *srcMat) {
+ *dstMatVar = QVariant(*srcMat);
+ return true;
+ }
+ return false;
+ }
+ default: break;
+ }
+
+ return false;
+ }
+#undef ASSERT_VALID_SIZE
+};
+
+static Quick3DValueTypeProvider *getValueTypeProvider()
+{
+ static Quick3DValueTypeProvider valueTypeProvider;
+ return &valueTypeProvider;
+}
+
+static Quick3DColorProvider *getColorProvider()
+{
+ static Quick3DColorProvider colorProvider;
+ return &colorProvider;
+}
+
+void Quick3D_initializeProviders()
+{
+ Qt3D::Quick::Quick3DValueTypes::registerValueTypes();
+ QQml_addValueTypeProvider(getValueTypeProvider());
+ QQml_setColorProvider(getColorProvider());
+}
+
+} // Quick
+
+} // Qt3D
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3d/qt3dquick_global_p.h b/src/quick3d/quick3d/qt3dquick_global_p.h
new file mode 100644
index 000000000..c068d33fd
--- /dev/null
+++ b/src/quick3d/quick3d/qt3dquick_global_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DQUICK_GLOBAL_P_H
+#define QT3DQUICK_GLOBAL_P_H
+
+#include <Qt3DQuick/qt3dquick_global.h>
+
+#define QT3DQUICKSHARED_PRIVATE_EXPORT QT3DQUICKSHARED_EXPORT
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+namespace Quick {
+
+QT3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_initializeProviders();
+
+} // Quick
+
+} // Qt3D
+
+QT_END_NAMESPACE
+
+#endif // QT3DQUICK_GLOBAL_P_H
diff --git a/src/quick3d/quick3d/qt3dquickvaluetypes.cpp b/src/quick3d/quick3d/qt3dquickvaluetypes.cpp
new file mode 100644
index 000000000..9a6c15432
--- /dev/null
+++ b/src/quick3d/quick3d/qt3dquickvaluetypes.cpp
@@ -0,0 +1,611 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qt3dquickvaluetypes_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+namespace Quick {
+
+namespace Quick3DValueTypes {
+ void registerValueTypes()
+ {
+ QQmlValueTypeFactory::registerValueTypes("Qt3D", 2, 0);
+ }
+}
+
+Quick3DColorValueType::Quick3DColorValueType(QObject *parent)
+ : QQmlValueTypeBase<QColor>(QMetaType::QColor, parent)
+{
+}
+
+QString Quick3DColorValueType::toString() const
+{
+ // to maintain behaviour with QtQuick 1.0, we just output normal toString() value.
+ return QVariant(v).toString();
+}
+
+qreal Quick3DColorValueType::r() const
+{
+ return v.redF();
+}
+
+qreal Quick3DColorValueType::g() const
+{
+ return v.greenF();
+}
+
+qreal Quick3DColorValueType::b() const
+{
+ return v.blueF();
+}
+
+qreal Quick3DColorValueType::a() const
+{
+ return v.alphaF();
+}
+
+void Quick3DColorValueType::setR(qreal r)
+{
+ v.setRedF(r);
+}
+
+void Quick3DColorValueType::setG(qreal g)
+{
+ v.setGreenF(g);
+}
+
+void Quick3DColorValueType::setB(qreal b)
+{
+ v.setBlueF(b);
+}
+
+void Quick3DColorValueType::setA(qreal a)
+{
+ v.setAlphaF(a);
+}
+
+
+Quick3DVector2DValueType::Quick3DVector2DValueType(QObject *parent)
+ : QQmlValueTypeBase<QVector2D>(QMetaType::QVector2D, parent)
+{
+}
+
+QString Quick3DVector2DValueType::toString() const
+{
+ return QString(QLatin1String("QVector2D(%1, %2)")).arg(v.x()).arg(v.y());
+}
+
+bool Quick3DVector2DValueType::isEqual(const QVariant &other) const
+{
+ if (other.userType() != QMetaType::QVector2D)
+ return false;
+
+ QVector2D otherVector = other.value<QVector2D>();
+ return (v == otherVector);
+}
+
+qreal Quick3DVector2DValueType::x() const
+{
+ return v.x();
+}
+
+qreal Quick3DVector2DValueType::y() const
+{
+ return v.y();
+}
+
+void Quick3DVector2DValueType::setX(qreal x)
+{
+ v.setX(x);
+}
+
+void Quick3DVector2DValueType::setY(qreal y)
+{
+ v.setY(y);
+}
+
+qreal Quick3DVector2DValueType::dotProduct(const QVector2D &vec) const
+{
+ return QVector2D::dotProduct(v, vec);
+}
+
+QVector2D Quick3DVector2DValueType::times(const QVector2D &vec) const
+{
+ return v * vec;
+}
+
+QVector2D Quick3DVector2DValueType::times(qreal scalar) const
+{
+ return v * scalar;
+}
+
+QVector2D Quick3DVector2DValueType::plus(const QVector2D &vec) const
+{
+ return v + vec;
+}
+
+QVector2D Quick3DVector2DValueType::minus(const QVector2D &vec) const
+{
+ return v - vec;
+}
+
+QVector2D Quick3DVector2DValueType::normalized() const
+{
+ return v.normalized();
+}
+
+qreal Quick3DVector2DValueType::length() const
+{
+ return v.length();
+}
+
+QVector3D Quick3DVector2DValueType::toVector3d() const
+{
+ return v.toVector3D();
+}
+
+QVector4D Quick3DVector2DValueType::toVector4d() const
+{
+ return v.toVector4D();
+}
+
+bool Quick3DVector2DValueType::fuzzyEquals(const QVector2D &vec, qreal epsilon) const
+{
+ qreal absEps = qAbs(epsilon);
+ if (qAbs(v.x() - vec.x()) > absEps)
+ return false;
+ if (qAbs(v.y() - vec.y()) > absEps)
+ return false;
+ return true;
+}
+
+bool Quick3DVector2DValueType::fuzzyEquals(const QVector2D &vec) const
+{
+ return qFuzzyCompare(v, vec);
+}
+
+
+Quick3DVector3DValueType::Quick3DVector3DValueType(QObject *parent)
+ : QQmlValueTypeBase<QVector3D>(QMetaType::QVector3D, parent)
+{
+}
+
+QString Quick3DVector3DValueType::toString() const
+{
+ return QString(QLatin1String("QVector3D(%1, %2, %3)")).arg(v.x()).arg(v.y()).arg(v.z());
+}
+
+bool Quick3DVector3DValueType::isEqual(const QVariant &other) const
+{
+ if (other.userType() != QMetaType::QVector3D)
+ return false;
+
+ QVector3D otherVector = other.value<QVector3D>();
+ return (v == otherVector);
+}
+
+qreal Quick3DVector3DValueType::x() const
+{
+ return v.x();
+}
+
+qreal Quick3DVector3DValueType::y() const
+{
+ return v.y();
+}
+
+qreal Quick3DVector3DValueType::z() const
+{
+ return v.z();
+}
+
+void Quick3DVector3DValueType::setX(qreal x)
+{
+ v.setX(x);
+}
+
+void Quick3DVector3DValueType::setY(qreal y)
+{
+ v.setY(y);
+}
+
+void Quick3DVector3DValueType::setZ(qreal z)
+{
+ v.setZ(z);
+}
+
+QVector3D Quick3DVector3DValueType::crossProduct(const QVector3D &vec) const
+{
+ return QVector3D::crossProduct(v, vec);
+}
+
+qreal Quick3DVector3DValueType::dotProduct(const QVector3D &vec) const
+{
+ return QVector3D::dotProduct(v, vec);
+}
+
+QVector3D Quick3DVector3DValueType::times(const QMatrix4x4 &m) const
+{
+ return v * m;
+}
+
+QVector3D Quick3DVector3DValueType::times(const QVector3D &vec) const
+{
+ return v * vec;
+}
+
+QVector3D Quick3DVector3DValueType::times(qreal scalar) const
+{
+ return v * scalar;
+}
+
+QVector3D Quick3DVector3DValueType::plus(const QVector3D &vec) const
+{
+ return v + vec;
+}
+
+QVector3D Quick3DVector3DValueType::minus(const QVector3D &vec) const
+{
+ return v - vec;
+}
+
+QVector3D Quick3DVector3DValueType::normalized() const
+{
+ return v.normalized();
+}
+
+qreal Quick3DVector3DValueType::length() const
+{
+ return v.length();
+}
+
+QVector2D Quick3DVector3DValueType::toVector2d() const
+{
+ return v.toVector2D();
+}
+
+QVector4D Quick3DVector3DValueType::toVector4d() const
+{
+ return v.toVector4D();
+}
+
+bool Quick3DVector3DValueType::fuzzyEquals(const QVector3D &vec, qreal epsilon) const
+{
+ qreal absEps = qAbs(epsilon);
+ if (qAbs(v.x() - vec.x()) > absEps)
+ return false;
+ if (qAbs(v.y() - vec.y()) > absEps)
+ return false;
+ if (qAbs(v.z() - vec.z()) > absEps)
+ return false;
+ return true;
+}
+
+bool Quick3DVector3DValueType::fuzzyEquals(const QVector3D &vec) const
+{
+ return qFuzzyCompare(v, vec);
+}
+
+
+Quick3DVector4DValueType::Quick3DVector4DValueType(QObject *parent)
+ : QQmlValueTypeBase<QVector4D>(QMetaType::QVector4D, parent)
+{
+}
+
+QString Quick3DVector4DValueType::toString() const
+{
+ return QString(QLatin1String("QVector4D(%1, %2, %3, %4)")).arg(v.x()).arg(v.y()).arg(v.z()).arg(v.w());
+}
+
+bool Quick3DVector4DValueType::isEqual(const QVariant &other) const
+{
+ if (other.userType() != QMetaType::QVector4D)
+ return false;
+
+ QVector4D otherVector = other.value<QVector4D>();
+ return (v == otherVector);
+}
+
+qreal Quick3DVector4DValueType::x() const
+{
+ return v.x();
+}
+
+qreal Quick3DVector4DValueType::y() const
+{
+ return v.y();
+}
+
+qreal Quick3DVector4DValueType::z() const
+{
+ return v.z();
+}
+
+qreal Quick3DVector4DValueType::w() const
+{
+ return v.w();
+}
+
+void Quick3DVector4DValueType::setX(qreal x)
+{
+ v.setX(x);
+}
+
+void Quick3DVector4DValueType::setY(qreal y)
+{
+ v.setY(y);
+}
+
+void Quick3DVector4DValueType::setZ(qreal z)
+{
+ v.setZ(z);
+}
+
+void Quick3DVector4DValueType::setW(qreal w)
+{
+ v.setW(w);
+}
+
+qreal Quick3DVector4DValueType::dotProduct(const QVector4D &vec) const
+{
+ return QVector4D::dotProduct(v, vec);
+}
+
+QVector4D Quick3DVector4DValueType::times(const QVector4D &vec) const
+{
+ return v * vec;
+}
+
+QVector4D Quick3DVector4DValueType::times(const QMatrix4x4 &m) const
+{
+ return v * m;
+}
+
+QVector4D Quick3DVector4DValueType::times(qreal scalar) const
+{
+ return v * scalar;
+}
+
+QVector4D Quick3DVector4DValueType::plus(const QVector4D &vec) const
+{
+ return v + vec;
+}
+
+QVector4D Quick3DVector4DValueType::minus(const QVector4D &vec) const
+{
+ return v - vec;
+}
+
+QVector4D Quick3DVector4DValueType::normalized() const
+{
+ return v.normalized();
+}
+
+qreal Quick3DVector4DValueType::length() const
+{
+ return v.length();
+}
+
+QVector2D Quick3DVector4DValueType::toVector2d() const
+{
+ return v.toVector2D();
+}
+
+QVector3D Quick3DVector4DValueType::toVector3d() const
+{
+ return v.toVector3D();
+}
+
+bool Quick3DVector4DValueType::fuzzyEquals(const QVector4D &vec, qreal epsilon) const
+{
+ qreal absEps = qAbs(epsilon);
+ if (qAbs(v.x() - vec.x()) > absEps)
+ return false;
+ if (qAbs(v.y() - vec.y()) > absEps)
+ return false;
+ if (qAbs(v.z() - vec.z()) > absEps)
+ return false;
+ if (qAbs(v.w() - vec.w()) > absEps)
+ return false;
+ return true;
+}
+
+bool Quick3DVector4DValueType::fuzzyEquals(const QVector4D &vec) const
+{
+ return qFuzzyCompare(v, vec);
+}
+
+Quick3DQuaternionValueType::Quick3DQuaternionValueType(QObject *parent)
+ : QQmlValueTypeBase<QQuaternion>(QMetaType::QQuaternion, parent)
+{
+}
+
+QString Quick3DQuaternionValueType::toString() const
+{
+ return QString(QLatin1String("QQuaternion(%1, %2, %3, %4)")).arg(v.scalar()).arg(v.x()).arg(v.y()).arg(v.z());
+}
+
+qreal Quick3DQuaternionValueType::scalar() const
+{
+ return v.scalar();
+}
+
+qreal Quick3DQuaternionValueType::x() const
+{
+ return v.x();
+}
+
+qreal Quick3DQuaternionValueType::y() const
+{
+ return v.y();
+}
+
+qreal Quick3DQuaternionValueType::z() const
+{
+ return v.z();
+}
+
+void Quick3DQuaternionValueType::setScalar(qreal scalar)
+{
+ v.setScalar(scalar);
+}
+
+void Quick3DQuaternionValueType::setX(qreal x)
+{
+ v.setX(x);
+}
+
+void Quick3DQuaternionValueType::setY(qreal y)
+{
+ v.setY(y);
+}
+
+void Quick3DQuaternionValueType::setZ(qreal z)
+{
+ v.setZ(z);
+}
+
+
+Quick3DMatrix4x4ValueType::Quick3DMatrix4x4ValueType(QObject *parent)
+ : QQmlValueTypeBase<QMatrix4x4>(QMetaType::QMatrix4x4, parent)
+{
+}
+
+QMatrix4x4 Quick3DMatrix4x4ValueType::times(const QMatrix4x4 &m) const
+{
+ return v * m;
+}
+
+QVector4D Quick3DMatrix4x4ValueType::times(const QVector4D &vec) const
+{
+ return v * vec;
+}
+
+QVector3D Quick3DMatrix4x4ValueType::times(const QVector3D &vec) const
+{
+ return v * vec;
+}
+
+QMatrix4x4 Quick3DMatrix4x4ValueType::times(qreal factor) const
+{
+ return v * factor;
+}
+
+QMatrix4x4 Quick3DMatrix4x4ValueType::plus(const QMatrix4x4 &m) const
+{
+ return v + m;
+}
+
+QMatrix4x4 Quick3DMatrix4x4ValueType::minus(const QMatrix4x4 &m) const
+{
+ return v - m;
+}
+
+QVector4D Quick3DMatrix4x4ValueType::row(int n) const
+{
+ return v.row(n);
+}
+
+QVector4D Quick3DMatrix4x4ValueType::column(int m) const
+{
+ return v.column(m);
+}
+
+qreal Quick3DMatrix4x4ValueType::determinant() const
+{
+ return v.determinant();
+}
+
+QMatrix4x4 Quick3DMatrix4x4ValueType::inverted() const
+{
+ return v.inverted();
+}
+
+QMatrix4x4 Quick3DMatrix4x4ValueType::transposed() const
+{
+ return v.transposed();
+}
+
+bool Quick3DMatrix4x4ValueType::fuzzyEquals(const QMatrix4x4 &m, qreal epsilon) const
+{
+ qreal absEps = qAbs(epsilon);
+ for (int i = 0; i < 4; ++i) {
+ for (int j = 0; j < 4; ++j) {
+ if (qAbs(v(i,j) - m(i,j)) > absEps) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool Quick3DMatrix4x4ValueType::fuzzyEquals(const QMatrix4x4 &m) const
+{
+ return qFuzzyCompare(v, m);
+}
+
+QString Quick3DMatrix4x4ValueType::toString() const
+{
+ return QString(QLatin1String("QMatrix4x4(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16)"))
+ .arg(v(0, 0)).arg(v(0, 1)).arg(v(0, 2)).arg(v(0, 3))
+ .arg(v(1, 0)).arg(v(1, 1)).arg(v(1, 2)).arg(v(1, 3))
+ .arg(v(2, 0)).arg(v(2, 1)).arg(v(2, 2)).arg(v(2, 3))
+ .arg(v(3, 0)).arg(v(3, 1)).arg(v(3, 2)).arg(v(3, 3));
+}
+
+bool Quick3DMatrix4x4ValueType::isEqual(const QVariant &other) const
+{
+ if (other.userType() != qMetaTypeId<QMatrix4x4>())
+ return false;
+
+ QMatrix4x4 otherMatrix = other.value<QMatrix4x4>();
+ return (v == otherMatrix);
+
+}
+
+} // Quick
+
+} // Qt3D
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3d/qt3dquickvaluetypes_p.h b/src/quick3d/quick3d/qt3dquickvaluetypes_p.h
new file mode 100644
index 000000000..05e83122d
--- /dev/null
+++ b/src/quick3d/quick3d/qt3dquickvaluetypes_p.h
@@ -0,0 +1,293 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DQUICKVALUETYPES_P_H
+#define QT3DQUICKVALUETYPES_P_H
+
+#include <private/qt3dquick_global_p.h>
+#include <private/qqmlvaluetype_p.h>
+
+#include <QtGui/QColor>
+#include <QtGui/QVector2D>
+#include <QtGui/QVector3D>
+#include <QtGui/QVector4D>
+#include <QtGui/QQuaternion>
+#include <QtGui/QMatrix4x4>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+namespace Quick {
+
+namespace Quick3DValueTypes {
+
+QT3DQUICKSHARED_PRIVATE_EXPORT void registerValueTypes();
+
+}
+
+class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DColorValueType : public QQmlValueTypeBase<QColor>
+{
+ Q_PROPERTY(qreal r READ r WRITE setR FINAL)
+ Q_PROPERTY(qreal g READ g WRITE setG FINAL)
+ Q_PROPERTY(qreal b READ b WRITE setB FINAL)
+ Q_PROPERTY(qreal a READ a WRITE setA FINAL)
+ Q_OBJECT
+public:
+ Quick3DColorValueType(QObject *parent = 0);
+
+ virtual QString toString() const;
+
+ qreal r() const;
+ qreal g() const;
+ qreal b() const;
+ qreal a() const;
+ void setR(qreal);
+ void setG(qreal);
+ void setB(qreal);
+ void setA(qreal);
+};
+
+class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DVector2DValueType : public QQmlValueTypeBase<QVector2D>
+{
+ Q_PROPERTY(qreal x READ x WRITE setX FINAL)
+ Q_PROPERTY(qreal y READ y WRITE setY FINAL)
+ Q_OBJECT
+public:
+ Quick3DVector2DValueType(QObject *parent = 0);
+
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &other) const;
+
+ qreal x() const;
+ qreal y() const;
+ void setX(qreal);
+ void setY(qreal);
+
+ Q_INVOKABLE qreal dotProduct(const QVector2D &vec) const;
+ Q_INVOKABLE QVector2D times(const QVector2D &vec) const;
+ Q_INVOKABLE QVector2D times(qreal scalar) const;
+ Q_INVOKABLE QVector2D plus(const QVector2D &vec) const;
+ Q_INVOKABLE QVector2D minus(const QVector2D &vec) const;
+ Q_INVOKABLE QVector2D normalized() const;
+ Q_INVOKABLE qreal length() const;
+ Q_INVOKABLE QVector3D toVector3d() const;
+ Q_INVOKABLE QVector4D toVector4d() const;
+ Q_INVOKABLE bool fuzzyEquals(const QVector2D &vec, qreal epsilon) const;
+ Q_INVOKABLE bool fuzzyEquals(const QVector2D &vec) const;
+};
+
+class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DVector3DValueType : public QQmlValueTypeBase<QVector3D>
+{
+ Q_PROPERTY(qreal x READ x WRITE setX FINAL)
+ Q_PROPERTY(qreal y READ y WRITE setY FINAL)
+ Q_PROPERTY(qreal z READ z WRITE setZ FINAL)
+ Q_OBJECT
+public:
+ Quick3DVector3DValueType(QObject *parent = 0);
+
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &other) const;
+
+ qreal x() const;
+ qreal y() const;
+ qreal z() const;
+ void setX(qreal);
+ void setY(qreal);
+ void setZ(qreal);
+
+ Q_INVOKABLE QVector3D crossProduct(const QVector3D &vec) const;
+ Q_INVOKABLE qreal dotProduct(const QVector3D &vec) const;
+ Q_INVOKABLE QVector3D times(const QMatrix4x4 &m) const;
+ Q_INVOKABLE QVector3D times(const QVector3D &vec) const;
+ Q_INVOKABLE QVector3D times(qreal scalar) const;
+ Q_INVOKABLE QVector3D plus(const QVector3D &vec) const;
+ Q_INVOKABLE QVector3D minus(const QVector3D &vec) const;
+ Q_INVOKABLE QVector3D normalized() const;
+ Q_INVOKABLE qreal length() const;
+ Q_INVOKABLE QVector2D toVector2d() const;
+ Q_INVOKABLE QVector4D toVector4d() const;
+ Q_INVOKABLE bool fuzzyEquals(const QVector3D &vec, qreal epsilon) const;
+ Q_INVOKABLE bool fuzzyEquals(const QVector3D &vec) const;
+};
+
+class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DVector4DValueType : public QQmlValueTypeBase<QVector4D>
+{
+ Q_PROPERTY(qreal x READ x WRITE setX FINAL)
+ Q_PROPERTY(qreal y READ y WRITE setY FINAL)
+ Q_PROPERTY(qreal z READ z WRITE setZ FINAL)
+ Q_PROPERTY(qreal w READ w WRITE setW FINAL)
+ Q_OBJECT
+public:
+ Quick3DVector4DValueType(QObject *parent = 0);
+
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &other) const;
+
+ qreal x() const;
+ qreal y() const;
+ qreal z() const;
+ qreal w() const;
+ void setX(qreal);
+ void setY(qreal);
+ void setZ(qreal);
+ void setW(qreal);
+
+ Q_INVOKABLE qreal dotProduct(const QVector4D &vec) const;
+ Q_INVOKABLE QVector4D times(const QVector4D &vec) const;
+ Q_INVOKABLE QVector4D times(const QMatrix4x4 &m) const;
+ Q_INVOKABLE QVector4D times(qreal scalar) const;
+ Q_INVOKABLE QVector4D plus(const QVector4D &vec) const;
+ Q_INVOKABLE QVector4D minus(const QVector4D &vec) const;
+ Q_INVOKABLE QVector4D normalized() const;
+ Q_INVOKABLE qreal length() const;
+ Q_INVOKABLE QVector2D toVector2d() const;
+ Q_INVOKABLE QVector3D toVector3d() const;
+ Q_INVOKABLE bool fuzzyEquals(const QVector4D &vec, qreal epsilon) const;
+ Q_INVOKABLE bool fuzzyEquals(const QVector4D &vec) const;
+};
+
+class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DQuaternionValueType : public QQmlValueTypeBase<QQuaternion>
+{
+ Q_PROPERTY(qreal scalar READ scalar WRITE setScalar)
+ Q_PROPERTY(qreal x READ x WRITE setX)
+ Q_PROPERTY(qreal y READ y WRITE setY)
+ Q_PROPERTY(qreal z READ z WRITE setZ)
+ Q_OBJECT
+public:
+ Quick3DQuaternionValueType(QObject *parent = 0);
+
+ virtual QString toString() const;
+
+ qreal scalar() const;
+ qreal x() const;
+ qreal y() const;
+ qreal z() const;
+ void setScalar(qreal);
+ void setX(qreal);
+ void setY(qreal);
+ void setZ(qreal);
+};
+
+class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DMatrix4x4ValueType : public QQmlValueTypeBase<QMatrix4x4>
+{
+ Q_PROPERTY(qreal m11 READ m11 WRITE setM11 FINAL)
+ Q_PROPERTY(qreal m12 READ m12 WRITE setM12 FINAL)
+ Q_PROPERTY(qreal m13 READ m13 WRITE setM13 FINAL)
+ Q_PROPERTY(qreal m14 READ m14 WRITE setM14 FINAL)
+ Q_PROPERTY(qreal m21 READ m21 WRITE setM21 FINAL)
+ Q_PROPERTY(qreal m22 READ m22 WRITE setM22 FINAL)
+ Q_PROPERTY(qreal m23 READ m23 WRITE setM23 FINAL)
+ Q_PROPERTY(qreal m24 READ m24 WRITE setM24 FINAL)
+ Q_PROPERTY(qreal m31 READ m31 WRITE setM31 FINAL)
+ Q_PROPERTY(qreal m32 READ m32 WRITE setM32 FINAL)
+ Q_PROPERTY(qreal m33 READ m33 WRITE setM33 FINAL)
+ Q_PROPERTY(qreal m34 READ m34 WRITE setM34 FINAL)
+ Q_PROPERTY(qreal m41 READ m41 WRITE setM41 FINAL)
+ Q_PROPERTY(qreal m42 READ m42 WRITE setM42 FINAL)
+ Q_PROPERTY(qreal m43 READ m43 WRITE setM43 FINAL)
+ Q_PROPERTY(qreal m44 READ m44 WRITE setM44 FINAL)
+ Q_OBJECT
+public:
+ Quick3DMatrix4x4ValueType(QObject *parent = 0);
+
+ virtual QString toString() const;
+ virtual bool isEqual(const QVariant &other) const;
+
+ qreal m11() const { return v(0, 0); }
+ qreal m12() const { return v(0, 1); }
+ qreal m13() const { return v(0, 2); }
+ qreal m14() const { return v(0, 3); }
+ qreal m21() const { return v(1, 0); }
+ qreal m22() const { return v(1, 1); }
+ qreal m23() const { return v(1, 2); }
+ qreal m24() const { return v(1, 3); }
+ qreal m31() const { return v(2, 0); }
+ qreal m32() const { return v(2, 1); }
+ qreal m33() const { return v(2, 2); }
+ qreal m34() const { return v(2, 3); }
+ qreal m41() const { return v(3, 0); }
+ qreal m42() const { return v(3, 1); }
+ qreal m43() const { return v(3, 2); }
+ qreal m44() const { return v(3, 3); }
+
+ void setM11(qreal value) { v(0, 0) = value; }
+ void setM12(qreal value) { v(0, 1) = value; }
+ void setM13(qreal value) { v(0, 2) = value; }
+ void setM14(qreal value) { v(0, 3) = value; }
+ void setM21(qreal value) { v(1, 0) = value; }
+ void setM22(qreal value) { v(1, 1) = value; }
+ void setM23(qreal value) { v(1, 2) = value; }
+ void setM24(qreal value) { v(1, 3) = value; }
+ void setM31(qreal value) { v(2, 0) = value; }
+ void setM32(qreal value) { v(2, 1) = value; }
+ void setM33(qreal value) { v(2, 2) = value; }
+ void setM34(qreal value) { v(2, 3) = value; }
+ void setM41(qreal value) { v(3, 0) = value; }
+ void setM42(qreal value) { v(3, 1) = value; }
+ void setM43(qreal value) { v(3, 2) = value; }
+ void setM44(qreal value) { v(3, 3) = value; }
+
+ Q_INVOKABLE QMatrix4x4 times(const QMatrix4x4 &m) const;
+ Q_INVOKABLE QVector4D times(const QVector4D &vec) const;
+ Q_INVOKABLE QVector3D times(const QVector3D &vec) const;
+ Q_INVOKABLE QMatrix4x4 times(qreal factor) const;
+ Q_INVOKABLE QMatrix4x4 plus(const QMatrix4x4 &m) const;
+ Q_INVOKABLE QMatrix4x4 minus(const QMatrix4x4 &m) const;
+
+ Q_INVOKABLE QVector4D row(int n) const;
+ Q_INVOKABLE QVector4D column(int m) const;
+
+ Q_INVOKABLE qreal determinant() const;
+ Q_INVOKABLE QMatrix4x4 inverted() const;
+ Q_INVOKABLE QMatrix4x4 transposed() const;
+
+ Q_INVOKABLE bool fuzzyEquals(const QMatrix4x4 &m, qreal epsilon) const;
+ Q_INVOKABLE bool fuzzyEquals(const QMatrix4x4 &m) const;
+};
+
+} // Quick
+
+} // Qt3D
+
+QT_END_NAMESPACE
+
+#endif // QT3DQUICKVALUETYPES_P_H
diff --git a/src/quick3d/quick3d/quick3d.pro b/src/quick3d/quick3d/quick3d.pro
index 506725004..ec898bc13 100644
--- a/src/quick3d/quick3d/quick3d.pro
+++ b/src/quick3d/quick3d/quick3d.pro
@@ -1,6 +1,6 @@
TARGET = Qt3DQuick
-QT += core-private gui-private qml qml-private quick 3dcore
+QT += core-private gui-private qml qml-private quick quick-private 3dcore
DEFINES += QT3DQUICK_LIBRARY
@@ -18,9 +18,13 @@ gcov {
HEADERS += $$PRIVATE_HEADERS \
qt3dquick_global.h \
- quickwindow.h
+ quickwindow.h \
+ qt3dquick_global_p.h \
+ qt3dquickvaluetypes_p.h
-SOURCES += quickwindow.cpp
+SOURCES += quickwindow.cpp \
+ qt3dquick_global.cpp \
+ qt3dquickvaluetypes.cpp
!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL