diff options
author | Mike Krus <mike.krus@kdab.com> | 2017-01-12 22:11:16 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-01-23 21:45:27 +0000 |
commit | 9c17af71e63873dfa7af3fcc7c1303a302f2608a (patch) | |
tree | d2b003ee83e3d85f688e93b3a86b6a6b84971ddd /tests/manual/lod | |
parent | 45b5514ee1f816b24461f7523b779f65c6c93ea5 (diff) |
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 <sean.harmer@kdab.com>
Diffstat (limited to 'tests/manual/lod')
-rw-r--r-- | tests/manual/lod/main.qml | 39 |
1 files changed, 37 insertions, 2 deletions
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 |