1 | // Copyright (C) 2023 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause |
3 | |
4 | #include "qssgrendercontextcore_p.h" |
5 | #include "qssgrenderhelpers_p.h" |
6 | |
7 | #include <QtQuick3DRuntimeRender/private/qssgrenderer_p.h> |
8 | #include <QtQuick3DRuntimeRender/private/qssglayerrenderdata_p.h> |
9 | |
10 | #include <QtQuick3DUtils/private/qssgassert_p.h> |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | void QSSGRenderHelpers::rhiPrepareRenderable(QSSGRhiContext &rhiCtx, |
15 | QSSGPassKey passKey, |
16 | const QSSGFrameData &frameData, |
17 | QSSGRenderableObject &inObject, |
18 | QRhiRenderPassDescriptor *renderPassDescriptor, |
19 | QSSGRhiGraphicsPipelineState *ps, |
20 | int samples) |
21 | { |
22 | auto *layerData = frameData.getCurrent(); |
23 | QSSG_ASSERT(layerData, return); |
24 | RenderHelpers::rhiPrepareRenderable(rhiCtx: &rhiCtx, |
25 | passKey, |
26 | inData: *layerData, |
27 | inObject, |
28 | renderPassDescriptor, |
29 | ps, |
30 | featureSet: layerData->getShaderFeatures(), |
31 | samples); |
32 | } |
33 | |
34 | void QSSGRenderHelpers::rhiRenderRenderable(QSSGRhiContext &rhiCtx, |
35 | const QSSGRhiGraphicsPipelineState &state, |
36 | QSSGRenderableObject &object, |
37 | bool *needsSetViewport) |
38 | { |
39 | RenderHelpers::rhiRenderRenderable(rhiCtx: &rhiCtx, state, object, needsSetViewport); |
40 | } |
41 | |
42 | QSSGRenderHelpers::QSSGRenderHelpers() |
43 | { |
44 | |
45 | } |
46 | |
47 | void QSSGModelHelpers::ensureMeshes(const QSSGRenderContextInterface &contextInterface, |
48 | QSSGRenderableNodes &renderableModels) |
49 | { |
50 | QSSGLayerRenderData::prepareModelMeshesForRenderInternal(contextInterface, renderableModels, globalPickingEnabled: false); |
51 | } |
52 | |
53 | bool QSSGModelHelpers::createRenderables(QSSGRenderContextInterface &contextInterface, |
54 | const QSSGRenderableNodes &renderableModels, |
55 | const QSSGRenderCamera &camera, |
56 | RenderableFilter filter, |
57 | float lodThreshold) |
58 | { |
59 | auto layer = QSSGLayerRenderData::getCurrent(renderer: *contextInterface.renderer()); |
60 | auto &flags = layer->layerPrepResult->flags; // TODO: Maybe not an optional? also, is there any point returing wasDirty here? |
61 | const auto &cameraData = layer->getCameraRenderData(camera: &camera); |
62 | return layer->prepareModelsForRender(renderableModels, ioFlags&: flags, cameraData, filter, lodThreshold); |
63 | } |
64 | |
65 | QT_END_NAMESPACE |
66 | |