mesh_texture refactoring #1

This commit is contained in:
Sandro Sobczyński
2020-10-29 22:19:06 +01:00
parent 8501a85f49
commit 99d4c3633b
12 changed files with 102 additions and 22 deletions
+4 -3
View File
@@ -14,6 +14,7 @@
#include "../include/loaders/md2_loader.hpp"
#include "../include/loaders/dff_loader.hpp"
#include "../include/loaders/bmp_loader.hpp"
#include "../include/models/mesh_texture.hpp"
#include "../include/utils/debug.hpp"
#include "../include/utils/string.hpp"
@@ -178,7 +179,7 @@ void Mesh::loadTextures(char *t_subfolder, char *t_extension)
BmpLoader bmpLoader = BmpLoader();
if (isObjLoaded)
{
spec->textures = new Texture[obj->frames[0].getMaterialsCount()];
spec->textures = new MeshTexture[obj->frames[0].getMaterialsCount()];
for (u8 i = 0; i < obj->frames[0].getMaterialsCount(); i++)
{
bmpLoader.load(spec->textures[i], t_subfolder, obj->frames[0].getMaterial(i).getName(), t_extension);
@@ -187,13 +188,13 @@ void Mesh::loadTextures(char *t_subfolder, char *t_extension)
}
else if (isMd2Loaded)
{
spec->textures = new Texture[1];
spec->textures = new MeshTexture[1];
bmpLoader.load(spec->textures[0], t_subfolder, md2->filename, t_extension);
setDefaultWrapSettings(spec->textures[0].wrapSettings);
}
else if (isDffLoaded)
{
spec->textures = new Texture[dff->clump.geometryList.geometries[0].materialList.data.materialCount];
spec->textures = new MeshTexture[dff->clump.geometryList.geometries[0].materialList.data.materialCount];
for (u8 i = 0; i < dff->clump.geometryList.geometries[0].materialList.data.materialCount; i++)
for (u8 j = 0; j < dff->clump.geometryList.geometries[0].materialList.materials[i].data.textureCount; j++)
{
+28
View File
@@ -0,0 +1,28 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2020, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "../include/models/mesh_texture.hpp"
#include "../include/utils/debug.hpp"
// ----
// Constructors/Destructors
// ----
MeshTexture::MeshTexture()
{
}
MeshTexture::~MeshTexture()
{
}
// ----
// Methods
// ----