Class: Assimp::AnimationCopier
- Inherits:
-
Object
- Object
- Assimp::AnimationCopier
- Defined in:
- lib/assimp/animation_copier.rb
Instance Method Summary collapse
- #copy(pointer) ⇒ Object
-
#initialize(native: Native) ⇒ AnimationCopier
constructor
A new instance of AnimationCopier.
Constructor Details
#initialize(native: Native) ⇒ AnimationCopier
Returns a new instance of AnimationCopier.
5 6 7 8 9 |
# File 'lib/assimp/animation_copier.rb', line 5 def initialize(native: Native) current_keys = native.version[1] >= 4 @vector_key_type = current_keys ? Native::VectorKey : Native::LegacyVectorKey @quaternion_key_type = current_keys ? Native::QuatKey : Native::LegacyQuatKey end |
Instance Method Details
#copy(pointer) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/assimp/animation_copier.rb', line 11 def copy(pointer) source = Native::Animation.new(pointer) channels = NativeReader.pointers(source[:channels], source[:num_channels]).map do |channel_pointer| copy_channel(channel_pointer) end.freeze Animation.new( name: source[:name].to_s, duration_ticks: source[:duration], ticks_per_second: source[:ticks_per_second], channels: ) end |