-
-
Notifications
You must be signed in to change notification settings - Fork 746
Conversation
vertex skinning and examples and book not fixed yet |
sprite_animation works now in a code-first way and not prefabs. we are ironing out the last bit of how prefabs should work still. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall nice work.
use uuid::Uuid; | ||
|
||
impl TypeUuid for Sampler<MaterialPrimitive> { | ||
const UUID: type_uuid::Bytes = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we hide those behind a macro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately TypeUuid doesn't support generic types yet, so this is a workaround: randomPoison/type-uuid#4
amethyst_animation/src/bundle.rs
Outdated
"vertex_skinning_system", | ||
self.dep, | ||
); | ||
// FIXME: builder.add_system(VertexSkinningSystem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is missing for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think i've converted it now, but we won't be able to test until the gltf example is working.
@@ -42,15 +33,11 @@ pub trait AnimationSampling: Send + Sync + 'static + for<'b> ApplyData<'b> { | |||
&mut self, | |||
channel: &Self::Channel, | |||
data: &Self::Primitive, | |||
extra: &<Self as ApplyData<'a>>::ApplyData, | |||
buffer: &mut CommandBuffer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we enforce the same naming schema for all CommandBuffers in fn arguments inside of amethyst?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only see one instance of it being named differently, in the removal util. I think it would be good to stay consistent but I don't know of a linting tool to enforce it. Do you have something in mind?
examples/sprite_animation/main.rs
Outdated
|
||
{ | ||
let loader = resources | ||
.get_mut::<DefaultLoader>() | ||
.expect("Missing loader"); | ||
// let bat_prefab = loader.load("prefab/sprite_animation.ron"); | ||
// let arrow_test_prefab = loader.load("prefab/sprite_animation_test.ron"); | ||
|
||
let texture = loader.load("texture/bat.32x32.png"); | ||
let sprites = loader.load("sprites/bat.ron"); | ||
let sprite_sheet_store = resources.get::<ProcessingQueue<SpriteSheet>>().unwrap(); | ||
let sheet: Handle<SpriteSheet> = | ||
loader.load_from_data(SpriteSheet { texture, sprites }, (), &sprite_sheet_store); | ||
|
||
//let anims: Handle<Sampler<SpriteRenderPrimitive>> = loader.load("anims/bat.ron"); | ||
let anims = loader.load_from_data( | ||
Sampler::<SpriteRenderPrimitive> { | ||
input: vec![0.0, 0.2, 0.4, 0.6, 0.8, 1.0], | ||
output: vec![ | ||
SpriteRenderPrimitive::SpriteIndex(4), | ||
SpriteRenderPrimitive::SpriteIndex(3), | ||
SpriteRenderPrimitive::SpriteIndex(2), | ||
SpriteRenderPrimitive::SpriteIndex(1), | ||
SpriteRenderPrimitive::SpriteIndex(0), | ||
], | ||
function: InterpolationFunction::Step, | ||
}, | ||
(), | ||
&resources | ||
.get::<ProcessingQueue<Sampler<SpriteRenderPrimitive>>>() | ||
.unwrap(), | ||
); | ||
let mut anim_set = AnimationSet::new(); | ||
let anim_handle: Handle<Animation<SpriteRender>> = loader.load_from_data( | ||
Animation::<SpriteRender>::new_single( | ||
0, | ||
amethyst_animation::SpriteRenderChannel::SpriteIndex, | ||
anims, | ||
), | ||
self.progress_counter.as_mut().unwrap(), | ||
) | ||
}); | ||
&resources | ||
.get::<ProcessingQueue<Animation<SpriteRender>>>() | ||
.unwrap(), | ||
); | ||
anim_set.insert(AnimationId::Fly, anim_handle); | ||
|
||
world.push((SpriteRender::new(sheet, 0), Transform::default(), anim_set)); | ||
} | ||
// Creates new entities with components from MyPrefabData | ||
world.create_entity().with(bat_prefab).build(); | ||
world.create_entity().with(arrow_test_prefab).build(); | ||
// world.create_entity().with(bat_prefab).build(); | ||
// world.create_entity().with(arrow_test_prefab).build(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this ok for now. Do we want to revert his when asset loading is fully working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm working on prefabs later, plus there is prior conversation throughout the issues of making the examples rely less on prefabs. The fastest way to get there is to port examples away from prefabs and possibly convert them back later. We should rely on user feedback as to whether or not they need prefabs for a given example.
This example works in this state to demonstrate an animated sprite so I'm happy with it as is. I think examples like this one should be focused on demonstrating the programmatic API rather than the magic of prefabs.
I have some work in progress towards a big prefab example that demos a bunch of different prefabs and swapping between them. With the legion-prefab approach you are essentially just serializing the component directly.
let (width, height) = { | ||
let dim = world.read_resource::<ScreenDimensions>(); | ||
let dim = resources.get::<ScreenDimensions>().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably use an except here. Helps new users if they copy code from the examples.
amethyst_animation
to Legion
this is blocking gltf, animation example, and my debug-lines example fix so I am going to merge now that i've fixed @valkum's concerns |
Description
Continuing work from #2351 to get amethyst_animation working with legion
but I've hit an impasse and my legion skills aren't developed enough yet to pick a best path forward. The AnimationControlSystem wants to pass a mutable world reference through theEdit: just used a world split and seems alright.process_animation_control
chain but that makes borrow checker unhappy. Will need to either passVec<(Entity, EntryMut)>
in place of hierarchy or something else. Any suggestions?