Sha256: 3fc6c41e72b0b5e30a4230d18fb7c73e64f881eef311c48a630bdcbc1a7b9ee0
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
module Mittsu class OpenGLSpotLight < OpenGLLight TYPE = :spot class Cache < Struct.new(:length, :count, :colors, :directions, :distances, :positions, :exponents, :angles_cos, :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) @_direction.set_from_matrix_position(@light.matrix_world) positions = @cache.positions positions[offset] = @_direction.x positions[offset + 1] = @_direction.y positions[offset + 2] = @_direction.z @cache.distances[index] = @light.distance @_vector3.set_from_matrix_position(@light.target.matrix_world) @_direction.sub(@_vector3) @_direction.normalize directions = @cache.directions directions[offset] = @_direction.x directions[offset + 1] = @_direction.y directions[offset + 2] = @_direction.z @cache.angles_cos[index] = Math.cos(@light.angle) @cache.exponents[index] = @light.exponent; @cache.decays[index] = @light.distance.zero? ? 0.0 : @light.decay end def to_sym :spot 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_spot_light.rb |