Wrp File Format - 4WVR: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{unsupported-doc}}" to "{{Feature|UnsupportedDoc}}")
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{unsupported-doc}}
{{Feature|UnsupportedDoc}}
==General==
== General ==
''Flashpoint wrp files use two different file formats to contain the data. This document contains information on 4WVR format as used by [[OFP: Community Tools | WrpTool]] and [[Visitor 2]].  
''Flashpoint wrp files use two different file formats to contain the data. This document contains information on unbinarised 4WVR format as used by [[OFP: Community Tools | WrpTool]] and [[Visitor 2]].  


This document does '''not''' discuss the alternate format, [[Wrp File Format - OPRW|OPRW]]. Both file formats can be used directly by the engine, whether the file exists independently in ~\worlds, or, packed inside a pbo (addon). ''
This document does '''not''' discuss the '''binary''' format, [[Wrp File Format - OPRW|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 [[BIS_File_Formats#Island_File_Formats|Island File Formats]] for further info.
See [[BIS_File_Formats#Island_File_Formats|Island File Formats]] for further info.
Line 11: Line 11:
(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]]
For a general description of how simple this (or any other) wrp file construct, see [[Wrp_File_Format_-_8WVR|8WVR format]]


===Conventions===
=== Conventions ===
see [[Generic FileFormat Data Types]]
see [[Generic FileFormat Data Types]]


==Structure==
== Structure ==


  4WVR
  4WVR
  {
  {
   WRP4Header  Header
   WRP4Header         Header
   Texture    Textures[...];
  CompressedFloats    Elevations [Ysize][Xsize]; // in centimetres. See below
   Model       Models[...];
   ushort              TextureIndex[Ysize][Xsize]; //Each 'index' refers to a filename below. Range 1..511
  char                TextureFilenames[512][32]; //"data\pi.paa\0|data\pi1.paa\0".....
   Model               Models[...];
  }
  }
===WRP4Header===
=== WRP4Header ===
  WRP4Header
  WRP4Header
  {
  {
Line 31: Line 33:
  ulong Ysize;      //(=256) cell dimension
  ulong Ysize;      //(=256) cell dimension
  }
  }
===Texture===
Texture
{
  ushort Elevations  [Ysize][Xsize]; // in centimetres. See below
  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".....
}


====Elevations====
==== Elevations ====
Elevations are (probably) a condensed float. To convert the value into meters:
Elevations are expressed as an integral of the gridsize.
  RealHeight = Elevations[x][y] * 0.045;
 
Since the gridsize for {{ofp}} is a fixed 50 meters, to convert the value into meters:
 
  RealHeight = Elevations[x][y] * 0.05;
 
Note that (probably WrpTool) can set a default index of -1 (0xFFFF). The meaning is unclear.


see Talk as this value is a strange condensed float
see Talk


====TextureIndex====
==== TextureIndex ====
Each cell on the map references an texture file (pac/paa) and an elevation for that text at that cell position.
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.
Since there could be myriads of 'sea' texture (eg), rather than have each cell list it is 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.
A fixed (and therefore max) table size of 512 texture filenames can be listed. Each is held as an asciiz string inside a fixed 32 byte record. Eg max length of filename is 31 characters. Each 32 byte record can contain garbage after the Asciiz. The first null entry is considered the end of the usable list.


The first entry (effectively index0) is never used. Even though a filename is associated with this entry. it is never accessed.
The first entry (effectively index0) is never used. Even though a filename is associated with this entry. it is never accessed.


===Model===
=== Model ===
  Model
  Model
  {
  {
   float  TransformMatrix[4][3];  
   float  TransformMatrix[4][3]; // see [[Generic FileFormat Data Types]]
   long  ObjectID;         //unique for every entry
   long  ObjectID;             // unique for every entry
   asciiz P3DFilename[76];   // "data3d\kasna.p3d"
   asciiz P3DFilename[76];       // "data3d\kasna.p3d"
  }
  }


Line 65: Line 65:
Note that this is in marked contrast to an 8WVR file. In 8WVR, there is always a minimum of one entry. The last (or only) entry in an 8WVR has no filename associated with it.
Note that this is in marked contrast to an 8WVR file. In 8WVR, there is always a minimum of one entry. The last (or only) entry in an 8WVR has no filename associated with it.


TransformMatrix[4][3];
== FilePaths ==
 
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 (Animation) File Format|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 [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/fixedfunction/transforms/transforms.asp here]
 
==FilePaths==


Despite the impression given (lack of a leading \) All filenames (pac/paa and p3d files) are HARD WIRED to the (virtual) pboRoot\ directory.
Despite the impression given (lack of a leading \) All filenames (pac/paa and p3d files) are HARD WIRED to the (virtual) pboRoot\ directory.
Line 86: Line 71:
The PboRoot\ directory is built in-situ during game load and consists of an index table of all addons from 'anywhere' in the game structure. Eg, the official Addon Directories (plural), the bin\folder, plus any oem addons stated in the command line.  
The PboRoot\ directory is built in-situ during game load and consists of an index table of all addons from 'anywhere' in the game structure. Eg, the official Addon Directories (plural), the bin\folder, plus any oem addons stated in the command line.  


[[category:Operation Flashpoint: Modelling]]
{{GameCategory|ofp|Modelling}}
[[Category:BIS_File_Formats]]
[[Category:BIS_File_Formats]]

Latest revision as of 15:54, 1 February 2021

bi symbol white.png
Disclaimer: This page describes internal undocumented structures of Bohemia Interactive software.

This page contains unofficial information.

Some usage of this information may constitute a violation of the rights of Bohemia Interactive and is in no way endorsed or recommended by Bohemia Interactive.
Bohemia Interactive is not willing to tolerate use of such tools if it contravenes any general licenses granted to end users of this community wiki or BI products.

General

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

This document does not discuss the binary 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 8WVR format

Conventions

see Generic FileFormat Data Types

Structure

4WVR
{
  WRP4Header          Header
  CompressedFloats    Elevations  [Ysize][Xsize]; // in centimetres. See below 
  ushort              TextureIndex[Ysize][Xsize]; //Each 'index' refers to a filename below. Range 1..511
  char                TextureFilenames[512][32];  //"data\pi.paa\0|data\pi1.paa\0".....
  Model               Models[...];
}

WRP4Header

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

Elevations

Elevations are expressed as an integral of the gridsize.

Since the gridsize for Operation Flashpoint is a fixed 50 meters, to convert the value into meters:

RealHeight = Elevations[x][y] * 0.05;

Note that (probably WrpTool) can set a default index of -1 (0xFFFF). The meaning is unclear.

see Talk

TextureIndex

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 is 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 fixed (and therefore max) table size of 512 texture filenames can be listed. Each is held as an asciiz string inside a fixed 32 byte record. Eg max length of filename is 31 characters. Each 32 byte record can contain garbage after the Asciiz. The first null entry is considered the end of the usable list.

The first entry (effectively index0) is never used. Even though a filename is associated with this entry. it is never accessed.

Model

Model
{
 float  TransformMatrix[4][3]; // see Generic FileFormat Data Types
 long   ObjectID;              // unique for every entry
 asciiz P3DFilename[76];       // "data3d\kasna.p3d"
}

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

Note that this is in marked contrast to an 8WVR file. In 8WVR, there is always a minimum of one entry. The last (or only) entry in an 8WVR has no filename associated with it.

FilePaths

Despite the impression given (lack of a leading \) All filenames (pac/paa and p3d files) are HARD WIRED to the (virtual) pboRoot\ directory.

The PboRoot\ directory is built in-situ during game load and consists of an index table of all addons from 'anywhere' in the game structure. Eg, the official Addon Directories (plural), the bin\folder, plus any oem addons stated in the command line.