Class: Mittsu::Sprite
Constant Summary collapse
- INDICES =
[0, 1, 2, 0, 2, 3]
- VERTICES =
[-0.5, -0.5, 0.0, 0.5, -0.5, 0.0, 0.5, 0.5, 0.0, -0.5, 0.5, 0.0]
- UVS =
[0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0]
- GEOMETRY =
BufferGeometry.new
Constants inherited from Object3D
Instance Attribute Summary collapse
-
#material ⇒ Object
Returns the value of attribute material.
-
#z ⇒ Object
Returns the value of attribute z.
Attributes inherited from Object3D
#cast_shadow, #children, #frustum_culled, #geometry, #id, #matrix, #matrix_auto_update, #matrix_world, #matrix_world_needs_update, #name, #parent, #position, #quaternion, #receive_shadow, #render_order, #rotation, #rotation_auto_update, #scale, #type, #up, #user_data, #uuid, #visible
Instance Method Summary collapse
- #clone(object = Sprite.new(@material)) ⇒ Object
-
#initialize(material = SpriteMaterial.new) ⇒ Sprite
constructor
A new instance of Sprite.
- #raycast(raycaster, intersects) ⇒ Object
Methods inherited from Object3D
#add, #apply_matrix, #get_object_by_id, #get_object_by_name, #get_object_by_property, #get_world_direction, #get_world_position, #get_world_quaternion, #get_world_rotation, #get_world_scale, #local_to_world, #look_at, #print_tree, #remove, #rotate_on_axis, #rotate_x, #rotate_y, #rotate_z, #set_rotation_from_axis_angle, #set_rotation_from_euler, #set_rotation_from_matrix, #set_rotation_from_quaternion, #to_json, #to_s, #translate_on_axis, #translate_x, #translate_y, #translate_z, #traverse, #traverse_ancestors, #traverse_visible, #update_matrix, #update_matrix_world, #world_to_local
Methods included from EventDispatcher
#add_event_listener, #dispatch_event, #has_event_listener, #remove_event_listener
Constructor Details
#initialize(material = SpriteMaterial.new) ⇒ Sprite
Returns a new instance of Sprite.
21 22 23 24 25 26 27 28 29 |
# File 'lib/mittsu/objects/sprite.rb', line 21 def initialize(material = SpriteMaterial.new) super() @type = 'Sprite' @geometry = GEOMETRY @material = material @z = nil end |
Instance Attribute Details
#material ⇒ Object
Returns the value of attribute material.
3 4 5 |
# File 'lib/mittsu/objects/sprite.rb', line 3 def material @material end |
#z ⇒ Object
Returns the value of attribute z.
3 4 5 |
# File 'lib/mittsu/objects/sprite.rb', line 3 def z @z end |
Instance Method Details
#clone(object = Sprite.new(@material)) ⇒ Object
48 49 50 51 |
# File 'lib/mittsu/objects/sprite.rb', line 48 def clone(object = Sprite.new(@material)) super(object) object end |
#raycast(raycaster, intersects) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mittsu/objects/sprite.rb', line 31 def raycast(raycaster, intersects) @_matrix_position ||= Vector3.new @_matrix_position.set_from_matrix_position(@matrix_world) distance = raycaster.ray.distance_to_pint(@_matrix_position) return if distance > @scale.x intersects.push({ distance: distance, point: @position, face: nil, object: self }) end |