wc3lib  0.1.0
MDLX module

MDLX refers both formats for Warcraft III's model files:

For further information see MDL and MDX.

This module provides several classes to read and write Blizzard's 3D graphics formats MDX (binary) and MDL (human-readable). It does not provide any display/rendering functionality. Use module editor for this.

Class wc3lib::mdlx::Mdlx provides all functionality which is needed to save or load one MDX or MDL file. The class can easily be used to convert one format into the other one (application "wc3converter" provides this feature).

Include file mdlx.hpp and use namespace wc3lib::mdlx to for this module.

Groups

MDX and MDL often use groups of entries for specific sections. For example lights are stored as list of entries without specified size. For each group there is a class like mdlx::Lights which inherits mdlx::GroupMdxBlock and stores a number of mdlx::GroupMdxBlockMember, one for each entry.

For accessing the members you have to use mdlx::Lights::members() and cast a member of type mdlx::GroupMdxBlockMember to mdlx::Light.

The implementation therefore relies on polymorphism:

Light *light2 = boost::polymorphic_cast<Light*>(&lights->members().front());

Animated Properties

MDX and MDL support properties which can be animated using a specified time of a sequence. Those properties are scalings, transformations or rotations.

mdlx::MdlxAnimatedProperties is a template which offers all required data using a dimension parameter to specify which number of numeric values is used. For example scalings and transformations usually need three coordinates whereas a rotation uses a quaternion with four values. Alphas which can be animated as well only have one single value.

Therefore mdlx::MdlxAnimatedProperties is the base class of mdlx::MdlxScalings, mdlx::MdlxTranslations, mdlx::MdlxRotations and mdlx::MdlxAlphas which use different dimensions (except scalings and translations).

It also manages the storage of entries using mdlx::MdlxAnimatedProperty similar to the group member managemenent. Use mdlx::MdlxAnimatedProperties::properties() to access all members.