Refactoring graphics

This commit is contained in:
Dynamitos
2023-10-26 18:37:29 +02:00
parent 28e5c9ff01
commit 1ca861459c
113 changed files with 3131 additions and 3221 deletions
+8 -8
View File
@@ -4,7 +4,7 @@ import Common;
interface ILightEnv
{
float3 illuminate<B:IBRDF>(MaterialFragmentParameter input, B brdf);
float3 illuminate<B:IBRDF>(MaterialParameter input, B brdf);
};
struct DirectionalLight : ILightEnv
@@ -12,9 +12,9 @@ struct DirectionalLight : ILightEnv
float4 color;
float4 direction;
float3 illuminate<B:IBRDF>(MaterialFragmentParameter input, B brdf)
float3 illuminate<B:IBRDF>(MaterialParameter input, B brdf)
{
float3 lightDir_TS = input.transformWorldToTangent(normalize(direction.xyz));
float3 lightDir_TS = normalize(direction.xyz);
return brdf.evaluate(input.viewDir_TS, -lightDir_TS, color.xyz);
}
};
@@ -24,9 +24,9 @@ struct PointLight : ILightEnv
float4 position_WS;
float4 colorRange;
float3 illuminate<B:IBRDF>(MaterialFragmentParameter input, B brdf)
float3 illuminate<B:IBRDF>(MaterialParameter input, B brdf)
{
float3 position_TS = input.transformWorldToTangent(position_WS.xyz);
float3 position_TS = position_WS.xyz;
float3 lightDir_TS = position_TS - input.position_TS;
float d = length(lightDir_TS);
float illuminance = max(1 - d / colorRange.w, 0);
@@ -48,7 +48,7 @@ struct PointLight : ILightEnv
}
for(int i = 0; i < 4 && result; ++i)
{
if(insidePlane(frustum.planes[i]))
if(insidePlane(frustum.sides[i]))
{
//result = false;
}
@@ -57,7 +57,7 @@ struct PointLight : ILightEnv
}
float3 getViewPos()
{
return mul(gViewParams.viewMatrix, position_WS).xyz;
return mul(viewParams.viewMatrix, position_WS).xyz;
}
};
@@ -65,7 +65,7 @@ struct LightEnv
{
StructuredBuffer<DirectionalLight> directionalLights;
uint numDirectionalLights;
StructureBuffer<PointLight> pointLights;
StructuredBuffer<PointLight> pointLights;
uint numPointLights;
};