mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Everything is broken and stuff.
This commit is contained in:
@@ -34,8 +34,11 @@ class IMICFPS
|
||||
@bounding_box = BoundingBox.new(0,0,0, 0,0,0)
|
||||
start_time = Time.now
|
||||
parse
|
||||
# point = rand(1.0..10.0)
|
||||
# @bounding_box = BoundingBox.new(point.to_f/2, point.to_f/2, point.to_f/2, point, point, point)
|
||||
# puts "!!!!!!!!!!!!!!"
|
||||
# puts @bounding_box
|
||||
puts "#{@file_path.split('/').last} took #{(Time.now-start_time).round(2)} seconds to parse"
|
||||
p @bounding_box
|
||||
|
||||
face_count = 0
|
||||
@objects.each {|o| face_count+=o.faces.size}
|
||||
|
||||
@@ -13,6 +13,7 @@ class IMICFPS
|
||||
@faces = []
|
||||
@bounding_box = BoundingBox.new(0,0,0, 0,0,0)
|
||||
@debug_color = Color.new(1.0,0.0,0.0)
|
||||
@x,@y,@z = 0,0,0
|
||||
|
||||
# Faces array packs everything:
|
||||
# vertex = index[0]
|
||||
@@ -21,17 +22,28 @@ class IMICFPS
|
||||
# material = index[3]
|
||||
end
|
||||
|
||||
def at_same_position?
|
||||
if @x == @parent.x
|
||||
if @x == @parent.x
|
||||
if @x == @parent.x
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def flattened_vertices
|
||||
unless @vertices_list
|
||||
unless @vertices_list && at_same_position?
|
||||
@debug_color = @faces.first[3].diffuse
|
||||
@x,@y,@z = @parent.x,@parent.y,@parent.z
|
||||
|
||||
list = []
|
||||
@faces.each do |face|
|
||||
[face[0]].each do |v|
|
||||
next unless v
|
||||
list << v.x*@parent.scale#+@parent.x
|
||||
list << v.y*@parent.scale#+@parent.y
|
||||
list << v.z*@parent.scale#+@parent.z
|
||||
list << v.x*@parent.scale+@parent.x
|
||||
list << v.y*@parent.scale+@parent.y
|
||||
list << v.z*@parent.scale+@parent.z
|
||||
list << v.weight
|
||||
end
|
||||
end
|
||||
|
||||
@@ -150,7 +150,7 @@ class IMICFPS
|
||||
|
||||
def calculate_bounding_box(vertices, bounding_box)
|
||||
unless bounding_box.min_x.is_a?(Float)
|
||||
vertex = vertices.first
|
||||
vertex = vertices.last
|
||||
bounding_box.min_x = vertex.x
|
||||
bounding_box.min_y = vertex.y
|
||||
bounding_box.min_z = vertex.z
|
||||
@@ -161,13 +161,13 @@ class IMICFPS
|
||||
end
|
||||
|
||||
vertices.each do |vertex|
|
||||
bounding_box.min_x = vertex.x if vertex.x < bounding_box.min_x
|
||||
bounding_box.min_y = vertex.y if vertex.y < bounding_box.min_y
|
||||
bounding_box.min_z = vertex.z if vertex.z < bounding_box.min_z
|
||||
bounding_box.min_x = vertex.x if vertex.x <= bounding_box.min_x
|
||||
bounding_box.min_y = vertex.y if vertex.y <= bounding_box.min_y
|
||||
bounding_box.min_z = vertex.z if vertex.z <= bounding_box.min_z
|
||||
|
||||
bounding_box.max_x = vertex.x if vertex.x > bounding_box.max_x
|
||||
bounding_box.max_y = vertex.y if vertex.y > bounding_box.max_y
|
||||
bounding_box.max_z = vertex.z if vertex.z > bounding_box.max_z
|
||||
bounding_box.max_x = vertex.x if vertex.x >= bounding_box.max_x
|
||||
bounding_box.max_y = vertex.y if vertex.y >= bounding_box.max_y
|
||||
bounding_box.max_z = vertex.z if vertex.z >= bounding_box.max_z
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user