WoWs Model Exported
World of Warships 3D model Exporter
Loading...
Searching...
No Matches
wows-model-exporter.h File Reference
#include <string>
#include <vector>
#include <map>
#include <cstdint>
#include <functional>
#include <tiny_gltf.h>
#include "wows-assets-bin.h"

Go to the source code of this file.

Functions

void wows_stitch_set_verbose (bool v)
 Enable or disable verbose diagnostic output.
 
bool wows_stitch_export_ship (const std::string &game_dir, const std::string &ship_name, const std::string &output_path, const wows_ship_export_options &opts={})
 Export a complete ship model to a binary glTF (GLB) file.
 
bool wows_stitch_export_ship_to_glb_mem (const std::string &game_dir, const std::string &ship_name, std::vector< uint8_t > &glb_out, const wows_ship_export_options &opts={}, wows_file_provider_t file_provider=nullptr)
 Export a complete ship model to a binary glTF (GLB) buffer in memory.
 
std::string wows_stitch_path_basename (const std::string &p)
 Return the basename component of a path (everything after the last /).
 
std::string wows_stitch_path_dirname (const std::string &p)
 Return the directory component of a path (everything up to and including the last /).
 
std::string wows_stitch_stem (const std::string &filename)
 Return the stem of a filename (basename without the final extension).
 
std::string wows_stitch_normalize_slashes (std::string s)
 Replace all backslashes in s with forward slashes and return the result.
 
bool wows_stitch_file_exists (const std::string &p)
 Return true if the file at p exists and is readable.
 
std::string wows_stitch_model_to_geom_path (const std::string &model, const std::string &game_dir)
 Resolve a .visual model path to the corresponding .geometry file path.
 
std::string wows_stitch_geom_to_visual_suffix (const std::string &geom_path)
 Convert a .geometry filesystem path to its .visual suffix form.
 
std::vector< std::string > wows_stitch_find_hull_geoms (const std::string &hull_model, const std::string &game_dir)
 Find all .geometry files belonging to a hull model.
 
std::vector< std::string > wows_stitch_find_propeller_geoms (const std::string &hull_model, const std::string &game_dir)
 Find propeller/screw .geometry files for a ship.
 
std::string wows_stitch_find_game_file (const std::string &game_dir, const std::string &filename)
 Search for a game asset file by name under game_dir.
 
wows_mat16d wows_stitch_mat4_mul_d (const wows_mat16d &a, const wows_mat16d &b)
 Multiply two column-major 4×4 double matrices.
 
wows_mat16d wows_stitch_float_to_double_mat (const float m[16])
 Convert a float[16] column-major matrix to a double wows_mat16d.
 
bool wows_stitch_geom_to_model (const std::string &geom_path, tinygltf::Model &model_out)
 Load a .geometry file and convert it to a tinygltf model.
 
bool wows_stitch_geom_to_model_from_memory (const uint8_t *data, size_t size, tinygltf::Model &model_out)
 Load a .geometry file from a memory buffer and convert it to a tinygltf model.
 
tinygltf::Model wows_stitch_merge_parts (std::vector< wows_glb_part > &parts)
 Merge a list of wows_glb_part objects into a single tinygltf scene.
 
std::vector< uint8_t > wows_stitch_decode_dds (const uint8_t *d, size_t sz, int *W, int *H)
 Decode a DDS texture buffer to raw RGBA pixels.
 
std::vector< uint8_t > wows_stitch_dds_to_png (const std::string &path, int max_sz)
 Load a .dds file from disk and encode it as a PNG byte buffer.
 
std::vector< uint8_t > wows_stitch_dds_to_png_from_memory (const uint8_t *data, size_t size, int max_sz)
 Decode a DDS buffer in memory and encode it as a PNG byte buffer.
 
void wows_stitch_apply_textures (tinygltf::Model &model, const std::vector< std::string > &geom_order, wows_assets_bin_pdb_t *pdb, const std::string &game_dir, int lod_level, bool excl_damage, int max_tex, std::function< void(int)> progress_cb=nullptr, wows_file_provider_t file_provider=nullptr)
 Attach textures from assets.bin to the materials in a glTF model.
 
void wows_stitch_apply_default_material (tinygltf::Model &model)
 Apply a uniform grey default material to all primitives in a model.
 

Data Structures

struct  wows_ship_export_options
 Options controlling a full-ship GLB export. More...
 
struct  wows_mount_entry
 A turret or module mount point, pairing a hardpoint name with a model path. More...
 
struct  wows_hull_info
 Aggregated hull information for one ship hull variant. More...
 
struct  wows_glb_part
 One resolved geometry part ready to be merged into a GLB scene. More...
 

Macros

#define wows_stitch_vlog(...)
 Conditionally print a formatted message to stderr when verbose mode is active.
 

Typedefs

using wows_mat16d = std::vector< double >
 Column-major 4×4 transform matrix stored as a flat double vector of 16 elements.
 
using wows_file_provider_t = std::function< std::vector< uint8_t >(const std::string &)>
 Callback type for reading a file from an arbitrary storage backend.
 

Variables

bool wows_stitch_verbose
 Set to true before calling any stitch function to enable verbose logging to stderr.
 

Function Documentation

◆ wows_stitch_set_verbose()

void wows_stitch_set_verbose ( bool  v)

Enable or disable verbose diagnostic output.

Parameters
vtrue to enable, false to disable.

Macro Definition Documentation

◆ wows_stitch_vlog

#define wows_stitch_vlog (   ...)
Value:
do { \
fprintf(stderr, __VA_ARGS__); \
} while (0)
bool wows_stitch_verbose
Set to true before calling any stitch function to enable verbose logging to stderr.

Conditionally print a formatted message to stderr when verbose mode is active.

Usage mirrors fprintf(stderr, ...).

Typedef Documentation

◆ wows_mat16d

using wows_mat16d = std::vector<double>

Column-major 4×4 transform matrix stored as a flat double vector of 16 elements.

Variable Documentation

◆ wows_stitch_verbose

bool wows_stitch_verbose
extern

Set to true before calling any stitch function to enable verbose logging to stderr.