Mesh_Entities!
This commit is contained in:
@@ -158,11 +158,12 @@ animation_time_normalized :: (e: *Entity) -> float {
|
||||
|
||||
sample_animation_state :: (e: *Entity, index: s32, weight: float) {
|
||||
state := *e.animator.states[index];
|
||||
model := get_model_by_handle(e.renderable.model);
|
||||
|
||||
if state.type == {
|
||||
case .SINGLE;
|
||||
{
|
||||
animation := *e.renderable.model.animations[state.single.index];
|
||||
animation := *model.animations[state.single.index];
|
||||
sample_animation(e, animation, min(state.single.time, cast(float)animation.duration - 0.0001), weight);
|
||||
}
|
||||
case .BLEND_TREE_1D;
|
||||
@@ -187,8 +188,8 @@ sample_animation_state :: (e: *Entity, index: s32, weight: float) {
|
||||
range := p1_position - p0_position;
|
||||
alpha := position / range;
|
||||
|
||||
anim0 := e.renderable.model.animations[state.blend_tree.points[p0].index];
|
||||
anim1 := e.renderable.model.animations[state.blend_tree.points[p1].index];
|
||||
anim0 := model.animations[state.blend_tree.points[p0].index];
|
||||
anim1 := model.animations[state.blend_tree.points[p1].index];
|
||||
time0 := state.blend_tree.points[p0].time;
|
||||
time1 := state.blend_tree.points[p1].time;
|
||||
|
||||
@@ -213,13 +214,14 @@ transition_to_animation_state :: (e: *Entity, index: s32, transition_duration: f
|
||||
|
||||
update_animation_state :: (e: *Entity, index: s32, dt: float) {
|
||||
state := *e.animator.states[index];
|
||||
model := get_model_by_handle(e.renderable.model);
|
||||
|
||||
if state.type == {
|
||||
case .SINGLE;
|
||||
{
|
||||
state.single.time += dt * state.single.multiplier;
|
||||
|
||||
animation := *e.renderable.model.animations[state.single.index];
|
||||
animation := *model.animations[state.single.index];
|
||||
|
||||
if state.single.time > animation.duration {
|
||||
if state.single.looping {
|
||||
@@ -238,7 +240,7 @@ update_animation_state :: (e: *Entity, index: s32, dt: float) {
|
||||
for *p: state.blend_tree.points {
|
||||
p.time += dt * p.multiplier;
|
||||
|
||||
animation := *e.renderable.model.animations[p.index];
|
||||
animation := *model.animations[p.index];
|
||||
|
||||
if p.time > animation.duration {
|
||||
if p.looping {
|
||||
@@ -259,7 +261,6 @@ update_animator :: (e: *Entity, animator: *Animator, dt: float) {
|
||||
it.transform.position = .{0,0,0};
|
||||
it.transform.scale = .{0,0,0};
|
||||
it.transform.orientation = .{0,0,0,0};
|
||||
it.has_sampled_animation = false;
|
||||
}
|
||||
|
||||
if animator.playing_transition {
|
||||
|
||||
Reference in New Issue
Block a user