mirror of
https://github.com/bevyengine/bevy
synced 2024-12-20 18:13:10 +00:00
38766faccb
fixes #6799 # Objective We should be able to reuse the `Globals` or `View` shader struct definitions from anywhere (including third party plugins) without needing to worry about defining unrelated shader defs. Also we'd like to refactor these structs to not be repeatedly defined. ## Solution Refactor both `Globals` and `View` into separate importable shaders. Use the imports throughout. Co-authored-by: Torstein Grindvik <52322338+torsteingrindvik@users.noreply.github.com>
16 lines
475 B
WebGPU Shading Language
16 lines
475 B
WebGPU Shading Language
#define_import_path bevy_render::globals
|
|
|
|
struct Globals {
|
|
// The time since startup in seconds
|
|
// Wraps to 0 after 1 hour.
|
|
time: f32,
|
|
// The delta time since the previous frame in seconds
|
|
delta_time: f32,
|
|
// Frame count since the start of the app.
|
|
// It wraps to zero when it reaches the maximum value of a u32.
|
|
frame_count: u32,
|
|
#ifdef SIXTEEN_BYTE_ALIGNMENT
|
|
// WebGL2 structs must be 16 byte aligned.
|
|
_webgl2_padding: f32
|
|
#endif
|
|
};
|