-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0eee907
commit 0d4037d
Showing
9 changed files
with
140 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ target | |
.vscode | ||
tools | ||
res | ||
resources/*.png |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// blocks | ||
|
||
//@CAMERA_STRUCT | ||
|
||
struct TransformationUniforms { | ||
transform_matrix: mat4x4<f32>, | ||
}; | ||
@group(2) @binding(0) | ||
var<uniform> transform_uniform: TransformationUniforms; | ||
|
||
struct VertexInput { | ||
@location(0) position: vec3<f32>, | ||
@location(1) texture_coordinates: vec2<f32>, | ||
}; | ||
|
||
struct VertexOutput { | ||
@builtin(position) position: vec4<f32>, | ||
@location(0) texture_coordinates: vec2<f32>, | ||
}; | ||
|
||
struct InstanceInput { | ||
@location(3) model_matrix_0: vec4<f32>, | ||
@location(4) model_matrix_1: vec4<f32>, | ||
@location(5) model_matrix_2: vec4<f32>, | ||
@location(6) model_matrix_3: vec4<f32>, | ||
}; | ||
|
||
// Vertex Stage | ||
@vertex | ||
fn vs_main(input: VertexInput, instance: InstanceInput) -> VertexOutput { | ||
let model_matrix = mat4x4<f32>( | ||
instance.model_matrix_0, | ||
instance.model_matrix_1, | ||
instance.model_matrix_2, | ||
instance.model_matrix_3, | ||
); | ||
|
||
var out: VertexOutput; | ||
out.texture_coordinates = input.texture_coordinates; | ||
//@CAMERA_VERTEX | ||
return out; | ||
} | ||
|
||
// Fragment Stage | ||
struct FragmentUniforms { | ||
color: vec4<f32>, | ||
}; | ||
@group(2) @binding(1) | ||
var<uniform> fragment_uniforms: FragmentUniforms; | ||
|
||
@group(0) @binding(0) | ||
var texture_diffuse: texture_2d<f32>; | ||
|
||
@group(0) @binding(1) | ||
var sampler_diffuse: sampler; | ||
|
||
@fragment | ||
fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> { | ||
if fragment_uniforms.color.w == 0.0 { | ||
return textureSample(texture_diffuse, sampler_diffuse, input.texture_coordinates); | ||
} else { | ||
return textureSample(texture_diffuse, sampler_diffuse, input.texture_coordinates) * fragment_uniforms.color; | ||
} | ||
} |