Class: Mittsu::PointCloudMaterial

Inherits:
Material
  • Object
show all
Defined in:
lib/mittsu/materials/point_cloud_material.rb,
lib/mittsu/renderers/opengl/materials/point_cloud_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, #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 = {}) ⇒ PointCloudMaterial

Returns a new instance of PointCloudMaterial.



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

def initialize(parameters = {})
  super()

  @type = 'PointCloudMaterial'

  @color = Color.new(0xffffff)

  @map = nil

  @size = 1.0
  @size_attenuation = true

  @vertex_colors = NoColors

  @fog = true

  self.set_values(parameters)
end

Instance Attribute Details

#sizeObject

Returns the value of attribute size.



20
21
22
# File 'lib/mittsu/materials/point_cloud_material.rb', line 20

def size
  @size
end

#size_attenuationObject

Returns the value of attribute size_attenuation.



20
21
22
# File 'lib/mittsu/materials/point_cloud_material.rb', line 20

def size_attenuation
  @size_attenuation
end

Instance Method Details

#cloneObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/mittsu/materials/point_cloud_material.rb', line 41

def clone
  material = PointCloudMaterial.new
  super(material)
  material.color.copy(@color)
  material.map = @map
  material.size = @size
  material.size_attenuation = @size_attenuation
  material.vertex_colors = @vertex_colors
  material.fog = @fog
  material
end

#init_shaderObject



19
20
21
# File 'lib/mittsu/renderers/opengl/materials/point_cloud_material.rb', line 19

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

#refresh_uniforms(uniforms) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mittsu/renderers/opengl/materials/point_cloud_material.rb', line 3

def refresh_uniforms(uniforms)
  uniforms['psColor'].value = color
  uniforms['opacity'].value = opacity
  uniforms['size'].value = size
  # uniforms['scale'].value = _canvas.height / 2.0 # TODO get window height?

  uniforms['map'].value = map

  if !map.nil?
    offset = material.map.offset
    repeat = material.map.repeat

    uniforms['offsetRepeat'].value.set(offset.x, offset.y, repeat.x, repeat.y)
  end
end

#shader_idObject



23
24
25
# File 'lib/mittsu/renderers/opengl/materials/point_cloud_material.rb', line 23

def shader_id
  :particle_basic
end