MAJOR rendering overhaul. Snow deformation, persistent light, flowmap out. Also ECS architexture overhaul

This commit is contained in:
Jonas H
2026-03-03 19:30:41 +01:00
parent f615810509
commit 08ddaa2c5d
56 changed files with 2737 additions and 3463 deletions

53
src/bundles/spotlight.rs Normal file
View File

@@ -0,0 +1,53 @@
use glam::Vec3;
use crate::bundles::Bundle;
use crate::components::RotateComponent;
use crate::entity::EntityHandle;
use crate::loaders::lights::LightData;
use crate::world::{Transform, World};
pub struct SpotlightBundle
{
pub light_data: LightData,
}
impl Bundle for SpotlightBundle
{
fn spawn(self, world: &mut World) -> Result<EntityHandle, String>
{
let entity = world.spawn();
let transform = Transform::from_matrix(self.light_data.transform);
world.transforms.insert(entity, transform);
world.spotlights.insert(entity, self.light_data.component);
if let Some(tag) = self.light_data.tag
{
if tag == "lighthouse"
{
world
.rotates
.insert(entity, RotateComponent::new(Vec3::Y, 1.0));
}
}
Ok(entity)
}
}
pub fn spawn_spotlights(world: &mut World, spotlights: Vec<LightData>)
{
for light_data in spotlights
{
let entity = world.spawn();
let transform = Transform::from_matrix(light_data.transform);
world.transforms.insert(entity, transform);
world.spotlights.insert(entity, light_data.component);
if let Some(tag) = light_data.tag
{
if tag == "lighthouse"
{
world
.rotates
.insert(entity, RotateComponent::new(Vec3::Y, 1.0));
}
}
}
}