fixes across crates after changes to ecs
This commit is contained in:
parent
c0df9f2d65
commit
70fecc8cdd
|
@ -1,8 +1,5 @@
|
|||
use lyra_engine::{
|
||||
game::Game,
|
||||
input::{ActionHandler, CommonActionLabel},
|
||||
math::{Quat, Vec3, EulerRot},
|
||||
plugin::Plugin, ecs::{Component, query::{Res, View}}, DeltaTime, scene::CameraComponent,
|
||||
ecs::{query::{Res, View}, Component}, game::Game, input::ActionHandler, math::{EulerRot, Quat, Vec3}, plugin::Plugin, scene::CameraComponent, DeltaTime
|
||||
};
|
||||
|
||||
/* enum FreeFlyCameraActions {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::ptr::NonNull;
|
||||
|
||||
use lyra_engine::{math::{self, Vec3}, math::Transform, input::{KeyCode, ActionHandler, Action, ActionKind, LayoutId, ActionMapping, ActionSource, ActionMappingId, InputActionPlugin, MouseInput, MouseAxis, CommonActionLabel}, game::Game, render::{window::{CursorGrabMode, WindowOptions}, light::{PointLight, directional::DirectionalLight, SpotLight}}, change_tracker::Ct, ecs::{system::{Criteria, CriteriaSchedule, BatchedSystem, IntoSystem}, world::World, Component}, DeltaTime, scene::{ModelComponent, CameraComponent}, lua::{LuaScriptingPlugin, LuaScript}, Script, ScriptList};
|
||||
use lyra_engine::{math::{self, Vec3}, math::Transform, input::{KeyCode, ActionHandler, Action, ActionKind, LayoutId, ActionMapping, ActionSource, ActionMappingId, InputActionPlugin, MouseInput, MouseAxis, CommonActionLabel}, game::Game, render::{window::{CursorGrabMode, WindowOptions}, light::{PointLight, directional::DirectionalLight, SpotLight}}, change_tracker::Ct, ecs::{system::{Criteria, CriteriaSchedule, BatchedSystem, IntoSystem}, World, Component}, DeltaTime, scene::{ModelComponent, CameraComponent}, lua::{LuaScriptingPlugin, LuaScript}, Script, ScriptList};
|
||||
use lyra_engine::assets::{ResourceManager, Model};
|
||||
|
||||
mod free_fly_camera;
|
||||
|
@ -88,6 +88,7 @@ async fn main() {
|
|||
//let cube_model = resman.request::<Model>("assets/cube-texture-bin.glb").unwrap();
|
||||
let cube_model = resman.request::<Model>("assets/texture-sep/texture-sep.gltf").unwrap();
|
||||
let crate_model = resman.request::<Model>("assets/crate/crate.gltf").unwrap();
|
||||
//let sponza_model = resman.request::<Model>("assets/sponza/Sponza.gltf").unwrap();
|
||||
drop(resman);
|
||||
|
||||
/* world.spawn((
|
||||
|
@ -95,6 +96,11 @@ async fn main() {
|
|||
Transform::from_xyz(0.0, -5.0, -10.0),
|
||||
)); */
|
||||
|
||||
/* world.spawn((
|
||||
ModelComponent(sponza_model),
|
||||
Transform::from_xyz(0.0, 0.0, 0.0),
|
||||
)); */
|
||||
|
||||
{
|
||||
let cube_tran = Transform::from_xyz(-3.5, 0.0, -8.0);
|
||||
//cube_tran.rotate_y(math::Angle::Degrees(180.0));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use instant::Instant;
|
||||
use lyra_ecs::{Component, world::World};
|
||||
use lyra_ecs::{Component, World};
|
||||
use lyra_reflect::Reflect;
|
||||
|
||||
use crate::{plugin::Plugin, game::GameStages};
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::{sync::Arc, collections::VecDeque, ptr::NonNull};
|
|||
|
||||
use async_std::task::block_on;
|
||||
|
||||
use lyra_ecs::{world::World, system::{System, IntoSystem}};
|
||||
use lyra_ecs::{World, system::{System, IntoSystem}};
|
||||
use tracing::{info, error, Level};
|
||||
use tracing_appender::non_blocking;
|
||||
use tracing_subscriber::{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::{collections::HashMap, ops::Deref, hash::{Hash, DefaultHasher, Hasher}, fmt::Debug};
|
||||
|
||||
use glam::Vec2;
|
||||
use lyra_ecs::world::World;
|
||||
use lyra_ecs::World;
|
||||
use lyra_reflect::Reflect;
|
||||
|
||||
use crate::{plugin::Plugin, game::GameStages, EventQueue};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::ptr::NonNull;
|
||||
|
||||
use glam::Vec2;
|
||||
use lyra_ecs::{world::World, system::IntoSystem};
|
||||
use lyra_ecs::{World, system::IntoSystem};
|
||||
use winit::event::MouseScrollDelta;
|
||||
|
||||
use crate::{EventQueue, plugin::Plugin, game::GameStages};
|
||||
|
|
|
@ -2,7 +2,7 @@ pub mod point;
|
|||
pub mod directional;
|
||||
pub mod spotlight;
|
||||
|
||||
use lyra_ecs::{Entity, Tick, world::World, query::{Entities, TickOf}};
|
||||
use lyra_ecs::{Entity, Tick, World, query::{Entities, TickOf}};
|
||||
pub use point::*;
|
||||
pub use spotlight::*;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use instant::Instant;
|
|||
use itertools::izip;
|
||||
use lyra_ecs::Entity;
|
||||
use lyra_ecs::query::{Entities, TickOf};
|
||||
use lyra_ecs::world::World;
|
||||
use lyra_ecs::World;
|
||||
use tracing::{debug, warn};
|
||||
use wgpu::{BindGroupLayout, Limits};
|
||||
use wgpu::util::DeviceExt;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use glam::{Vec2, IVec2};
|
||||
use lyra_ecs::world::World;
|
||||
use lyra_ecs::World;
|
||||
use tracing::{warn, error};
|
||||
use winit::{window::{Window, Fullscreen}, dpi::{LogicalPosition, LogicalSize, PhysicalPosition}, error::ExternalError};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::{any::TypeId, any::Any, cell::{Ref, RefMut}};
|
||||
|
||||
use lyra_ecs::{world::World, DynamicBundle, Component, Entity, ComponentInfo};
|
||||
use lyra_ecs::World;
|
||||
|
||||
extern crate self as lyra_reflect;
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ impl ModelLoader {
|
|||
|
||||
fn process_node(buffers: &Vec<Vec<u8>>, materials: &Vec<Material>, node: gltf::Node<'_>) -> Vec<Mesh> {
|
||||
let mut meshes = vec![];
|
||||
//node.transform()
|
||||
|
||||
if let Some(mesh) = node.mesh() {
|
||||
for prim in mesh.primitives() {
|
||||
let reader = prim.reader(|buf| Some(buffers[buf.index()].as_slice()));
|
||||
|
|
|
@ -27,7 +27,7 @@ impl<'a> Fetch<'a> for FetchDynamicType {
|
|||
unsafe fn get_item(&mut self, entity: ArchetypeEntityId) -> Self::Item {
|
||||
let ptr = unsafe { self.col.as_ref().borrow_ptr() };
|
||||
let ptr = NonNull::new_unchecked(ptr.as_ptr()
|
||||
.add(entity.0 as usize * self.info.layout.size));
|
||||
.add(entity.0 as usize * self.info.layout().size()));
|
||||
|
||||
DynamicType {
|
||||
info: self.info,
|
||||
|
@ -96,7 +96,7 @@ impl Iterator for DynamicViewIter {
|
|||
}
|
||||
|
||||
let arch = unsafe { self.archetypes.get_unchecked(self.next_archetype - 1).as_ref() };
|
||||
let entity = arch.entity_of_index(entity_index).unwrap();
|
||||
let entity = arch.entity_at_index(entity_index).unwrap();
|
||||
let row = DynamicViewRow {
|
||||
entity,
|
||||
item: fetch_res,
|
||||
|
@ -112,7 +112,7 @@ impl Iterator for DynamicViewIter {
|
|||
self.next_archetype += 1;
|
||||
let arch = unsafe { self.archetypes.get_unchecked(arch_id).as_ref() };
|
||||
|
||||
if arch.entities().len() == 0 {
|
||||
if arch.entity_indexes().len() == 0 {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ impl Iterator for DynamicViewIter {
|
|||
.map(|q| unsafe { q.fetch(world, ArchetypeId(arch_id as u64), arch) } )
|
||||
.map(|f| FetchDynamicType::from(f))
|
||||
.collect();
|
||||
self.component_indices = 0..arch.entities().len() as u64;
|
||||
self.component_indices = 0..arch.entity_indexes().len() as u64;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ impl ReflectedIterator {
|
|||
|
||||
let mut dynamic_row = vec![];
|
||||
for d in row.item.iter() {
|
||||
let id = d.info.type_id.as_rust();
|
||||
let id = d.info.type_id().as_rust();
|
||||
let reflected_components =
|
||||
unsafe { self.reflected_components.as_ref().unwrap().as_ref() };
|
||||
|
||||
|
|
|
@ -192,14 +192,14 @@ impl elua::Userdata for ScriptWorldPtr {
|
|||
let lua_comp = reflect_user_data(ud);
|
||||
let refl_comp =
|
||||
lua_comp.reflect_branch.as_component_unchecked();
|
||||
refl_comp.info.type_id.as_rust()
|
||||
}
|
||||
refl_comp.info.type_id().as_rust()
|
||||
},
|
||||
elua::Value::Table(tbl) => {
|
||||
let name: String = tbl.get(elua::MetaMethod::Name)?;
|
||||
|
||||
let lookup = world.get_resource::<LuaTableProxyLookup>();
|
||||
*lookup.typeid_from_name.get(&name).unwrap()
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
panic!("A userdata or table value was not returned!");
|
||||
// TODO: Handle properly
|
||||
|
@ -209,8 +209,8 @@ impl elua::Userdata for ScriptWorldPtr {
|
|||
// update the component tick
|
||||
let world = unsafe { this.inner.as_mut() };
|
||||
let arch = world.entity_archetype_mut(row.entity).unwrap();
|
||||
let idx = arch.entities().get(&row.entity).unwrap().clone();
|
||||
let c = arch.get_column_mut(lua_typeid.into()).unwrap();
|
||||
let idx = arch.entity_indexes().get(&row.entity).unwrap().clone();
|
||||
let c = arch.get_column_mut(lua_typeid).unwrap();
|
||||
c.entity_ticks[idx.0 as usize] = current;
|
||||
|
||||
// apply the new component data
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::ptr::NonNull;
|
||||
|
||||
use lyra_ecs::{world::World, Entity};
|
||||
use lyra_ecs::{World, Entity};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ScriptEntity(pub Entity);
|
||||
|
|
Loading…
Reference in New Issue