Class: Quake::Bsp::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/quake/bsp/reader.rb

Constant Summary collapse

BSP_VERSION =
29
LUMP_ENTITIES =
0
LUMP_PLANES =
1
LUMP_TEXTURES =
2
LUMP_VERTICES =
3
LUMP_VISIBILITY =
4
LUMP_NODES =
5
LUMP_TEXINFO =
6
LUMP_FACES =
7
LUMP_LIGHTING =
8
LUMP_CLIPNODES =
9
LUMP_LEAFS =
10
LUMP_MARKSURFACES =
11
LUMP_EDGES =
12
LUMP_SURFEDGES =
13
LUMP_MODELS =
14
NUM_LUMPS =
15

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Reader

Returns a new instance of Reader.



26
27
28
29
# File 'lib/quake/bsp/reader.rb', line 26

def initialize(data)
  @data = data
  @lumps = []
end

Instance Method Details

#parseObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/quake/bsp/reader.rb', line 31

def parse
  parse_header

  Level.new(
    vertices:     parse_vertices,
    edges:        parse_edges,
    faces:        parse_faces,
    surfedges:    parse_surfedges,
    planes:       parse_planes,
    nodes:        parse_nodes,
    leafs:        parse_leafs,
    clipnodes:    parse_clipnodes,
    texinfo:      parse_texinfo,
    models:       parse_models,
    marksurfaces: parse_marksurfaces,
    entities:     parse_entities,
    visibility:   parse_visibility,
    lighting:     parse_lighting,
    textures:     parse_textures
  )
end