Sha256: 94f1d4b8e27ab39706d42612a4530d74ac954155c097448b5db6b7fdd430c427

Contents?: true

Size: 999 Bytes

Versions: 5

Compression:

Stored size: 999 Bytes

Contents

module CyberarmEngine
  class Renderer
    attr_reader :opengl_renderer, :bounding_box_renderer

    def initialize
      @bounding_box_renderer = BoundingBoxRenderer.new
      @opengl_renderer = OpenGLRenderer.new(width: CyberarmEngine::Window.instance.width, height: CyberarmEngine::Window.instance.height)
    end

    def draw(camera, lights, entities)
      Stats.frame.start_timing(:opengl_renderer)

      Stats.frame.start_timing(:opengl_model_renderer)
      @opengl_renderer.render(camera, lights, entities)
      Stats.frame.end_timing(:opengl_model_renderer)

      if @show_bounding_boxes
        Stats.frame.start_timing(:opengl_boundingbox_renderer)
        @bounding_box_renderer.render(entities)
        Stats.frame.end_timing(:opengl_boundingbox_renderer)
      end

      Stats.frame.end_timing(:opengl_renderer)
    end

    def canvas_size_changed
      @opengl_renderer.canvas_size_changed
    end

    def finalize # cleanup
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cyberarm_engine-0.24.4 lib/cyberarm_engine/opengl/renderer/renderer.rb
cyberarm_engine-0.24.3 lib/cyberarm_engine/opengl/renderer/renderer.rb
cyberarm_engine-0.24.2 lib/cyberarm_engine/opengl/renderer/renderer.rb
cyberarm_engine-0.24.1 lib/cyberarm_engine/opengl/renderer/renderer.rb
cyberarm_engine-0.24.0 lib/cyberarm_engine/opengl/renderer/renderer.rb