Module: Bayonetta::MOTDecoder
Instance Method Summary collapse
Instance Method Details
#decode ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bayonetta/mot.rb', line 32 def decode tracks = Hash::new { |h,k| h[k] = {} } motion = {} motion[:flag] = @header.flag motion[:frame_count] = frame_count = @header.frame_count motion[:tracks] = tracks @records.each_with_index { |r, i| if r.interpolation_type != -1 if r.interpolation_type == 0 tracks[r.bone_index][r.animation_track] = [r.value] * frame_count else tracks[r.bone_index][r.animation_track] = @interpolations[i].values(frame_count) end end } motion end |
#decode_frame(frame_index) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bayonetta/mot.rb', line 17 def decode_frame(frame_index) raise "Invalid frame number #{frame_index} (#{0} - #{@header.frame_count}!" if frame_index < 0 || frame_index >= @header.frame_count tracks = Hash::new { |h,k| h[k] = {} } @records.each_with_index { |r, i| if r.interpolation_type != -1 if r.interpolation_type == 0 tracks[r.bone_index][r.animation_track] = r.value else tracks[r.bone_index][r.animation_track] = @interpolations[i].value(frame_index) end end } tracks end |