xoreos
0.0.5
|
Loader for TRX, baked terrain files, found in Neverwinter Nights 2. More...
#include <trxfile.h>
Classes | |
struct | Packet |
A packet within a TRX file. More... | |
Public Member Functions | |
TRXFile (const Common::UString &resRef) | |
~TRXFile () | |
void | show () |
void | hide () |
Private Types | |
typedef Common::PtrList< Graphics::Aurora::GeometryObject > | ObjectList |
Private Member Functions | |
void | load (Common::SeekableReadStream &trx) |
void | loadDirectory (Common::SeekableReadStream &trx, std::vector< Packet > &packets) |
Load the packets directory. More... | |
void | loadPackets (Common::SeekableReadStream &trx, std::vector< Packet > &packets) |
Load the packets. More... | |
void | loadPacket (Common::SeekableReadStream &trx, Packet &packet) |
Load one packets. More... | |
void | loadTRWH (Common::SeekableReadStream &trx, Packet &packet) |
Load TRWH (size information) packets. More... | |
void | loadTRRN (Common::SeekableReadStream &trx, Packet &packet) |
Load TRRN (terrain tile) packets. More... | |
void | loadWATR (Common::SeekableReadStream &trx, Packet &packet) |
Load WATR (water tile) packets. More... | |
void | loadASWM (Common::SeekableReadStream &trx, Packet &packet) |
Load ASWM (walk mesh) packets. More... | |
Private Attributes | |
bool | _visible |
uint32 | _width |
uint32 | _height |
ObjectList | _terrain |
ObjectList | _water |
Loader for TRX, baked terrain files, found in Neverwinter Nights 2.
While indoor areas in Neverwinter Nights 2 use tiles similar to those found in the first Neverwinter Nights game, outdoor areas use a more free-form and dynamic terrain.
A TRX file consists of 4 "packet" types:
Usually, there should be exactly one TRWH packet, followed by an arbitrary number of TRRN, WATR and ASWM packets. TRRN packets are divided into tiles, rectangular areas for a piece of the ground, while WATR packets divide the bodies of water in more natural ways.
Engines::NWN2::TRXFile::TRXFile | ( | const Common::UString & | resRef | ) |
Definition at line 46 of file trxfile.cpp.
References Common::StackException::add(), Common::UString::c_str(), Aurora::kFileTypeTRX, load(), and ResMan.
Engines::NWN2::TRXFile::~TRXFile | ( | ) |
Definition at line 60 of file trxfile.cpp.
References hide().
void Engines::NWN2::TRXFile::hide | ( | ) |
Definition at line 80 of file trxfile.cpp.
References _terrain, _visible, _water, and GfxMan.
Referenced by ~TRXFile().
|
private |
Definition at line 96 of file trxfile.cpp.
References Common::debugTag(), loadDirectory(), loadPackets(), MKTAG, Common::SeekableReadStream::pos(), Common::ReadStream::readUint16LE(), Common::ReadStream::readUint32BE(), Common::ReadStream::readUint32LE(), and Common::SeekableReadStream::size().
Referenced by TRXFile().
|
private |
Load ASWM (walk mesh) packets.
Definition at line 321 of file trxfile.cpp.
Referenced by loadPacket().
|
private |
Load the packets directory.
Definition at line 117 of file trxfile.cpp.
References Common::ReadStream::readUint32BE(), Common::ReadStream::readUint32LE(), and Common::SeekableReadStream::size().
Referenced by load().
|
private |
Load one packets.
Definition at line 143 of file trxfile.cpp.
References Common::UString::c_str(), Common::debugTag(), loadASWM(), loadTRRN(), loadTRWH(), loadWATR(), MKTAG, and Engines::NWN2::TRXFile::Packet::type.
Referenced by loadPackets().
|
private |
Load the packets.
Definition at line 127 of file trxfile.cpp.
References loadPacket(), Common::SeekableReadStream::pos(), Common::ReadStream::readUint32BE(), Common::ReadStream::readUint32LE(), Common::SeekableReadStream::seek(), and Common::SeekableReadStream::size().
Referenced by load().
|
private |
Load TRRN (terrain tile) packets.
Definition at line 166 of file trxfile.cpp.
References _terrain, Graphics::IndexBuffer::getData(), Graphics::VertexBuffer::getData(), Common::kEncodingASCII, Common::SeekableReadStream::pos(), Common::readStringFixed(), Graphics::IndexBuffer::setSize(), Graphics::VertexBuffer::setVertexDeclInterleave(), Engines::NWN2::TRXFile::Packet::size, Graphics::VCOLOR, Graphics::VNORMAL, and Graphics::VPOSITION.
Referenced by loadPacket().
|
private |
Load TRWH (size information) packets.
Definition at line 156 of file trxfile.cpp.
References _height, _width, Common::ReadStream::readUint32LE(), and Engines::NWN2::TRXFile::Packet::size.
Referenced by loadPacket().
|
private |
Load WATR (water tile) packets.
Definition at line 245 of file trxfile.cpp.
References _water, Graphics::IndexBuffer::getData(), Graphics::VertexBuffer::getData(), Common::kEncodingASCII, Common::SeekableReadStream::pos(), Common::readStringFixed(), Graphics::IndexBuffer::setSize(), Graphics::VertexBuffer::setVertexDeclInterleave(), Engines::NWN2::TRXFile::Packet::size, Graphics::VCOLOR, and Graphics::VPOSITION.
Referenced by loadPacket().
void Engines::NWN2::TRXFile::show | ( | ) |
|
private |
Definition at line 88 of file trxfile.h.
Referenced by loadTRWH().
|
private |
Definition at line 90 of file trxfile.h.
Referenced by hide(), loadTRRN(), and show().
|
private |
|
private |
Definition at line 91 of file trxfile.h.
Referenced by hide(), loadWATR(), and show().
|
private |
Definition at line 87 of file trxfile.h.
Referenced by loadTRWH().