Class: Mittsu::SpritePlugin
- Inherits:
-
Object
- Object
- Mittsu::SpritePlugin
- Includes:
- OpenGLHelper
- Defined in:
- lib/mittsu/renderers/opengl/plugins/sprite_plugin.rb
Constant Summary collapse
- VERTICES =
[ -0.5, -0.5, 0.0, 0.0, 0.5, -0.5, 1.0, 0.0, 0.5, 0.5, 1.0, 1.0, -0.5, 0.5, 0.0, 1.0 ]
- FACES =
Float32Array
[ 0, 1, 2, 0, 2, 3 ]
Instance Method Summary collapse
-
#initialize(renderer, sprites) ⇒ SpritePlugin
constructor
Uint16Array.
- #render(scene, camera) ⇒ Object
Methods included from OpenGLHelper
#array_to_ptr, #array_to_ptr_easy, #glBufferData_easy, #glCreateBuffer, #glCreateFramebuffer, #glCreateRenderbuffer, #glCreateTexture, #glCreateVertexArray, #glGetParameter, mark_uniforms_lights_needs_update, painter_sort_stable, refresh_uniforms_lambert, refresh_uniforms_lights, refresh_uniforms_shadow, reverse_painter_sort_stable, set_color_linear
Constructor Details
#initialize(renderer, sprites) ⇒ SpritePlugin
Uint16Array
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mittsu/renderers/opengl/plugins/sprite_plugin.rb', line 17 def initialize(renderer, sprites) @renderer = renderer @sprites = sprites @program = nil # for decomposing matrixWorld @sprite_position = Vector3.new @sprite_rotation = Quaternion.new @sprite_scale = Vector3.new end |
Instance Method Details
#render(scene, camera) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mittsu/renderers/opengl/plugins/sprite_plugin.rb', line 28 def render(scene, camera) return if @sprites.empty? init if @program.nil? setup_gl_for_render(camera) setup_fog(scene) update_positions_and_sort(camera) render_all_sprites(scene) glEnable(GL_CULL_FACE) @renderer.reset_gl_state end |