yes
This commit is contained in:
49
Assets/Shaders/ForwardVertex.nzsl
git.filemode.normal_file
49
Assets/Shaders/ForwardVertex.nzsl
git.filemode.normal_file
@@ -0,0 +1,49 @@
|
||||
[nzsl_version("1.0")]
|
||||
module;
|
||||
|
||||
import ViewerData from ScopEngine.ViewerData;
|
||||
|
||||
struct VertIn
|
||||
{
|
||||
[location(0)] pos: vec4[f32],
|
||||
[location(1)] color: vec4[f32],
|
||||
[location(2)] normal: vec4[f32],
|
||||
[location(3)] uv: vec2[f32]
|
||||
}
|
||||
|
||||
struct VertOut
|
||||
{
|
||||
[location(0)] color: vec4[f32],
|
||||
[location(1)] uv: vec2[f32],
|
||||
[location(2)] norm: vec4[f32],
|
||||
[location(3)] transformed_norm: vec3[f32],
|
||||
[location(4)] frag_position: vec4[f32],
|
||||
[location(5)] camera_position: vec3[f32],
|
||||
[builtin(position)] pos: vec4[f32]
|
||||
}
|
||||
|
||||
struct ModelData
|
||||
{
|
||||
matrix: mat4[f32],
|
||||
normal: mat4[f32],
|
||||
}
|
||||
|
||||
external
|
||||
{
|
||||
[set(0), binding(0)] viewer_data: uniform[ViewerData],
|
||||
model: push_constant[ModelData]
|
||||
}
|
||||
|
||||
[entry(vert)]
|
||||
fn main(input: VertIn) -> VertOut
|
||||
{
|
||||
let output: VertOut;
|
||||
output.color = input.color;
|
||||
output.uv = input.uv;
|
||||
output.norm = normalize(input.normal);
|
||||
output.transformed_norm = mat3[f32](model.normal) * output.norm.xyz;
|
||||
output.frag_position = model.matrix * vec4[f32](input.pos.xyz, 1.0);
|
||||
output.camera_position = viewer_data.camera_position;
|
||||
output.pos = viewer_data.view_proj_matrix * output.frag_position;
|
||||
return output;
|
||||
}
|
||||
Reference in New Issue
Block a user