From 65d74bdb26af833b5380046dec204f685f745cc1 Mon Sep 17 00:00:00 2001 From: Omniscient Date: Thu, 11 Jul 2024 18:03:29 +1000 Subject: changing styles plus simplifying a bit --- src/new_render/pbr.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ src/new_render/shadows.h | 30 ++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 src/new_render/pbr.h create mode 100644 src/new_render/shadows.h (limited to 'src/new_render') diff --git a/src/new_render/pbr.h b/src/new_render/pbr.h new file mode 100644 index 0000000..dd29301 --- /dev/null +++ b/src/new_render/pbr.h @@ -0,0 +1,60 @@ +/** + * @file pbr.h + * @brief PBR render pass + */ + +#pragma once +#include "defines.h" +#include "camera.h" +#include "maths_types.h" +#include "ral/ral.h" +#include "ral/ral_common.h" + +// PBR; + +// --- Public API +typedef struct PBR_Storage PBR_Storage; // Stores all necessary data and handles + +PUB void PBR_Init(PBR_Storage* storage); + +// NOTE: For simplicity's sake we will render this pass directly to the default framebuffer +PUB void PBR_Run( + PBR_Storage* storage + // light data + // camera + // geometry + // materials +); + +typedef struct PBR_Params { + Vec3 albedo; + f32 metallic; + f32 roughness; + f32 ao; +} PBR_Params; + +typedef struct PBR_Textures { + TextureHandle albedo_map; + TextureHandle normal_map; + bool metal_roughness_combined; + TextureHandle metallic_map; + TextureHandle roughness_map; + TextureHandle ao_map; +} PBR_Textures; + +// --- Internal + + +GPU_Renderpass* PBR_RPassCreate(); +GPU_Pipeline* PBR_PipelineCreate(GPU_Renderpass* rpass); +void PBR_Execute( + PBR_Storage* storage, + Camera camera, + TextureHandle shadowmap_tex, + MaterialMap* materials, // map of String -> Material + RenderEnt* entities, + size_t entity_count + +); + +// Internally this will need to update material parameters diff --git a/src/new_render/shadows.h b/src/new_render/shadows.h new file mode 100644 index 0000000..4f10f35 --- /dev/null +++ b/src/new_render/shadows.h @@ -0,0 +1,30 @@ +/** + * @file shadows.h + * @brief Functions for adding shadows to scene rendering. +*/ + + +#pragma once +#include "defines.h" +#include "ral/ral_types.h" + +typedef struct Shadow_Storage Shadow_Storage; + +typedef struct RenderEnt RenderEnt; +typedef struct Camera Camera; +typedef struct Mat4 Mat4; + +// --- Public API +PUB void Shadow_Init(Shadow_Storage* storage); + +/** @brief Run shadow map generation for given entities, and store in a texture. + * @note Uses active directional light for now */ +PUB void Shadow_Run(Shadow_Storage* storage, RenderEnt* entities, size_t entity_count); + +/** @brief Get the shadow texture generated from shadowmap pass */ +PUB Handle Shadow_GetShadowMapTexture(Shadow_Storage* storage); + +// --- Internal +GPU_Renderpass* Shadow_RPassCreate(); // Creates the render pass +GPU_Pipeline* Shadow_PipelineCreate(GPU_Renderpass* rpass); // Creates the pipeline +void Shadow_ShadowmapExecute(Shadow_Storage* storage, Mat4 light_space_transform, RenderEnt* entites, size_t entity_count); -- cgit v1.2.3-70-g09d2