S_Kleer
Member
Hello all! Just I want to show my asset that allow to load models from Magica Voxel to GMS 2!
All code writen on GML. It fast and optimased (i hope).
This asset is a paid, but you can try free compiled demo.
Features:
- Import Magica Voxel (.vox) models
- Models can be stored in one vertex buffer for better perfomance
- Support frame based animation (you must use Magica Voxel 0.98.2)
- Simple texture support
- Support to set scale, when model is loading
- Support to set origin, when model is loading (nine points of origin)
- Easy to use
- If you load many models through a loop, it can take a lot of memory (make small loops)
- Large levels can take a long time to load
- Maximal size of model is 256x256x256 voxels
- Models is not optimazed when is loaded. Each voxel have external sides. (2 triangle for each side) But inner sides not be generated.
List of functions:
Code:
VI_init()
VI_data_load(fname)
VI_data_unload(data)
VI_data_get_frames(data)
VI_data_get_palette(data)
VI_model_create(data, x, y, z, scale, origin)
VI_model_complex_start(frames)
VI_model_complex_add(complex, data, x, y, z, scale, origin)
VI_model_complex_end(complex)
VI_model_draw(model, frame, texture, x, y, z)
VI_model_draw_ext(model, frame, texture, x, y, z, xrotation, yrotation, zrotation, xscale, yscale, zscale)
VI_model_destroy(model)
- All functions are rewritten for version 2.3.0!
- Models are now loaded into memory using the new VI_data_load function. Previously, to create a model, game had to constantly open and read a file.
- Due to the addition of the VI_data_load function, a lot of work has been done to rewrite the old code.
- Added VI_data_unload function to unload information about models from memory if they are no longer needed.
- Renamed the VI_model_get_frames and VI_model_get_palette functions to VI_data_get_frames and VI_data_get_palette.
- Changed the origin system of models. Now the argument takes an array of 3 values, which is much clearer and more convenient. By default, the center [0, 0, 0] is in the upper left corner at the bottom of the model.
- Slightly changed the code for drawing models. Now you need to call matrix_set(matrix_world, matrix_build_identity()) after the VI_model_draw and VI_model_draw_ext functions. This change made it possible to slightly speed up the draw of models.
- Fixed a bug with model normals (I hope), which led to incorrect display of light.
- Added a new demo. The already familiar landscape, but without using the VI_model_complex_start function to clearly show the difference in fps.
Marketplace link.
Demo link.
Last edited: