Class: Mittsu::LineBasicMaterial

Inherits:
Material
  • Object
show all
Defined in:
lib/mittsu/materials/line_basic_material.rb,
lib/mittsu/renderers/opengl/materials/line_basic_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, #shader, #shading, #shadow_pass, #side, #size_attenuation, #skinning, #specular_map, #transparent, #type, #uniforms, #uniforms_list, #uuid, #vertex_colors, #vertex_shader, #visible, #wireframe, #wrap_around

Instance Method Summary collapse

Methods inherited from Material

#clear_custom_attributes, #custom_attributes_dirty?, #dispose, #init, #needs_camera_position_uniform?, #needs_face_normals?, #needs_lights?, #needs_update=, #needs_update?, #needs_view_matrix_uniform?, #set, #set_values, #to_json, #update

Methods included from EventDispatcher

#add_event_listener, #dispatch_event, #has_event_listener, #remove_event_listener

Constructor Details

#initialize(parameters = {}) ⇒ LineBasicMaterial

Returns a new instance of LineBasicMaterial.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mittsu/materials/line_basic_material.rb', line 5

def initialize(parameters = {})
  super()

  @type = 'LineBasicMaterial'

  @color = Color.new(0xffffff)

  @line_width = 1.0
  @line_cap = :round
  @line_join = :round

  @vertex_colors = NoColors

  @fog = true

  self.set_values(parameters)
end

Instance Attribute Details

#line_capObject

Returns the value of attribute line_cap.



3
4
5
# File 'lib/mittsu/materials/line_basic_material.rb', line 3

def line_cap
  @line_cap
end

#line_joinObject

Returns the value of attribute line_join.



3
4
5
# File 'lib/mittsu/materials/line_basic_material.rb', line 3

def line_join
  @line_join
end

#line_widthObject

Returns the value of attribute line_width.



3
4
5
# File 'lib/mittsu/materials/line_basic_material.rb', line 3

def line_width
  @line_width
end

Instance Method Details

#cloneObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/mittsu/materials/line_basic_material.rb', line 23

def clone
  LineBasicMaterial.new.tap do |material|
    super(material)

    material.color.copy(@color)

    material.line_width = @line_width
    material.line_cap = @line_cap
    material.line_join = @line_join

    material.vertex_colors = @vertex_colors

    material.fog = @fog
  end
end

#init_shaderObject



8
9
10
# File 'lib/mittsu/renderers/opengl/materials/line_basic_material.rb', line 8

def init_shader
  @shader = ShaderLib.create_shader(shader_id)
end

#refresh_uniforms(uniforms) ⇒ Object



3
4
5
6
# File 'lib/mittsu/renderers/opengl/materials/line_basic_material.rb', line 3

def refresh_uniforms(uniforms)
  uniforms['diffuse'].value = color
  uniforms['opacity'].value = opacity
end

#shader_idObject



12
13
14
# File 'lib/mittsu/renderers/opengl/materials/line_basic_material.rb', line 12

def shader_id
  :basic
end