class Mittsu::BufferAttribute
Attributes
array[RW]
item_size[RW]
needs_update[RW]
Public Class Methods
new(array, item_size)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 5 def initialize(array, item_size) @array = array @item_size = item_size @needs_update = false end
Public Instance Methods
clone()
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 95 def clone BufferAttribute.new(@array.clone, @item_size) end
copy_at(index1, attribute, index2)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 16 def copy_at(index1, attribute, index2) index1 *= @item_size index2 *= attribute.item_size @item_size.times do |i| @array[index1 + i] = attribute.array[index2 + i] end self end
get_x(index)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 53 def get_x(index) @array[index * @item_size] end
get_y(index)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 57 def get_y(index) @array[index * @item_size + 1] end
get_z(index)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 61 def get_z(index) @array[index * @item_size + 2] end
length()
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 12 def length @array.length end
set(value, offset)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 27 def set(value, offset) offset ||= 0 @array[offset, value.length] = value self end
set_x(index, x)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 35 def set_x(index, x) @array[index * @item_size] = x self end
set_xy(index, x, y)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 65 def set_xy(index, x, y) index *= @item_size @array[index ] = x @array[index + 1] = y self end
set_xyz(index, x, y, z)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 74 def set_xyz(index, x, y, z) index *= @item_size @array[index ] = x @array[index + 1] = y @array[index + 2] = z self end
set_xyzw(index, x, y, z, w)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 84 def set_xyzw(index, x, y, z, w) index *= @item_size @array[index ] = x @array[index + 1] = y @array[index + 2] = z @array[index + 3] = w self end
set_y(index, y)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 41 def set_y(index, y) @array[index * @item_size + 1] = y self end
set_z(index, z)
click to toggle source
# File lib/mittsu/core/buffer_attribute.rb, line 47 def set_z(index, z) @array[index * @item_size + 2] = z self end