Difference between revisions of "Vertex"

From DoomWiki.org

[checked revision][checked revision]
(+ brief description of seg-specific vertexes)
m (PlayStation / Doom 64 format: +wl fixed point)
 
(11 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
{{Doom level format}}
 
{{Doom level format}}
'''Vertices''' are nothing more than coordinates on the map. [[Linedefs]] and [[seg]]s reference vertices for their start-point and end-point.
+
'''Vertices''' are nothing more than coordinates on the map. [[Linedef]]s and [[seg]]s reference vertices for their start-point and end-point.
  
The vertices for a map are stored in the <tt>VERTEXES</tt> [[lump]], which consists of a raw sequence of x, y coordinates as pairs of 16-bit signed integers. The bytes are in [[Wikipedia:Endianness|little-endian]] order (least significant byte first).
+
The vertices for a map are stored in the {{c|VERTEXES}} [[lump]], which consists of a raw sequence of x, y coordinates as pairs of 16-bit signed integers. The bytes are in {{wp|Endianness|little-endian}} order (least significant byte first).
  
Due to the 16-bit signed [[Wikipedia:Two's complement|two's complement]] format, each coordinate can range from -32768 to +32767.
+
Due to the 16-bit signed {{wp|two's complement}} format, each coordinate can range from -32768 to +32767.
  
 
==Vertex structure==
 
==Vertex structure==
{| {{prettytable}}
+
{| {{prettytable|style=text-align: center;}}
 
! Offset
 
! Offset
 
! Size (bytes)
 
! Size (bytes)
 +
! C99 type
 
! Description
 
! Description
 
|-
 
|-
| align="center" | 0
+
| 0 || 2 || int16_t
| align="center" | 2
+
| style="text-align: left;" | ''x'' position
| ''x'' position
 
 
|-
 
|-
| align="center" | 2
+
| 2 || 2 || int16_t
| align="center" | 2
+
| style="text-align: left;" | ''y'' position
| ''y'' position
 
 
|}
 
|}
  
 
===Lump size===
 
===Lump size===
 +
The number of vertices displayed in an [[editing utility]] is less than the size of the VERTEXES lump divided by 32 bits.  This is because the map designer cannot manipulate the extra vertices required for all [[seg]]s to have endpoints; these are generated by the [[node builder]] (and then concealed from the user by nearly all mapping programs).
  
The number of vertices displayed in an [[editing utility]] is less than the size of the VERTEXES lump divided by 32 bits.  This is because the map designer cannot manipulate the extra vertices required for all [[seg]]s to have endpoints; these are generated deterministically by the [[node builder]] (and then concealed from the user by nearly all mapping programs).
+
===PlayStation / Doom 64 format===
 +
Midway's ports of Doom to the [[Sony PlayStation]], as well as [[Doom 64]] for the [[Nintendo 64]], feature additional precision by storing vertex coordinates as [[Fixed point|fixed_t]] (32-bit integers where 16 bits are used for the integral part and 16 for the fractional part). The range is therefore the same as in the original format, but fractional coordinates are possible.
  
===Doom 64 EX format===
+
{| {{prettytable|style=text-align: center;}}
 +
! Offset
 +
! Size (bytes)
 +
! C99 type
 +
! Description
 +
|-
 +
| 0 || 4 || int32_t
 +
| style="text-align: left;" | ''x'' position
 +
|-
 +
| 4 || 4 || int32_t
 +
| style="text-align: left;" | ''y'' position
 +
|}
 +
 
 +
== Sources ==
 +
* {{dwforums|52150|Discrepancy in VERTEXES and other on-disk structs counts}}, thread at the [[Doomworld forums]]
 +
* [[Unofficial Doom Specs]], especially section 4.5
 +
* {{idgames|file=docs/editing/d64techbible|title=Doom 64 Tech Bible}}
  
[[Doom 64 EX]] stores even 32 bit = 4 byte integers per direction, so each vertex uses 8 bytes. [[Doom Builder 64]] reads them as long integer and divides them by 65536; internally it uses float values.
 
 
[[Category:Doom engine]]
 
[[Category:Doom engine]]
 
[[Category:WAD lumps]]
 
[[Category:WAD lumps]]
 
== Sources ==
 
 
* [http://www.doomworld.com/vb/source-ports/52150-discrepancy-in-vertexes-and-other-on-disk-structs-counts/ Discrepancy in VERTEXES and other on-disk structs counts.], thread at the [[Doomworld forums]]
 
* [[The Unofficial Doom Specs]] version 1.666, especially section 4.8
 

Latest revision as of 13:06, 17 January 2021

Doom level format

Vertices are nothing more than coordinates on the map. Linedefs and segs reference vertices for their start-point and end-point.

The vertices for a map are stored in the VERTEXES lump, which consists of a raw sequence of x, y coordinates as pairs of 16-bit signed integers. The bytes are in little-endian order (least significant byte first).

Due to the 16-bit signed two's complement format, each coordinate can range from -32768 to +32767.

Vertex structure[edit]

Offset Size (bytes) C99 type Description
0 2 int16_t x position
2 2 int16_t y position

Lump size[edit]

The number of vertices displayed in an editing utility is less than the size of the VERTEXES lump divided by 32 bits. This is because the map designer cannot manipulate the extra vertices required for all segs to have endpoints; these are generated by the node builder (and then concealed from the user by nearly all mapping programs).

PlayStation / Doom 64 format[edit]

Midway's ports of Doom to the Sony PlayStation, as well as Doom 64 for the Nintendo 64, feature additional precision by storing vertex coordinates as fixed_t (32-bit integers where 16 bits are used for the integral part and 16 for the fractional part). The range is therefore the same as in the original format, but fractional coordinates are possible.

Offset Size (bytes) C99 type Description
0 4 int32_t x position
4 4 int32_t y position

Sources[edit]