Documentation ¶
Overview ¶
Package terrain implements decoders for the WDT and ADT terrain formats.
Index ¶
- Constants
- Variables
- type C3Vector
- type CAaBox
- type CAaSphere
- type ChunkAlphaMap
- type ChunkData
- type ChunkHeader
- type ChunkInfo
- type ChunkLayer
- type ChunkLiquids
- type ChunkOldSoundEmitter
- type Dir
- type DoodadDef
- type HeaderFlags
- type Index
- type MapReader
- type MapTile
- type Source
- type TileChunkLookupIndex
- type TileFlags
- type TileIndex
- type WMODef
Constants ¶
View Source
const ChunkBufferSize = 9*9 + 8*8
View Source
const ChunkSize = TileSize / 16
View Source
const TileSize = 533.33333
Variables ¶
View Source
var ( MapVersion = chunked.CnkID("MVER") MainTileIndex = chunked.CnkID("MAIN") MapIndexHeader = chunked.CnkID("MPHD") MapWMO = chunked.CnkID("MWMO") MapChunkInfo = chunked.CnkID("MCIN") MapTextures = chunked.CnkID("MTEX") TileHeader = chunked.CnkID("MHDR") M2Models = chunked.CnkID("MMDX") M2FilenameOffsets = chunked.CnkID("MMID") WMOFilenameOffsets = chunked.CnkID("MWID") DoodadDefs = chunked.CnkID("MDDF") WMODefs = chunked.CnkID("MODF") Chunk = chunked.CnkID("MCNK") Normals = chunked.CnkID("MCNR") Heights = chunked.CnkID("MCVT") Layer = chunked.CnkID("MCLY") CollisionObjects = chunked.CnkID("MCRF") ShadowMap = chunked.CnkID("MCSH") Alpha = chunked.CnkID("MCAL") Liquids = chunked.CnkID("MCLQ") SoundEmitters = chunked.CnkID("MCSE") )
Functions ¶
This section is empty.
Types ¶
type ChunkAlphaMap ¶
type ChunkAlphaMap [64 * 64]byte
type ChunkData ¶
type ChunkData struct { ChunkHeader // MCNR Normals [ChunkBufferSize][3]byte NormalsPad [13]byte // MCVT Heights [ChunkBufferSize]float32 // MCLY Layer []ChunkLayer // MCRF CollisionDoodads []uint32 CollisionWMOs []uint32 // MCSH ShadowMap [64]uint64 // MCAL AlphaMaps []ChunkAlphaMap // MCLQ Liquids ChunkLiquids // MCSE OldSoundEmitters []ChunkOldSoundEmitter }
type ChunkHeader ¶
type ChunkHeader struct { Flags uint32 IndexX uint32 IndexY uint32 // Radius float32 NumLayers uint32 NumDoodadRefs uint32 OffsetHeight uint32 OffsetNormal uint32 OffsetLayer uint32 OffsetRefs uint32 OffsetAlpha uint32 SizeAlpha uint32 OffsetShadow uint32 SizeShadow uint32 AreaID uint32 NumMapObjRefs uint32 Holes uint16 Pad0 uint16 PredTex [8]uint16 NumEffectDoodad [8]byte OffsetSndEmitters uint32 NumSndEmitters uint32 OffsetLiquid uint32 SizeLiquid uint32 Position C3Vector OffsetMCCV uint32 Unused1 uint32 Unused2 uint32 }
type ChunkLayer ¶
type ChunkLiquids ¶
type ChunkOldSoundEmitter ¶
type ChunkOldSoundEmitter struct { SoundPointID uint32 SoundNameID uint32 Position C3Vector MinDistance float32 MaxDistance float32 CutoffDistance float32 StartTime uint16 EndTime uint16 Mode uint16 GroupSilenceMin uint16 GroupSilenceMax uint16 PlayInstancesMin uint16 PlayInstancesMax uint16 LoopCountMin byte LoopCountMax byte InterSoundGapMin uint16 InterSoundGapMax uint16 }
type DoodadDef ¶
type DoodadDef struct { // NameID references an entry in the MMID chunk, specifying the model to use. NameID uint32 // 0x00 UniqueID uint32 // 0x04 Position C3Vector // 0x08 Rotation C3Vector // 0x14 Scale uint16 // 0x20 Flags uint16 // 0x22 }
DoodadDef Placement information for doodads (M2 models). Additional to this, the models to render are referenced in each MCRF chunk.
type HeaderFlags ¶
type HeaderFlags uint32
const ( WDTUsesGlobalWMO HeaderFlags = 1 << iota ADTHasMCCV ADTHasBigAlpha )
type Index ¶
type Index struct { // MVER Version uint32 // MPHD HeaderFlags HeaderFlags // MAIN Tiles [64 * 64]TileIndex }
type MapReader ¶
func (*MapReader) GetChunkByIndex ¶
func (mr *MapReader) GetChunkByIndex(idx *TileChunkLookupIndex) (*ChunkData, error)
func (*MapReader) GetChunkByPos ¶
type MapTile ¶
type MapTile struct { // MVER Version uint32 // MHDR Flags uint32 // MCIN ChunkInfo [16 * 16]ChunkInfo // MTEX Textures []string // MMDX M2Models []byte // MMID M2FilenameOffsets []uint32 // MWMO WMOModels []byte // MWID WMOFilenameOffsets []uint32 // MDDF DoodadDefs []DoodadDef // MODF WMODefs []WMODef // MCNK * 16 * 16 ChunkData [16][16]*ChunkData }
type TileChunkLookupIndex ¶
func FindTileChunkIndex ¶
func FindTileChunkIndex(x, y float32) (*TileChunkLookupIndex, error)
Since maps are split into a hierarchy of tiles and chunks, we have to find their path from global coordinates.
Click to show internal directories.
Click to hide internal directories.