Class: Raylib::ModelAnimations
- Inherits:
-
Object
- Object
- Raylib::ModelAnimations
- Defined in:
- lib/raylib_helper.rb
Overview
Manages a set of ModelAnimation (ruby raylib original)
Instance Attribute Summary collapse
-
#anim_ptrs ⇒ Object
readonly
Returns the value of attribute anim_ptrs.
-
#anims ⇒ Object
readonly
Returns the value of attribute anims.
Instance Method Summary collapse
- #anim(index) ⇒ Object
- #anims_count ⇒ Object
-
#bone_info(anim_index, bone_index) ⇒ Object
BoneInfo.
-
#bone_transform(frame_pose, bone_index) ⇒ Object
Transform.
-
#bone_transform_of_frame_pose(anim_index, frame, bone_index) ⇒ Object
Transform.
- #cleanup ⇒ Object
- #frame_count(index) ⇒ Object
-
#frame_pose(index, frame) ⇒ Object
Transform*.
-
#initialize ⇒ ModelAnimations
constructor
A new instance of ModelAnimations.
-
#setup(fileName) ⇒ Object
Self.
Constructor Details
#initialize ⇒ ModelAnimations
316 317 318 319 320 |
# File 'lib/raylib_helper.rb', line 316 def initialize @anims = nil @anim_ptrs = nil @framePoses = nil # array of Transform** end |
Instance Attribute Details
#anim_ptrs ⇒ Object (readonly)
Returns the value of attribute anim_ptrs.
314 315 316 |
# File 'lib/raylib_helper.rb', line 314 def anim_ptrs @anim_ptrs end |
#anims ⇒ Object (readonly)
Returns the value of attribute anims.
314 315 316 |
# File 'lib/raylib_helper.rb', line 314 def anims @anims end |
Instance Method Details
#anim(index) ⇒ Object
322 |
# File 'lib/raylib_helper.rb', line 322 def anim(index) = @anims[index] |
#anims_count ⇒ Object
323 |
# File 'lib/raylib_helper.rb', line 323 def anims_count = @anims.length |
#bone_info(anim_index, bone_index) ⇒ Object
327 328 329 |
# File 'lib/raylib_helper.rb', line 327 def bone_info(anim_index, bone_index) BoneInfo.new(@anims[anim_index][:bones] + bone_index * BoneInfo.size) end |
#bone_transform(frame_pose, bone_index) ⇒ Object
337 338 339 |
# File 'lib/raylib_helper.rb', line 337 def bone_transform(frame_pose, bone_index) Transform.new(frame_pose.read_pointer + bone_index * Transform.size) end |
#bone_transform_of_frame_pose(anim_index, frame, bone_index) ⇒ Object
342 343 344 |
# File 'lib/raylib_helper.rb', line 342 def bone_transform_of_frame_pose(anim_index, frame, bone_index) bone_transform(frame_pose(anim_index, frame), bone_index) end |
#cleanup ⇒ Object
356 357 358 |
# File 'lib/raylib_helper.rb', line 356 def cleanup UnloadAndFreeModelAnimations(@anims, @anim_ptrs) end |
#frame_count(index) ⇒ Object
324 |
# File 'lib/raylib_helper.rb', line 324 def frame_count(index) = @anims[index][:frameCount] |
#frame_pose(index, frame) ⇒ Object
332 333 334 |
# File 'lib/raylib_helper.rb', line 332 def frame_pose(index, frame) @framePoses[index] + frame * FFI::NativeType::POINTER.size # Transform* end |
#setup(fileName) ⇒ Object
347 348 349 350 351 352 353 354 |
# File 'lib/raylib_helper.rb', line 347 def setup(fileName) @anims, @anim_ptrs = LoadAndAllocateModelAnimations(fileName) @framePoses = [] @anims.each do |anim| @framePoses << anim[:framePoses] end self end |