mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
Removed global state for LightManager and ObjectManager, they're now inside GameState. Simplified terrain mesh.
This commit is contained in:
@@ -4,7 +4,9 @@ class IMICFPS
|
||||
include GLU
|
||||
|
||||
attr_reader :bounding_boxes, :vertex_count
|
||||
def initialize
|
||||
def initialize(game_state:)
|
||||
@game_state = game_state
|
||||
|
||||
@bounding_boxes = {}
|
||||
@vertex_count = 0
|
||||
end
|
||||
@@ -215,7 +217,7 @@ class IMICFPS
|
||||
|
||||
glPopMatrix
|
||||
|
||||
found = ObjectManager.objects.detect { |o| o == bounding_box[:object] }
|
||||
found = @game_state.game_objects.detect { |o| o == bounding_box[:object] }
|
||||
|
||||
unless found
|
||||
@vertex_count -= @bounding_boxes[key][:vertices_size]
|
||||
|
||||
@@ -5,13 +5,15 @@ class IMICFPS
|
||||
|
||||
attr_reader :opengl_renderer, :bounding_box_renderer
|
||||
|
||||
def initialize
|
||||
@bounding_box_renderer = BoundingBoxRenderer.new
|
||||
def initialize(game_state:)
|
||||
@game_state = game_state
|
||||
|
||||
@bounding_box_renderer = BoundingBoxRenderer.new(game_state: game_state)
|
||||
@opengl_renderer = OpenGLRenderer.new
|
||||
end
|
||||
|
||||
def draw
|
||||
ObjectManager.objects.each do |object|
|
||||
@game_state.game_objects.each do |object|
|
||||
if object.visible && object.renderable
|
||||
# Render bounding boxes before transformation is applied
|
||||
@bounding_box_renderer.create_bounding_box(object, object.model.bounding_box, object.debug_color, object.object_id) if $debug
|
||||
|
||||
Reference in New Issue
Block a user