Expand description
Texture loading and configuration for shaders.
This module provides texture support for particle simulations, allowing custom textures to be loaded from files or generated procedurally and sampled in fragment, post-process, and compute shaders.
§Quick Start
ⓘ
use rdpe::prelude::*;
Simulation::<Particle>::new()
.with_texture("noise", "assets/noise.png")
.with_fragment_shader(r#"
let n = textureSample(tex_noise, tex_noise_sampler, in.uv * 0.5 + 0.5);
return vec4<f32>(in.color * n.r, 1.0);
"#)
.run();§Texture Names in Shaders
Each texture you add with .with_texture("name", ...) becomes available
in your shaders as:
tex_name- the texture itselftex_name_sampler- the sampler for that texture
§Supported Formats
- PNG (recommended)
- JPEG
Structs§
- Texture
Config - Configuration for a single texture.
- Texture
Registry - Holds all texture configurations for a simulation.
Enums§
- Address
Mode - Address mode for texture wrapping.
- Filter
Mode - Filter mode for texture sampling.