Sha256: 3815196e73eefe9b1320e32a1014bb8858a93584fe8d4dd8e259aea3676d7a01
Contents?: true
Size: 913 Bytes
Versions: 1
Compression:
Stored size: 913 Bytes
Contents
module Mittsu class OpenGLPointLight < OpenGLLight TYPE = :point class Cache < Struct.new(:length, :count, :colors, :distances, :positions, :decays) def initialize super(0, 0, [], [], [], []) end def reset self.length = 0 end end def setup_specific(index) offset = index * 3; OpenGLHelper.set_color_linear(@cache.colors, offset, @light.color, @light.intensity) @_vector3.set_from_matrix_position(@light.matrix_world) positions = @cache.positions positions[offset] = @_vector3.x positions[offset + 1] = @_vector3.y positions[offset + 2] = @_vector3.z # distance is 0 if decay is 0, because there is no attenuation at all. @cache.distances[index] = @light.distance @cache.decays[index] = @light.distance.zero? ? 0.0 : @light.decay end def to_sym :point 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_point_light.rb |