Sha256: 987852a3e1a9b5e5ac1b9439fdea21e69437ab36012e42857074f34cda0e8fa3

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

module Hate
  module Graphics
    module Manager
      
      @objects = []
      @shaders = []
      @lights  = []
      @cameras = []
      
      def self.lights
        @lights
      end
      
      def self.run
        @cameras.each do |obj|
          obj.run
        end

        @objects.each do |obj|
          obj.run
        end
        
        @shaders.each do |obj|
          obj.run
        end
        
        @lights.each do |obj|
          obj.run
        end
      end
      
      def self.add_object(obj)
        @objects << obj
      end
      
      def self.remove_object(obj)
        @objects.delete obj
      end
      
      def self.add_shader(obj)
        @shaders << obj
      end
      
      def self.remove_shader(obj)
        @shaders.delete obj
      end
      
      def self.add_light(obj)
        @lights << obj
      end
      
      def self.remove_light(obj)
        @lights.delete obj
      end
      
      def self.add_camera(obj)
        @cameras << obj
      end
      
      def self.remove_camera(obj)
        @cameras.delete obj
      end
      
      def self.default_camera
        add_camera Hate::Graphics::Camera.new if @cameras.empty?
        @cameras.each do |obj|
          return obj if obj.is_default?
        end
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hate-0.1.0 lib/hate/graphics/manager.rb