WoWs Model Exported
World of Warships 3D model Exporter
Loading...
Searching...
No Matches
wows-geometry.h File Reference

Public API for parsing and exporting World of Warships .geometry files. More...

#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Functions

int wows_parse_geometry (char *input, wows_geometry **geometry_content)
 Parse a .geometry file from a memory-mapped path.
 
int wows_parse_geometry_fp (FILE *input, wows_geometry **geometry_content)
 Parse a .geometry file from an already-open FILE stream.
 
int wows_geometry_print (wows_geometry *geometry_content, bool verbose)
 Print a human-readable summary of a parsed geometry to stdout.
 
int wows_geometry_free (wows_geometry *geometry_content)
 Free all memory associated with a parsed geometry.
 
int wows_geometry_to_glb (wows_geometry *geometry, const char *output_path)
 Export a full geometry as a binary glTF (GLB) file.
 
int wows_geometry_to_glb_sections (wows_geometry *geometry, const char *output_path, const uint32_t *sections, uint32_t n_sections)
 Export a subset of draw-call sections as a GLB file.
 
int wows_parse_geometry_buffer (char *contents, size_t length, wows_geometry **geometry_content)
 Parse a .geometry file from a raw memory buffer.
 

Data Structures

struct  wows_vertex
 Minimal vertex containing only position, normal, and UV. More...
 
struct  wows_vert_xyznuvtbpc
 Vertex with tangent and binormal vectors (TB layouts). More...
 
struct  wows_vert_xyznuvrpc
 Vertex with an extra 32-bit R attribute (R layouts). More...
 
struct  wows_geometry_header
 Top-level .geometry file header at offset 0. More...
 
struct  wows_geometry_info
 Draw-call descriptor mapping a render set to a slice of a merged buffer. More...
 
struct  wows_geometry_vertex_section_metadata
 Metadata for one merged vertex buffer (ENCD block descriptor). More...
 
struct  wows_geometry_vertex_section
 Decoded vertex buffer for one merged vertex stream. More...
 
struct  wows_geometry_index_section_metadata
 Metadata for one merged index buffer (ENCD block descriptor). More...
 
struct  wows_geometry_index_section
 Decoded index buffer for one merged index stream. More...
 
struct  wows_geometry
 Top-level container for a fully parsed .geometry file. More...
 
struct  WOWS_GEOMETRY_CONTEXT
 Library context holding global parse settings. More...
 

Macros

#define WOWS_ERROR_NOT_A_FILE   12
 
#define WOWS_ERROR_NOT_A_DIR   13
 
#define WOWS_ERROR_UNKNOWN   7
 
#define WOWS_VER_UNKNOWN   "unknown"
 
#define WOWS_ID_UNKNOWN   0
 
#define WOWS_VER_SET3_XYNUV2IIIWWTBPC   "set3/xyznuv2iiiwwtbpc"
 
#define WOWS_ID_SET3_XYNUV2IIIWWTBPC   1
 
#define WOWS_VER_SET3_XYNUV2TBIPC   "set3/xyznuv2tbipc"
 
#define WOWS_ID_SET3_XYNUV2TBIPC   2
 
#define WOWS_VER_SET3_XYNUV2TBPC   "set3/xyznuv2tbpc"
 
#define WOWS_ID_SET3_XYNUV2TBPC   3
 
#define WOWS_VER_SET3_XYNUVIIIWWPC   "set3/xyznuviiiwwpc"
 
#define WOWS_ID_SET3_XYNUVIIIWWPC   4
 
#define WOWS_VER_SET3_XYNUVIIIWWR   "set3/xyznuviiiwwr"
 
#define WOWS_ID_SET3_XYNUVIIIWWR   5
 
#define WOWS_VER_SET3_XYNUVIIIWWTBPC   "set3/xyznuviiiwwtbpc"
 
#define WOWS_ID_SET3_XYNUVIIIWWTBPC   6
 
#define WOWS_VER_SET3_XYNUVPC   "set3/xyznuvpc"
 
#define WOWS_ID_SET3_XYNUVPC   7
 
#define WOWS_VER_SET3_XYNUVRPC   "set3/xyznuvrpc"
 
#define WOWS_ID_SET3_XYNUVRPC   8
 
#define WOWS_SIZE_XYNUVRPC   28
 
#define WOWS_VER_SET3_XYNUVTBIPC   "set3/xyznuvtbipc"
 
#define WOWS_ID_SET3_XYNUVTBIPC   9
 
#define WOWS_VER_SET3_XYNUVTBOI   "set3/xyznuvtboi"
 
#define WOWS_ID_SET3_XYNUVTBOI   10
 
#define WOWS_VER_SET3_XYNUVTBPC   "set3/xyznuvtbpc"
 
#define WOWS_ID_SET3_XYNUVTBPC   11
 
#define WOWS_VERTEX_FIELDS
 Common vertex fields shared by every vertex layout.
 
#define WOWS_HEADER_SIZE   72
 Size of a serialised wows_geometry_header in bytes.
 
#define WOWS_BLOC_INFO_SIZE   16
 Size of a serialised wows_geometry_info entry in bytes.
 
#define WOWS_VERTEX_META_SIZE   32
 Size of a serialised wows_geometry_vertex_section_metadata in bytes.
 
#define WOWS_INDEX_META_SIZE   16
 Size of a serialised wows_geometry_index_section_metadata in bytes.
 

Detailed Description

Public API for parsing and exporting World of Warships .geometry files.

A .geometry file stores meshoptimizer-compressed (ENCD) vertex and index buffers for one or more parts of a ship model. This library decompresses those buffers and can export the result as a binary glTF (GLB) file.

Typical usage:

wows_geometry *geo = NULL;
int rc = wows_parse_geometry("/path/to/ship.geometry", &geo);
if (rc == 0) {
wows_geometry_to_glb(geo, "/path/to/out.glb");
}
int wows_geometry_free(wows_geometry *geometry_content)
Free all memory associated with a parsed geometry.
int wows_parse_geometry(char *input, wows_geometry **geometry_content)
Parse a .geometry file from a memory-mapped path.
int wows_geometry_to_glb(wows_geometry *geometry, const char *output_path)
Export a full geometry as a binary glTF (GLB) file.
Top-level container for a fully parsed .geometry file.
Definition wows-geometry.h:241

Macro Definition Documentation

◆ WOWS_BLOC_INFO_SIZE

#define WOWS_BLOC_INFO_SIZE   16

Size of a serialised wows_geometry_info entry in bytes.

◆ WOWS_HEADER_SIZE

#define WOWS_HEADER_SIZE   72

Size of a serialised wows_geometry_header in bytes.

◆ WOWS_INDEX_META_SIZE

#define WOWS_INDEX_META_SIZE   16

Size of a serialised wows_geometry_index_section_metadata in bytes.

◆ WOWS_VERTEX_FIELDS

#define WOWS_VERTEX_FIELDS
Value:
float x; \
float y; \
float z; \
uint32_t n; \
float _nx; \
float _ny; \
float _nz; \
float u; \
float v;

Common vertex fields shared by every vertex layout.

This macro expands to the position, packed normal, unpacked normal components, and texture coordinates that appear in every format variant. It is used as the first member block of every vertex struct. Texture coordinate V.

◆ WOWS_VERTEX_META_SIZE

#define WOWS_VERTEX_META_SIZE   32

Size of a serialised wows_geometry_vertex_section_metadata in bytes.