Class: Engine::QuadMesh

Inherits:
Object
  • Object
show all
Defined in:
lib/engine/standard_meshes/quad_mesh.rb

Instance Method Summary collapse

Instance Method Details

#index_dataObject



19
20
21
22
23
24
# File 'lib/engine/standard_meshes/quad_mesh.rb', line 19

def index_data
  @index_data ||= [
    0, 2, 1,
    2, 0, 3
  ]
end

#vertex_dataObject

Vertex format: pos(3) + uv(2) + normal(3) + tangent(3) + bitangent(3) + extra(6) = 20 floats



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/engine/standard_meshes/quad_mesh.rb', line 6

def vertex_data
  @vertex_data ||= [
    # top-left
    -0.5,  0.5, 0.0,   0.0, 0.0,   0.0, 0.0, 1.0,   1.0, 0.0, 0.0,   0.0, 1.0, 0.0,   0.0, 0.0, 0.0,   0.0, 0.0, 0.0,
    # top-right
     0.5,  0.5, 0.0,   1.0, 0.0,   0.0, 0.0, 1.0,   1.0, 0.0, 0.0,   0.0, 1.0, 0.0,   0.0, 0.0, 0.0,   0.0, 0.0, 0.0,
    # bottom-right
     0.5, -0.5, 0.0,   1.0, 1.0,   0.0, 0.0, 1.0,   1.0, 0.0, 0.0,   0.0, 1.0, 0.0,   0.0, 0.0, 0.0,   0.0, 0.0, 0.0,
    # bottom-left
    -0.5, -0.5, 0.0,   0.0, 1.0,   0.0, 0.0, 1.0,   1.0, 0.0, 0.0,   0.0, 1.0, 0.0,   0.0, 0.0, 0.0,   0.0, 0.0, 0.0,
  ]
end