Sha256: cb01beea3afc06b21b4e1e61bbac08cc992a62b12987c1b428c3d1c2c6214770

Contents?: true

Size: 930 Bytes

Versions: 16

Compression:

Stored size: 930 Bytes

Contents

module Mittsu
  class HemisphereLight
    TYPE = :hemi

    class Cache < Struct.new(:length, :count, :sky_colors, :ground_colors, :positions)
      def initialize
        super(0, 0, [], [], [])
      end

      def reset
        self.length = 0
      end
    end

    def setup_specific(index)
      offset = index * 3

      @_direction.set_from_matrix_position(matrix_world)
      @_direction.normalize

      positions = @cache.positions
      positions[offset]     = @_direction.x
      positions[offset + 1] = @_direction.y
      positions[offset + 2] = @_direction.z

      OpenGLHelper.set_color_linear(@cache.sky_colors, offset, color, intensity)
      OpenGLHelper.set_color_linear(@cache.ground_colors, offset, ground_color, intensity)
    end

    def self.null_remaining_lights(cache)
      super(cache, cache.ground_colors)
      super(cache, cache.sky_colors)
    end

    def to_sym
      :hemi
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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