Class: Engine::Components::MeshRenderer

Inherits:
Engine::Component show all
Defined in:
lib/engine/components/mesh_renderer.rb

Instance Attribute Summary collapse

Attributes inherited from Engine::Component

#game_object

Instance Method Summary collapse

Methods inherited from Engine::Component

#_erase!, #destroy!, #destroyed?, destroyed_components, erase_destroyed_components, method_added, #set_game_object, #ui_renderer?

Constructor Details

#initialize(mesh, material, static: false) ⇒ MeshRenderer

Returns a new instance of MeshRenderer.



7
8
9
10
11
# File 'lib/engine/components/mesh_renderer.rb', line 7

def initialize(mesh, material, static: false)
  @mesh = mesh
  @material = material
  @static = static
end

Instance Attribute Details

#materialObject (readonly)

Returns the value of attribute material.



5
6
7
# File 'lib/engine/components/mesh_renderer.rb', line 5

def material
  @material
end

#meshObject (readonly)

Returns the value of attribute mesh.



5
6
7
# File 'lib/engine/components/mesh_renderer.rb', line 5

def mesh
  @mesh
end

#staticObject (readonly)

Returns the value of attribute static.



5
6
7
# File 'lib/engine/components/mesh_renderer.rb', line 5

def static
  @static
end

Instance Method Details

#destroyObject



27
28
29
# File 'lib/engine/components/mesh_renderer.rb', line 27

def destroy
  Rendering::RenderPipeline.remove_instance(self)
end

#renderer?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/engine/components/mesh_renderer.rb', line 13

def renderer?
  true
end

#startObject



17
18
19
# File 'lib/engine/components/mesh_renderer.rb', line 17

def start
  Rendering::RenderPipeline.add_instance(self)
end

#update(delta_time) ⇒ Object



21
22
23
24
25
# File 'lib/engine/components/mesh_renderer.rb', line 21

def update(delta_time)
  unless static
    Rendering::RenderPipeline.update_instance(self)
  end
end