diff options
-rw-r--r-- | examples/qt3d/lights/SimpleForwardRenderer.qml | 77 | ||||
-rw-r--r-- | examples/qt3d/lights/lights.qrc | 1 | ||||
-rw-r--r-- | examples/qt3d/lights/main.qml | 2 |
3 files changed, 79 insertions, 1 deletions
diff --git a/examples/qt3d/lights/SimpleForwardRenderer.qml b/examples/qt3d/lights/SimpleForwardRenderer.qml new file mode 100644 index 000000000..b7ad3188c --- /dev/null +++ b/examples/qt3d/lights/SimpleForwardRenderer.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt3D.Core 2.0 +import Qt3D.Render 2.0 + +TechniqueFilter { + // Expose camera to allow user to choose which camera to use for rendering + property alias camera: cameraSelector.camera + property alias clearColor: clearBuffer.clearColor + property alias viewportRect: viewport.normalizedRect + property alias window: surfaceSelector.surface + property alias externalRenderTargetSize: surfaceSelector.externalRenderTargetSize + property alias frustumCulling: frustumCulling.enabled + + // Select the forward rendering Technique of any used Effect + matchAll: [ FilterKey { name: "renderingStyle"; value: "forward" } ] + + RenderSurfaceSelector { + id: surfaceSelector + + // Use the whole viewport + Viewport { + id: viewport + normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0) + + // Use the specified camera + CameraSelector { + id : cameraSelector + FrustumCulling { + id: frustumCulling + ClearBuffers { + id: clearBuffer + clearColor: "white" + buffers : ClearBuffers.ColorDepthBuffer + } + } + } + } + } +} diff --git a/examples/qt3d/lights/lights.qrc b/examples/qt3d/lights/lights.qrc index caa3f2d28..278abe5ae 100644 --- a/examples/qt3d/lights/lights.qrc +++ b/examples/qt3d/lights/lights.qrc @@ -2,5 +2,6 @@ <qresource prefix="/"> <file>main.qml</file> <file>PlaneEntity.qml</file> + <file>SimpleForwardRenderer.qml</file> </qresource> </RCC> diff --git a/examples/qt3d/lights/main.qml b/examples/qt3d/lights/main.qml index 69250da13..c676335c4 100644 --- a/examples/qt3d/lights/main.qml +++ b/examples/qt3d/lights/main.qml @@ -58,7 +58,7 @@ Entity { components: [ RenderSettings { - activeFrameGraph: ForwardRenderer { + activeFrameGraph: SimpleForwardRenderer { clearColor: Qt.rgba(0, 0, 0, 1) camera: camera } |