Module textures

Module textures 

Source
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 itself
  • tex_name_sampler - the sampler for that texture

§Supported Formats

  • PNG (recommended)
  • JPEG

Structs§

TextureConfig
Configuration for a single texture.
TextureRegistry
Holds all texture configurations for a simulation.

Enums§

AddressMode
Address mode for texture wrapping.
FilterMode
Filter mode for texture sampling.