Remove assets from repository and download them using xmake
This commit is contained in:
63
assets/shaders/deferred_frag.nzsl
Normal file
63
assets/shaders/deferred_frag.nzsl
Normal file
@@ -0,0 +1,63 @@
|
||||
[nzsl_version("1.0")]
|
||||
module;
|
||||
|
||||
import Engine.InstanceData;
|
||||
import Engine.ViewerData;
|
||||
|
||||
option HasDiffuseTexture: bool = false;
|
||||
option HasAlphaTexture: bool = false;
|
||||
option AlphaTest: bool = false;
|
||||
|
||||
[layout(std140)]
|
||||
struct BasicSettings
|
||||
{
|
||||
AlphaThreshold: f32,
|
||||
DiffuseColor: vec4[f32]
|
||||
}
|
||||
|
||||
external
|
||||
{
|
||||
[binding(0)] settings: uniform[BasicSettings],
|
||||
[binding(1)] MaterialDiffuseMap: sampler2D[f32],
|
||||
[binding(2)] MaterialAlphaMap: sampler2D[f32],
|
||||
[binding(3)] TextureOverlay: sampler2D[f32],
|
||||
[binding(4)] instanceData: uniform[InstanceData],
|
||||
[binding(5)] viewerData: uniform[ViewerData],
|
||||
}
|
||||
|
||||
struct InputData
|
||||
{
|
||||
[location(0)] normal: vec3[f32],
|
||||
[location(1)] uv: vec2[f32],
|
||||
[location(2)] pos: vec3[f32]
|
||||
}
|
||||
|
||||
struct OutputData
|
||||
{
|
||||
[location(0)] diffuseMap: vec4[f32],
|
||||
[location(1)] normalMap: vec4[f32],
|
||||
[location(2)] positionMap: vec4[f32]
|
||||
}
|
||||
|
||||
[entry(frag)]
|
||||
fn main(input: InputData) -> OutputData
|
||||
{
|
||||
let diffuseColor = settings.DiffuseColor;
|
||||
const if (HasDiffuseTexture)
|
||||
diffuseColor *= MaterialDiffuseMap.Sample(input.uv);
|
||||
|
||||
const if (HasAlphaTexture)
|
||||
diffuseColor.w *= MaterialAlphaMap.Sample(input.uv).x;
|
||||
|
||||
const if (AlphaTest)
|
||||
{
|
||||
if (diffuseColor.w < settings.AlphaThreshold)
|
||||
discard;
|
||||
}
|
||||
|
||||
let output: OutputData;
|
||||
output.diffuseMap = diffuseColor;
|
||||
output.normalMap = vec4[f32]((vec3[f32](1.0, 1.0, 1.0) + input.normal) * 0.5, 1.0);
|
||||
output.positionMap = vec4[f32](input.pos, 1.0);
|
||||
return output;
|
||||
}
|
||||
Reference in New Issue
Block a user