Sha256: b2ee1cef57aef99fc82e836d82e5eb9111ff0e7e8cf9f6895c17d179840c5fef

Contents?: true

Size: 762 Bytes

Versions: 18

Compression:

Stored size: 762 Bytes

Contents

require 'mittsu/lights/light'

module Mittsu
  class PointLight < Light
    attr_accessor :decay

    def initialize(color = nil, intensity = 1.0, distance = 0.0, decay = 1.0)
      super(color)

      @type = 'PointLight'

      @intensity = intensity
      @distance = distance
      @decay = decay # for physically correct light, should be 2
    end

    def clone
      light = PointLight.new
      super(light)

      light.intensity = @intensity
      light.distance = @distance
      light.decay = @decay
      light
    end

    protected

    def jsonify
      data = super
      data[:color] = self.color.get_hex
      data[:intensity] = self.intensity
      data[:distance] = self.distance
      data[:decay] = self.decay
      data
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mittsu-0.5.0 lib/mittsu/lights/point_light.rb
mittsu-0.4.1 lib/mittsu/lights/point_light.rb
mittsu-0.4.0 lib/mittsu/lights/point_light.rb
mittsu-0.3.3 lib/mittsu/lights/point_light.rb
mittsu-0.3.2 lib/mittsu/lights/point_light.rb
mittsu-0.3.1 lib/mittsu/lights/point_light.rb
mittsu-0.3.0 lib/mittsu/lights/point_light.rb
mittsu-0.2.4 lib/mittsu/lights/point_light.rb
mittsu-0.2.3 lib/mittsu/lights/point_light.rb
mittsu-0.2.2 lib/mittsu/lights/point_light.rb
mittsu-0.2.1 lib/mittsu/lights/point_light.rb
mittsu-0.2.0 lib/mittsu/lights/point_light.rb
mittsu-0.1.7 lib/mittsu/lights/point_light.rb
mittsu-0.1.6 lib/mittsu/lights/point_light.rb
mittsu-0.1.5 lib/mittsu/lights/point_light.rb
mittsu-0.1.4 lib/mittsu/lights/point_light.rb
mittsu-0.1.3 lib/mittsu/lights/point_light.rb
mittsu-0.1.2 lib/mittsu/lights/point_light.rb