Sha256: d79a0c0da2cde53a517f035fc5dfd58e981ee87f6907c8fadfbef150026d496e

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module Mittsu
  class OpenGLLight < OpenGLObject3D
    attr_accessor :camera_helper

    def initialize(light, renderer)
      super
      @light = light
      @light_renderer = renderer.light_renderer
      @cache = @light_renderer.cache[type]

      @_direction = Vector3.new
      @_vector3 = Vector3.new
    end

    def type
      self.class::TYPE
    end

    def setup
      @cache.count += 1

      return unless @light.visible
      setup_specific(@cache.length)

      @cache.length += 1
    end

    def project
      return unless @light.visible
      init
      # TODO!!! FIXME!!!
      @renderer.instance_variable_get(:@lights) << @light
      project_children
    end

    def setup_specific
      raise "Unknown Light Impl: #{@light.class} => #{self.class}"
    end

    def self.null_remaining_lights(cache, colors = nil)
      colors ||= cache.colors
      count = [colors.length, cache.count * 3].max
      (cache.length * 3).upto(count - 1).each { |i|
        colors[i] = 0.0
      }
    end

    def to_sym
      :other
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mittsu-0.1.2 lib/mittsu/renderers/opengl/lights/opengl_light.rb