summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2017-11-10 08:56:20 +0200
committerTomi Korpipää <tomi.korpipaa@qt.io>2017-11-10 09:20:30 +0000
commit9847eaad86c3052a940af8f4b3cb4aa8d16d3418 (patch)
tree98d47a9745ad1a7b4312e0f814b5090abb88653c /examples
parent26dc23f177bbc15f6fb7dfce860cb2970f20cc4e (diff)
Update behavior example scripts
Change-Id: Ia68d9066363ba3d2296a1a6f630d51400354fe55 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/studio3d/qmlbehaviors/scripts/Billboard.qml34
-rw-r--r--examples/studio3d/qmlbehaviors/scripts/CatchEvents.qml4
-rw-r--r--examples/studio3d/qmlbehaviors/scripts/DateTime.qml2
-rw-r--r--examples/studio3d/qmlbehaviors/scripts/Keyboard.qml8
-rw-r--r--examples/studio3d/qmlbehaviors/scripts/SineWave.qml8
-rw-r--r--examples/studio3d/qmlbehaviors/scripts/Toggle.qml12
6 files changed, 34 insertions, 34 deletions
diff --git a/examples/studio3d/qmlbehaviors/scripts/Billboard.qml b/examples/studio3d/qmlbehaviors/scripts/Billboard.qml
index de4ae3f5..45259f1e 100644
--- a/examples/studio3d/qmlbehaviors/scripts/Billboard.qml
+++ b/examples/studio3d/qmlbehaviors/scripts/Billboard.qml
@@ -104,12 +104,12 @@ QtObject {
}
function faceCamera() {
- var cameraTransform = Qt3ds.calculateGlobalTransform(renderCamera);
+ var cameraTransform = Qt3DSRuntime.calculateGlobalTransform(renderCamera);
var cameraSpot = cameraTransform.row(3).toVector3d();
- var myTransform = Qt3ds.calculateGlobalTransform();
+ var myTransform = Qt3DSRuntime.calculateGlobalTransform();
var mySpot = myTransform.row(3).toVector3d();
- var matrix = Qt3ds.calculateGlobalTransform(Qt3ds.getParent()).inverted();
+ var matrix = Qt3DSRuntime.calculateGlobalTransform(Qt3DSRuntime.getParent()).inverted();
matrix.m41 = 0;
matrix.m42 = 0;
matrix.m43 = 0;
@@ -118,14 +118,14 @@ QtObject {
.minus(mySpot)
.times(matrix);
- var rotation = Qt3ds.lookAt(rotateRay);
+ var rotation = Qt3DSRuntime.lookAt(rotateRay);
setAttributeVector("rotation", rotation);
}
function faceCameraGlobalY() {
- var cameraTransform = Qt3ds.calculateGlobalTransform(renderCamera);
+ var cameraTransform = Qt3DSRuntime.calculateGlobalTransform(renderCamera);
var cameraSpot = cameraTransform.row(3).toVector3d();
- var myTransform = Qt3ds.calculateGlobalTransform();
+ var myTransform = Qt3DSRuntime.calculateGlobalTransform();
var mySpot = myTransform.row(3).toVector3d();
var rotateRay = cameraSpot.minus(mySpot);
@@ -136,10 +136,10 @@ QtObject {
}
function matchRotation() {
- var cameraTransform = Qt3ds.calculateGlobalTransform(renderCamera);
+ var cameraTransform = Qt3DSRuntime.calculateGlobalTransform(renderCamera);
var cameraSpot = cameraTransform.row(3).toVector3d();
- var matrix = Qt3ds.calculateGlobalTransform(Qt3ds.getParent()).inverted();
+ var matrix = Qt3DSRuntime.calculateGlobalTransform(Qt3DSRuntime.getParent()).inverted();
matrix.m41 = 0;
matrix.m42 = 0;
matrix.m43 = 0;
@@ -149,12 +149,12 @@ QtObject {
.minus(cameraSpot)
.times(matrix);
- var rotation = Qt3ds.lookAt(rotateRay);
+ var rotation = Qt3DSRuntime.lookAt(rotateRay);
setAttributeVector("rotation", rotation);
}
function matchRotationGlobalY() {
- var cameraTransform = Qt3ds.calculateGlobalTransform(renderCamera);
+ var cameraTransform = Qt3DSRuntime.calculateGlobalTransform(renderCamera);
var cameraSpot = cameraTransform.row(3).toVector3d();
var rotateRay = Qt.vector3d(0, 0, 1)
@@ -162,21 +162,21 @@ QtObject {
.minus(cameraSpot)
var rotation = getAttributeVector("rotation");
- rotation.y = Qt3ds.lookAt(rotateRay).y;
+ rotation.y = Qt3DSRuntime.lookAt(rotateRay).y;
setAttributeVector("rotation", rotation);
}
function getAttributeVector(name) {
var vec = Qt.vector3d(0, 0, 0);
- Qt3ds.getAttribute(name + ".x", vec.x);
- Qt3ds.getAttribute(name + ".y", vec.y);
- Qt3ds.getAttribute(name + ".z", vec.z);
+ Qt3DSRuntime.getAttribute(name + ".x", vec.x);
+ Qt3DSRuntime.getAttribute(name + ".y", vec.y);
+ Qt3DSRuntime.getAttribute(name + ".z", vec.z);
return vec;
}
function setAttributeVector(name, vec) {
- Qt3ds.setAttribute(name + ".x", vec.x);
- Qt3ds.setAttribute(name + ".y", vec.y);
- Qt3ds.setAttribute(name + ".z", vec.z);
+ Qt3DSRuntime.setAttribute(name + ".x", vec.x);
+ Qt3DSRuntime.setAttribute(name + ".y", vec.y);
+ Qt3DSRuntime.setAttribute(name + ".z", vec.z);
}
}
diff --git a/examples/studio3d/qmlbehaviors/scripts/CatchEvents.qml b/examples/studio3d/qmlbehaviors/scripts/CatchEvents.qml
index f5b14a80..2aadbc96 100644
--- a/examples/studio3d/qmlbehaviors/scripts/CatchEvents.qml
+++ b/examples/studio3d/qmlbehaviors/scripts/CatchEvents.qml
@@ -52,8 +52,8 @@ import QtQml 2.2
QtObject {
function onInitialize() {
- Qt3ds.registerForEvent("onPressureDown", onMouseDown);
- Qt3ds.registerForEvent("onPressureUp", onMouseUp);
+ Qt3DSRuntime.registerForEvent("onPressureDown", onMouseDown);
+ Qt3DSRuntime.registerForEvent("onPressureUp", onMouseUp);
}
function onMouseDown() {
diff --git a/examples/studio3d/qmlbehaviors/scripts/DateTime.qml b/examples/studio3d/qmlbehaviors/scripts/DateTime.qml
index 79773dc5..bab6db34 100644
--- a/examples/studio3d/qmlbehaviors/scripts/DateTime.qml
+++ b/examples/studio3d/qmlbehaviors/scripts/DateTime.qml
@@ -55,6 +55,6 @@ QtObject {
var date = new Date();
var timeString = date.getDate() + "/" + (date.getMonth()+1) + "/" + date.getFullYear()
+ " " + date.getHours() + ":" + date.getMinutes() + "." + date.getSeconds();
- Qt3ds.setAttribute("textstring", timeString);
+ Qt3DSRuntime.setAttribute("textstring", timeString);
}
}
diff --git a/examples/studio3d/qmlbehaviors/scripts/Keyboard.qml b/examples/studio3d/qmlbehaviors/scripts/Keyboard.qml
index 9a1d86f1..2cdfb8e4 100644
--- a/examples/studio3d/qmlbehaviors/scripts/Keyboard.qml
+++ b/examples/studio3d/qmlbehaviors/scripts/Keyboard.qml
@@ -185,15 +185,15 @@ QtObject {
"SCALE"]
function onInitialize() {
- Qt3ds.registerForEvent("onKeyDown", onKeyDown);
- Qt3ds.registerForEvent("onKeyUp", onKeyUp);
+ Qt3DSRuntime.registerForEvent("onKeyDown", onKeyDown);
+ Qt3DSRuntime.registerForEvent("onKeyUp", onKeyUp);
}
function onKeyDown(keyCode) {
- Qt3ds.fireEvent("on" + keyNames[keyCode] + "Down");
+ Qt3DSRuntime.fireEvent("on" + keyNames[keyCode] + "Down");
}
function onKeyUp(keyCode) {
- Qt3ds.fireEvent("on" + keyNames[keyCode] + "Up");
+ Qt3DSRuntime.fireEvent("on" + keyNames[keyCode] + "Up");
}
}
diff --git a/examples/studio3d/qmlbehaviors/scripts/SineWave.qml b/examples/studio3d/qmlbehaviors/scripts/SineWave.qml
index 4aa9daf7..179dc370 100644
--- a/examples/studio3d/qmlbehaviors/scripts/SineWave.qml
+++ b/examples/studio3d/qmlbehaviors/scripts/SineWave.qml
@@ -82,14 +82,14 @@ QtObject {
function start() {
if (!running) {
running = true;
- Qt3ds.fireEvent("onStarted");
+ Qt3DSRuntime.fireEvent("onStarted");
}
}
function stop() {
if (running) {
running = false;
- Qt3ds.fireEvent("onStopped");
+ Qt3DSRuntime.fireEvent("onStopped");
}
}
@@ -117,8 +117,8 @@ QtObject {
amplitude *= (Math.PI / 180);
}
- elapsedTime += Qt3ds.getDeltaTime();
+ elapsedTime += Qt3DSRuntime.getDeltaTime();
var value = ampOffset + amplitude * Math.cos(elapsedTime * Math.PI * 2 / period);
- Qt3ds.setAttribute(attribute, value);
+ Qt3DSRuntime.setAttribute(attribute, value);
}
}
diff --git a/examples/studio3d/qmlbehaviors/scripts/Toggle.qml b/examples/studio3d/qmlbehaviors/scripts/Toggle.qml
index aa71f264..4c91c117 100644
--- a/examples/studio3d/qmlbehaviors/scripts/Toggle.qml
+++ b/examples/studio3d/qmlbehaviors/scripts/Toggle.qml
@@ -78,7 +78,7 @@ QtObject {
function start() {
running = true;
- Qt3ds.setAttribute(attribute, firstValue);
+ Qt3DSRuntime.setAttribute(attribute, firstValue);
}
function stop() {
@@ -87,11 +87,11 @@ QtObject {
function toggle() {
if (index == 0) {
- Qt3ds.setAttribute(attribute, secondValue);
- Qt3ds.fireEvent("onToggle");
+ Qt3DSRuntime.setAttribute(attribute, secondValue);
+ Qt3DSRuntime.fireEvent("onToggle");
} else if (index == 1) {
- Qt3ds.setAttribute(attribute, firstValue);
- Qt3ds.fireEvent("onUntoggle");
+ Qt3DSRuntime.setAttribute(attribute, firstValue);
+ Qt3DSRuntime.fireEvent("onUntoggle");
}
index++;
if (index > 1)
@@ -107,7 +107,7 @@ QtObject {
if (!running)
return;
- timer += Qt3ds.getDeltaTime();
+ timer += Qt3DSRuntime.getDeltaTime();
var interval = timerInterval / 1000;
while (timer >= interval) {
timer -= interval;