class CrShader::Compute::ParticleSimulationBuilder

Overview

========================================================================= Declarative DSL Layer: Ergonomic Compute Particle Simulation Builder

Provides block-receiver builders (yield ctx) to configure compute particle simulations and synthesize either .crshader DSL or GLSL 450 compute shaders automatically.

Defined in:

crshader/compute/particle_simulation_dsl.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String = "ParticleSimulation") #

Instance Method Detail

def add_attractor(type : AttractorType = AttractorType::Point, x : Float32 = 0.0_f32, y : Float32 = 5.0_f32, z : Float32 = 0.0_f32, strength : Float32 = 15.0_f32, radius : Float32 = 20.0_f32, falloff : Float32 = 2.0_f32) : self #

def attractors : Array(ForceAttractor) #

def attractors=(attractors : Array(ForceAttractor)) #

def bounds : DomainBounds #

def bounds=(bounds : DomainBounds) #

def buffer_binding : Int32 #

def buffer_binding=(buffer_binding : Int32) #

def buffer_set : Int32 #

def buffer_set=(buffer_set : Int32) #

def build_engine : ParticleSimulationEngine #

Builds the pure core engine configured by this declarative builder


def capacity : Int32 #

def capacity=(capacity : Int32) #

def curl_turbulence(strength : Float32, scale : Float32 = 0.25_f32) : self #

def domain_bounds(mode : BoundaryMode = BoundaryMode::Bounce, min_x : Float32 = -10.0_f32, min_y : Float32 = 0.0_f32, min_z : Float32 = -10.0_f32, max_x : Float32 = 10.0_f32, max_y : Float32 = 20.0_f32, max_z : Float32 = 10.0_f32, restitution : Float32 = 0.7_f32) : self #

def drag : Float32 #

def drag=(drag : Float32) #

def gravity(x : Float32, y : Float32, z : Float32) : self #

def gravity_x : Float32 #

def gravity_x=(gravity_x : Float32) #

def gravity_y : Float32 #

def gravity_y=(gravity_y : Float32) #

def gravity_z : Float32 #

def gravity_z=(gravity_z : Float32) #

def integration(mode : IntegratorMode) : self #

def integrator : IntegratorMode #

def integrator=(integrator : IntegratorMode) #

def linear_drag(coeff : Float32) : self #

def local_size_x : Int32 #

def local_size_x=(local_size_x : Int32) #

def max_particles(count : Int32) : self #

def name : String #

def noise_scale : Float32 #

def noise_scale=(noise_scale : Float32) #

def to_crshader_source : String #

Synthesizes a valid CRShader source string (.crshader) for this particle simulation


def turbulence : Float32 #

def turbulence=(turbulence : Float32) #

def workgroup_size(x : Int32) : self #