Skip to main content

Module common

Module common 

Source
Expand description

Common data structures shared across BMD format files.

This module provides reusable geometric and transformation primitives used throughout BMD (Battle Map Definition) files and related formats. These structures are public to allow reuse in other file format modules.

§Geometric Primitives

§Points

§Shapes

§Colors

§Transformations

  • Transform3x4 - 3x4 transformation matrix (rotation + translation)
  • Transform4x4 - 4x4 transformation matrix (full affine transform)
  • Quaternion - Rotation quaternion (i, j, k, w)
  • Matrix - Trait for matrix operations and conversions

§Matrix Trait

The Matrix trait provides common operations for transformation matrices:

  • Element accessors (m00(), m01(), etc.)
  • Rotation matrix extraction
  • Scale extraction and application
  • Euler angle conversion
  • Identity matrix creation

§Usage

use rpfm_lib::files::bmd::common::{Point3d, Transform4x4, Matrix};

// Create a 3D point
let point = Point3d::new(10.0, 20.0, 30.0);

// Create an identity transform
let transform = Transform4x4::identity();

// Extract rotation angles
let rotation_matrix = transform.rotation_matrix();
let (x, y, z) = Transform4x4::rotation_matrix_to_euler_angles(rotation_matrix, true);

§Submodules

Modules§

building_link
Building link data structure for BMD files.
building_reference
Building reference data structure for BMD files.
flags
Flag definitions for BMD entities.
properties
Building and entity property definitions for BMD files.

Structs§

ColourRGB
RGB color with floating-point components.
ColourRGBA
RGBA color with 8-bit components.
Cube
3D axis-aligned bounding box (AABB).
Outline2d
2D polyline outline.
Outline3d
3D polyline outline.
Point2d
2D point in Cartesian coordinates.
Point3d
3D point in Cartesian coordinates.
Polygon2d
2D polygon with arbitrary vertices.
Quaternion
Rotation quaternion.
Rectangle
2D axis-aligned rectangle.
Transform3x4
3x4 transformation matrix.
Transform4x4
4x4 transformation matrix.

Traits§

Matrix
Common operations for transformation matrices.