Sha256: c4fc8fd8ba6467e253188aeb6017e038ed250c4a09f5a1e5192d32f7d8a21251

Contents?: true

Size: 489 Bytes

Versions: 1

Compression:

Stored size: 489 Bytes

Contents

class VertexData
  attr_accessor :ptr
  
  def initialize(data)
    @vertex_size = data[0].count
    @num_vertices = data.count
    @ptr = Pointer.new(:float, @vertex_size * @num_vertices)
    set_data(data)
  end
  
  def set_data(vertices)
    vertices.each_with_index do |vertex,idx|
      vertex.each_with_index do |component, component_idx|
        @ptr[idx * @vertex_size + component_idx] = component
      end
    end
  end  
  
  def size
    @vertex_size * @num_vertices
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubymotionr-0.0.1 spec/multiple-rubymotion-apps/HelloGL/app/vertex_data.rb