Class: Three::MeshMatcapMaterial

Inherits:
Material show all
Defined in:
lib/three/materials/mesh_matcap_material.rb

Constant Summary collapse

TEXTURE_SLOTS =
%i[
  matcap
  map
  alpha_map
  bump_map
  displacement_map
  normal_map
].freeze

Instance Attribute Summary collapse

Attributes inherited from Material

#blending, #id, #name, #opacity, #side, #transparent, #type, #user_data, #uuid, #vertex_colors, #visible

Instance Method Summary collapse

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) ⇒ MeshMatcapMaterial

Returns a new instance of MeshMatcapMaterial.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/three/materials/mesh_matcap_material.rb', line 20

def initialize(parameters = nil)
  super(nil)
  @type = "MeshMatcapMaterial"
  @color = Color.new(0xffffff)
  TEXTURE_SLOTS.each { |slot| instance_variable_set(:"@#{slot}", nil) }
  @wireframe = false
  @wireframe_linewidth = 1
  @fog = true
  @flat_shading = false
  bind_color_changes
  set_values(parameters) if parameters
  mark_dirty!
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



17
18
19
# File 'lib/three/materials/mesh_matcap_material.rb', line 17

def color
  @color
end

#flat_shadingObject

Returns the value of attribute flat_shading.



17
18
19
# File 'lib/three/materials/mesh_matcap_material.rb', line 17

def flat_shading
  @flat_shading
end

#fogObject

Returns the value of attribute fog.



17
18
19
# File 'lib/three/materials/mesh_matcap_material.rb', line 17

def fog
  @fog
end

#wireframeObject

Returns the value of attribute wireframe.



17
18
19
# File 'lib/three/materials/mesh_matcap_material.rb', line 17

def wireframe
  @wireframe
end

#wireframe_linewidthObject

Returns the value of attribute wireframe_linewidth.



17
18
19
# File 'lib/three/materials/mesh_matcap_material.rb', line 17

def wireframe_linewidth
  @wireframe_linewidth
end

Instance Method Details

#texture_slotsObject



64
65
66
# File 'lib/three/materials/mesh_matcap_material.rb', line 64

def texture_slots
  TEXTURE_SLOTS
end

#to_hObject



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/three/materials/mesh_matcap_material.rb', line 68

def to_h
  result = super.merge(
    color: @color.hex,
    wireframe: @wireframe,
    wireframe_linewidth: @wireframe_linewidth,
    fog: @fog,
    flat_shading: @flat_shading
  )
  TEXTURE_SLOTS.each { |slot| result[slot] = public_send(slot)&.to_h }
  result
end