Method: Mittsu::Object3D#initialize

Defined in:
lib/mittsu/core/object_3d.rb

#initializeObject3D

Returns a new instance of Object3D.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/mittsu/core/object_3d.rb', line 16

def initialize
  super
  @id = (@@id ||= 1).tap { @@id += 1 }

  @uuid = SecureRandom.uuid

  @type = 'Object3D'

  @children = []

  @up = DefaultUp.clone

  @position = Vector3.new
  @rotation = Euler.new
  @quaternion = Quaternion.new
  @scale = Vector3.new(1.0, 1.0, 1.0)

  @rotation.on_change do
    @quaternion.set_from_euler(rotation, false)
  end

  @quaternion.on_change do
    @rotation.set_from_quaternion(quaternion, false)
  end

  @rotation_auto_update = true

  @matrix = Matrix4.new
  @matrix_world = Matrix4.new

  @matrix_auto_update = true
  @matrix_world_needs_update = false

  @visible = true

  @cast_shadow = false
  @receive_shadow = false

  @frustum_culled = true
  @render_order = 0

  @user_data = {}
end