Class: Mittsu::MeshLambertMaterial

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

Overview

parameters:

color: <hex>,
emissive: <hex>,
opacity: <float>,

map: Texture.new( <Image> ),

light_map: Texture.( <Image> ),

specular_map: Texture.new( <Image> ),

alpha_map: Texture.new( <Image> ),

env_map: TextureCube.new( [posx, negx, posy, negy, posz, negz]),
combine: Multiply,
reflectivity: <float>,
refraction_ratio: <float>,

shading: SmoothShading,
blending: NormalBlending,
depth_test: <bool>,
depth_write: <bool>,

wireframe: <boolean>,
wireframe_linewidth: <float>,

vertex_colors: NoColors / VertexColors / FaceColors,

skinning: <bool>,
morph_targets: <bool>,
morph_normals: <bool>,

fog: <bool>

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, #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 = {}) ⇒ MeshLambertMaterial

Returns a new instance of MeshLambertMaterial.



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
75
76
77
78
79
80
81
82
# File 'lib/mittsu/materials/mesh_lambert_material.rb', line 42

def initialize(parameters = {})
  super()

  @type = 'MeshLambertMaterial'

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

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

  @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.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.



40
41
42
# File 'lib/mittsu/materials/mesh_lambert_material.rb', line 40

def emissive
  @emissive
end

#shadingObject

Returns the value of attribute shading.



40
41
42
# File 'lib/mittsu/materials/mesh_lambert_material.rb', line 40

def shading
  @shading
end

#wireframe_linecapObject

Returns the value of attribute wireframe_linecap.



40
41
42
# File 'lib/mittsu/materials/mesh_lambert_material.rb', line 40

def wireframe_linecap
  @wireframe_linecap
end

#wireframe_linejoinObject

Returns the value of attribute wireframe_linejoin.



40
41
42
# File 'lib/mittsu/materials/mesh_lambert_material.rb', line 40

def wireframe_linejoin
  @wireframe_linejoin
end

#wireframe_linewidthObject

Returns the value of attribute wireframe_linewidth.



40
41
42
# File 'lib/mittsu/materials/mesh_lambert_material.rb', line 40

def wireframe_linewidth
  @wireframe_linewidth
end

Instance Method Details

#cloneObject



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
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/mittsu/materials/mesh_lambert_material.rb', line 84

def clone
  material = MeshLambertMaterial.new

  super(material)

  material.color.copy(@color)
  material.emissive.copy(@color)

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

  material.map = @map

  material.light_map = @light_map

  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