Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
impeller::scene::TimelineResolver Class Reference

#include <property_resolver.h>

Inheritance diagram for impeller::scene::TimelineResolver:
impeller::scene::PropertyResolver impeller::scene::RotationTimelineResolver impeller::scene::ScaleTimelineResolver impeller::scene::TranslationTimelineResolver

Classes

struct  TimelineKey
 

Public Member Functions

virtual ~TimelineResolver ()
 
SecondsF GetEndTime ()
 
- Public Member Functions inherited from impeller::scene::PropertyResolver
virtual ~PropertyResolver ()
 
virtual SecondsF GetEndTime ()=0
 
virtual void Apply (AnimationTransforms &target, SecondsF time, Scalar weight)=0
 Resolve and apply the property value to a target node. This operation is additive; a given node property may be amended by many different PropertyResolvers prior to rendering. For example, an AnimationPlayer may blend multiple Animations together by applying several AnimationClips. More...
 

Protected Member Functions

TimelineKey GetTimelineKey (SecondsF time)
 

Protected Attributes

std::vector< Scalartimes_
 

Additional Inherited Members

- Static Public Member Functions inherited from impeller::scene::PropertyResolver
static std::unique_ptr< TranslationTimelineResolverMakeTranslationTimeline (std::vector< Scalar > times, std::vector< Vector3 > values)
 
static std::unique_ptr< RotationTimelineResolverMakeRotationTimeline (std::vector< Scalar > times, std::vector< Quaternion > values)
 
static std::unique_ptr< ScaleTimelineResolverMakeScaleTimeline (std::vector< Scalar > times, std::vector< Vector3 > values)
 

Detailed Description

Definition at line 53 of file property_resolver.h.

Constructor & Destructor Documentation

◆ ~TimelineResolver()

impeller::scene::TimelineResolver::~TimelineResolver ( )
virtualdefault

Member Function Documentation

◆ GetEndTime()

SecondsF impeller::scene::TimelineResolver::GetEndTime ( )
virtual

Implements impeller::scene::PropertyResolver.

Definition at line 55 of file property_resolver.cc.

55 {
56 if (times_.empty()) {
57 return SecondsF::zero();
58 }
59 return SecondsF(times_.back());
60}
std::chrono::duration< float > SecondsF
Definition: timing.h:13

◆ GetTimelineKey()

TimelineResolver::TimelineKey impeller::scene::TimelineResolver::GetTimelineKey ( SecondsF  time)
protected

Definition at line 62 of file property_resolver.cc.

62 {
63 if (times_.size() <= 1 || time.count() <= times_.front()) {
64 return {.index = 0, .lerp = 1};
65 }
66 if (time.count() >= times_.back()) {
67 return {.index = times_.size() - 1, .lerp = 1};
68 }
69 auto it = std::lower_bound(times_.begin(), times_.end(), time.count());
70 size_t index = std::distance(times_.begin(), it);
71
72 Scalar previous_time = *(it - 1);
73 Scalar next_time = *it;
74 return {.index = index,
75 .lerp = (time.count() - previous_time) / (next_time - previous_time)};
76}
float Scalar
Definition: scalar.h:18
static double time(int loops, Benchmark *bench, Target *target)
Definition: nanobench.cpp:394

Member Data Documentation

◆ times_

std::vector<Scalar> impeller::scene::TimelineResolver::times_
protected

Definition at line 70 of file property_resolver.h.


The documentation for this class was generated from the following files: