Class: Three::Fog

Inherits:
Object
  • Object
show all
Includes:
Dirty
Defined in:
lib/three/scenes/fog.rb

Direct Known Subclasses

FogExp2

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dirty

#add_dirty_dependent, #dirty?, #dirty_dependents, #dirty_field?, #dirty_fields, #mark_clean!, #mark_dirty!, #remove_dirty_dependent

Constructor Details

#initialize(color = 0xffffff, near: 1, far: 1000, name: "") ⇒ Fog

Returns a new instance of Fog.



13
14
15
16
17
18
19
20
21
22
# File 'lib/three/scenes/fog.rb', line 13

def initialize(color = 0xffffff, near: 1, far: 1000, name: "")
  @uuid = MathUtils.generate_uuid
  @type = "Fog"
  @name = name
  @color = color.is_a?(Color) ? color : Color.new(color)
  @near = near
  @far = far
  bind_color_changes
  mark_dirty!
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



11
12
13
# File 'lib/three/scenes/fog.rb', line 11

def color
  @color
end

#farObject

Returns the value of attribute far.



11
12
13
# File 'lib/three/scenes/fog.rb', line 11

def far
  @far
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/three/scenes/fog.rb', line 11

def name
  @name
end

#nearObject

Returns the value of attribute near.



11
12
13
# File 'lib/three/scenes/fog.rb', line 11

def near
  @near
end

#typeObject (readonly)

Returns the value of attribute type.



11
12
13
# File 'lib/three/scenes/fog.rb', line 11

def type
  @type
end

#uuidObject (readonly)

Returns the value of attribute uuid.



11
12
13
# File 'lib/three/scenes/fog.rb', line 11

def uuid
  @uuid
end

Instance Method Details

#to_hObject



45
46
47
48
49
50
51
52
53
# File 'lib/three/scenes/fog.rb', line 45

def to_h
  {
    type: @type,
    name: @name,
    color: @color.hex,
    near: @near,
    far: @far
  }
end