Module: Mittsu::OpenGLGeometryLike

Included in:
BufferGeometry, Geometry, OpenGLGeometryGroup
Defined in:
lib/mittsu/renderers/opengl/opengl_geometry_like.rb

Constant Summary collapse

CONST_BUFFER_NAMES =
[
  :vertex,
  :color,
  :normal,
  :tangent,
  :uv,
  :uv2,
  :skin_indices,
  :skin_weight,
  :line_distance,
  :face,
  :line
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#custom_attributes_listObject

Returns the value of attribute custom_attributes_list.



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

def custom_attributes_list
  @custom_attributes_list
end

#face_countObject

Returns the value of attribute face_count.



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

def face_count
  @face_count
end

#faces3Object

Returns the value of attribute faces3.



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

def faces3
  @faces3
end

#initted_arraysObject

Returns the value of attribute initted_arrays.



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

def initted_arrays
  @initted_arrays
end

#line_countObject

Returns the value of attribute line_count.



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

def line_count
  @line_count
end

#morph_normals_arraysObject

Returns the value of attribute morph_normals_arrays.



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

def morph_normals_arrays
  @morph_normals_arrays
end

#morph_normals_buffersObject

Returns the value of attribute morph_normals_buffers.



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

def morph_normals_buffers
  @morph_normals_buffers
end

#morph_targets_arraysObject

Returns the value of attribute morph_targets_arrays.



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

def morph_targets_arrays
  @morph_targets_arrays
end

#morph_targets_buffersObject

Returns the value of attribute morph_targets_buffers.



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

def morph_targets_buffers
  @morph_targets_buffers
end

#num_morph_normalsObject

Returns the value of attribute num_morph_normals.



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

def num_morph_normals
  @num_morph_normals
end

#num_morph_targetsObject

Returns the value of attribute num_morph_targets.



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

def num_morph_targets
  @num_morph_targets
end

#num_verticesObject

Returns the value of attribute num_vertices.



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

def num_vertices
  @num_vertices
end

#particle_countObject

Returns the value of attribute particle_count.



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

def particle_count
  @particle_count
end

#rendererObject

Returns the value of attribute renderer.



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

def renderer
  @renderer
end

#type_arrayObject

Returns the value of attribute type_array.



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

def type_array
  @type_array
end

#vertex_array_objectObject

Returns the value of attribute vertex_array_object.



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

def vertex_array_object
  @vertex_array_object
end

Instance Method Details

#bind_vertex_array_objectObject



36
37
38
# File 'lib/mittsu/renderers/opengl/opengl_geometry_like.rb', line 36

def bind_vertex_array_object
  glBindVertexArray(@vertex_array_object) if @vertex_array_object
end

#update_other_buffers(object, material, attributes) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/mittsu/renderers/opengl/opengl_geometry_like.rb', line 46

def update_other_buffers(object, material, attributes)
  update_custom_attributes(attributes)

  update_color_buffer(attributes['color'], object, material)
  update_normal_buffer(attributes['normal'])
  update_tangent_buffer(attributes['tangent'])
  update_uv_buffers(attributes['uv'], attributes['uv2'], object, material)

  if material.skinning
    update_skin_buffers(attributes['skin_index'], attributes['skin_weight'])
  end

  update_line_distances_buffer(attributes['line_distances'])
end

#update_vertex_buffer(attribute) ⇒ Object



40
41
42
43
44
# File 'lib/mittsu/renderers/opengl/opengl_geometry_like.rb', line 40

def update_vertex_buffer(attribute)
  glBindBuffer(GL_ARRAY_BUFFER, @vertex_buffer)
  @renderer.state.enable_attribute(attribute)
  glVertexAttribPointer(attribute, 3, GL_FLOAT, GL_FALSE, 0, 0)
end