Added main menu, added loading screen, hacked and chiseled things until I could load models without attaching to a gameobject.

This commit is contained in:
2018-09-09 15:01:53 -05:00
parent d37758526a
commit 66e7800cad
11 changed files with 182 additions and 16 deletions

View File

@@ -11,12 +11,12 @@ class IMICFPS
include Parser
attr_accessor :objects, :materials, :vertices, :texures, :normals, :faces
attr_accessor :x, :y, :z, :scale
attr_accessor :x, :y, :z, :scale, :game_object
attr_reader :bounding_box
def initialize(file_path:, game_object:)
def initialize(file_path:, game_object: nil)
@game_object = game_object
update
update if @game_object
@file_path = file_path
@file = File.open(file_path, 'r')
@material_file = nil
@@ -103,6 +103,10 @@ class IMICFPS
def update
@x, @y, @z = @game_object.x, @game_object.y, @game_object.z
@scale = @game_object.scale
# if @scale != @game_object.scale
# puts "oops for #{self}: #{@scale} != #{@game_object.scale}"
# self.objects.each(&:reflatten) if self.objects && self.objects.count > 0
# end
end
end
end

View File

@@ -22,6 +22,20 @@ class IMICFPS
# material = index[3]
end
def parent=(game_object)
@parent = game_object
end
def reflatten
@vertices_list = nil
@textures_list = nil
@normals_list = nil
flattened_vertices
flattened_textures
flattened_normals
end
def at_same_position?
if @x == @parent.x
if @x == @parent.x