Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Doomwad::GLSeg Class Reference

Inheritance diagram for Doomwad::GLSeg:

Doomwad::WadEntryElement List of all members.

Detailed Description

Represents a single GLSeg in a map.

See also:
GLNode GLSegs Ssector
Segs are used to split linedefs in the BSP process. When the BSP program splits sectors into convex regions, or Ssectors, sometimes it must split a Linedef to do so. Whether or not a Linedef is split, each line around the Ssector becomes a Seg.

GLSegs are different from normal ones in several ways. While they record starting and ending vertices, these may be normal vertices or GL vertices. Rather than having an offset along a line, the GL BSP process simply creates a new Vertex wherever needed.

Version 3.0 of the GLBSP specs has a new format for GLSegs. Essentially it uses 32 bit integers for some of the fields. The beginning of a version 3 lump is denoted with the marker "gNd3", which is stored in the constant GLSegs::V3_MARKER.

The vertex number is a little more complex. Bit 30 of a 32 bit int, or 15 of a 16 bit int is used to denote a GL vertex. This way the engine knows which vertex resource has the vertex it needs.

Right now there is only one flag defined for segs, the side number. This is identical to normal segs.

Definition at line 128 of file segs.hpp.

Public Member Functions

virtual size_t getLength (void) const throw ()
 Get the length of an element.
 GLSeg (uint32=0, uint32=0, uint16=0, uint16=RIGHT, uint32=0) throw ()
 Default constructor.
virtual bool read (const Lump &lump, Lump::size_type i) throw ()
 Read this element from a Lump.
virtual bool readV1 (const Lump &lump, Lump::size_type i) throw ()
 Read this element from a Lump.
virtual std::string toString (void) const throw ()
 Convert this element to a string.
virtual bool write (Lump &lump, Lump::size_type i) const throw ()
 Write this element into a Lump.
virtual bool writeV1 (Lump &lump, Lump::size_type i) const throw ()
 Write this element into a Lump.
virtual ~GLSeg (void) throw ()
 Destructor.

Public Attributes

uint32 end
 End vertex.
uint16 flags
 Direction it faces, left or right.
uint16 linedef
 Linedef this belongs to, 0xFFFF if none.
uint32 partner
 Partnet seg on the other side of the Linedef.
uint32 start
 Start vertex.

Static Public Attributes

static const uint16 LEFT
 Faces left.
static const size_t LENGTH = 0x00000010
 Length of a single record, version 1.
static const size_t LENGTH_V3 = 0x0000000A
 Length of a single record, version 3.
static const uint16 NO_LINEDEF
 Does not belong to a Linedef.
static const uint16 RIGHT
 Faces right.


Constructor & Destructor Documentation

GLSeg::GLSeg uint32  _start = 0,
uint32  _end = 0,
uint16  _linedef = 0,
uint16  _flags = RIGHT,
uint32  _partner = 0
throw ()
 

Default constructor.

Constructs a GLSeg. Arguments are all optional.

Parameters:
_start Start vertex.
_end End vertex.
_linedef Linedef number.
_flags Flags.
_partner Partner GLSeg number.

Definition at line 216 of file segs.cpp.


Member Function Documentation

size_t GLSeg::getLength void   )  const throw () [virtual]
 

Get the length of an element.

Each element record type has a length. Some are fixed, in which case this function returns that length. Some records are variable-length, in which case this function returns zero.

Returns:
Length of the record.

Implements Doomwad::WadEntryElement.

Definition at line 263 of file segs.cpp.

References LENGTH.

bool GLSeg::read const Lump lump,
Lump::size_type  i
throw () [virtual]
 

Read this element from a Lump.

Read one element from a Lump at the specified index.

Parameters:
lump Reference to the target Lump.
i Index into the Lump's buffer.
Returns:
True if successful, false if not.

Implements Doomwad::WadEntryElement.

Definition at line 275 of file segs.cpp.

References Doomwad::Lump::size().

bool GLSeg::readV1 const Lump lump,
Lump::size_type  i
throw () [virtual]
 

Read this element from a Lump.

Read one element from a Lump at the specified index.

Parameters:
lump Reference to the target Lump.
i Index into the Lump's buffer.
Returns:
True if successful, false if not.

Definition at line 256 of file segs.cpp.

References Doomwad::Lump::size().

std::string GLSeg::toString void   )  const throw () [virtual]
 

Convert this element to a string.

The format of the string will vary from class to class, but every subclass must be able to format itself as a string. IMPORTANT: this string representation is not guaranteed to preserve all data. Reading back in is not supported. This function's goal is to make the object's state user-readable, not machine-readable.

Returns:
std::string object containing object state.

Implements Doomwad::WadEntryElement.

Definition at line 282 of file segs.cpp.

bool GLSeg::write Lump lump,
Lump::size_type  i
const throw () [virtual]
 

Write this element into a Lump.

Write one element into a Lump at the specified index.

Parameters:
lump Reference to the target Lump.
i Index into the Lump's buffer.
Returns:
True if successful, false if not.

Implements Doomwad::WadEntryElement.

Definition at line 268 of file segs.cpp.

References Doomwad::Lump::size().

bool GLSeg::writeV1 Lump lump,
Lump::size_type  i
const throw () [virtual]
 

Write this element into a Lump.

Write one element into a Lump at the specified index.

Parameters:
lump Reference to the target Lump.
i Index into the Lump's buffer.
Returns:
True if successful, false if not.

Definition at line 239 of file segs.cpp.

References Doomwad::Lump::size().


Generated on Fri Jun 10 19:38:52 2005 for libdoomwad by  doxygen 1.4.0