Class: Mittsu::MeshPhongMaterial

Inherits:
Material
  • Object
show all
Defined in:
lib/mittsu/materials/mesh_phong_material.rb

Instance Attribute Summary collapse

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, #to_json, #update

Methods included from EventDispatcher

#add_event_listener, #dispatch_event, #has_event_listener, #remove_event_listener

Constructor Details

#initialize(parameters = {}) ⇒ MeshPhongMaterial

Returns a new instance of MeshPhongMaterial.



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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/mittsu/materials/mesh_phong_material.rb', line 48

def initialize(parameters = {})
  super()

	@type = 'MeshPhongMaterial'

	@color = Color.new(0xffffff) # diffuse
	@emissive = Color.new(0x000000)
	@specular = Color.new(0x111111)
	@shininess = 30.0

	@metal = false

	@wrap_around = false
	@wrap_rgb = Vector3.new(1.0, 1.0, 1.0)

	@map = nil

	@light_map = nil

	@bump_map = nil
	@bump_scale = 1.0

	@normal_map = nil
	@normal_scale = Vector2.new(1.0, 1.0)

	@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.0
	@wireframe_linecap = 'round'
	@wireframe_linejoin = 'round'

	@vertex_colors = NoColors

	@skinning = false
	@morph_targets = false
	@morph_normals = false

	self.set_values(parameters)
end

Instance Attribute Details

#emissiveObject

Returns the value of attribute emissive.



46
47
48
# File 'lib/mittsu/materials/mesh_phong_material.rb', line 46

def emissive
  @emissive
end

#normal_scaleObject

Returns the value of attribute normal_scale.



46
47
48
# File 'lib/mittsu/materials/mesh_phong_material.rb', line 46

def normal_scale
  @normal_scale
end

#shininessObject

Returns the value of attribute shininess.



46
47
48
# File 'lib/mittsu/materials/mesh_phong_material.rb', line 46

def shininess
  @shininess
end

#specularObject

Returns the value of attribute specular.



46
47
48
# File 'lib/mittsu/materials/mesh_phong_material.rb', line 46

def specular
  @specular
end

Instance Method Details

#cloneObject



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/mittsu/materials/mesh_phong_material.rb', line 100

def clone
  material = MeshPhongMaterial.new

  super(material)

	material.color.copy(@color)
	material.emissive.copy(@emissive)
	material.specular.copy(@specular)
	material.shininess = @shininess

	material.metal = @metal

	material.wrap_around = @wrap_around
	material.wrap_rgb.copy(@wrap_rgb)

	material.map = @map

	material.light_map = @light_map

	material.bump_map = @bump_map
	material.bump_scale = @bump_scale

	material.normal_map = @normal_map
	material.normal_scale.copy(@normal_scale)

	material.specular_map = @specular_map

	material.alpha_map = @alpha_map

	material.env_map = @env_map
	material.combine = @combine
	material.reflectivity = @reflectivity
	material.refraction_ratio = @refraction_ratio

	material.fog = @fog

	material.shading = @shading

	material.wireframe = @wireframe
	material.wireframe_linewidth = @wireframe_linewidth
	material.wireframe_linecap = @wireframe_linecap
	material.wireframe_linejoin = @wireframe_linejoin

	material.vertex_colors = @vertex_colors

	material.skinning = @skinning
	material.morph_targets = @morph_targets
	material.morph_normals = @morph_normals

	material
end