7#include <SDL3/SDL_gpu.h>
76 std::array<float, 3>
ambient{0.53F, 0.53F, 0.53F};
120 {
return lighting_; }
122 {
return meshCache_.get(); }
124 {
return pipeline_; }
126 {
return modernPipeline_ ? &*modernPipeline_ :
nullptr; }
128 {
return studioEnvironmentEnabled_; }
135 [[
nodiscard]]
bool ensureShadowResources();
136 void releasePresentationResources()
noexcept;
138 void releaseSamplingResources()
noexcept;
141 World3DPipeline pipeline_;
142 std::optional<World3DPipeline> modernPipeline_;
143 bool modernPipelineAttempted_{};
144 std::filesystem::path shaderDirectory_;
146 std::unique_ptr<MeshGPUCache> meshCache_;
147 StudioEnvironmentGPU studioEnvironment_;
148 bool studioEnvironmentEnabled_{};
151 bool bilinearFiltering_{};
154 std::uint32_t depthWidth_{};
155 std::uint32_t depthHeight_{};
156 World3DLighting lighting_{};
157 bool modernPresentation_{};
158 bool presentationShadows_{};
159 bool presentationAntialiasing_{};
160 bool shadowsActive_{};
161 bool antialiasingActive_{};
164 std::uint32_t multisampleWidth_{};
165 std::uint32_t multisampleHeight_{};
166 std::optional<World3DPipeline> multisampleLegacyPipeline_;
167 std::optional<World3DPipeline> multisampleModernPipeline_;
171 std::optional<World3DPipeline> shadowMapPipeline_;
World3DRenderer()=default
void setBilinearFiltering(bool enabled) noexcept
void setLighting(const World3DLighting &lighting) noexcept
const World3DPipeline * modernPipeline() const noexcept
void setModernPresentation(bool enabled) noexcept
World3DRenderer & operator=(const World3DRenderer &)=delete
World3DRenderer(const World3DRenderer &)=delete
bool studioEnvironmentEnabled() const noexcept
const World3DLighting & lighting() const noexcept
std::uint32_t presentationSampleCount() const noexcept
bool presentationShadowsActive() const noexcept
static std::expected< World3DRenderer, World3DRendererError > load(SDL_GPUDevice *device, const std::filesystem::path &shaderDirectory, SDL_GPUTextureFormat colorFormat, const std::filesystem::path &studioEnvironmentPath={})
void setPresentationShadows(bool enabled) noexcept
const World3DPipeline & pipeline() const noexcept
bool bilinearFiltering() const noexcept
MeshGPUCache * meshCache() noexcept
void setPresentationAntialiasing(bool enabled) noexcept
bool presentationAntialiasingActive() const noexcept
std::expected< World3DRenderStats, World3DRendererError > render(SDL_GPUCommandBuffer *commandBuffer, SDL_GPUTexture *colorTarget, std::uint32_t targetWidth, std::uint32_t targetHeight, const SDL_GPUViewport &viewport, const SequenceWorld3DSlot &slot)
@ RenderPassCreationFailed
@ FallbackTextureUploadFailed
@ FallbackTextureCreationFailed
@ DepthTargetCreationFailed
std::array< float, 3 > direction
std::array< float, 3 > color
World3DDirectionalLight sun
std::array< float, 3 > ambient
World3DDirectionalLight boardReflection
World3DSpotLight spotlight
std::size_t shadowBatches
std::size_t shadowTriangles
std::uint32_t sampleCount
std::optional< MeshGPUError > meshError
std::optional< World3DPipelineError > pipelineError
World3DRendererErrorCode code
std::array< float, 3 > attenuation
std::array< float, 3 > color
std::array< float, 3 > position
std::array< float, 3 > direction