Wrp File Format - 4WVR: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (cleanup)
Line 10: Line 10:


(some problems exist with 2 versions of binarize)
(some problems exist with 2 versions of binarize)
For a general description of how simple this (or any other) wrp file construct, see [[Wrp_File_Format_-_8WVR]]


===Conventions===
===Conventions===
Line 21: Line 23:
==Structure==
==Structure==


  struct
  4WVR
  {
  {
  byte Signature[4]; //"4WVR"
  WRP4Header  Header
  ulong Xsize;      //(=256) cell dimension
  Texture    Textures[...];
  ulong Ysize;      //(=256) cell dimension
  Model      Models[...];
  short Elevations[Ysize][Xsize]; // eg 2*256*256 = 131072 bytes See Note
}
  short TextureIndex[Ysize][Xsize]; // eg 2*256*256 = 131072 bytes
===WRP4Header===
      //Each 'index' refers to a filename below. Max value = 511
WRP4Header
  Asciiz TextureFilenames[512][32];
{
  /*
char Signature[4]; //"4WVR"
A max of 512 texture files can be listed. Each is held as an asciiz string inside a fixed 32 byte
ulong Xsize;      //(=256) cell dimension
record. Eg max length of filename is 31 characters.
ulong Ysize;      //(=256) cell dimension
  example: data\pi.paa
}
*/
===Texture===
Texture
{
  ushort Elevations [Ysize][Xsize]; // See Talk as this value is a condensed float
  ushort TextureIndex[Ysize][Xsize]; //Each 'index' refers to a filename below. Range 1..511
  Asciiz TextureFilenames[512][32]; //"data\pi.paa\0|data\pi1.paa\0".....
  }
 
Each cell on the map references an texture file (pac/paa) and an elevation for that text at that cell position.
Since there could be myriads of 'sea' texture (eg), rather than have each cell list it's texture, it references a texture list via an index. In this way, THE texture which is common to many cells (at sometimes differing elevations) is only stored once.
 
A max of 512 texture files can be listed. Each is held as an asciiz string inside a fixed 32 byte record. Eg max length of filename is 31 characters.


  struct model
===Model===
  Model
  {
  {
   float  TransformMatrix[12]; //see below
   float  TransformMatrix[4][3];  
   long  3DobjectIndex;      //the unique ouid for this model
   long  ObjectID;      //unique for every entry
   asciiz Filename[76];
   asciiz Filename[76];   //each string is held within a 76 byte record. Therefore filename is 75 chars max.
  //each string is held within a 76 byte record. Therefore filename is 75 chars max.
  }
  }[variable];


//...see below
};


 
The number of models varies from none, to end of file. Each model is 128 bytes in length.
==Note1==


TransformMatrix[4][3];
TransformMatrix[4][3];
Line 66: Line 76:


See [[Rtm (Animation) File Format|RTM file format]]
See [[Rtm (Animation) File Format|RTM file format]]
==Note2==
The number of models varies from none, to end of file. Each model is 128 bytes in length.


[[category:Operation Flashpoint: Modelling]]
[[category:Operation Flashpoint: Modelling]]
[[Category:BIS_File_Formats]]
[[Category:BIS_File_Formats]]

Revision as of 06:49, 30 January 2009

Template:unsupported-doc

General

Flashpoint wrp files use two different file formats to contain the data. This document contains information on 4WVR format as used by WrpTool and Visitor 2.

This document does not discuss the alternate format, OPRW. Both file formats can be used directly by the engine, whether the file exists independently in ~\worlds, or, packed inside a pbo (addon).

See Island File Formats for further info.

"Binarize" tool by BIStudio will convert 4WVR to OPRW if desired.

(some problems exist with 2 versions of binarize)

For a general description of how simple this (or any other) wrp file construct, see Wrp_File_Format_-_8WVR

Conventions

Intel byte order, lsb first
byte = 1 char = 8 bits
ulong = unsigned long, 4 bytes
ushort= unsigned short 2 bytes
asciiz= variable length zero terminated string.
float= 4byte (single precision)

Structure

4WVR
{
  WRP4Header  Header
  Texture     Textures[...];
  Model       Models[...];
}

WRP4Header

WRP4Header
{
char Signature[4]; //"4WVR"
ulong Xsize;       //(=256) cell dimension
ulong Ysize;       //(=256) cell dimension
}

Texture

Texture
{
  ushort Elevations  [Ysize][Xsize]; // See Talk as this value is a condensed float
  ushort TextureIndex[Ysize][Xsize]; //Each 'index' refers to a filename below. Range 1..511
  Asciiz TextureFilenames[512][32];  //"data\pi.paa\0|data\pi1.paa\0".....
}

Each cell on the map references an texture file (pac/paa) and an elevation for that text at that cell position. Since there could be myriads of 'sea' texture (eg), rather than have each cell list it's texture, it references a texture list via an index. In this way, THE texture which is common to many cells (at sometimes differing elevations) is only stored once.

A max of 512 texture files can be listed. Each is held as an asciiz string inside a fixed 32 byte record. Eg max length of filename is 31 characters.

Model

Model
{
 float  TransformMatrix[4][3]; 
 long   ObjectID;       //unique for every entry
 asciiz Filename[76];   //each string is held within a 76 byte record. Therefore filename is 75 chars max.
}


The number of models varies from none, to end of file. Each model is 128 bytes in length.

TransformMatrix[4][3];

This is the transform matrix used directly by Microsoft DirectX engines.

In fact, the 'correct' matrix is actually 4 x 4, but the last column always represents 0,0,0,1 thus

M11,M12 M13 (0.0)
M21,M22,M23 (0.0)
M31,M32,M33 (0.0)
M41,M42,M43 (1.0)

and so is never stored. This identical matrix is used for WRP files (both formats) and RTM files. The last row (M41...) happens to be the position of the object X Z Y co-ordinates, and is often referred to separately.

For further information visit here

See RTM file format