mittsu 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/mittsu.rb +8 -0
  4. data/lib/mittsu/core/face3.rb +1 -1
  5. data/lib/mittsu/core/geometry.rb +0 -4
  6. data/lib/mittsu/core/object_3d.rb +7 -6
  7. data/lib/mittsu/extras/helpers/camera_helper.rb +2 -2
  8. data/lib/mittsu/materials/material.rb +0 -4
  9. data/lib/mittsu/renderers/opengl/core/{opengl_geometry.rb → geometry.rb} +23 -32
  10. data/lib/mittsu/renderers/opengl/core/{opengl_object_3d.rb → object_3d.rb} +20 -24
  11. data/lib/mittsu/renderers/opengl/lights/{opengl_ambient_light.rb → ambient_light.rb} +4 -4
  12. data/lib/mittsu/renderers/opengl/lights/{opengl_directional_light.rb → directional_light.rb} +4 -4
  13. data/lib/mittsu/renderers/opengl/lights/{opengl_hemisphere_light.rb → hemisphere_light.rb} +4 -7
  14. data/lib/mittsu/renderers/opengl/lights/light.rb +55 -0
  15. data/lib/mittsu/renderers/opengl/lights/{opengl_point_light.rb → point_light.rb} +5 -5
  16. data/lib/mittsu/renderers/opengl/lights/{opengl_spot_light.rb → spot_light.rb} +8 -8
  17. data/lib/mittsu/renderers/opengl/materials/{opengl_line_basic_material.rb → line_basic_material.rb} +3 -3
  18. data/lib/mittsu/renderers/opengl/materials/{opengl_material.rb → material.rb} +55 -56
  19. data/lib/mittsu/renderers/opengl/materials/mesh_basic_material.rb +21 -0
  20. data/lib/mittsu/renderers/opengl/materials/{opengl_mesh_lambert_material.rb → mesh_lambert_material.rb} +9 -5
  21. data/lib/mittsu/renderers/opengl/materials/{opengl_mesh_phong_material.rb → mesh_phong_material.rb} +11 -7
  22. data/lib/mittsu/renderers/opengl/materials/opengl_material_basics.rb +57 -0
  23. data/lib/mittsu/renderers/opengl/materials/{opengl_shader_material.rb → shader_material.rb} +1 -1
  24. data/lib/mittsu/renderers/opengl/objects/group.rb +9 -0
  25. data/lib/mittsu/renderers/opengl/objects/line.rb +45 -0
  26. data/lib/mittsu/renderers/opengl/objects/{opengl_mesh.rb → mesh.rb} +15 -22
  27. data/lib/mittsu/renderers/opengl/opengl_buffer.rb +4 -0
  28. data/lib/mittsu/renderers/opengl/opengl_debug.rb +5 -4
  29. data/lib/mittsu/renderers/opengl/opengl_default_target.rb +0 -4
  30. data/lib/mittsu/renderers/opengl/opengl_geometry_group.rb +2 -8
  31. data/lib/mittsu/renderers/opengl/opengl_geometry_like.rb +2 -1
  32. data/lib/mittsu/renderers/opengl/opengl_implementations.rb +24 -53
  33. data/lib/mittsu/renderers/opengl/opengl_lib.rb +62 -0
  34. data/lib/mittsu/renderers/opengl/opengl_light_renderer.rb +6 -6
  35. data/lib/mittsu/renderers/opengl/opengl_program.rb +3 -5
  36. data/lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb +11 -12
  37. data/lib/mittsu/renderers/opengl/scenes/scene.rb +9 -0
  38. data/lib/mittsu/renderers/opengl/textures/{opengl_compressed_texture.rb → compressed_texture.rb} +5 -6
  39. data/lib/mittsu/renderers/opengl/textures/{opengl_cube_texture.rb → cube_texture.rb} +23 -21
  40. data/lib/mittsu/renderers/opengl/textures/{opengl_data_texture.rb → data_texture.rb} +3 -5
  41. data/lib/mittsu/renderers/opengl/textures/{opengl_texture.rb → texture.rb} +29 -33
  42. data/lib/mittsu/renderers/opengl_render_target.rb +5 -6
  43. data/lib/mittsu/renderers/opengl_renderer.rb +35 -44
  44. data/lib/mittsu/textures/texture.rb +0 -4
  45. data/lib/mittsu/version.rb +1 -1
  46. metadata +26 -24
  47. data/lib/mittsu/renderers/opengl/lights/opengl_light.rb +0 -52
  48. data/lib/mittsu/renderers/opengl/materials/opengl_mesh_basic_material.rb +0 -69
  49. data/lib/mittsu/renderers/opengl/objects/opengl_group.rb +0 -8
  50. data/lib/mittsu/renderers/opengl/objects/opengl_line.rb +0 -54
  51. data/lib/mittsu/renderers/opengl/scenes/opengl_scene.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a116d4e3970e8c01c66d77f51eae67c987240017
