aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/dynamic3DTest/main.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/dynamic3DTest/main.qml')
-rw-r--r--tests/manual/dynamic3DTest/main.qml59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/manual/dynamic3DTest/main.qml b/tests/manual/dynamic3DTest/main.qml
index bd16f590..71c8cd68 100644
--- a/tests/manual/dynamic3DTest/main.qml
+++ b/tests/manual/dynamic3DTest/main.qml
@@ -65,6 +65,7 @@ Window {
property var spotLights: []
property var cameras: []
property var models: []
+ property var riggedModels: []
property var dynamicModels: []
property var dynamicGeometries: []
property var textures: []
@@ -78,6 +79,7 @@ Window {
property int spotLightsCount: 0
property int camerasCount: 0
property int modelsCount: 0
+ property int riggedModelsCount: 0
property int dynamicModelsCount: 0
property int texturesCount: 0
property int dynamicTexturesCount: 0
@@ -126,6 +128,13 @@ Window {
}
Component {
+ id: riggedModel
+ RiggedFigure {
+
+ }
+ }
+
+ Component {
id: dynamicModel
Model {
property alias color: material.baseColor
@@ -253,6 +262,15 @@ Window {
return sources[index]
}
+ function getRiggedMeshSource() {
+ let sources = [
+ "riggedfigure.mesh",
+ "riggedsimple.mesh"
+ ]
+ let index = Math.floor(Math.random() * sources.length);
+ return sources[index]
+ }
+
function getImageSource() {
let sources = [
"noise1.jpg",
@@ -341,6 +359,22 @@ Window {
}
}
+ function addRiggedModel() {
+ let position = getRandomVector3d(objectSpawner.range)
+ let rotation = getRandomVector3d(360)
+ let instance = riggedModel.createObject(objectSpawner, { "position": position, "eulerRotation": rotation})
+ riggedModels.push(instance);
+ riggedModelsCount++
+ }
+
+ function removeRiggedModel() {
+ if (riggedModels.length > 0) {
+ let instance = riggedModels.pop();
+ instance.destroy();
+ riggedModelsCount--
+ }
+ }
+
function addDynamicModel() {
let position = getRandomVector3d(objectSpawner.range)
let rotation = getRandomVector3d(360)
@@ -459,6 +493,7 @@ Window {
// reset the model sources
models.forEach(model => model.source = getMeshSource())
}
+
function changeDynamicModels() {
// reset the dynamic model sources
if (dynamicModels.length == 0)
@@ -712,6 +747,30 @@ Window {
}
RowLayout {
Label {
+ text: "Rigged Model"
+ color: "white"
+ Layout.fillWidth: true
+ }
+ Label {
+ text: objectSpawner.riggedModelsCount
+ color: "white"
+ Layout.fillWidth: true
+ }
+ ToolButton {
+ text: "+"
+ onClicked: {
+ objectSpawner.addRiggedModel()
+ }
+ }
+ ToolButton {
+ text: "-"
+ onClicked: {
+ objectSpawner.removeRiggedModel()
+ }
+ }
+ }
+ RowLayout {
+ Label {
text: "Dynamic Model"
color: "white"
Layout.fillWidth: true