diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qt3d/controls/Logo.qml | 14 | ||||
-rw-r--r-- | examples/qt3d/controls/main.qml | 9 | ||||
-rw-r--r-- | examples/qt3d/wave/shaders/ribbon.vert | 2 |
3 files changed, 22 insertions, 3 deletions
diff --git a/examples/qt3d/controls/Logo.qml b/examples/qt3d/controls/Logo.qml index a686e29bd..2eb9abd1a 100644 --- a/examples/qt3d/controls/Logo.qml +++ b/examples/qt3d/controls/Logo.qml @@ -56,6 +56,18 @@ import Qt3D.Extras 2.0 Entity { id: sceneRoot + readonly property double cameraZ: camera.position.z + + function viewAll() { + camera.viewAll() + } + function viewLogo() { + camera.viewEntity(logoEntity) + } + function setPositionZ(z) { + camera.position = Qt.vector3d( 0.0, 0.0, z ) + } + Camera { id: camera projectionType: CameraLens.PerspectiveProjection @@ -63,7 +75,7 @@ Entity { aspectRatio: 4/3 nearPlane : 0.1 farPlane : 1000.0 - position: Qt.vector3d( 0.0, 0.0, viewCenter_z.value ) + position: Qt.vector3d( 0.0, 0.0, 7.5 ) upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) } diff --git a/examples/qt3d/controls/main.qml b/examples/qt3d/controls/main.qml index 2b438ac20..5d1f9c02c 100644 --- a/examples/qt3d/controls/main.qml +++ b/examples/qt3d/controls/main.qml @@ -178,13 +178,20 @@ Item { spacing: 5 Text { text: "Camera"; font.bold: true } - Text { text: "View Center Z" } + Text { text: "View Ctr Z: " + watch.cameraZ.toFixed(2) } Slider { id: viewCenter_z Layout.fillWidth: true minimumValue: 4 maximumValue: 12 value: 7.5 + onValueChanged: watch.setPositionZ(value) + } + Button { + id: viewAll + Layout.fillWidth: true + text: "View All" + onClicked: watch.viewLogo() } } diff --git a/examples/qt3d/wave/shaders/ribbon.vert b/examples/qt3d/wave/shaders/ribbon.vert index e099d53c8..2ff9d2729 100644 --- a/examples/qt3d/wave/shaders/ribbon.vert +++ b/examples/qt3d/wave/shaders/ribbon.vert @@ -111,7 +111,7 @@ float snoise(vec3 v) float height( const in vec3 pos ) { // Perturb the y position by a wave function in (x, t) - const float twoPi = 2.0 * 3.14159; + const float twoPi = 2.0 * 3.14159265358979323846; float k = twoPi / lambda; float omega = twoPi / period; |