Commit Graph

12 Commits

Author SHA1 Message Date
Soheil Armin d4752094b4 Dice: Fix cameraController stealing drawer flickable gestures
The OrbitCameraController inside the Scene, steals gestures from
the Flickable inside the drawer.

This change disables the camera controller when drawer is shown.

Pick-to: 6.8 6.9 6.9.0
Change-Id: I557f1196db0da2d1b30ddbfbe804585de2519f1a
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2025-03-20 18:51:53 +02:00
Soheil Armin fc4f30767e Dice: Improve DiceSpawner and its property bindings
This change replaces the imperative logic of DiceSpawner
with a more declarative approach using Repeater3D.

It also replaces sending properties via functions, with
property binding and property aliases.

Pick-to: 6.8 6.9 6.9.0
Change-Id: Ic5c166fb50b0ede393cc72411f1a4a7e08a6ccd7
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2025-03-20 18:51:37 +02:00
Soheil Armin ec48a83d72 Dice: Replace the DirectionalLight with a PointLight
DirectionalLight shows performance issues on some targets.
We can achieve a similar visual result with a PointLight.

Pick-to: 6.8 6.9 6.9.0
Change-Id: I39708d2179782f8643ede39e970f47337cae507f
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2025-03-20 18:51:34 +02:00
Jonas Karlsson 0365c031cf Dice app: Disable camera panning
There is no point in being able to make the camera not focused on the
table since there is nothing else to see in the example.

Change-Id: I6fc0df5619080165ea147ce870065b2cae12e371
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-12-05 10:49:36 +00:00
Jonas Karlsson 779fea7875 Dice example: tweak shadowBias
There was a bug previously causing the shadowBias to be 2x its specified
value, so update the value to account for this fix.

Change-Id: I980993eb3a798755ede736d6b20537ed4f23186c
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-10-01 14:15:13 +02:00
Assam Boudjelthia 7668e5a746 Android: optimize dice app for mobile orientation
Now, the camera position is set too close so that not the whole view
is shown on portrait mode. So set the camera position close or far based
on the orientation.

Increase the default size of the dice so it's more visible and not tiny.

Don't move/shift the whole scene when the drawer is opened, this just
causes huge drop in fps on Android devices, instead the drawer opens
without affecting the scene's postion or dimentions.

Pick-to: 6.8
Task-number: QTBUG-127813
Change-Id: I3c7c54e4a1dbb3378045d86debaa21c8e50e8e94
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-09-26 15:39:24 +03:00
Jonas Karlsson 8b4248d687 Dice example: adapt to Qt 6.8 shadow mapping
The dice shadows are now only enabled when they are close enough to the
table. This will keep shadow map bounds smaller and reduce graphical
artifacts.

Pick-to: 6.8
Change-Id: I4664e4d6d825f0dd01ebb65e1180cb28155cb890
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-08-22 09:11:29 +02:00
Sami Shalayel c4d3c1690a dice demo: use qt_add_qml_module
Use qt_add_qml_module for the dice demo.

Make the demo qmllint clean by removing unused imports, unqualified
accesses and more.

Use loadFromModule instead of load, and rename main.qml to Main.qml to
be loadable. Also add a missing qmldir file for the qmake project to
work with loadFromModule, and fix the prefixes in the .pro file.

Pick-to: 6.8
Task-number: QTBUG-100100
Change-Id: I786dcb971980f48e91b0aeaf9d65f285a78c260e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-07-09 08:57:19 +02:00
Tuukka Turunen 84a7477e2a Add possibility to adjust dice size with a slider
New slider UI controls added to adjust dice size.

Pick-to: 6.7 6.6
Change-Id: Ie01efacff8eae0a33644f943bfd50d2cd258a7b1
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-01-12 11:04:10 +01:00
Nicholas Bennett 62b33327c0 Dice Demo: Add sound effects and shake to roll
Added the features in line with the spike outcome.
In addition, I modified the spawnDice function to
estimate if all dice are at rest before enabling spawning.
This prevents duplicate shake events and double tap
fumbles.

Task-number: QTBUG-116491
Pick-to: 6.6
Change-Id: Ia0dc59e469e008da5fc3afe2a7342381eadc1008
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-09-02 03:40:04 +00:00
Kai Köhne 67d2885605 Reformat .qml files in dice example
Use qmlformat -i on all files.

Pick-to: 6.5 6.6
Change-Id: I163d1faf281fc085b824e092056cebe57fce5a6b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-22 17:27:34 +02:00
Jonas Karlsson 34ecd60038 Add the 'dice' example
Fixes: QTBUG-113600
Pick-to: 6.5 6.5.2 6.6
Change-Id: I13b8327f2dcf3e7eaec80c7c10038b22a1656df3
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-06-21 00:50:04 +02:00