Module: MSPhysics::Materials

Extended by:
Enumerable
Defined in:
RubyExtension/MSPhysics/materials.rb

Overview

Since:

  • 1.0.0

Class Method Summary collapse

Class Method Details

.add(material) ⇒ Boolean

Add/Overwrite material to/in the materials list.

Parameters:

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0



18
19
20
21
22
# File 'RubyExtension/MSPhysics/materials.rb', line 18

def add(material)
  AMS.validate_type(material, MSPhysics::Material)
  @instances[material.name] = material
  true
end

.material_by_name(name) ⇒ Material?

Note:

Case sensitive.

Get material by name.

Parameters:

  • name (String)

Returns:

Since:

  • 1.0.0



44
45
46
# File 'RubyExtension/MSPhysics/materials.rb', line 44

def material_by_name(name)
  @instances[name]
end

.namesArray<String>

Get all material names.

Returns:

  • (Array<String>)

Since:

  • 1.0.0



50
51
52
# File 'RubyExtension/MSPhysics/materials.rb', line 50

def names
  @instances.keys
end

.remove(material) ⇒ Boolean

Remove material from the materials list.

Parameters:

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0



27
28
29
30
# File 'RubyExtension/MSPhysics/materials.rb', line 27

def remove(material)
  AMS.validate_type(material, MSPhysics::Material)
  @instances.delete(material)
end

.remove_by_name(name) ⇒ Boolean

Note:

Case sensitive.

Remove material from the materials list by name.

Parameters:

  • name (String)

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0



36
37
38
# File 'RubyExtension/MSPhysics/materials.rb', line 36

def remove_by_name(name)
  @instances.delete(name) ? true : false
end