Models

From Pragma
Jump to: navigation, search

Description

All models in pragma are located in the "models" sub-directory, and have the extension ".wmd" ("Weave Model data").
Every 3D object in the world with physics or visible geometry has a model, including the world itself. Each model, in turn, consists of multiple meshes (and sub-meshes), as well as animations, constraints, bones, etc.

Importing Models

There are two ways of importing models into the engine.
You can use the model viewer/importer tool, which is the quick and easy route, but doesn't have many customization options at the moment.
Alternatively you can go the manual route, write a script for the compiler and compile the model yourself. This is difficult and time consuming, but gives you more flexibility.

Model Viewer/Importer

The model viewer is an in-engine tool with a GUI. It gives you detailed information about a specific model, but also allows you to make some changes, or import new meshes.

http://pragma-engine.com/sharex/sciolyte_2016-12-12_20-49-38.png


Export Model from Modelling Program

You'll have to export your meshes and animations in a certain format first. Supported formats are:

  • .smd: Studiomdl Data
  • .wrmi: "Weave Raw Model Information" - Custom format for Pragma
  • .wad: "Weave Animation Data" - Custom format for Pragma
  • .wrci: "Weave Raw Collision Information" - Custom format for Pragma

It is recommended to use Pragma's formats (.wrmi, .wad and .wrci), but .smds should work as well (Just make sure to never mix the two!).
To export your meshes and animations in Pragma's formats, you can use the 3ds max exporters, located in the "<root>/sdk/3ds Max" directory of your Pragma installation.

Create Model Info File

After having exported your meshes and animations in one of these formats, you'll have to create a ".wmci"-file (Weave Model Compiler Information), which is just a plain text file.
You can fill this file with any of the parameters you can find here. For example, a simple model with a collision mesh could look like this:

$texturepath "models/woodcrate/" // Path to where the materials and textures are located (Relative to "<root>/materials/")
$mesh woodcrate // The file name for the mesh (e.g. "woodcrate.smd"), multiple meshes can be defined
$collisionmesh woodcrate_phys // The file name for the collision mesh (e.g. "woodcrate_phys.smd")
$origin 0 0 0
$static 1 // Always set "static" to 1 if there are no animations or bones
$modelname woodcrate // The output file will be named "woodcrate.wmd", but you can still change the name later

You can find more examples inside the "<root>/sdk/models" directory. The ".wmci"-files in this directory have (mistakenly) the extension ".wai".

Compile Model

Once you have created your model info file, you have to run it through the compiler. To do so, simply drag and drop the ".wmci"-file on the "<root>/bin/wmc.exe" and it should generate your model (With the ".wmd" extension) in the same directory. All you have to do now is move the ".wmd"-file to your "<root>/models" directory, and the model can be used ingame.

See Also