Vox loaded (#1981)
* new models_magicavoxel_loading example * Portable header-only file "magicavoxel_loader.h" for MagicaVoxel loader example. * models_magicavoxel_loading example added to CMakeLists.txt and Makefile * fix models_magicavoxel_loading example for linux. * * vox_loader into "src/external/vox_loader.h" * vox file support for "models.c" * updated example "models/models_magicavoxel_loading.c" * * Fix Vox_FreeArrays (removed memory leak) * * removed magicavoxel_loader.h * * Revert vs2019 solution * * vox_loader.h -> Support custom memory allocators * vox_loader.h -> Reverse Y<>Z for left to right handed system * models/models_magicavoxel_loading.c -> fix model center * * vox_loader.h -> Removed Raylib dependencies * * Changed Vox_LoadFileName to Vox_LoadFromMemory
This commit is contained in:
parent
803094f41f
commit
a422d2fc8b
3 changed files with 125 additions and 92 deletions
|
@ -51,16 +51,14 @@ int main(void)
|
|||
t1 = GetTime() * 1000.0;
|
||||
TraceLog(LOG_INFO, TextFormat("Vox <%s> loaded in %f ms", GetFileName(szVoxFiles[i]), t1 - t0));
|
||||
|
||||
//Compute model matrix
|
||||
//Compute model's center matrix
|
||||
BoundingBox bb = GetModelBoundingBox(models[i]);
|
||||
Vector3 center;
|
||||
center.x = -(((bb.max.x - bb.min.x) / 2));
|
||||
center.y = -(((bb.max.y - bb.min.y) / 2));
|
||||
center.z = -(((bb.max.z - bb.min.z) / 2));
|
||||
center.x = bb.min.x + (((bb.max.x - bb.min.x) / 2));
|
||||
center.z = bb.min.z + (((bb.max.z - bb.min.z) / 2));
|
||||
|
||||
Matrix matP = MatrixTranslate(center.x, center.z, 0);
|
||||
Matrix matR = MatrixRotateX(90 * DEG2RAD);
|
||||
models[i].transform = MatrixMultiply(matP, matR);
|
||||
Matrix matP = MatrixTranslate(-center.x, 0, -center.z);
|
||||
models[i].transform = matP;
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue