generated from emilk/eframe_template
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add collision shader This adds a new shader for collision that renders over the fog. It doesn't do anything yet because the collision is not being calculated anywhere yet. (cherry picked from commit eeecc6c) * Fix loop dimensions in collision shader `calculate_vertices` (cherry picked from commit 93bc2c9) * Render fog and collision on top of event graphics I also made the event border rectangles render on top of the fog and collision because otherwise they may be hard to see through those layers. (cherry picked from commit ade0fa2) * Start implementing collision calculation (cherry picked from commit 7938c22) * Replace image cache with dummy bind group in collision shader (cherry picked from commit cbbf696) * Update collision preview when map changes (cherry picked from commit 2ad9e87) * Fix fog and collision not rendering when events are disabled (cherry picked from commit b47e70b) * Add collision preview to tilepicker as well (cherry picked from commit c5dd6d0) * Collision preview now ignores disabled map layers (cherry picked from commit 28e17bf) * Fix labels in layer picker not aligning with checkboxes (cherry picked from commit e777057) * Bind viewport to group 0 instead of using dummy layout (cherry picked from commit 74874f2) * Fix crash when map has tile IDs larger than tileset size * Fix crash when tileset `passages` is smaller than the tileset * Use `copy_from_slice` to calculate tilepicker passages * Remove extra vertices from collision shader * Collision shader `calculate_vertices` now returns an array instead of a vector * Fix collision calculation edge cases * Simplify `calculate_passage`
- Loading branch information
Showing
14 changed files
with
834 additions
and
52 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
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,50 @@ | ||
struct VertexInput { | ||
@location(0) position: vec3<f32>, | ||
@location(1) direction: u32, | ||
} | ||
|
||
struct InstanceInput { | ||
@location(2) tile_position: vec3<f32>, | ||
@location(3) passage: u32, | ||
} | ||
|
||
struct VertexOutput { | ||
@builtin(position) clip_position: vec4<f32>, | ||
} | ||
|
||
struct Viewport { | ||
proj: mat4x4<f32>, | ||
} | ||
|
||
#if USE_PUSH_CONSTANTS == true | ||
struct PushConstants { | ||
viewport: Viewport, | ||
} | ||
var<push_constant> push_constants: PushConstants; | ||
#else | ||
@group(0) @binding(0) | ||
var<uniform> viewport: Viewport; | ||
#endif | ||
|
||
@vertex | ||
fn vs_main(vertex: VertexInput, instance: InstanceInput) -> VertexOutput { | ||
var out: VertexOutput; | ||
|
||
#if USE_PUSH_CONSTANTS == true | ||
let viewport = push_constants.viewport; | ||
#endif | ||
|
||
if (instance.passage & vertex.direction) == 0u { | ||
return out; | ||
} | ||
|
||
let position = viewport.proj * vec4<f32>(vertex.position.xy + (instance.tile_position.xy * 32.), 0.0, 1.0); | ||
out.clip_position = vec4<f32>(position.xy, instance.tile_position.z, 1.0); | ||
|
||
return out; | ||
} | ||
|
||
@fragment | ||
fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> { | ||
return vec4<f32>(1., 0., 0., 0.4); | ||
} |
Oops, something went wrong.