From 9c17af71e63873dfa7af3fcc7c1303a302f2608a Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Thu, 12 Jan 2017 22:11:16 +0000 Subject: Add QLevelOfDetailSwitch to toggle child entities Derived from QLevelOfDetail, can be used to toggle the enabled state of child entities based on the currentIndex property. Especially useful in QML since the child entities is not available there. Change-Id: Icafad22a6990d537bdda239907c62f6b31260c81 Reviewed-by: Sean Harmer --- tests/manual/lod/main.qml | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'tests/manual/lod') diff --git a/tests/manual/lod/main.qml b/tests/manual/lod/main.qml index aea87f653..8d9c8722a 100644 --- a/tests/manual/lod/main.qml +++ b/tests/manual/lod/main.qml @@ -115,7 +115,7 @@ Entity { }, Transform { scale: 1.5 - translation: Qt.vector3d(-5, 0, 0) + translation: Qt.vector3d(0, 0, 0) rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45) }, PhongMaterial { @@ -145,7 +145,7 @@ Entity { LevelOfDetailLoader { components: [ Transform { scale: .5 - translation: Qt.vector3d(5, 0, 0) + translation: Qt.vector3d(-8, 0, 0) } ] camera: camera @@ -156,6 +156,41 @@ Entity { } } + Entity { + components: [ + Transform { + translation: transform.translation + } + ] + + Entity { + components: [ + Transform { + scale: .5 + translation: Qt.vector3d(8, 0, 0) + }, + LevelOfDetailSwitch { + camera: camera + thresholds: [20, 35, 50, 65] + thresholdType: LevelOfDetail.DistanceToCamera + } + ] + + SphereEntity { + enabled: false + } + CylinderEntity { + enabled: false + } + ConeEntity { + enabled: false + } + CuboidEntity { + enabled: false + } + } + } + QQ2.SequentialAnimation { QQ2.Vector3dAnimation { target: transform -- cgit v1.2.3