diff options
author | Frederico Linhares <fred@linhares.blue> | 2024-02-06 17:37:20 -0300 |
---|---|---|
committer | Frederico Linhares <fred@linhares.blue> | 2024-03-23 19:12:24 -0300 |
commit | bf240d7eeaa89657462b705849fde56e54e237db (patch) | |
tree | 0bd3f9826dd2d4d88f9da1ec77ba8f1b27b41be1 /test | |
parent | 8d7e40e0b2b592efc7bcf7101ee362ec61f1989f (diff) |
refa Use quaternion for orientation
Diffstat (limited to 'test')
-rw-r--r-- | test/src/mode/demo.rb | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/test/src/mode/demo.rb b/test/src/mode/demo.rb index 67fa805..a821d65 100644 --- a/test/src/mode/demo.rb +++ b/test/src/mode/demo.rb @@ -49,21 +49,21 @@ module Mode CandyGear::Vector3D.new(0.0, 0.0, 5.0), CandyGear::Vector3D.new(0.0, 0.0, -5.0) ]; - @instances_rotation = CandyGear::Rotation3D.new(0.0, 0.0, 0.0); + @instances_orientation = CandyGear::Orientation3D.new(0.0, 0.0, 0.0); @instances = [ CandyGear::StaticModel.new( - mesh, texture, instance_positions[0], @instances_rotation), + mesh, texture, instance_positions[0], @instances_orientation), CandyGear::StaticModel.new( - mesh, texture, instance_positions[1], @instances_rotation), + mesh, texture, instance_positions[1], @instances_orientation), CandyGear::StaticModel.new( - mesh, texture, instance_positions[2], @instances_rotation), + mesh, texture, instance_positions[2], @instances_orientation), CandyGear::StaticModel.new( - mesh, texture, instance_positions[3], @instances_rotation), + mesh, texture, instance_positions[3], @instances_orientation), CandyGear::StaticModel.new( - mesh, texture, instance_positions[4], @instances_rotation), + mesh, texture, instance_positions[4], @instances_orientation), CandyGear::StaticModel.new( - mesh, texture, instance_positions[5], @instances_rotation) + mesh, texture, instance_positions[5], @instances_orientation) ] sprite_3d_position = CandyGear::Vector3D.new(0.0, 0.0, 0.0); @@ -71,7 +71,7 @@ module Mode @sprite, sprite_3d_position, 1.0, 1.0); @camera_position = CandyGear::Vector3D.new(0.0, 0.0, 0.0); - @camera_rotation = CandyGear::Rotation3D.new(0.0, 0.0, 0.0); + @camera_orientation = CandyGear::Orientation3D.new(0.0, 0.0, 0.0); color = CandyGear::Vector3D.new(0.12, 0.12, 0.18); @view1 = CandyGear::View2D.new( @@ -81,35 +81,35 @@ module Mode CandyGear.views = [@view1, @view2]; @view2.camera_position = @camera_position; - @view2.camera_rotation = @camera_rotation; + @view2.camera_orientation = @camera_orientation; end def key_down(key) case key when CandyGear::Key::I - @camera_rotation.rotate(-CAMERA_ROTATION_SPEED, 0.0); + @camera_orientation.rotate(-CAMERA_ROTATION_SPEED, 0.0, 0.0); when CandyGear::Key::K - @camera_rotation.rotate(CAMERA_ROTATION_SPEED, 0.0); + @camera_orientation.rotate(CAMERA_ROTATION_SPEED, 0.0, 0.0); when CandyGear::Key::J - @camera_rotation.rotate(0.0, CAMERA_ROTATION_SPEED); + @camera_orientation.rotate(0.0, CAMERA_ROTATION_SPEED, 0.0); when CandyGear::Key::L - @camera_rotation.rotate(0.0, -CAMERA_ROTATION_SPEED); + @camera_orientation.rotate(0.0, -CAMERA_ROTATION_SPEED, 0.0); when CandyGear::Key::E @camera_position.translate( CandyGear::Vector3D.new( - 0.0, 0.0, -TRANSLATION_SPEED), @camera_rotation); + 0.0, 0.0, -TRANSLATION_SPEED), @camera_orientation); when CandyGear::Key::D @camera_position.translate( CandyGear::Vector3D.new( - 0.0, 0.0, TRANSLATION_SPEED), @camera_rotation); + 0.0, 0.0, TRANSLATION_SPEED), @camera_orientation); when CandyGear::Key::S @camera_position.translate( CandyGear::Vector3D.new( - -TRANSLATION_SPEED, 0.0, 0.0), @camera_rotation); + -TRANSLATION_SPEED, 0.0, 0.0), @camera_orientation); when CandyGear::Key::F @camera_position.translate( CandyGear::Vector3D.new( - TRANSLATION_SPEED, 0.0, 0.0), @camera_rotation); + TRANSLATION_SPEED, 0.0, 0.0), @camera_orientation); end end @@ -126,7 +126,7 @@ module Mode @english_text_sprite.draw( @view1, @english_text_position.x, @english_text_position.y, @english_text_position.w, @english_text_position.h); - @instances_rotation.rotate(0.0, BOX_ROTATION_SPEED); + @instances_orientation.rotate(0.0, BOX_ROTATION_SPEED, 0.0); @rectangle.draw_rectangle(@view1, @color); @instances.each {_1.draw()}; @sprite_3d.draw(); |