Class: Three::SpriteMaterial
- Inherits:
-
Material
- Object
- EventDispatcher
- Material
- Three::SpriteMaterial
- Defined in:
- lib/three/materials/sprite_material.rb
Instance Attribute Summary collapse
-
#alpha_map ⇒ Object
Returns the value of attribute alpha_map.
-
#color ⇒ Object
Returns the value of attribute color.
-
#fog ⇒ Object
Returns the value of attribute fog.
-
#map ⇒ Object
Returns the value of attribute map.
-
#rotation ⇒ Object
Returns the value of attribute rotation.
-
#size_attenuation ⇒ Object
Returns the value of attribute size_attenuation.
Attributes inherited from Material
#blending, #id, #name, #opacity, #side, #transparent, #type, #user_data, #uuid, #vertex_colors, #visible
Instance Method Summary collapse
-
#initialize(parameters = nil) ⇒ SpriteMaterial
constructor
A new instance of SpriteMaterial.
- #texture_slots ⇒ Object
- #to_h ⇒ Object
Methods inherited from Material
allocate_id, #dirty_dependency_changed, #dispose, #needs_update, #needs_update!, #needs_update=, #set_values, #textures
Methods included from Dirty
#add_dirty_dependent, #dirty?, #dirty_dependents, #dirty_field?, #dirty_fields, #mark_clean!, #mark_dirty!, #remove_dirty_dependent
Methods inherited from EventDispatcher
#add_event_listener, #dispatch_event, #has_event_listener?, #remove_event_listener
Constructor Details
#initialize(parameters = nil) ⇒ SpriteMaterial
Returns a new instance of SpriteMaterial.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/three/materials/sprite_material.rb', line 10 def initialize(parameters = nil) super(nil) @type = "SpriteMaterial" @color = Color.new(0xffffff) @map = nil @alpha_map = nil @rotation = 0 @size_attenuation = true @transparent = true @fog = true bind_color_changes set_values(parameters) if parameters mark_dirty! end |
Instance Attribute Details
#alpha_map ⇒ Object
Returns the value of attribute alpha_map.
8 9 10 |
# File 'lib/three/materials/sprite_material.rb', line 8 def alpha_map @alpha_map end |
#color ⇒ Object
Returns the value of attribute color.
8 9 10 |
# File 'lib/three/materials/sprite_material.rb', line 8 def color @color end |
#fog ⇒ Object
Returns the value of attribute fog.
8 9 10 |
# File 'lib/three/materials/sprite_material.rb', line 8 def fog @fog end |
#map ⇒ Object
Returns the value of attribute map.
8 9 10 |
# File 'lib/three/materials/sprite_material.rb', line 8 def map @map end |
#rotation ⇒ Object
Returns the value of attribute rotation.
8 9 10 |
# File 'lib/three/materials/sprite_material.rb', line 8 def rotation @rotation end |
#size_attenuation ⇒ Object
Returns the value of attribute size_attenuation.
8 9 10 |
# File 'lib/three/materials/sprite_material.rb', line 8 def size_attenuation @size_attenuation end |
Instance Method Details
#texture_slots ⇒ Object
54 55 56 |
# File 'lib/three/materials/sprite_material.rb', line 54 def texture_slots %i[map alpha_map] end |
#to_h ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/three/materials/sprite_material.rb', line 58 def to_h super.merge( color: @color.hex, map: @map&.to_h, alpha_map: @alpha_map&.to_h, rotation: @rotation, size_attenuation: @size_attenuation, fog: @fog ) end |