Improve readme

This commit is contained in:
Antonio Niño Díaz 2022-10-10 23:46:11 +01:00
parent d083d8db5a
commit b97056e036

View File

@ -6,22 +6,22 @@ Introduction
**DSMA** (DS Model Animation) is a library that allows you to convert animated
models saved in MD5 format into a format that can be displayed in the Nintendo DS
in a very efficient way. This library depends on ``libnds``, which is
distributed by ``devkitPro``.
in a very efficient way. This library depends on **libnds**, which is
distributed by **devkitPro**.
MD5 supports skeletal animation, which lets you reuse the same model with
multiple animations (a ``md5mesh`` file can be used with multiple ``md5anim``
multiple animations (a **md5mesh** file can be used with multiple **md5anim**
files). This library works in a similar way.
The converter used for this library is called ``md5_to_dsma``, and it generates
The converter used for this library is called **md5_to_dsma**, and it generates
the following files:
- **DSM** (DS Model): It contains a display list with the geometry of the model.
- **DSA** (DS Animation): It contains the position and orientation of all bones
in a specific animation sequence. You can have multiple ``DSA`` files for a
single ``DSM`` model if you have multiple animations for it.
in a specific animation sequence. You can have multiple DSA files for a single
DSM model if you have multiple animations for it.
The library supports interpolation between frames so that ``DSA`` can have a
The library supports interpolation between frames so that DSA files can have a
smaller size by reducing the number of stored frames in it.
You are expected to load the files in some way (either including them as binary
@ -29,15 +29,15 @@ data in your game, or loading them from the filesystem) and pass them to the
functions exposed by the library header.
There are multiple examples of how to use the library in this repository. They
all use ``libnds``, and most of the 3D setup code is generic ``libnds`` 3D setup
code. You can test them with an emulator such as ``DeSmuME`` or ``melonDS``, or
in real hardware with a flashcard.
all use libnds, and most of the 3D setup code is generic libnds 3D setup code.
You can test them with an emulator such as **DeSmuME** or **melonDS** or in real
hardware with a flashcard.
- ``basic_model``: Simply load an animated model embedded in the binary.
- ``filesystem_loading``: Load models from the filesystem (with ``nitroFS``).
- ``multiple_animations``: Display one model with multiple animations.
- ``performance``: Show how much CPU time it takes to draw an animated model.
- ``stress_test``: Show multiple animated models with different animations.
- **basic_model**: Simply load an animated model embedded in the binary.
- **filesystem_loading**: Load models from the filesystem (with **nitroFS**).
- **multiple_animations**: Display one model with multiple animations.
- **performance**: Show how much CPU time it takes to draw an animated model.
- **stress_test**: Show multiple animated models with different animations.
You can download them pre-compiled from the **Releases** page on GitHub:
@ -110,20 +110,20 @@ Converting textures
-------------------
In order to convert textures you can use some tool like
``nitro-texture-converter``, found here:
**nitro-texture-converter**, found here:
https://github.com/AntonioND/nitro-engine/tree/master/tools/nitro_texture_converter
``md5_to_dsma``
-------------
---------------
The options supported are:
- ``--output``: Output folder. It will be created if it doesn't exist.
- ``--model``: ``md5mesh`` file to convert. All MD5 models come with a base
pose, which is exported as a ``DSA`` file. The model itself is saved as a
``DSM`` file.
pose, which is exported as a DSA file. The model itself is saved as a DSM
file.
- ``--texture``: Texture size of the model. This is required. The DS doesn't
use floating point values for texture coordinates, so you can only use
@ -131,7 +131,7 @@ The options supported are:
texture, do ``--texture 32 64``.
- ``--anims``: List of ``md5anim`` files to convert. Each animation is saved as
a ``DSA`` file.
a DSA file.
- ``--name``: Base name used for the output files.
@ -142,13 +142,13 @@ The options supported are:
- ``--bin``: When this is used, ``.bin`` is added to the end of all the names of
the files generated by the tool. This is useful if you want to copy the files
to a ``data`` folder of a ``libnds`` template and you don't want to modify the
to a ``data`` folder of a libnds template and you don't want to modify the
``Makefile`` to accept new file extensions. This option isn't required if you
are using ``libfilesystem`` or similar and you're loading files from a
filesystem.
are using **libfilesystem**, **libfat** or similar and you're loading files
from a filesystem.
- ``--export-base-pose``: ``md5mesh`` files contain a base pose. This option
will export this base pose as a ``DSA`` file with one frame.
will export this base pose as a DSA file with one frame.
- ``--skip-frames``: Number of animation frames to skip after exporting each
frame. For example, to skip half of the frames, do ``--skip-frames 1``, and to
@ -165,11 +165,11 @@ The library only has two functions:
- ``uint32_t DSMA_GetNumFrames(const void *dsa_file)``
Returns the number of frames of the animation in a ``DSA`` file.
Returns the number of frames of the animation in a DSA file.
- ``int DSMA_DrawModel(const void *dsm_file, const void *dsa_file, uint32_t frame_interp)``
Draws the model in a ``DSM`` file with the animation in a ``DSA`` file.
Draws the model in a DSM file with the animation in a DSA file.
The value of the frame to be drawn is a fixed point value (20.12, or ``f32``).
If the frame is an integer value there is no interpolation between frames. If
@ -181,14 +181,15 @@ Future work
- Smooth shading (only flat shading is supported at the moment).
- Optimize normal commands (if multiple vertices belong to the same joint and
have the same normal).
- Container files to hold multiple ``DSM`` and ``DSA`` files.
- Container files to hold multiple DSM and DSA files.
Thanks to
---------
- devkitPro: https://devkitpro.org/
- Blender addon used to generate models: https://github.com/KozGit/Blender-2.8-MD5-import-export-addon
- **devkitPro**: https://devkitpro.org/
- **Blender**: https://www.blender.org/
- **Blender** addon used to generate models: https://github.com/KozGit/Blender-2.8-MD5-import-export-addon
- MD5 format information: http://tfc.duke.free.fr/coding/md5-specs-en.html
- Quaternion to matrix conversion: http://www.songho.ca/opengl/gl_quaternion.html
- DeSmuME: http://desmume.org/
- melonDS: https://melonds.kuribo64.net/
- **DeSmuME**: http://desmume.org/
- **melonDS**: https://melonds.kuribo64.net/