GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
Renderer3D.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Ivar Härnqvist
2// SPDX-License-Identifier: MIT
3
4#ifndef GREM_GRAPHICS_3D_RENDERER_3D_HPP
5#define GREM_GRAPHICS_3D_RENDERER_3D_HPP
6
8
26#include <GREM/core/extents.hpp>
29#include <GREM/core/math.hpp>
51
52#include <new> // std::bad_alloc
53#include <utility> // std::move
54
55namespace grem::graphics {
56
57class Device; // Forward declaration, to avoid including Device.hpp.
58class Bootstrapper; // Forward declaration.
59
69 uint32_t tileSize = 64;
70
77 uint32_t depthBinCount = 1024;
78
87
96
101
106
114 [[nodiscard]] constexpr bool operator==(const Renderer3DOptions& other) const noexcept = default;
115};
116
121public:
125
129
135
137 using PBRParameterBuffer = UniformBuffer<PBRParameters, "Renderer3DPBRParameters">;
138
171
173 using ScreenDecalBuffer = StorageBuffer<ScreenDecalFields, "Renderer3DScreenDecals">;
174
192
194 using ScreenLightBuffer = StorageBuffer<ScreenLightFields, "Renderer3DScreenLights">;
195
201 static constexpr size_t MAX_TILE_COUNT = 1024;
202 static_assert((MAX_TILE_COUNT * 2) % 4 == 0);
203
215 };
216 static_assert(sizeof(ScreenTileParameters) <= 16384);
217
219 using ScreenTileBuffer = UniformBuffer<ScreenTileParameters, "Renderer3DScreenTiles">;
220
237 static_assert(sizeof(ScreenDepthBinParameters) <= 16384);
238
240 using ScreenDepthBinBuffer = UniformBuffer<ScreenDepthBinParameters, "Renderer3DScreenDepthBins">;
241
245 uint32_t itemIndex;
246 };
247
249 using ScreenItemBuffer = StorageBuffer<ScreenItemFields, "Renderer3DScreenItems">;
250
280
282 using ScreenParameterBuffer = UniformBuffer<ScreenParameters, "Renderer3DScreenParameters">;
283
287
290
293
296
299
303
307
310
314
318
321
324
328
331
334
350 GREM_API(graphics_3d) Renderer3D(Device& device, Renderer2D& renderer2D, const Renderer3DOptions& options = {});
351
353 GREM_API(graphics_3d) ~Renderer3D();
354
356 Renderer3D(const Renderer3D&) = delete;
357
360
362 Renderer3D& operator=(const Renderer3D&) = delete;
363
366
387 template <typename... ExtraBuffers>
388 void drawUnlitFrame(RenderPass& renderPass, StridedSpan<const Instances3DView> instanceBatches, const Camera3D& camera, const ExtraBuffers&... extraBuffers) {
389 Array<Pair<BufferLayoutReference, SharedPointer<void>>, sizeof...(ExtraBuffers)> extraBufferHandles{
390 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
391 };
392 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles, {});
393 }
394
416 template <typename... ExtraBuffers>
417 void drawUnlitUnorderedFrame(RenderPass& renderPass, StridedSpan<const Instances3DView> instanceBatches, const Camera3D& camera, const ExtraBuffers&... extraBuffers) {
418 Array<Pair<BufferLayoutReference, SharedPointer<void>>, sizeof...(ExtraBuffers)> extraBufferHandles{
419 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
420 };
421 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles, {.unordered = true});
422 }
423
445 template <typename... ExtraBuffers>
446 void drawUnlitFrameWithSky(RenderPass& renderPass, StridedSpan<const Instances3DView> instanceBatches, const Camera3D& camera, Sky3DView sky,
447 const ExtraBuffers&... extraBuffers) {
448 GREM_ASSERT(sky.sky);
449 sky.sky->flush(*this);
450 Array<Pair<BufferLayoutReference, SharedPointer<void>>, 1 + sizeof...(ExtraBuffers)> extraBufferHandles{
452 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
453 };
454 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles,
455 {
456 .skyShaderPipelineOverrideHandle = std::move(sky.shaderPipelineOverrideHandle),
457 .drawSky = true,
458 });
459 }
460
483 template <typename... ExtraBuffers>
485 const ExtraBuffers&... extraBuffers) {
486 GREM_ASSERT(sky.sky);
487 sky.sky->flush(*this);
488 Array<Pair<BufferLayoutReference, SharedPointer<void>>, 1 + sizeof...(ExtraBuffers)> extraBufferHandles{
490 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
491 };
492 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles,
493 {
494 .skyShaderPipelineOverrideHandle = std::move(sky.shaderPipelineOverrideHandle),
495 .unordered = true,
496 .drawSky = true,
497 });
498 }
499
522 template <typename... ExtraBuffers>
523 void drawHDRUnlitFrameWithSky(RenderPass& renderPass, StridedSpan<const Instances3DView> instanceBatches, const Camera3D& camera, Sky3DView sky,
524 const ExtraBuffers&... extraBuffers) {
525 GREM_ASSERT(sky.sky);
526 sky.sky->flush(*this);
527 Array<Pair<BufferLayoutReference, SharedPointer<void>>, 1 + sizeof...(ExtraBuffers)> extraBufferHandles{
529 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
530 };
531 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles,
532 {
533 .skyShaderPipelineOverrideHandle = std::move(sky.shaderPipelineOverrideHandle),
534 .hdr = true,
535 .drawSky = true,
536 });
537 }
538
562 template <typename... ExtraBuffers>
564 const ExtraBuffers&... extraBuffers) {
565 GREM_ASSERT(sky.sky);
566 sky.sky->flush(*this);
567 Array<Pair<BufferLayoutReference, SharedPointer<void>>, 1 + sizeof...(ExtraBuffers)> extraBufferHandles{
569 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
570 };
571 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles,
572 {
573 .skyShaderPipelineOverrideHandle = std::move(sky.shaderPipelineOverrideHandle),
574 .hdr = true,
575 .unordered = true,
576 .drawSky = true,
577 });
578 }
579
604 template <typename... ExtraBuffers>
605 void drawPBRFrame(RenderPass& renderPass, StridedSpan<const Instances3DView> instanceBatches, const Camera3D& camera, const Fog3D& fog, Sky3DView sky, const Decals3D& decals,
606 const Lights3D& lights, const LightProbeVolumes3D& lightProbeVolumes, const ReflectionProbes3D& reflectionProbes, const ExtraBuffers&... extraBuffers) {
607 GREM_ASSERT(sky.sky);
608 flushPBRBuffers(renderPass.getFramebufferSize(), renderPass.getViewport(), camera, fog, *sky.sky, decals, lights, lightProbeVolumes, reflectionProbes);
609 Array<Pair<BufferLayoutReference, SharedPointer<void>>, 2 + sizeof...(ExtraBuffers)> extraBufferHandles{
612 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
613 };
614 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles,
615 {
616 .skyShaderPipelineOverrideHandle = std::move(sky.shaderPipelineOverrideHandle),
617 .pbr = true,
618 .drawSky = !sky.filter.skipSkyRendering,
619 });
620 environmentBuffers.setBuffers(nullptr);
621 }
622
648 template <typename... ExtraBuffers>
649 void drawPBRUnorderedFrame(RenderPass& renderPass, StridedSpan<const Instances3DView> instanceBatches, const Camera3D& camera, const Fog3D& fog, Sky3DView sky,
650 const Decals3D& decals, const Lights3D& lights, const LightProbeVolumes3D& lightProbeVolumes, const ReflectionProbes3D& reflectionProbes,
651 const ExtraBuffers&... extraBuffers) {
652 GREM_ASSERT(sky.sky);
653 flushPBRBuffers(renderPass.getFramebufferSize(), renderPass.getViewport(), camera, fog, *sky.sky, decals, lights, lightProbeVolumes, reflectionProbes);
654 Array<Pair<BufferLayoutReference, SharedPointer<void>>, 2 + sizeof...(ExtraBuffers)> extraBufferHandles{
657 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
658 };
659 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles,
660 {
661 .skyShaderPipelineOverrideHandle = std::move(sky.shaderPipelineOverrideHandle),
662 .pbr = true,
663 .unordered = true,
664 .drawSky = !sky.filter.skipSkyRendering,
665 });
666 environmentBuffers.setBuffers(nullptr);
667 }
668
693 template <typename... ExtraBuffers>
694 void drawHDRPBRFrame(RenderPass& renderPass, StridedSpan<const Instances3DView> instanceBatches, const Camera3D& camera, const Fog3D& fog, Sky3DView sky,
695 const Decals3D& decals, const Lights3D& lights, const LightProbeVolumes3D& lightProbeVolumes, const ReflectionProbes3D& reflectionProbes,
696 const ExtraBuffers&... extraBuffers) {
697 GREM_ASSERT(sky.sky);
698 flushPBRBuffers(renderPass.getFramebufferSize(), renderPass.getViewport(), camera, fog, *sky.sky, decals, lights, lightProbeVolumes, reflectionProbes);
699 Array<Pair<BufferLayoutReference, SharedPointer<void>>, 2 + sizeof...(ExtraBuffers)> extraBufferHandles{
702 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
703 };
704 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles,
705 {
706 .skyShaderPipelineOverrideHandle = std::move(sky.shaderPipelineOverrideHandle),
707 .hdr = true,
708 .pbr = true,
709 .drawSky = !sky.filter.skipSkyRendering,
710 });
711 environmentBuffers.setBuffers(nullptr);
712 }
713
739 template <typename... ExtraBuffers>
740 void drawHDRPBRUnorderedFrame(RenderPass& renderPass, StridedSpan<const Instances3DView> instanceBatches, const Camera3D& camera, const Fog3D& fog, Sky3DView sky,
741 const Decals3D& decals, const Lights3D& lights, const LightProbeVolumes3D& lightProbeVolumes, const ReflectionProbes3D& reflectionProbes,
742 const ExtraBuffers&... extraBuffers) {
743 GREM_ASSERT(sky.sky);
744 flushPBRBuffers(renderPass.getFramebufferSize(), renderPass.getViewport(), camera, fog, *sky.sky, decals, lights, lightProbeVolumes, reflectionProbes);
745 Array<Pair<BufferLayoutReference, SharedPointer<void>>, 2 + sizeof...(ExtraBuffers)> extraBufferHandles{
748 Pair<BufferLayoutReference, SharedPointer<void>>{ExtraBuffers::LAYOUT_REFERENCE, extraBuffers.lock()}...,
749 };
750 drawFrameImplementation(renderPass, instanceBatches, camera, extraBufferHandles,
751 {
752 .skyShaderPipelineOverrideHandle = std::move(sky.shaderPipelineOverrideHandle),
753 .hdr = true,
754 .pbr = true,
755 .unordered = true,
756 .drawSky = !sky.filter.skipSkyRendering,
757 });
758 environmentBuffers.setBuffers(nullptr);
759 }
760
762 [[nodiscard]] const Texture& getInvisibleTexture2D() {
763 return renderer2D.getInvisibleTexture2D();
764 }
765
767 [[nodiscard]] const Texture& getInvisibleTexture2DArray() {
768 return renderer2D.getInvisibleTexture2DArray();
769 }
770
772 [[nodiscard]] const Texture& getInvisibleTextureCube() {
773 return renderer2D.getInvisibleTextureCube();
774 }
775
777 [[nodiscard]] const Texture& getInvisibleTextureCubeArray() {
778 return renderer2D.getInvisibleTextureCubeArray();
779 }
780
782 [[nodiscard]] const Texture& getWhiteTexture2D() {
783 return renderer2D.getWhiteTexture2D();
784 }
785
787 [[nodiscard]] const Texture& getWhiteTextureCube() {
788 return renderer2D.getWhiteTextureCube();
789 }
790
792 [[nodiscard]] const Texture& getFlatNormalTexture2D() {
793 return renderer2D.getFlatNormalTexture2D();
794 }
795
797 [[nodiscard]] const Texture& getDefaultDepthTexture2D() {
798 return renderer2D.getDefaultDepthTexture2D();
799 }
800
802 [[nodiscard]] const Texture& getDefaultDepthTexture2DArray() {
803 return renderer2D.getDefaultDepthTexture2DArray();
804 }
805
807 [[nodiscard]] const Texture& getDefaultDepthTextureCube() {
808 return renderer2D.getDefaultDepthTextureCube();
809 }
810
813 return renderer2D.getDefaultDepthTextureCubeArray();
814 }
815
818 return renderer2D.getDefaultModel2DVertexShader();
819 }
820
823 return renderer2D.getPlainModel2DFragmentShader();
824 }
825
828 return renderer2D.getPlainModel2DShaderPipeline();
829 }
830
833 return renderer2D.getTextModel2DFragmentShader();
834 }
835
838 return renderer2D.getTextModel2DShaderPipeline();
839 }
840
843 return renderer2D.getTonemappingModel2DFragmentShader();
844 }
845
848 return renderer2D.getTonemappingModel2DShaderPipeline();
849 }
850
852 [[nodiscard]] const Model2D& getUnitSquareModel2D() const noexcept {
853 return renderer2D.getUnitSquareModel2D();
854 }
855
857 [[nodiscard]] const Model2D& getUnitRightAngledTriangleModel2D() const noexcept {
858 return renderer2D.getUnitRightAngledTriangleModel2D();
859 }
860
867 return model3DDataBuffers;
868 }
869
887 if (inverseBindPoseMatrices.empty()) {
888 return {};
889 }
890 const Optional<RangeAllocation<uint32_t>> allocation = model3DInverseBindPoseMatrixRangeAllocator.allocateRange(static_cast<uint32_t>(inverseBindPoseMatrices.size()));
891 if (!allocation) {
892 throw std::bad_alloc{};
893 }
894 model3DDataBuffers.write<Model3D::InverseBindPoseMatrixBuffer>(allocation->begin, inverseBindPoseMatrices);
895 [[maybe_unused]] const auto [it, inserted] = model3DInverseBindPoseMatrixRangeReferenceCounts.emplace(allocation->begin, size_t{1});
896 GREM_ASSERT(inserted);
897 return *allocation;
898 }
899
915 const auto it = model3DInverseBindPoseMatrixRangeReferenceCounts.find(allocation.begin);
916 GREM_ASSERT(it != model3DInverseBindPoseMatrixRangeReferenceCounts.end());
917 ++it->second;
918 }
919
931 if (allocation.begin == allocation.end) {
932 return;
933 }
934 const auto it = model3DInverseBindPoseMatrixRangeReferenceCounts.find(allocation.begin);
935 GREM_ASSERT(it != model3DInverseBindPoseMatrixRangeReferenceCounts.end());
936 if (it->second-- == 1) {
937 model3DInverseBindPoseMatrixRangeAllocator.deallocateRange(allocation);
938 model3DInverseBindPoseMatrixRangeReferenceCounts.erase(it);
939 }
940 }
941
959 if (morphTargetValues.empty()) {
960 return {};
961 }
962 const Optional<RangeAllocation<uint32_t>> allocation = model3DMorphTargetValueRangeAllocator.allocateRange(static_cast<uint32_t>(morphTargetValues.size()));
963 if (!allocation) {
964 throw std::bad_alloc{};
965 }
966 model3DDataBuffers.write<Model3D::MorphTargetValueBuffer>(allocation->begin, morphTargetValues);
967 [[maybe_unused]] const auto [it, inserted] = model3DMorphTargetValueRangeReferenceCounts.emplace(allocation->begin, size_t{1});
968 GREM_ASSERT(inserted);
969 return *allocation;
970 }
971
987 const auto it = model3DMorphTargetValueRangeReferenceCounts.find(allocation.begin);
988 GREM_ASSERT(it != model3DMorphTargetValueRangeReferenceCounts.end());
989 ++it->second;
990 }
991
1003 if (allocation.begin == allocation.end) {
1004 return;
1005 }
1006 const auto it = model3DMorphTargetValueRangeReferenceCounts.find(allocation.begin);
1007 GREM_ASSERT(it != model3DMorphTargetValueRangeReferenceCounts.end());
1008 if (it->second-- == 1) {
1009 model3DMorphTargetValueRangeAllocator.deallocateRange(allocation);
1010 model3DMorphTargetValueRangeReferenceCounts.erase(it);
1011 }
1012 }
1013
1027
1041
1055 if (!plain3DTransformedModel2DShaderPipeline) {
1056 [[unlikely]];
1057 plain3DTransformedModel2DShaderPipeline.emplace(device, getDefault3DTransformedModel2DVertexShader(), Model2D::DEFAULT_VERTEX_SHADER_CONSTANTS,
1060 .primitiveType = PrimitiveType::TRIANGLE_STRIP,
1061 .faceCullingMode = FaceCullingMode::NONE,
1063 });
1064 }
1065 return *plain3DTransformedModel2DShaderPipeline;
1066 }
1067
1080
1093 if (!plain3DTransformedTextShaderPipeline) {
1094 [[unlikely]];
1095 plain3DTransformedTextShaderPipeline.emplace(device, getDefault3DTransformedModel2DVertexShader(), Model2D::DEFAULT_VERTEX_SHADER_CONSTANTS,
1098 .primitiveType = PrimitiveType::TRIANGLE_STRIP,
1099 .faceCullingMode = FaceCullingMode::NONE,
1101 });
1102 }
1103 return *plain3DTransformedTextShaderPipeline;
1104 }
1105
1117 [[nodiscard]] GREM_API(graphics_3d) const DefaultModel3DVertexShader& getDefaultModel3DVertexShader();
1118
1131 [[nodiscard]] GREM_API(graphics_3d) const UnlitModel3DFragmentShader& getUnlitModel3DFragmentShader();
1132
1146 if (!unlitModel3DShaderPipelineSet) {
1147 [[unlikely]];
1150 }
1151 return *unlitModel3DShaderPipelineSet;
1152 }
1153
1169 if (!hdrUnlitModel3DShaderPipelineSet) {
1170 [[unlikely]];
1171 hdrUnlitModel3DShaderPipelineSet.emplace(
1173 [](const Model3D::ShaderConfiguration& shaderConfiguration) -> Model3D::FragmentShaderConstants {
1175 result.FRAGMENT_HDR = true;
1176 return result;
1177 },
1179 }
1180 return *hdrUnlitModel3DShaderPipelineSet;
1181 }
1182
1197 if (!wireframeModel3DShaderPipelineSet) {
1198 [[unlikely]];
1204 return result;
1205 });
1206 }
1207 return *wireframeModel3DShaderPipelineSet;
1208 }
1209
1226 if (!hdrWireframeModel3DShaderPipelineSet) {
1227 [[unlikely]];
1228 hdrWireframeModel3DShaderPipelineSet.emplace(
1230 [](const Model3D::ShaderConfiguration& shaderConfiguration) -> Model3D::FragmentShaderConstants {
1232 result.FRAGMENT_HDR = true;
1233 return result;
1234 },
1235 [&](const Model3D::ShaderConfiguration& shaderConfiguration) -> ShaderPipelineOptions {
1239 return result;
1240 });
1241 }
1242 return *hdrWireframeModel3DShaderPipelineSet;
1243 }
1244
1258 [[nodiscard]] GREM_API(graphics_3d) const PBRModel3DFragmentShader& getPBRModel3DFragmentShader();
1259
1269 [[nodiscard]] PBRModel3DShaderPipelineSet::FragmentShaderSelector getPBRModel3DFragmentShaderSelector() {
1270 return [this](const Model3D::ShaderConfiguration& shaderConfiguration) -> SharedPointer<FragmentShaderImplementation> {
1271 switch (shaderConfiguration.materialType) {
1274 }
1275 return getPBRModel3DFragmentShader().lock();
1276 };
1277 }
1278
1293 if (!pbrModel3DShaderPipelineSet) {
1294 [[unlikely]];
1297 }
1298 return *pbrModel3DShaderPipelineSet;
1299 }
1300
1317 if (!hdrPBRModel3DShaderPipelineSet) {
1318 [[unlikely]];
1319 hdrPBRModel3DShaderPipelineSet.emplace(
1321 [](const Model3D::ShaderConfiguration& shaderConfiguration) -> Model3D::FragmentShaderConstants {
1323 result.FRAGMENT_HDR = true;
1324 return result;
1325 },
1327 }
1328 return *hdrPBRModel3DShaderPipelineSet;
1329 }
1330
1344
1362
1374 [[nodiscard]] GREM_API(graphics_3d) const DefaultSky3DVertexShader& getDefaultSky3DVertexShader();
1375
1387 [[nodiscard]] GREM_API(graphics_3d) const UnlitSky3DFragmentShader& getUnlitSky3DFragmentShader();
1388
1401 if (!unlitSky3DShaderPipeline) {
1402 [[unlikely]];
1405 }
1406 return *unlitSky3DShaderPipeline;
1407 }
1408
1421 if (!hdrUnlitSky3DShaderPipeline) {
1422 [[unlikely]];
1425 }
1426 return *hdrUnlitSky3DShaderPipeline;
1427 }
1428
1440 [[nodiscard]] GREM_API(graphics_3d) const PBRSky3DFragmentShader& getPBRSky3DFragmentShader();
1441
1454 if (!pbrSky3DShaderPipeline) {
1455 [[unlikely]];
1458 }
1459 return *pbrSky3DShaderPipeline;
1460 }
1461
1474 if (!hdrPBRSky3DShaderPipeline) {
1475 [[unlikely]];
1478 }
1479 return *hdrPBRSky3DShaderPipeline;
1480 }
1481
1487 [[nodiscard]] const Model3D& getCubeModel3D() const noexcept {
1488 return cubeModel3D;
1489 }
1490
1496 [[nodiscard]] const Cubemap3D& getCubemap3D() const noexcept {
1497 return cubemap3D;
1498 }
1499
1514 if (!specularSplitSumBRDFIntegrationMap) {
1515 specularSplitSumBRDFIntegrationMap = generateSpecularSplitSumBRDFIntegrationMap(device, renderer2D, options.specularSplitSumBRDFIntegrationMapResolution,
1516 options.specularSplitSumBRDFIntegrationMapSampleCount);
1517 }
1518 return specularSplitSumBRDFIntegrationMap;
1519 }
1520
1546 GREM_API(graphics_3d)
1547 void renderShadowMap(Lights3D& lights, LightID lightID, const Box<3, float>& totalShadowCasterBoundingBox, const mat4& observerProjectionMatrix, const mat4& observerViewMatrix,
1548 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters);
1549
1573 void renderShadowMap(Lights3D& lights, LightID lightID, const Box<3, float>& totalShadowCasterBoundingBox, const Camera3D& observerCamera,
1574 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters) {
1575 renderShadowMap(lights, lightID, totalShadowCasterBoundingBox, observerCamera.getProjectionMatrix(), observerCamera.getViewMatrix(), drawShadowCasters);
1576 }
1577
1598 GREM_API(graphics_3d)
1599 void renderAllShadowMaps(Lights3D& lights, const Box<3, float>& totalShadowCasterBoundingBox, const mat4& observerProjectionMatrix, const mat4& observerViewMatrix,
1600 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters);
1601
1620 void renderAllShadowMaps(Lights3D& lights, const Box<3, float>& totalShadowCasterBoundingBox, const Camera3D& observerCamera,
1621 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters) {
1622 renderAllShadowMaps(lights, totalShadowCasterBoundingBox, observerCamera.getProjectionMatrix(), observerCamera.getViewMatrix(), drawShadowCasters);
1623 }
1624
1644 GREM_API(graphics_3d) void renderViewIndependentShadowMap(Lights3D& lights, LightID lightID, FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters);
1645
1661 GREM_API(graphics_3d) void renderAllViewIndependentShadowMaps(Lights3D& lights, FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters);
1662
1689 GREM_API(graphics_3d)
1690 void renderViewDependentShadowMap(Lights3D& lights, LightID lightID, const Box<3, float>& totalShadowCasterBoundingBox, const mat4& observerProjectionMatrix,
1691 const mat4& observerViewMatrix, FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters);
1692
1717 void renderViewDependentShadowMap(Lights3D& lights, LightID lightID, const Box<3, float>& totalShadowCasterBoundingBox, const Camera3D& observerCamera,
1718 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters) {
1719 renderViewDependentShadowMap(lights, lightID, totalShadowCasterBoundingBox, observerCamera.getProjectionMatrix(), observerCamera.getViewMatrix(), drawShadowCasters);
1720 }
1721
1742 GREM_API(graphics_3d)
1743 void renderAllViewDependentShadowMaps(Lights3D& lights, const Box<3, float>& totalShadowCasterBoundingBox, const mat4& observerProjectionMatrix, const mat4& observerViewMatrix,
1744 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters);
1745
1764 void renderAllViewDependentShadowMaps(Lights3D& lights, const Box<3, float>& totalShadowCasterBoundingBox, const Camera3D& observerCamera,
1765 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters) {
1766 renderAllViewDependentShadowMaps(lights, totalShadowCasterBoundingBox, observerCamera.getProjectionMatrix(), observerCamera.getViewMatrix(), drawShadowCasters);
1767 }
1768
1790 GREM_API(graphics_3d)
1791 void renderViewDependentShadowMapForFullZoomedOutView(Lights3D& lights, LightID lightID, const Box<3, float>& totalShadowCasterBoundingBox,
1792 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters);
1793
1811 GREM_API(graphics_3d)
1812 void renderAllViewDependentShadowMapsForFullZoomedOutView(Lights3D& lights, const Box<3, float>& totalShadowCasterBoundingBox,
1813 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters);
1814
1832 GREM_API(graphics_3d)
1833 void renderAllShadowMapsForFullZoomedOutView(Lights3D& lights, const Box<3, float>& totalShadowCasterBoundingBox,
1834 FunctionView<void(RenderPass&, const Camera3D&)> drawShadowCasters);
1835
1836private:
1837 friend Instances3D;
1838 friend Bootstrapper;
1839
1840 struct SpecularSplitSumBRDFIntegrationMapFragmentShaderConstants {
1841 uint32_t SPECULAR_SPLIT_SUM_BRDF_INTEGRATION_MAP_SAMPLE_COUNT;
1842 };
1843
1844 using SpecularSplitSumBRDFIntegrationMapFragmentShader =
1846
1847 struct FrameOptions {
1848 SharedPointer<ShaderPipelineImplementation> skyShaderPipelineOverrideHandle{};
1849 bool hdr = false;
1850 bool pbr = false;
1851 bool unordered = false;
1852 bool drawSky = false;
1853 };
1854
1855 struct TransparentDrawCommandReference {
1856 bool is3D;
1857 uint16_t instanceBatchIndex;
1858 uint32_t drawCommandIndex;
1859 };
1860
1861 GREM_API(graphics_3d) static const Array<vec3, 8> CUBE_MODEL_3D_VERTEX_POSITIONS;
1862 GREM_API(graphics_3d) static const Array<uint32_t, 36> CUBE_MODEL_3D_INDICES;
1863
1864 [[nodiscard]] GREM_API(graphics_3d) static Texture
1865 generateSpecularSplitSumBRDFIntegrationMap(Device& device, Renderer2D& renderer2D, uint32_t resolution, uint32_t sampleCount);
1866
1867 template <typename... Buffers>
1868 void setTemporaryCombinedBufferHandles(Span<const Pair<BufferLayoutReference, SharedPointer<void>>> extraBufferHandles, const Buffers&... buffers) {
1869 temporaryCombinedBufferHandles.clear();
1870 (temporaryCombinedBufferHandles.push_back(Pair<BufferLayoutReference, SharedPointer<void>>{Buffers::LAYOUT_REFERENCE, buffers.lock()}), ...);
1871 for (const Pair<BufferLayoutReference, SharedPointer<void>>& extraBufferHandle : extraBufferHandles) {
1872 temporaryCombinedBufferHandles.push_back(extraBufferHandle);
1873 }
1874 sortByAscending<&Pair<BufferLayoutReference, SharedPointer<void>>::first>(temporaryCombinedBufferHandles);
1875 }
1876
1877 GREM_API(graphics_3d)
1878 void drawFrameImplementation(RenderPass& renderPass, StridedSpan<const Instances3DView> instanceBatches, const Camera3D& camera,
1879 Span<const Pair<BufferLayoutReference, SharedPointer<void>>> extraBufferHandles, FrameOptions frameOptions);
1880
1881 GREM_API(graphics_3d)
1882 void flushPBRBuffers(Extent2D framebufferSize, const Viewport& viewport, const Camera3D& camera, const Fog3D& fog, const Sky3D& sky, const Decals3D& decals,
1883 const Lights3D& lights, const LightProbeVolumes3D& lightProbeVolumes, const ReflectionProbes3D& reflectionProbes);
1884
1885 Device& device;
1886 Renderer2D& renderer2D;
1887 Renderer3DOptions options;
1888 Model3D::DataBuffers model3DDataBuffers{device};
1889 RangeAllocator<uint32_t> model3DInverseBindPoseMatrixRangeAllocator{};
1890 HashMap<uint32_t, size_t> model3DInverseBindPoseMatrixRangeReferenceCounts{};
1891 RangeAllocator<uint32_t> model3DMorphTargetValueRangeAllocator{};
1892 HashMap<uint32_t, size_t> model3DMorphTargetValueRangeReferenceCounts{};
1893 Optional<Model2DTransformed3DVertexShader> default3DTransformedModel2DVertexShader{};
1894 Optional<Model2DTransformed3DFragmentShader> plain3DTransformedModel2DFragmentShader{};
1895 Optional<ShaderPipeline<Model2D::Mesh>> plain3DTransformedModel2DShaderPipeline{};
1896 Optional<Model2DTransformed3DFragmentShader> raw3DTransformedModel2DFragmentShader{};
1897 Optional<ShaderPipeline<Model2D::Mesh>> raw3DTransformedModel2DShaderPipeline{};
1898 Optional<Model2DTransformed3DFragmentShader> plain3DTransformedTextFragmentShader{};
1899 Optional<ShaderPipeline<Model2D::Mesh>> plain3DTransformedTextShaderPipeline{};
1900 Optional<Model2DTransformed3DFragmentShader> raw3DTransformedTextFragmentShader{};
1901 Optional<ShaderPipeline<Model2D::Mesh>> raw3DTransformedTextShaderPipeline{};
1902 Optional<DefaultModel3DVertexShader> defaultModel3DVertexShader{};
1903 Optional<UnlitModel3DFragmentShader> unlitModel3DFragmentShader{};
1904 Optional<UnlitModel3DShaderPipelineSet> unlitModel3DShaderPipelineSet{};
1905 Optional<UnlitModel3DShaderPipelineSet> hdrUnlitModel3DShaderPipelineSet{};
1906 Optional<UnlitModel3DShaderPipelineSet> wireframeModel3DShaderPipelineSet{};
1907 Optional<UnlitModel3DShaderPipelineSet> hdrWireframeModel3DShaderPipelineSet{};
1908 Optional<PBRModel3DFragmentShader> pbrModel3DFragmentShader{};
1909 Optional<PBRModel3DShaderPipelineSet> pbrModel3DShaderPipelineSet{};
1910 Optional<PBRModel3DShaderPipelineSet> hdrPBRModel3DShaderPipelineSet{};
1911 Optional<ShadowMapModel3DShaderPipelineSet> shadowMapModel3DShaderPipelineSet{};
1912 Optional<DistanceModel3DShaderPipelineSet> distanceModel3DShaderPipelineSet{};
1913 Optional<DefaultSky3DVertexShader> defaultSky3DVertexShader{};
1914 Optional<UnlitSky3DFragmentShader> unlitSky3DFragmentShader{};
1915 Optional<Sky3D::ShaderPipeline> unlitSky3DShaderPipeline{};
1916 Optional<Sky3D::ShaderPipeline> hdrUnlitSky3DShaderPipeline{};
1917 Optional<PBRSky3DFragmentShader> pbrSky3DFragmentShader{};
1918 Optional<Sky3D::ShaderPipeline> pbrSky3DShaderPipeline{};
1919 Optional<Sky3D::ShaderPipeline> hdrPBRSky3DShaderPipeline{};
1920 Model3D cubeModel3D{device, *this, resource::Model{CUBE_MODEL_3D_VERTEX_POSITIONS, CUBE_MODEL_3D_INDICES}};
1921 Cubemap3D cubemap3D{device};
1922 Texture specularSplitSumBRDFIntegrationMap{};
1923 Text2D temporaryText{};
1924 resource::Model::Transformation temporaryModelTransformation{};
1925 Camera3D shadowMapCamera3D{device};
1926 ArrayList<Pair<BufferLayoutReference, SharedPointer<void>>> temporaryCombinedBufferHandles{};
1927 Model2D::TextureBuffer textureBuffer2D{device};
1928 Model2D::Transformation3DBuffer transformation3DBuffer2D{device};
1929 DrawCommandBuffer<Model3D::Mesh> transparentDrawCommandBuffer3D{device};
1930 DrawCommandBuffer<Model2D::Mesh> transparentDrawCommandBuffer2D{device};
1931 Buffer<TransparentDrawCommandReference> combined2DAnd3DTransparentDrawCommands{};
1932 Optional<DrawCommandBuffer<Cubemap3D::Mesh>> skyDrawCommandBuffer{};
1933 PBRParameterBuffer pbrParameterBuffer{device};
1934 EnvironmentBuffers environmentBuffers{device, nullptr};
1935 ScreenBuffers screenBuffers{device};
1936 Arena<0> flushPBRBuffersArena{147456};
1937 bool pbrParameterBufferDirty = true;
1938};
1939
1940} // namespace grem::graphics
1941
1942#endif
#define GREM_ASSERT(expression)
Definition assertions.hpp:77
Definition FunctionView.hpp:29
Optional value type that holds either a value or no value.
Definition Optional.hpp:58
Definition SharedPointer.hpp:65
Definition Span.hpp:146
constexpr bool empty() const noexcept
Definition Span.hpp:257
constexpr size_type size() const noexcept
Definition Span.hpp:207
Definition StridedSpan.hpp:427
Collection of GPU memory buffers to be read by a shader.
Definition buffers.hpp:580
Combined view-projection matrix, defining a 3D perspective to render from.
Definition Camera3D.hpp:173
UniformBuffer< Parameters, "Camera3DParameters"> ParameterBuffer
Shader buffer for 3D camera parameters.
Definition Camera3D.hpp:191
Container for a cubemap mesh stored on the GPU.
Definition Cubemap3D.hpp:22
Set of decals in 3D space.
Definition Decals3D.hpp:255
UniformBuffer< Parameters, "Decals3DParameters"> ParameterBuffer
Shader buffer for decal parameters.
Definition Decals3D.hpp:264
Persistent system managing the rendering context of a Window.
Definition Device.hpp:68
Distance-based fog in 3D space.
Definition Fog3D.hpp:85
UniformBuffer< Parameters, "Fog3DParameters"> ParameterBuffer
Shader buffer for fog parameters.
Definition Fog3D.hpp:115
Compiled GPU fragment shader stage.
Definition shaders.hpp:1274
Set of light probe volumes in 3D space.
Definition LightProbeVolumes3D.hpp:89
UniformBuffer< AtlasParameters, "LightProbeVolumes3DAtlases"> AtlasBuffer
Shader buffer for light probe volume atlases.
Definition LightProbeVolumes3D.hpp:105
StorageBuffer< VolumeFields, "LightProbeVolumes3DVolumes"> VolumeBuffer
Shader buffer for light probe volumes.
Definition LightProbeVolumes3D.hpp:139
Set of direct light sources in 3D space.
Definition Lights3D.hpp:363
StorageBuffer< ShadowMatrixFields, "Lights3DShadowMatrices"> ShadowMatrixBuffer
Shader buffer for shadow matrices.
Definition Lights3D.hpp:390
UniformBuffer< Parameters, "Lights3DParameters"> ParameterBuffer
Shader buffer for light parameters.
Definition Lights3D.hpp:381
Container for a set of 2D triangle strip meshes stored on the GPU.
Definition Model2D.hpp:30
UniformBuffer< TextureParameters, "Model2DTexture"> TextureBuffer
Shader buffer for 2D model texture parameters.
Definition Model2D.hpp:97
graphics::Mesh< Vertex, NoIndex, NoParameters, Instance > Mesh
Type of a single mesh of a 2D model.
Definition Model2D.hpp:59
static constexpr FragmentShaderConstants DEFAULT_FRAGMENT_SHADER_CONSTANTS
Default 2D model fragment shader constants.
Definition Model2D.hpp:176
static constexpr VertexShaderConstants DEFAULT_VERTEX_SHADER_CONSTANTS
Default 2D model vertex shader constants.
Definition Model2D.hpp:171
graphics::FragmentShader< Mesh, Inputs, Constants, Outputs, Camera2D::ParameterBuffer, ExtraBuffers..., TextureBuffer > FragmentShaderBase
Fragment shader for drawing 2D models.
Definition Model2D.hpp:142
UniformBuffer< Transformation3DParameters, "Model2DTransformation3D"> Transformation3DBuffer
Shader buffer for 2D model 3D transformation parameters.
Definition Model2D.hpp:109
graphics::ShaderPipeline< Mesh > ShaderPipeline
Shader pipeline for drawing 2D models.
Definition Model2D.hpp:152
Shader pipeline set for drawing 3D models.
Definition Model3D.hpp:496
Container for a set of 3D triangle mesh nodes stored on the GPU.
Definition Model3D.hpp:67
@ UNLIT
The shader should use only the base color at full brightness.
Definition Model3D.hpp:75
@ METALLIC_ROUGHNESS
The shader should interpret the material according to the standard metallic-roughness model.
Definition Model3D.hpp:74
static constexpr auto DEFAULT_SHADER_PIPELINE_OPTIONS
Default 3D model graphics pipeline configuration.
Definition Model3D.hpp:668
ShaderPipelineSetBase< VertexShaderConstants, VertexShaderOutputs, meta::TypeList<>, FragmentShaderConstants, FragmentShaderOutputs, meta::TypeList<> > ShaderPipelineSet
Default shader pipeline set for drawing 3D models.
Definition Model3D.hpp:597
BufferSet< InverseBindPoseMatrixBuffer, MorphTargetValueBuffer > DataBuffers
Set of shader buffers related to the static data of 3D models.
Definition Model3D.hpp:325
StorageBuffer< InverseBindPoseMatrixFields, "Model3DInverseBindPoseMatrices"> InverseBindPoseMatrixBuffer
Shader buffer for 3D model inverse bind-pose matrices.
Definition Model3D.hpp:307
VertexShaderBase< VertexShaderConstants, VertexShaderOutputs > VertexShader
Default vertex shader for drawing 3D models.
Definition Model3D.hpp:373
static constexpr auto DEFAULT_FRAGMENT_SHADER_CONSTANTS
Default 3D model fragment shader constants.
Definition Model3D.hpp:646
FragmentShaderBase< VertexShaderOutputs, FragmentShaderConstants, FragmentShaderOutputs > FragmentShader
Default fragment shader type for drawing 3D models.
Definition Model3D.hpp:393
static constexpr auto DEFAULT_VERTEX_SHADER_CONSTANTS
Default 3D model vertex shader constants.
Definition Model3D.hpp:628
StorageBuffer< MorphTargetValueFields, "Model3DMorphTargetValues"> MorphTargetValueBuffer
Shader buffer for 3D model morph target values.
Definition Model3D.hpp:320
graphics::FragmentShader< Mesh, Inputs, Constants, Outputs, Camera3D::ParameterBuffer, DataBuffers, InstanceBuffers, ExtraBuffers... > FragmentShaderBase
Fragment shader for drawing 3D models.
Definition Model3D.hpp:388
Set of reflection probes in 3D space.
Definition ReflectionProbes3D.hpp:106
UniformBuffer< AtlasParameters, "ReflectionProbes3DAtlases"> AtlasBuffer
Shader buffer for reflection probe atlases.
Definition ReflectionProbes3D.hpp:125
StorageBuffer< ProbeFields, "LightProbeVolumes3DProbes"> ProbeBuffer
Shader buffer for reflection probes.
Definition ReflectionProbes3D.hpp:159
Backend-specific implementation of RenderPass.
Definition RenderPass.hpp:38
Extent2D getFramebufferSize()
Get the size of the framebuffer that the render pass will be rendering through.
const Viewport & getViewport()
Get the viewport that will be used for subsequently recorded draw commands.
Persistent system that provides 2D rendering capabilities.
Definition Renderer2D.hpp:46
Model2D::FragmentShader TonemappingModel2DFragmentShader
Default fragment shader type for tonemapping.
Definition Renderer2D.hpp:58
Model2D::FragmentShader PlainModel2DFragmentShader
Default fragment shader type for drawing plain 2D models.
Definition Renderer2D.hpp:52
Model2D::VertexShader DefaultModel2DVertexShader
Default vertex shader type for drawing 2D models.
Definition Renderer2D.hpp:49
Model2D::FragmentShader TextModel2DFragmentShader
Default fragment shader type for drawing text.
Definition Renderer2D.hpp:55
graphics::VertexShader< Model2D::Mesh, Model2D::VertexShaderConstants, Model2D::VertexShaderOutputs, Camera3D::ParameterBuffer, Model2D::Transformation3DBuffer > Model2DTransformed3DVertexShader
Default vertex shader for drawing 2D models with a 3D transformation.
Definition Renderer3D.hpp:123
const Sky3D::ShaderPipeline & getHDRPBRSky3DShaderPipeline()
Get the default non-tonemapped PBR skybox shader pipeline.
Definition Renderer3D.hpp:1473
void drawUnlitFrame(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches to a render pass, without any environment bu...
Definition Renderer3D.hpp:388
Renderer3D(Device &device, Renderer2D &renderer2D, const Renderer3DOptions &options={})
Construct a 3D renderer.
void reacquireModel3DInverseBindPoseMatrices(RangeAllocation< uint32_t > allocation) noexcept
Increment the reference count of an allocated range of 3D model inverse bind-pose matrices.
Definition Renderer3D.hpp:914
void renderViewDependentShadowMap(Lights3D &lights, LightID lightID, const Box< 3, float > &totalShadowCasterBoundingBox, const mat4 &observerProjectionMatrix, const mat4 &observerViewMatrix, FunctionView< void(RenderPass &, const Camera3D &)> drawShadowCasters)
Unconditionally render the shadow map of a specific shadow mapped view- dependent light source in a s...
const Model3D::DataBuffers & getModel3DDataBuffers()
Get the set of 3D model data buffers.
Definition Renderer3D.hpp:866
const Texture & getFlatNormalTexture2D()
Get the default flat normal map 2D texture.
Definition Renderer3D.hpp:792
StorageBuffer< ScreenLightFields, "Renderer3DScreenLights"> ScreenLightBuffer
Shader buffer for on-screen lights.
Definition Renderer3D.hpp:194
Model3D::FragmentShaderBase< Model3D::VertexShaderOutputs, Model3D::FragmentShaderConstants, Model3D::FragmentShaderOutputs, EnvironmentBuffers, ScreenBuffers > PBRModel3DFragmentShader
Default fragment shader type for drawing 3D models using PBR.
Definition Renderer3D.hpp:301
void drawPBRFrame(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, const Fog3D &fog, Sky3DView sky, const Decals3D &decals, const Lights3D &lights, const LightProbeVolumes3D &lightProbeVolumes, const ReflectionProbes3D &reflectionProbes, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches to a render pass.
Definition Renderer3D.hpp:605
const Texture & getInvisibleTexture2D()
Get the default invisible 2D texture.
Definition Renderer3D.hpp:762
Model3D::ShaderPipelineSet UnlitModel3DShaderPipelineSet
Default shader pipeline set for drawing 3D models at full brightness without any lighting.
Definition Renderer3D.hpp:298
const Texture & getWhiteTexture2D()
Get the default white 2D texture.
Definition Renderer3D.hpp:782
void drawPBRUnorderedFrame(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, const Fog3D &fog, Sky3DView sky, const Decals3D &decals, const Lights3D &lights, const LightProbeVolumes3D &lightProbeVolumes, const ReflectionProbes3D &reflectionProbes, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches to a render pass, without sorting alpha-blen...
Definition Renderer3D.hpp:649
VertexShader< Sky3D::Mesh, Sky3D::VertexShaderConstants, Sky3D::VertexShaderOutputs, Camera3D::ParameterBuffer > DefaultSky3DVertexShader
Default vertex shader for drawing skyboxes.
Definition Renderer3D.hpp:309
const Texture & getDefaultDepthTextureCubeArray()
Get the default cube array depth texture.
Definition Renderer3D.hpp:812
const Model2DTransformed3DVertexShader & getDefault3DTransformedModel2DVertexShader()
Get the default 2D-model-in-3D vertex shader.
const Model2D::ShaderPipeline & getTonemappingModel2DShaderPipeline()
Get the default tonemapping shader pipeline.
Definition Renderer3D.hpp:847
Renderer3D(Renderer3D &&)=delete
Moving a renderer is not allowed.
graphics::FragmentShader< Model2D::Mesh, Model2D::VertexShaderOutputs, Model2D::FragmentShaderConstants, Model2D::FragmentShaderOutputs, Camera3D::ParameterBuffer, Model2D::Transformation3DBuffer, Model2D::TextureBuffer > Model2DTransformed3DFragmentShader
Default fragment shader for drawing 2D models with a 3D transformation.
Definition Renderer3D.hpp:127
const Texture & getInvisibleTexture2DArray()
Get the default invisible 2D array texture.
Definition Renderer3D.hpp:767
BufferSet< ScreenTileBuffer, ScreenDepthBinBuffer, ScreenItemBuffer, ScreenDecalBuffer, ScreenLightBuffer, ScreenParameterBuffer > ScreenBuffers
Set of shader buffers related to the screen.
Definition Renderer3D.hpp:289
StorageBuffer< ScreenItemFields, "Renderer3DScreenItems"> ScreenItemBuffer
Shader buffer for screen items.
Definition Renderer3D.hpp:249
Renderer3D & operator=(Renderer3D &&)=delete
Moving a renderer is not allowed.
UniformBuffer< PBRParameters, "Renderer3DPBRParameters"> PBRParameterBuffer
Shader buffer for PBR rendering parameters.
Definition Renderer3D.hpp:137
void releaseModel3DInverseBindPoseMatrices(RangeAllocation< uint32_t > allocation) noexcept
Decrement the reference count of an allocated range of 3D model inverse bind-pose matrices,...
Definition Renderer3D.hpp:930
UnlitModel3DShaderPipelineSet & getUnlitModel3DShaderPipelineSet()
Get the default unlit 3D model shader pipeline set, which renders models' base color at full brightne...
Definition Renderer3D.hpp:1145
StorageBuffer< ScreenDecalFields, "Renderer3DScreenDecals"> ScreenDecalBuffer
Shader buffer for on-screen decals.
Definition Renderer3D.hpp:173
void drawHDRUnlitFrameWithSky(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, Sky3DView sky, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches and a 3D sky to a render pass,...
Definition Renderer3D.hpp:523
const Sky3D::ShaderPipeline & getHDRUnlitSky3DShaderPipeline()
Get the default non-tonemapped unlit skybox shader pipeline.
Definition Renderer3D.hpp:1420
const Renderer2D::TextModel2DFragmentShader & getTextModel2DFragmentShader()
Get the default text fragment shader.
Definition Renderer3D.hpp:832
Model3D::ShaderPipelineSetBase< Model3D::VertexShaderConstants, Model3D::VertexShaderOutputs, meta::TypeList<>, Model3D::FragmentShaderConstants, ShadowMapFragmentShaderOutputs, meta::TypeList<> > ShadowMapModel3DShaderPipelineSet
Shader pipeline set for drawing 3D models to shadow maps.
Definition Renderer3D.hpp:326
const Texture & getDefaultDepthTextureCube()
Get the default cube depth texture.
Definition Renderer3D.hpp:807
ShadowMapModel3DShaderPipelineSet & getShadowMapModel3DShaderPipelineSet()
Get the default shadow map 3D model shader pipeline set, which renders models to the depth buffer,...
const Sky3D::ShaderPipeline & getUnlitSky3DShaderPipeline()
Get the default unlit skybox shader pipeline.
Definition Renderer3D.hpp:1400
void renderAllViewDependentShadowMaps(Lights3D &lights, const Box< 3, float > &totalShadowCasterBoundingBox, const mat4 &observerProjectionMatrix, const mat4 &observerViewMatrix, FunctionView< void(RenderPass &, const Camera3D &)> drawShadowCasters)
Render the shadow maps of all shadow mapped view-dependent light sources in a set of lights with resp...
const Texture & getDefaultDepthTexture2D()
Get the default 2D depth texture.
Definition Renderer3D.hpp:797
void drawHDRPBRUnorderedFrame(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, const Fog3D &fog, Sky3DView sky, const Decals3D &decals, const Lights3D &lights, const LightProbeVolumes3D &lightProbeVolumes, const ReflectionProbes3D &reflectionProbes, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches to a render pass, without sorting alpha-blen...
Definition Renderer3D.hpp:740
const Model2D::ShaderPipeline & getTextModel2DShaderPipeline()
Get the default text shader pipeline.
Definition Renderer3D.hpp:837
const Renderer2D::DefaultModel2DVertexShader & getDefaultModel2DVertexShader()
Get the default 2D model vertex shader.
Definition Renderer3D.hpp:817
void drawUnlitUnorderedFrame(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches to a render pass, without any environment bu...
Definition Renderer3D.hpp:417
const DefaultModel3DVertexShader & getDefaultModel3DVertexShader()
Get the default 3D model vertex shader.
const Texture & getWhiteTextureCube()
Get the default white cubemap texture.
Definition Renderer3D.hpp:787
void renderAllShadowMaps(Lights3D &lights, const Box< 3, float > &totalShadowCasterBoundingBox, const mat4 &observerProjectionMatrix, const mat4 &observerViewMatrix, FunctionView< void(RenderPass &, const Camera3D &)> drawShadowCasters)
Render the shadow maps of shadow mapped light sources in a set of lights with respect to a future obs...
const Texture & getDefaultDepthTexture2DArray()
Get the default 2D array depth texture.
Definition Renderer3D.hpp:802
UniformBuffer< ScreenParameters, "Renderer3DScreenParameters"> ScreenParameterBuffer
Shader buffer for screen parameters.
Definition Renderer3D.hpp:282
UnlitModel3DShaderPipelineSet & getHDRUnlitModel3DShaderPipelineSet()
Get the default non-tonemapped unlit 3D model shader pipeline set, intended for high-dynamic-range re...
Definition Renderer3D.hpp:1168
const Model2D::ShaderPipeline & getPlainModel2DShaderPipeline()
Get the default plain 2D model shader pipeline.
Definition Renderer3D.hpp:827
RangeAllocation< uint32_t > uploadModel3DMorphTargetValues(Span< const Model3D::MorphTargetValueFields > morphTargetValues)
Allocate a range of morph targets and upload their values to the 3D model morph target value buffer.
Definition Renderer3D.hpp:958
UniformBuffer< ScreenTileParameters, "Renderer3DScreenTiles"> ScreenTileBuffer
Shader buffer for screen tiles.
Definition Renderer3D.hpp:219
void renderShadowMap(Lights3D &lights, LightID lightID, const Box< 3, float > &totalShadowCasterBoundingBox, const mat4 &observerProjectionMatrix, const mat4 &observerViewMatrix, FunctionView< void(RenderPass &, const Camera3D &)> drawShadowCasters)
Render the shadow map of a specific shadow mapped light source in a set of lights with respect to a f...
Model3D::ShaderPipelineSetBase< Model3D::VertexShaderConstants, Model3D::VertexShaderOutputs, meta::TypeList<>, Model3D::FragmentShaderConstants, Model3D::FragmentShaderOutputs, meta::TypeList< EnvironmentBuffers, ScreenBuffers > > PBRModel3DShaderPipelineSet
Default shader pipeline set for drawing 3D models using PBR.
Definition Renderer3D.hpp:305
void renderViewIndependentShadowMap(Lights3D &lights, LightID lightID, FunctionView< void(RenderPass &, const Camera3D &)> drawShadowCasters)
Unconditionally render the shadow map of a specific shadow mapped view- independent light source in a...
const Model3D & getCubeModel3D() const noexcept
Get the default 3D cube model.
Definition Renderer3D.hpp:1487
const Texture & getInvisibleTextureCube()
Get the default invisible cube texture.
Definition Renderer3D.hpp:772
Renderer3D(const Renderer3D &)=delete
Copying a renderer is not allowed.
UnlitModel3DShaderPipelineSet & getHDRWireframeModel3DShaderPipelineSet()
Get the default non-tonemapped wireframe 3D model shader pipeline set, intended for high-dynamic-rang...
Definition Renderer3D.hpp:1225
const UnlitSky3DFragmentShader & getUnlitSky3DFragmentShader()
Get the default unlit skybox fragment shader.
const Model2DTransformed3DFragmentShader & getPlain3DTransformedModel2DFragmentShader()
Get the default plain 2D-model-in-3D fragment shader.
void drawHDRUnlitUnorderedFrameWithSky(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, Sky3DView sky, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches and a 3D sky to a render pass,...
Definition Renderer3D.hpp:563
void renderViewDependentShadowMapForFullZoomedOutView(Lights3D &lights, LightID lightID, const Box< 3, float > &totalShadowCasterBoundingBox, FunctionView< void(RenderPass &, const Camera3D &)> drawShadowCasters)
Unconditionally render the shadow map of a specific shadow mapped view- dependent light source in a s...
UnlitModel3DShaderPipelineSet & getWireframeModel3DShaderPipelineSet()
Get the default wireframe 3D model shader pipeline set, which renders the wireframe of models in thei...
Definition Renderer3D.hpp:1196
void renderAllViewDependentShadowMapsForFullZoomedOutView(Lights3D &lights, const Box< 3, float > &totalShadowCasterBoundingBox, FunctionView< void(RenderPass &, const Camera3D &)> drawShadowCasters)
Unconditionally render the shadow maps of all shadow mapped view- dependent light sources in a set of...
Model3D::FragmentShaderBase< Model3D::VertexShaderOutputs, Model3D::FragmentShaderConstants, ShadowMapFragmentShaderOutputs > ShadowMapModel3DFragmentShader
Default fragment shader for drawing 3D models to shadow maps.
Definition Renderer3D.hpp:323
void renderAllShadowMapsForFullZoomedOutView(Lights3D &lights, const Box< 3, float > &totalShadowCasterBoundingBox, FunctionView< void(RenderPass &, const Camera3D &)> drawShadowCasters)
Unconditionally render the shadow maps of all shadow mapped light sources in a set of lights,...
const Texture & getSpecularSplitSumBRDFIntegrationMap()
Get the default BRDF integration map for split-sum approximation of ambient specular reflections.
Definition Renderer3D.hpp:1513
void drawHDRPBRFrame(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, const Fog3D &fog, Sky3DView sky, const Decals3D &decals, const Lights3D &lights, const LightProbeVolumes3D &lightProbeVolumes, const ReflectionProbes3D &reflectionProbes, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches to a render pass, without tonemapping when d...
Definition Renderer3D.hpp:694
void drawUnlitFrameWithSky(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, Sky3DView sky, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches and a 3D sky to a render pass,...
Definition Renderer3D.hpp:446
Model3D::VertexShader DefaultModel3DVertexShader
Default vertex shader type for drawing 3D models.
Definition Renderer3D.hpp:292
Renderer3D & operator=(const Renderer3D &)=delete
Copying a renderer is not allowed.
void releaseModel3DMorphTargetValues(RangeAllocation< uint32_t > allocation) noexcept
Decrement the reference count of an allocated range of 3D model morph target values,...
Definition Renderer3D.hpp:1002
PBRModel3DShaderPipelineSet & getPBRModel3DShaderPipelineSet()
Get the default PBR 3D model shader pipeline set, which renders models using physically based renderi...
Definition Renderer3D.hpp:1292
FragmentShader< Sky3D::Mesh, Sky3D::VertexShaderOutputs, Sky3D::FragmentShaderConstants, Sky3D::FragmentShaderOutputs, Camera3D::ParameterBuffer, EnvironmentBuffers > PBRSky3DFragmentShader
Default fragment shader for drawing skyboxes using PBR.
Definition Renderer3D.hpp:316
void renderAllViewIndependentShadowMaps(Lights3D &lights, FunctionView< void(RenderPass &, const Camera3D &)> drawShadowCasters)
Unconditionally render the shadow maps of all shadow mapped view-independent light sources in a set o...
RangeAllocation< uint32_t > uploadModel3DInverseBindPoseMatrices(Span< const Model3D::InverseBindPoseMatrixFields > inverseBindPoseMatrices)
Allocate a range of matrices and upload their values to the 3D model inverse bind-pose matrix buffer.
Definition Renderer3D.hpp:886
const Renderer2D::TonemappingModel2DFragmentShader & getTonemappingModel2DFragmentShader()
Get the default tonemapping fragment shader.
Definition Renderer3D.hpp:842
UniformBuffer< ScreenDepthBinParameters, "Renderer3DScreenDepthBins"> ScreenDepthBinBuffer
Shader buffer for screen depth bins.
Definition Renderer3D.hpp:240
PBRModel3DShaderPipelineSet & getHDRPBRModel3DShaderPipelineSet()
Get the default non-tonemapped PBR 3D model shader pipeline set, intended for high-dynamic-range rend...
Definition Renderer3D.hpp:1316
const Renderer2D::PlainModel2DFragmentShader & getPlainModel2DFragmentShader()
Get the default plain 2D model fragment shader.
Definition Renderer3D.hpp:822
const PBRModel3DFragmentShader & getPBRModel3DFragmentShader()
Get the default PBR 3D model fragment shader, which renders models using physically based rendering p...
const Model2D & getUnitSquareModel2D() const noexcept
Get the default 2D unit square model, which holds a single mesh that forms a square using a triangle ...
Definition Renderer3D.hpp:852
Model3D::FragmentShader UnlitModel3DFragmentShader
Default fragment shader type for drawing 3D models at full brightness without any lighting.
Definition Renderer3D.hpp:295
void drawUnlitUnorderedFrameWithSky(RenderPass &renderPass, StridedSpan< const Instances3DView > instanceBatches, const Camera3D &camera, Sky3DView sky, const ExtraBuffers &... extraBuffers)
Push the draw commands of a frame of 3D instance batches and a 3D sky to a render pass,...
Definition Renderer3D.hpp:484
BufferSet< PBRParameterBuffer, Fog3D::ParameterBuffer, Sky3D::ParameterBuffer, Decals3D::ParameterBuffer, Lights3D::ParameterBuffer, Lights3D::ShadowMatrixBuffer, LightProbeVolumes3D::AtlasBuffer, LightProbeVolumes3D::VolumeBuffer, ReflectionProbes3D::AtlasBuffer, ReflectionProbes3D::ProbeBuffer > EnvironmentBuffers
Set of shader buffers related to the environment.
Definition Renderer3D.hpp:285
PBRModel3DShaderPipelineSet::FragmentShaderSelector getPBRModel3DFragmentShaderSelector()
Get the default PBR 3D model fragment shader selector, which renders models using physically based re...
Definition Renderer3D.hpp:1269
const Model2D & getUnitRightAngledTriangleModel2D() const noexcept
Get the default 2D unit right-angled triangle model, which holds a single mesh that forms a single tr...
Definition Renderer3D.hpp:857
DistanceModel3DShaderPipelineSet & getDistanceModel3DShaderPipelineSet()
Get the default distance 3D model shader pipeline set, which renders models' distance from the camera...
const Sky3D::ShaderPipeline & getPBRSky3DShaderPipeline()
Get the default PBR skybox shader pipeline.
Definition Renderer3D.hpp:1453
void reacquireModel3DMorphTargetValues(RangeAllocation< uint32_t > allocation) noexcept
Increment the reference count of an allocated range of 3D model morph target values.
Definition Renderer3D.hpp:986
const UnlitModel3DFragmentShader & getUnlitModel3DFragmentShader()
Get the default unlit 3D model fragment shader, which renders models' base color at full brightness w...
Model3D::FragmentShader DistanceModel3DFragmentShader
Default fragment shader for drawing the distance of 3D models from the camera.
Definition Renderer3D.hpp:330
Model3D::ShaderPipelineSet DistanceModel3DShaderPipelineSet
Shader pipeline set for drawing the distance of 3D models from the camera.
Definition Renderer3D.hpp:333
const ShaderPipeline< Model2D::Mesh > & getPlain3DTransformedTextShaderPipeline()
Get the default plain 3D text shader pipeline.
Definition Renderer3D.hpp:1092
const Model2DTransformed3DFragmentShader & getPlain3DTransformedTextFragmentShader()
Get the default plain 3D text fragment shader.
const Cubemap3D & getCubemap3D() const noexcept
Get the default 3D cubemap.
Definition Renderer3D.hpp:1496
FragmentShader< Sky3D::Mesh, Sky3D::VertexShaderOutputs, Sky3D::FragmentShaderConstants, Sky3D::FragmentShaderOutputs, Camera3D::ParameterBuffer, Sky3D::ParameterBuffer > UnlitSky3DFragmentShader
Default fragment shader for drawing skyboxes without fog.
Definition Renderer3D.hpp:312
const PBRSky3DFragmentShader & getPBRSky3DFragmentShader()
Get the default PBR skybox fragment shader.
const ShaderPipeline< Model2D::Mesh > & getPlain3DTransformedModel2DShaderPipeline()
Get the default plain 2D-model-in-3D shader pipeline.
Definition Renderer3D.hpp:1054
const DefaultSky3DVertexShader & getDefaultSky3DVertexShader()
Get the default skybox vertex shader.
const Texture & getInvisibleTextureCubeArray()
Get the default invisible cube array texture.
Definition Renderer3D.hpp:777
Linked GPU shader pipeline.
Definition shaders.hpp:1508
static constexpr VertexShaderConstants DEFAULT_VERTEX_SHADER_CONSTANTS
Default skybox vertex shader constants.
Definition Sky3D.hpp:134
UniformBuffer< Parameters, "Sky3DParameters"> ParameterBuffer
Shader buffer for sky parameters.
Definition Sky3D.hpp:128
graphics::ShaderPipeline< Mesh > ShaderPipeline
Shader pipeline for drawing skyboxes.
Definition Sky3D.hpp:131
static constexpr ShaderPipelineOptions DEFAULT_SHADER_PIPELINE_OPTIONS
Default skybox graphics pipeline configuration.
Definition Sky3D.hpp:142
GPU memory buffer containing an array of structs to be read by a shader program.
Definition buffers.hpp:493
Storage for multidimensional data, such as 2D images, on the GPU, combined with a sampler configurati...
Definition Texture.hpp:700
GPU memory buffer containing a fixed-size struct of uniform parameters to be read by a shader program...
Definition buffers.hpp:426
static constexpr BufferLayoutReference LAYOUT_REFERENCE
Definition buffers.hpp:437
Compiled GPU vertex shader stage.
Definition shaders.hpp:1060
Definition buffer_layouts.hpp:20
@ TRIANGLE_STRIP
Each point, except the first two, forms a filled triangle with the previous two points.
Definition shaders.hpp:296
@ LINE
Polygon edges are drawn as single-pixel-wide line segments.
Definition shaders.hpp:306
@ NONE
Ignore facing, don't cull primitives based on their winding order.
Definition shaders.hpp:319
Array(T, Us...) -> Array< T, 1+sizeof...(Us)>
StridedSpan(R &&range) -> StridedSpan< std::remove_reference_t< decltype(*std::data(range))>, DYNAMIC_EXTENT, sizeof(std::remove_reference_t< decltype(*std::data(range))>)>
vec< 4, float > vec4
Definition math.hpp:440
vec< 2, float > vec2
Definition math.hpp:438
constexpr void sortByAscending(random_access_range auto &&range)
Definition algorithms.hpp:514
vec< 3, float > vec3
Definition math.hpp:439
Extent< 2 > Extent2D
Size of a 2D data region.
Definition extents.hpp:31
Span(R &&range) -> Span< std::remove_reference_t< decltype(*std::data(range))> >
Pair(T1, T2) -> Pair< T1, T2 >
vec< 4, uint32_t > u32vec4
Definition math.hpp:420
mat< 4, 4, float > mat4
Definition math.hpp:806
vec< 2, uint32_t > u32vec2
Definition math.hpp:418
Definition Array.hpp:20
Generic axis-aligned box shape with minimum and maximum extents in N-dimensional space.
Definition geometry.hpp:149
Definition Pair.hpp:53
Definition RangeAllocator.hpp:35
static const BlendState ALPHA_BLENDING_PREMULTIPLIED
Blend state to use for pre-multiplied alpha blending using the standard "over" operator.
Definition shaders.hpp:391
Opaque handle to a specific light in a Lights3D set.
Definition Lights3D.hpp:32
Struct of default fragment shader constants.
Definition Model2D.hpp:78
Struct of fields output by the default fragment shader.
Definition Model2D.hpp:83
Struct of fields output by the default vertex shader.
Definition Model2D.hpp:69
Struct of default fragment shader constants.
Definition Model3D.hpp:272
bool32_t FRAGMENT_HDR
Definition Model3D.hpp:273
Struct of fields output by the default fragment shader.
Definition Model3D.hpp:292
Configuration options for shading a mesh instance of a 3D model.
Definition Model3D.hpp:81
Configuration options for a Renderer3D.
Definition Renderer3D.hpp:63
constexpr bool operator==(const Renderer3DOptions &other) const noexcept=default
Compare these options to another set of options for equality.
uint32_t tileSize
Width or height of each screen tile, in pixels.
Definition Renderer3D.hpp:69
float shadowMapDepthBiasConstantFactor
Constant depth bias factor to use in the shadow map shader.
Definition Renderer3D.hpp:105
float shadowMapDepthBiasSlopeFactor
Slope-scaled depth bias factor to use in the shadow map shader.
Definition Renderer3D.hpp:100
uint32_t specularSplitSumBRDFIntegrationMapSampleCount
Number of samples to use when generating the bidirectional reflectance distribution function (BRDF) i...
Definition Renderer3D.hpp:95
uint32_t specularSplitSumBRDFIntegrationMapResolution
The width, in texels, of the generated bidirectional reflectance distribution function (BRDF) integra...
Definition Renderer3D.hpp:86
uint32_t depthBinCount
Number of depth bins to use for culling items on the screen along the Z axis.
Definition Renderer3D.hpp:77
Struct of shader parameters for PBR rendering.
Definition Renderer3D.hpp:131
sampler2D pbrSpecularSplitSumBRDFIntegrationMap
Sampler for the bidirectional reflectance distribution function (BRDF) integration map for split-sum ...
Definition Renderer3D.hpp:133
Struct of shader fields representing an on-screen decal.
Definition Renderer3D.hpp:140
mat4 decalMatrix
Combined view-projection matrix of the decal.
Definition Renderer3D.hpp:142
vec4 decalOcclusionRoughnessMetallicFactorAndNormalScale
Occlusion strength (X), roughness factor (Y), metallic factor (Z) and normal scale (W).
Definition Renderer3D.hpp:163
vec4 decalNormalTextureOffsetAndScale
Texture offset (XY) and scale (ZW) of the normal map in the decal atlas texture.
Definition Renderer3D.hpp:151
vec4 decalEmissiveTextureOffsetAndScale
Texture offset (XY) and scale (ZW) of the emissive map in the decal atlas texture.
Definition Renderer3D.hpp:157
vec4 decalBaseColorTextureOffsetAndScale
Texture offset (XY) and scale (ZW) of the base color map in the decal atlas texture.
Definition Renderer3D.hpp:148
vec4 decalDirectionAndRange
Direction vector (XYZ) and range (W) of the decal.
Definition Renderer3D.hpp:145
vec4 decalBaseColorFactor
Base color factor.
Definition Renderer3D.hpp:160
uint32_t decalModelInstanceIdentifier
Model identifier that the decal applies to, or the maximum value to apply to all models.
Definition Renderer3D.hpp:169
vec4 decalOcclusionRoughnessMetallicTextureOffsetAndScale
Texture offset (XY) and scale (ZW) of the occlusion-roughness-metallic map in the decal atlas texture...
Definition Renderer3D.hpp:154
vec3 decalEmissiveFactor
Emissive factor.
Definition Renderer3D.hpp:166
Struct of shader parameters representing the depth bins of the screen.
Definition Renderer3D.hpp:222
static constexpr size_t MAX_DEPTH_BIN_COUNT
Maximum number of depth bins.
Definition Renderer3D.hpp:226
Array< u32vec4, MAX_DEPTH_BIN_COUNT > depthBins
Depth bins, each containing the following data:
Definition Renderer3D.hpp:235
Struct of shader fields representing an item belonging to a screen tile.
Definition Renderer3D.hpp:243
uint32_t itemIndex
Index of the item in its corresponding buffer.
Definition Renderer3D.hpp:245
Struct of shader fields representing an on-screen light source.
Definition Renderer3D.hpp:176
vec4 lightColorAndIntensity
Color (XYZ) and intensity factor (W) of the light.
Definition Renderer3D.hpp:181
vec4 lightConeCosinesAndShadowMapIndexAndShadowMatrixIndex
Cosine of the inner (X) and outer (Y) cone angles, as well as the shadow map index (Z) and shadow mat...
Definition Renderer3D.hpp:187
vec4 lightPositionAndType
Position (XYZ) and type index (W) of the light.
Definition Renderer3D.hpp:184
vec4 lightDirectionAndRange
Direction (XYZ) vector and maximum range (W) of the light.
Definition Renderer3D.hpp:178
vec4 lightShadowNearAndFarPlaneDistancesAndShadowMapNormalOffsetBiasConstantAndSlopeFactors
Distances to the near (X) and far (Y) planes of the light shadow, as well as the constant (Z) and slo...
Definition Renderer3D.hpp:190
Struct of shader parameters representing the current screen.
Definition Renderer3D.hpp:252
uint32_t screenGlobalLightCount
Number of global lights at the beginning of the light buffer.
Definition Renderer3D.hpp:278
float screenInverseTileSize
Inverse of tile size.
Definition Renderer3D.hpp:260
samplerCubeArrayShadow screenPointLightShadowMaps
Sampler for the depth texture array representing the cube shadow maps of point lights.
Definition Renderer3D.hpp:272
u32vec2 screenTileCounts
Tile counts along the X/Y axes.
Definition Renderer3D.hpp:263
sampler2DArrayShadow screenCascadedShadowMaps
Sampler for the depth texture array representing the cascaded 2D shadow maps of sun/directional light...
Definition Renderer3D.hpp:269
vec2 screenViewportOffset
Viewport offset in pixels.
Definition Renderer3D.hpp:254
sampler2DArrayShadow screenSpotLightShadowMaps
Sampler for the depth texture array representing the 2D shadow maps of spot lights.
Definition Renderer3D.hpp:275
uint32_t screenDepthBinCount
Depth bin count along the Z axis.
Definition Renderer3D.hpp:266
float screenFramebufferHeight
Framebuffer height in pixels.
Definition Renderer3D.hpp:257
Struct of shader parameters representing the tiles of the screen.
Definition Renderer3D.hpp:197
Array< u32vec4,(MAX_TILE_COUNT *2)/4 > tileItemOffsetsAndCountsBy4s
Offsets and number of each item belonging to each tile in the item buffer, grouped into 4D vectors to...
Definition Renderer3D.hpp:214
static constexpr size_t MAX_TILE_COUNT
Maximum number of on-screen tiles.
Definition Renderer3D.hpp:201
Struct of fields output by the shadow map fragment shader.
Definition Renderer3D.hpp:320
Configuration of a graphics pipeline.
Definition shaders.hpp:428
PolygonMode polygonMode
How to render polygons.
Definition shaders.hpp:629
FaceCullingMode faceCullingMode
How to treat the facing of primitives while rendering.
Definition shaders.hpp:640
bool skipSkyRendering
If set, the sky will not be directly rendered, but will still contribute to the lighting of other ren...
Definition Sky3D.hpp:277
View over a sky to be drawn in a Renderer3D frame.
Definition Sky3D.hpp:283
const Sky3D * sky
Non-owning read-only pointer to the sky.
Definition Sky3D.hpp:285
Sky3DFilter filter
Filter parameters that determine which parts of the sky to draw.
Definition Sky3D.hpp:291
SharedPointer< ShaderPipelineImplementation > shaderPipelineOverrideHandle
Shader pipeline override to use, or nullptr to not use a shader override.
Definition Sky3D.hpp:288
Struct of default fragment shader constants.
Definition Sky3D.hpp:93
Reference to a sampler2DArrayShadow Texture that may be used as a parameter value type in a shader-re...
Definition ParameterDescription.hpp:155
Reference to a sampler2D Texture that may be used as a parameter value type in a shader-read buffer.
Definition ParameterDescription.hpp:131
Reference to a samplerCubeArrayShadow Texture that may be used as a parameter value type in a shader-...
Definition ParameterDescription.hpp:187
Compile-time list of types.
Definition metaprogramming.hpp:347