lib/cyberarm_engine/model.rb in cyberarm_engine-0.18.0 vs lib/cyberarm_engine/model.rb in cyberarm_engine-0.19.0

- old
+ new

@@ -1,11 +1,12 @@ module CyberarmEngine class Model attr_accessor :objects, :materials, :vertices, :uvs, :texures, :normals, :faces, :colors, :bones, :material_file, :current_material, :current_object, :vertex_count, :smoothing attr_reader :position, :bounding_box, :textured_material, :file_path, :positions_buffer_id, :colors_buffer_id, - :normals_buffer_id, :uvs_buffer_id, :textures_buffer_id, :vertex_array_id, :aabb_tree + :normals_buffer_id, :uvs_buffer_id, :textures_buffer_id, :vertex_array_id, :aabb_tree, + :vertices_count def initialize(file_path:) @file_path = file_path @material_file = nil @@ -21,17 +22,21 @@ @normals = [] @faces = [] @bones = [] @smoothing = 0 + @vertices_count = 0 + @bounding_box = BoundingBox.new start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond) type = File.basename(file_path).split(".").last.to_sym parser = Model::Parser.find(type) raise "Unsupported model type '.#{type}', supported models are: #{Model::Parser.supported_formats}" unless parser parse(parser) + + @vertices_count = @vertices.size @has_texture = false @materials.each do |_key, material| @has_texture = true if material.texture_id