Class: Assimp::Animation

Inherits:
Object
  • Object
show all
Defined in:
lib/assimp/animation.rb

Constant Summary collapse

DEFAULT_TICKS_PER_SECOND =
25.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, duration_ticks:, ticks_per_second:, channels:) ⇒ Animation

Returns a new instance of Animation.



11
12
13
14
15
16
17
# File 'lib/assimp/animation.rb', line 11

def initialize(name:, duration_ticks:, ticks_per_second:, channels:)
  @name = String(name).dup.freeze
  @duration_ticks = Float(duration_ticks)
  @ticks_per_second = Float(ticks_per_second)
  @channels = channels.freeze
  freeze
end

Instance Attribute Details

#channelsObject (readonly)

Returns the value of attribute channels.



9
10
11
# File 'lib/assimp/animation.rb', line 9

def channels
  @channels
end

#duration_ticksObject (readonly)

Returns the value of attribute duration_ticks.



9
10
11
# File 'lib/assimp/animation.rb', line 9

def duration_ticks
  @duration_ticks
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/assimp/animation.rb', line 9

def name
  @name
end

#ticks_per_secondObject (readonly)

Returns the value of attribute ticks_per_second.



9
10
11
# File 'lib/assimp/animation.rb', line 9

def ticks_per_second
  @ticks_per_second
end

Instance Method Details

#duration_secondsObject



23
24
25
# File 'lib/assimp/animation.rb', line 23

def duration_seconds
  duration_ticks / effective_ticks_per_second
end

#effective_ticks_per_secondObject



19
20
21
# File 'lib/assimp/animation.rb', line 19

def effective_ticks_per_second
  ticks_per_second.positive? ? ticks_per_second : DEFAULT_TICKS_PER_SECOND
end