use super::*;
use crate::physics::behaviors::BehaviorBlock;
use crate::physics::classes::{ReplicationClass, SimulationMode};
use crate::physics::collision::{CollisionMode, CollisionPolicy};
use crate::physics::emitter::*;
use crate::physics::promotion::PromotionPolicy;
use crate::physics::render_mode::{RenderMode, RepresentationMode};
use crate::physics::render_policy::RenderPolicy;
use crate::physics::semantic_binding::SemanticBinding;
fn base_entry(id: &str, name: &str) -> PresetCatalogEntry {
PresetCatalogEntry {
id: id.into(),
name: name.into(),
family: PresetFamily::CoreMotion,
authority: AuthorityProfile::VisualOnly,
semantics: SemanticBinding::default(),
shape: SpawnShape::Point,
spawn: SpawnPolicy {
mode: SpawnMode::Continuous,
rate_per_sec: 20.0,
burst_count: 0,
max_live: 200,
warmup_seconds: 0.0,
looped: true,
seed: 0,
density_scale_lod: false,
},
initialize: InitPolicy::default(),
simulate: SimPolicy {
mode: SimulationMode::Full,
gravity: [0.0, 0.0, 0.0],
drag: 0.02,
damping: 0.01,
noise: None,
forces: vec![],
lifetime: LifetimePolicy {
seconds: 3.0,
random_range: None,
},
behaviors: vec![],
},
collision: CollisionPolicy {
mode: CollisionMode::None,
..CollisionPolicy::default()
},
render: RenderPolicy {
mode: RenderMode::Billboard,
..RenderPolicy::default()
},
promotion: PromotionPolicy::default(),
budgets: BudgetPolicy {
max_gpu_particles: 200,
importance: "Low".into(),
offscreen_mode: SimulationMode::Culled,
},
replication: ReplicationPolicy {
class: ReplicationClass::None,
},
supported_views: vec![RepresentationMode::World3D, RepresentationMode::Sprite2D],
tags: vec!["core".into(), "motion".into()],
}
}
pub fn catalog() -> Vec<PresetCatalogEntry> {
vec![
{
let mut e = base_entry("core_idle_motes", "Idle Motes");
e.spawn.rate_per_sec = 5.0;
e.simulate.lifetime.seconds = 4.0;
e.tags.push("ambient".into());
e
},
{
let mut e = base_entry("core_float_up", "Float Up");
e.simulate.gravity = [0.0, 0.5, 0.0];
e.tags.push("rise".into());
e
},
{
let mut e = base_entry("core_fall_down", "Fall Down");
e.simulate.gravity = [0.0, -9.81, 0.0];
e.tags.push("gravity".into());
e
},
{
let mut e = base_entry("core_radial_burst", "Radial Burst");
e.spawn = SpawnPolicy {
mode: SpawnMode::Burst,
burst_count: 50,
max_live: 50,
rate_per_sec: 0.0,
warmup_seconds: 0.0,
looped: false,
seed: 0,
density_scale_lod: false,
};
e.shape = SpawnShape::Sphere { radius: 0.1 };
e.tags.push("burst".into());
e
},
{
let mut e = base_entry("core_cone_spray", "Cone Spray");
e.shape = SpawnShape::Cone {
radius: 0.5,
angle_radians: 0.8,
};
e.spawn.rate_per_sec = 40.0;
e.tags.push("spray".into());
e
},
{
let mut e = base_entry("core_ring_emit", "Ring Emit");
e.shape = SpawnShape::Ring {
radius: 1.0,
thickness: 0.1,
};
e.tags.push("ring".into());
e
},
{
let mut e = base_entry("core_line_emit", "Line Emit");
e.shape = SpawnShape::Line { length: 2.0 };
e.tags.push("line".into());
e
},
{
let mut e = base_entry("core_box_fill", "Box Fill");
e.shape = SpawnShape::Box {
extents: [1.0, 1.0, 1.0],
};
e.tags.push("volume".into());
e
},
{
let mut e = base_entry("core_orbit", "Orbit");
e.simulate.behaviors = vec![BehaviorBlock::Orbit];
e.tags.push("orbit".into());
e
},
{
let mut e = base_entry("core_seek_target", "Seek Target");
e.simulate.behaviors = vec![BehaviorBlock::Seek];
e.tags.push("seek".into());
e
},
{
let mut e = base_entry("core_wobble_drift", "Wobble Drift");
e.simulate.behaviors = vec![BehaviorBlock::Wobble, BehaviorBlock::Drift];
e.tags.push("wobble".into());
e
},
{
let mut e = base_entry("core_falloff_burst", "Falloff Burst");
e.spawn = SpawnPolicy {
mode: SpawnMode::Burst,
burst_count: 100,
max_live: 100,
rate_per_sec: 0.0,
warmup_seconds: 0.0,
looped: false,
seed: 0,
density_scale_lod: false,
};
e.simulate.drag = 0.15;
e.simulate.gravity = [0.0, -2.0, 0.0];
e.tags.push("falloff".into());
e
},
]
}