pub enum ShaderAsset {
Path(&'static str),
Source {
file_name: &'static str,
fragment: &'static str,
},
Stored(&'static str),
}Expand description
Represents a shader asset that can be loaded from a file path, embedded as source,
or looked up from the runtime shader storage in [MaterialManager].
Path is loaded from the filesystem at runtime (useful for development/hot-reloading).
Source embeds the shader in the binary (via include_str!).
Stored references a named entry in the shader storage, enabling runtime-updateable shader code.
Variants§
Path(&'static str)
Path to a compiled .glsl file, loaded at runtime
Source
Embedded GLSL ES 3.00 fragment shader source
Fields
Stored(&'static str)
References a named entry in the runtime shader storage.
Implementations§
Source§impl ShaderAsset
impl ShaderAsset
Sourcepub fn fragment_source(&self) -> Cow<'static, str>
pub fn fragment_source(&self) -> Cow<'static, str>
Returns the fragment shader source.
For Path variant, reads the file synchronously.
For Source variant, returns a borrowed reference (zero-copy).
For Stored variant, looks up the source from the global shader storage.
Trait Implementations§
Source§impl Clone for ShaderAsset
impl Clone for ShaderAsset
Source§fn clone(&self) -> ShaderAsset
fn clone(&self) -> ShaderAsset
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more