Class: Mittsu::MeshBasicMaterial

Inherits:
Material show all
Defined in:
lib/mittsu/materials/mesh_basic_material.rb

Instance Attribute Summary

Attributes inherited from Material

#alpha_map, #alpha_test, #attributes, #blend_dst, #blend_dst_alpha, #blend_equation, #blend_equation_alpha, #blend_src, #blend_src_alpha, #blending, #bump_map, #color, #color_write, #combine, #default_attribute_values, #defines, #depth_test, #depth_write, #env_map, #fog, #fragment_shader, #id, #light_map, #lights, #map, #metal, #morph_normals, #morph_targets, #name, #normal_map, #opacity, #overdraw, #polygon_offset, #polygon_offset_factor, #polygon_offset_units, #program, #reflectivity, #refraction_ratio, #shading, #side, #size_attenuation, #skinning, #specular_map, #transparent, #type, #uniforms, #uuid, #vertex_colors, #vertex_shader, #visible, #wireframe, #wrap_around

Instance Method Summary collapse

Methods inherited from Material

#dispose, #needs_update=, #needs_update?, #set_values, #update

Methods included from EventDispatcher

#add_event_listener, #dispatch_event, #has_event_listener, #remove_event_listener

Methods inherited from HashObject

#[], #[]=, #delete

Constructor Details

#initialize(parameters = {}) ⇒ MeshBasicMaterial

Returns a new instance of MeshBasicMaterial.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/mittsu/materials/mesh_basic_material.rb', line 39

def initialize(parameters = {})
  super()

  @type = 'MeshBasicMaterial'

  @color = Color.new(0xffffff) # emissive

  @map = nil

  @light_map = nil

  @specular_map = nil

  @alpha_map = nil

  @env_map = nil
  @combine = MultiplyOperation
  @reflectivity = 1.0
  @refraction_ratio = 0.98

  @fog = true

  @shading = SmoothShading

  @wireframe = false
  @wireframe_linewidth = 1
  @wireframe_linecap = :round
  @wireframe_linejoin = :round

  @vertex_colors = NoColors

  @skinning = false
  @morph_targets = false

  set_values(parameters)
end

Instance Method Details

#cloneObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/mittsu/materials/mesh_basic_material.rb', line 76

def clone
  material = Material.new

  super(material)

  material.color.copy(@color)

  material.map = @map

  material.lightMap = @lightMap

  material.specularMap = @specularMap

  material.alphaMap = @alphaMap

  material.envMap = @envMap
  material.combine = @combine
  material.reflectivity = @reflectivity
  material.refractionRatio = @refractionRatio

  material.fog = @fog

  material.shading = @shading

  material.wireframe = @wireframe
  material.wireframeLinewidth = @wireframeLinewidth
  material.wireframeLinecap = @wireframeLinecap
  material.wireframeLinejoin = @wireframeLinejoin

  material.vertexColors = @vertexColors

  material.skinning = @skinning
  material.morphTargets = @morphTargets

  material
end

#to_jsonObject



113
114
115
116
117
118
119
120
# File 'lib/mittsu/materials/mesh_basic_material.rb', line 113

def to_json
  output = super
  output[:color] = @color.hex
  output[:vertex_colors] = @vertex_colors unless @vertex_colors == NoColors
  output[:blending] = @blending unless @blending == NormalBlending
  output[:side] = @side unless @side == FrontSide
  output
end