From 25bf78bfb4785e2cbed683cc56d3cec4271d8b5a Mon Sep 17 00:00:00 2001 From: Frederico Linhares Date: Thu, 7 Sep 2023 15:14:14 -0300 Subject: feat Create skeletal mesh --- test/src/mode/demo.rb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'test/src/mode') diff --git a/test/src/mode/demo.rb b/test/src/mode/demo.rb index 5f28454..a9781b6 100644 --- a/test/src/mode/demo.rb +++ b/test/src/mode/demo.rb @@ -20,7 +20,7 @@ module Mode def initialize() texture = CandyGear::Texture.from_image("textures/color_texture.qoi"); - mesh = CandyGear::Mesh.new("meshes/cube.cgmesh"); + mesh = CandyGear::StaticMesh.new("meshes/cube.cgmesh"); font = CandyGear::Font.new("/usr/share/fonts/TTF/HanaMinA.ttf", 30); japanese_text = CandyGear::Texture.from_text( font, "こんにちは世界!"); @@ -28,7 +28,6 @@ module Mode font, "The quick brown fox jumps"); @color = CandyGear::Vector3D.new(0.8, 0.2, 0.2); - @model = CandyGear::Model.new(mesh, texture); @sprite = CandyGear::Sprite.new(texture, 0, 0, 1.0, 1.0); @rectangle = CandyGear::Vector4D.new(103.0, 1.0, 100.0, 100.0); @sprite_position = CandyGear::Vector4D.new(1.0, 1.0, 100.0, 100.0); @@ -42,7 +41,7 @@ module Mode 204.0, japanese_text.height + 2.0, english_text.width, english_text.height); - @instances = [ + instance_positions = [ CandyGear::Vector3D.new(5.0, 0.0, 0.0), CandyGear::Vector3D.new(-5.0, 0.0, 0.0), CandyGear::Vector3D.new(0.0, 5.0, 0.0), @@ -52,6 +51,21 @@ module Mode ]; @instances_rotation = CandyGear::Rotation3D.new(0.0, 0.0, 0.0); + @instances = [ + CandyGear::StaticModel.new( + mesh, texture, instance_positions[0], @instances_rotation), + CandyGear::StaticModel.new( + mesh, texture, instance_positions[1], @instances_rotation), + CandyGear::StaticModel.new( + mesh, texture, instance_positions[2], @instances_rotation), + CandyGear::StaticModel.new( + mesh, texture, instance_positions[3], @instances_rotation), + CandyGear::StaticModel.new( + mesh, texture, instance_positions[4], @instances_rotation), + CandyGear::StaticModel.new( + mesh, texture, instance_positions[5], @instances_rotation) + ] + @camera_position = CandyGear::Vector3D.new(0.0, 0.0, 0.0); @camera_rotation = CandyGear::Rotation3D.new(0.0, 0.0, 0.0); @@ -110,9 +124,7 @@ module Mode @english_text_position.w, @english_text_position.h); @instances_rotation.rotate(0.0, BOX_ROTATION_SPEED); @rectangle.draw_rectangle(@view1, @color); - @instances.each do |i| - @model.draw(i, @instances_rotation); - end + @instances.each {_1.draw()}; end end end -- cgit v1.2.3