4
- data.tar.gz: ee8cf7cd8bbeeb6936b6609777d1c767a72b48fd
3
+ metadata.gz: d7b8204b98ee764f5d16b7f05080fdfef61e40d9
4
+ data.tar.gz: f0414817f8f8d34396c8e2db3fc78940e1e9da5f
5
5
  SHA512:
6
- metadata.gz: 0fff4b0a5cba6d3088677d89434e7e2af7223d597dd10b438fd92eeb52aa6ab587fd3cb8e406e4a984d8b178d09bf97b9a1325b139ec200bfbf13ad0eecaeab3
7
- data.tar.gz: fed0e180de0ae1f9e91af33817c73f2ece532ce8bf5ffcae87655f27278205e819188979a53b742e989c25ab777f5a32bf992d7601e2fd749c51855b85691651
6
+ metadata.gz: 794ce9888d5bec3b342cdce1b06111f2d194467ad8b8964f81eb9f84d09540bf62b10dfe1b24aa241a402b31e5c0bfb76cc64e9eb35146e4407be4d8781cd8e6
7
+ data.tar.gz: f193740db7fd18fb93c31e7daaae4c1ccbab6b6de93a6eb03e806da99dd3eb88e8069b365546b14ec3ce4ba35dcdc2bab2bc08799c969fe6e3c43bc8139a1d06
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Mittsu
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/mittsu.svg)](https://badge.fury.io/rb/mittsu) [![Dependency Status](https://gemnasium.com/jellymann/mittsu.svg)](https://gemnasium.com/jellymann/mittsu) [![Circle CI](https://circleci.com/gh/jellymann/mittsu/tree/master.svg?style=shield)](https://circleci.com/gh/jellymann/mittsu/tree/master) [![Coverage Status](https://coveralls.io/repos/github/jellymann/mittsu/badge.svg?branch=master)](https://coveralls.io/github/jellymann/mittsu?branch=master) [![Code Climate](https://codeclimate.com/github/jellymann/mittsu/badges/gpa.svg)](https://codeclimate.com/github/jellymann/mittsu)
3
+ [![Gem Version](https://badge.fury.io/rb/mittsu.svg)](https://badge.fury.io/rb/mittsu) [![Dependency Status](https://gemnasium.com/jellymann/mittsu.svg)](https://gemnasium.com/jellymann/mittsu) [![Circle CI](https://circleci.com/gh/jellymann/mittsu/tree/master.svg?style=shield)](https://circleci.com/gh/jellymann/mittsu/tree/master) [![Test Coverage](https://codeclimate.com/github/jellymann/mittsu/badges/coverage.svg)](https://codeclimate.com/github/jellymann/mittsu/coverage) [![Code Climate](https://codeclimate.com/github/jellymann/mittsu/badges/gpa.svg)](https://codeclimate.com/github/jellymann/mittsu)
4
4
 
5
5
  3D Graphics Library for Ruby
6
6
 
data/lib/mittsu.rb CHANGED
@@ -1,3 +1,11 @@
1
+ module Mittsu
2
+ DEBUG = ENV["DEBUG"] == "true"
3
+
4
+ def self.debug?
5
+ DEBUG
6
+ end
7
+ end
8
+
1
9
  require "mittsu/version"
2
10
  require "mittsu/math"
3
11
  require "mittsu/core"
@@ -17,7 +17,7 @@ module Mittsu
17
17
  end
18
18
 
19
19
  def clone
20
- face = THREE.face3.new(@a, @b, @c)
20
+ face = Mittsu::Face3.new(@a, @b, @c)
21
21
  face.normal.copy(@normal)
22
22
  face.color.copy(@color)
23
23
  face.material_index = @material_index
@@ -562,10 +562,6 @@ module Mittsu
562
562
  self.dispatch_event type: :dispose
563
563
  end
564
564
 
565
- def implementation(renderer)
566
- @_implementation ||= renderer.create_implementation(self)
567
- end
568
-
569
565
  private
570
566
 
571
567
  def set_bit(value, position, enabled)
@@ -5,7 +5,9 @@ module Mittsu
5
5
  class Object3D
6
6
  include EventDispatcher
7
7
 
8
- attr_accessor :name, :children, :up, :position, :rotation, :quaternion, :scale, :rotation_auto_update, :matrix, :matrix_world, :matrix_auto_update, :matrix_world_needs_update, :visible, :cast_shadow, :receive_shadow, :frustum_culled, :render_order, :user_data, :parent, :geometry
8
+ attr_accessor :children, :up, :position, :rotation, :quaternion, :scale, :rotation_auto_update, :matrix, :matrix_world, :matrix_auto_update, :matrix_world_needs_update, :visible, :cast_shadow, :receive_shadow, :frustum_culled, :render_order, :user_data, :parent, :geometry
9
+
10
+ attr_writer :name
9
11
 
10
12
  attr_reader :id, :uuid, :type
11
13
 
@@ -17,7 +19,6 @@ module Mittsu
17
19
 
18
20
  @uuid = SecureRandom.uuid
19
21
 
20
- @name = ''
21
22
  @type = 'Object3D'
22
23
 
23
24
  @children = []
@@ -56,6 +57,10 @@ module Mittsu
56
57
  @user_data = {}
57
58
  end
58
59
 
60
+ def name
61
+ @name || "<#{@type} ##{@id}>"
62
+ end
63
+
59
64
  def apply_matrix(matrix)
60
65
  @matrix.multiply_matrices(matrix, @matrix)
61
66
  @matrix.decompose(@position, @quaternion, @scale)
@@ -336,10 +341,6 @@ module Mittsu
336
341
  object
337
342
  end
338
343
 
339
- def implementation(renderer)
340
- @_implementation ||= renderer.create_implementation(self)
341
- end
342
-
343
344
  protected
344
345
 
345
346
  def jsonify
@@ -75,10 +75,10 @@ module Mittsu
75
75
  @matrix = camera.matrix_world
76
76
  @matrix_auto_update = false
77
77
 
78
- update
78
+ update_points
79
79
  end
80
80
 
81
- def update
81
+ def update_points
82
82
  w = 1.0
83
83
  h = 1.0
84
84
 
@@ -135,10 +135,6 @@ module Mittsu
135
135
  dispatch_event type: :dispose
136
136
  end
137
137
 
138
- def implementation(renderer)
139
- @_implementation ||= renderer.create_implementation(self)
140
- end
141
-
142
138
  private
143
139
 
144
140
  def has_property?(key)
@@ -1,30 +1,21 @@
1
1
  require 'mittsu/renderers/opengl/opengl_geometry_like'
2
2
 
3
3
  module Mittsu
4
- class OpenGLGeometry
4
+ class Geometry
5
5
  include OpenGLGeometryLike
6
6
 
7
7
  attr_accessor :groups, :initted
8
- attr_reader :id
9
-
10
- def initialize(geometry, renderer)
11
- @id = (@@id ||= 1).tap { @@id += 1 }
12
-
13
- @geometry = geometry
14
- @renderer = renderer
15
- end
16
8
 
17
9
  def init_geometry_groups(object)
18
- object_impl = object.implementation(@renderer)
19
10
  material = object.material
20
11
  add_buffers = false
21
12
 
22
- if @groups.nil? || @geometry.groups_need_update
13
+ if @groups.nil? || @groups_need_update
23
14
  @renderer.remove_opengl_object(object)
24
15
 
25
16
  @groups = make_groups(material.is_a?(MeshFaceMaterial))
26
17
 
27
- @geometry.groups_need_update = false
18
+ @groups_need_update = false
28
19
  end
29
20
 
30
21
  # create separate VBOs per geometry chunk
@@ -35,29 +26,29 @@ module Mittsu
35
26
  geometry_group.create_mesh_buffers
36
27
  geometry_group.init_mesh_buffers(object)
37
28
 
38
- @geometry.vertices_need_update = true
39
- @geometry.morph_targets_need_update = true
40
- @geometry.elements_need_update = true
41
- @geometry.uvs_need_update = true
42
- @geometry.normals_need_update = true
43
- @geometry.tangents_need_update = true
44
- @geometry.colors_need_update = true
29
+ @vertices_need_update = true
30
+ @morph_targets_need_update = true
31
+ @elements_need_update = true
32
+ @uvs_need_update = true
33
+ @normals_need_update = true
34
+ @tangents_need_update = true
35
+ @colors_need_update = true
45
36
 
46
37
  add_buffers = true
47
38
  else
48
39
  add_buffers = false
49
40
  end
50
41
 
51
- if add_buffers || !object_impl.active?
42
+ if add_buffers || !object.active?
52
43
  @renderer.add_opengl_object(geometry_group, object)
53
44
  end
54
45
  end
55
46
 
56
- object_impl.active = true
47
+ object.active = true
57
48
  end
58
49
 
59
50
  def init_line_buffers(object)
60
- nvertices = @geometry.vertices.length
51
+ nvertices = @vertices.length
61
52
 
62
53
  @vertex_array = Array.new(nvertices * 3, 0.0) # Float32Array
63
54
  @color_array = Array.new(nvertices * 3, 0.0) # Float32Array
@@ -79,8 +70,8 @@ module Mittsu
79
70
  end
80
71
 
81
72
  def set_line_buffers(hint)
82
- if @geometry.vertices_need_update
83
- @geometry.vertices.each_with_index do |vertex, v|
73
+ if @vertices_need_update
74
+ @vertices.each_with_index do |vertex, v|
84
75
  offset = v * 3
85
76
 
86
77
  @vertex_array[offset] = vertex.x
@@ -92,8 +83,8 @@ module Mittsu
92
83
  glBufferData_easy(GL_ARRAY_BUFFER, @vertex_array, hint)
93
84
  end
94
85
 
95
- if @geometry.colors_need_update
96
- @geometry.colors.each_with_index do |color, c|
86
+ if @colors_need_update
87
+ @colors.each_with_index do |color, c|
97
88
  offset = c * 3
98
89
 
99
90
  @color_array[offset] = color.r
@@ -105,8 +96,8 @@ module Mittsu
105
96
  glBufferData_easy(GL_ARRAY_BUFFER, @color_array, hint)
106
97
  end
107
98
 
108
- if @geometry.line_distances_need_update
109
- @geometry.line_distances.each_with_index do |l, d|
99
+ if @line_distances_need_update
100
+ @line_distances.each_with_index do |l, d|
110
101
  @line_distance_array[d] = l
111
102
  end
112
103
 
@@ -176,13 +167,13 @@ module Mittsu
176
167
 
177
168
  hash_map = {}
178
169
 
179
- num_morph_targets = @geometry.morph_targets.length
180
- num_morph_normals = @geometry.morph_normals.length
170
+ num_morph_targets = @morph_targets.length
171
+ num_morph_normals = @morph_normals.length
181
172
 
182
173
  groups = {}
183
174
  groups_list = []
184
175
 
185
- @geometry.faces.each_with_index do |face, f|
176
+ @faces.each_with_index do |face, f|
186
177
  material_index = uses_face_material ? face.material_index : 0
187
178
 
188
179
  if !hash_map.include? material_index
@@ -218,7 +209,7 @@ module Mittsu
218
209
  def init_custom_attributes(object)
219
210
  material = object.material
220
211
 
221
- nvertices = @geometry.vertices.length
212
+ nvertices = @vertices.length
222
213
 
223
214
  if material.attributes
224
215
  @custom_attributes_list ||= []
@@ -1,36 +1,29 @@
1
1
  module Mittsu
2
- class OpenGLObject3D
3
- attr_accessor :morph_target_influences
2
+ class Object3D
3
+ attr_accessor :morph_target_influences, :renderer
4
4
  attr_reader :model_view_matrix
5
5
  attr_writer :active
6
6
 
7
- def initialize(object, renderer)
8
- @object = object
9
- @renderer = renderer
10
- @_vector3 = Vector3.new
11
- end
12
-
13
7
  def active?
14
8
  @active
15
9
  end
16
10
 
17
11
  def init
18
12
  if !@initted
13
+ puts " --- INIT #{self.name}" if DEBUG
14
+
19
15
  @initted = true
20
16
  @model_view_matrix = Matrix4.new
21
17
  @normal_matrix = Matrix3.new
22
18
 
23
- @object.add_event_listener(:removed, @renderer.method(:on_object_removed))
19
+ add_event_listener(:removed, @renderer.method(:on_object_removed))
24
20
  end
25
21
 
26
- geometry = @object.geometry
27
-
28
22
  if geometry.nil?
29
23
  # ImmediateRenderObject
30
24
  else
31
- geometry_impl = geometry.implementation(@renderer)
32
- if !geometry_impl.initted
33
- geometry_impl.initted = true
25
+ if !geometry.initted
26
+ geometry.initted = true
34
27
  geometry.add_event_listener(:dispose, @renderer.method(:on_geometry_dispose))
35
28
  if geometry.is_a?(BufferGeometry)
36
29
  @renderer.info[:memory][:geometries] += 1
@@ -55,26 +48,30 @@ module Mittsu
55
48
  add_opengl_object
56
49
  # TODO: when ImmediateRenderObject exists
57
50
  # if object.is_a? ImmediateRenderObject || object.immediate_render_callback
58
- # add_buffer_immediate(@renderer.instance_variable_get(:@_opengl_objects_immediate), @object)
51
+ # add_buffer_immediate(@renderer.instance_variable_get(:@_opengl_objects_immediate), self)
59
52
  # end
60
53
  end
61
54
  end
62
55
 
63
- def project
64
- return unless @object.visible
56
+ def project(renderer)
57
+ puts " --- PROJECT #{self.name}" if DEBUG
58
+ @renderer = renderer
59
+ return unless visible
65
60
  init
66
61
 
67
62
  # TODO!!! FIXME!!!
68
- opengl_objects = @renderer.instance_variable_get(:@_opengl_objects)[@object.id]
63
+ opengl_objects = @renderer.instance_variable_get(:@_opengl_objects)[id]
69
64
 
70
- if opengl_objects && (!@object.frustum_culled || @renderer.object_in_frustum?(@object))
65
+ if opengl_objects && (!frustum_culled || @renderer.object_in_frustum?(self))
71
66
  opengl_objects.each do |opengl_object|
72
67
  # TODO!!! FIXME!!!
73
68
  @renderer.send(:unroll_buffer_material, opengl_object)
74
69
 
75
70
  opengl_object.render = true
76
71
  if @renderer.sort_objects?
77
- @_vector3.set_from_matrix_position(@object.matrix_world)
72
+ @_vector3 ||= Vector3.new
73
+
74
+ @_vector3.set_from_matrix_position(matrix_world)
78
75
  @_vector3.apply_projection(@renderer.proj_screen_matrix)
79
76
 
80
77
  opengl_object[:z] = @_vector3.z
@@ -86,7 +83,7 @@ module Mittsu
86
83
  end
87
84
 
88
85
  def setup_matrices(camera)
89
- @model_view_matrix.multiply_matrices(camera.matrix_world_inverse, @object.matrix_world)
86
+ @model_view_matrix.multiply_matrices(camera.matrix_world_inverse, matrix_world)
90
87
  @normal_matrix.normal_matrix(@model_view_matrix)
91
88
  @model_view_matrix
92
89
  end
@@ -104,7 +101,6 @@ module Mittsu
104
101
  end
105
102
 
106
103
  def buffer_material(geometry_group)
107
- material = @object.material
108
104
  if material.is_a?(MeshFaceMaterial)
109
105
  material.materials[geometry_group.material_index]
110
106
  else
@@ -123,8 +119,8 @@ module Mittsu
123
119
  protected
124
120
 
125
121
  def project_children
126
- @object.children.each do |child|
127
- child.implementation(@renderer).project
122
+ children.each do |child|
123
+ child.project(@renderer)
128
124
  end
129
125
  end
130
126
  end
@@ -1,5 +1,5 @@
1
1
  module Mittsu
2
- class OpenGLAmbientLight < OpenGLLight
2
+ class AmbientLight
3
3
  TYPE = :ambient
4
4
 
5
5
  class Cache < Struct.new(:length, :count, :value)
@@ -16,9 +16,9 @@ module Mittsu
16
16
  end
17
17
 
18
18
  def setup_specific(_)
19
- @cache.value[0] += @light.color.r
20
- @cache.value[1] += @light.color.g
21
- @cache.value[2] += @light.color.b
19
+ @cache.value[0] += color.r
20
+ @cache.value[1] += color.g
21
+ @cache.value[2] += color.b
22
22
  end
23
23
 
24
24
  def self.null_remaining_lights(_); end
@@ -1,5 +1,5 @@
1
1
  module Mittsu
2
- class OpenGLDirectionalLight < OpenGLLight
2
+ class DirectionalLight
3
3
  TYPE = :directional
4
4
 
5
5
  class Cache < Struct.new(:length, :count, :colors, :positions)
@@ -15,8 +15,8 @@ module Mittsu
15
15
  def setup_specific(index)
16
16
  offset = index * 3
17
17
 
18
- @_direction.set_from_matrix_position(@light.matrix_world)
19
- @_vector3.set_from_matrix_position(@light.target.matrix_world)
18
+ @_direction.set_from_matrix_position(matrix_world)
19
+ @_vector3.set_from_matrix_position(target.matrix_world)
20
20
  @_direction.sub(@_vector3)
21
21
  @_direction.normalize
22
22
 
@@ -25,7 +25,7 @@ module Mittsu
25
25
  positions[offset + 1] = @_direction.y
26
26
  positions[offset + 2] = @_direction.z
27
27
 
28
- OpenGLHelper.set_color_linear(@cache.colors, offset, @light.color, @light.intensity)
28
+ OpenGLHelper.set_color_linear(@cache.colors, offset, color, intensity)
29
29
  end
30
30
 
31
31
  def to_sym
@@ -1,5 +1,5 @@
1
1
  module Mittsu
2
- class OpenGLHemisphereLight < OpenGLLight
2
+ class HemisphereLight
3
3
  TYPE = :hemi
4
4
 
5
5
  class Cache < Struct.new(:length, :count, :sky_colors, :ground_colors, :positions)
@@ -15,7 +15,7 @@ module Mittsu
15
15
  def setup_specific(index)
16
16
  offset = index * 3
17
17
 
18
- @_direction.set_from_matrix_position(@light.matrix_world)
18
+ @_direction.set_from_matrix_position(matrix_world)
19
19
  @_direction.normalize
20
20
 
21
21
  positions = @cache.positions
@@ -23,11 +23,8 @@ module Mittsu
23
23
  positions[offset + 1] = @_direction.y
24
24
  positions[offset + 2] = @_direction.z
25
25
 
26
- sky_color = @light.color
27
- ground_color = @light.ground_color
28
-
29
- OpenGLHelper.set_color_linear(@cache.sky_colors, offset, sky_color, @light.intensity )
30
- OpenGLHelper.set_color_linear(@cache.ground_colors, offset, ground_color, @light.intensity)
26
+ OpenGLHelper.set_color_linear(@cache.sky_colors, offset, color, intensity)
27
+ OpenGLHelper.set_color_linear(@cache.ground_colors, offset, ground_color, intensity)
31
28
  end
32
29
 
33
30
  def self.null_remaining_lights(cache)
@@ -0,0 +1,55 @@
1
+ module Mittsu
2
+ class Light
3
+ attr_accessor :camera_helper
4
+
5
+ # def initialize(light, renderer)
6
+ # super
7
+ # @light = light
8
+ # @light_renderer = renderer.light_renderer
9
+ #
10
+ #
11
+ # @_direction = Vector3.new
12
+ # @_vector3 = Vector3.new
13
+ # end
14
+
15
+ def type
16
+ self.class::TYPE
17
+ end
18
+
19
+ def setup(light_renderer)
20
+ @light_renderer = light_renderer
21
+ @cache ||= @light_renderer.cache[type]
22
+ @cache.count += 1
23
+
24
+ return unless visible
25
+
26
+ @_direction ||= Vector3.new
27
+ @_vector3 ||= Vector3.new
28
+
29
+ setup_specific(@cache.length)
30
+
31
+ @cache.length += 1
32
+ end
33
+
34
+ def project(renderer)
35
+ @renderer = renderer
36
+ return unless visible
37
+ init
38
+ # TODO!!! FIXME!!!
39
+ @renderer.instance_variable_get(:@lights) << self
40
+ project_children
41
+ end
42
+
43
+ def self.null_remaining_lights(cache, colors = nil)
44
+ colors ||= cache.colors
45
+ count = [colors.length, cache.count * 3].max
46
+ (cache.length * 3).upto(count - 1).each { |i|
47
+ colors[i] = 0.0
48
+ }
49
+ end
50
+
51
+ def to_sym
52
+ :other
53
+ end
54
+ end
55
+ end