Graphics: Move LightData to a shader module and add hotreload in debug

This commit is contained in:
Jérôme Leclercq
2022-03-12 16:53:36 +01:00
parent b92a9f8a1c
commit 2f26a1d9c7
6 changed files with 90 additions and 24 deletions

View File

@@ -0,0 +1,25 @@
[nzsl_version("1.0")]
module;
option MaxLightCount: u32 = u32(3); //< FIXME: Fix integral value types
[export]
[layout(std140)]
struct Light
{
type: i32,
color: vec4[f32],
factor: vec2[f32],
parameter1: vec4[f32],
parameter2: vec4[f32],
parameter3: vec4[f32],
hasShadowMapping: u32
}
[export]
[layout(std140)]
struct LightData
{
lights: array[Light, MaxLightCount],
lightCount: u32,
}

View File

@@ -2,6 +2,7 @@
module;
import Engine/InstanceData;
import Engine/LightData;
import Engine/ViewerData;
// Basic material options
@@ -15,8 +16,6 @@ option HasHeightTexture: bool = false;
option HasNormalTexture: bool = false;
option HasSpecularTexture: bool = false;
option MaxLightCount: u32 = u32(3); //< FIXME: Fix integral value types
// Billboard related options
option Billboard: bool = false;
option BillboardCenterLocation: i32 = -1;
@@ -55,25 +54,6 @@ const DirectionalLight = 0;
const PointLight = 1;
const SpotLight = 2;
[layout(std140)]
struct Light
{
type: i32,
color: vec4[f32],
factor: vec2[f32],
parameter1: vec4[f32],
parameter2: vec4[f32],
parameter3: vec4[f32],
hasShadowMapping: u32
}
[layout(std140)]
struct LightData
{
lights: array[Light, MaxLightCount],
lightCount: u32,
}
external
{
[binding(0)] settings: uniform[MaterialSettings],