mesh patch 1
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "./mesh_builder_material_data.hpp"
|
||||
#include "./mesh_builder_frame_data.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class MeshBuilderData {
|
||||
public:
|
||||
MeshBuilderData();
|
||||
~MeshBuilderData();
|
||||
|
||||
MeshBuilderFrameData** frames;
|
||||
u32 framesCount;
|
||||
|
||||
MeshBuilderMaterialData** materials;
|
||||
u32 materialsCount;
|
||||
|
||||
bool textureCoordsEnabled, normalsEnabled, manyColorsEnabled;
|
||||
|
||||
void allocateFrames(const u32& count);
|
||||
void allocateMaterials(const u32& count);
|
||||
void allocate(const u32& framesCount, const u32& materialsCount);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -1,35 +0,0 @@
|
||||
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tamtypes.h>
|
||||
#include "math/vec4.hpp"
|
||||
#include "renderer/models/color.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class MeshBuilderFrameData {
|
||||
public:
|
||||
MeshBuilderFrameData();
|
||||
~MeshBuilderFrameData();
|
||||
|
||||
Vec4 *vertices, *normals, *textureCoords;
|
||||
Color* colors;
|
||||
u32 verticesCount, textureCoordsCount, normalsCount, colorsCount;
|
||||
|
||||
void allocateTextureCoords(const u32& count);
|
||||
void allocateVertices(const u32& count);
|
||||
void allocateNormals(const u32& count);
|
||||
void allocateColors(const u32& count);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tamtypes.h>
|
||||
#include <string>
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class MeshBuilderMaterialData {
|
||||
public:
|
||||
MeshBuilderMaterialData();
|
||||
~MeshBuilderMaterialData();
|
||||
|
||||
std::string name;
|
||||
u32 *vertexFaces, *textureCoordFaces, *normalFaces, *colorFaces;
|
||||
u32 count;
|
||||
|
||||
void allocateFaces(const u32& count);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -11,7 +11,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../loader.hpp"
|
||||
#include "../builder/mesh_builder_data.hpp"
|
||||
#include "../builder2/mesh_builder2_data.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace Tyra {
|
||||
@@ -22,11 +22,11 @@ class MD2Loader : public Loader {
|
||||
MD2Loader();
|
||||
~MD2Loader();
|
||||
|
||||
MeshBuilderData* load(const char* fullpath, const float& scale,
|
||||
const bool& invertT);
|
||||
MeshBuilder2Data* load(const char* fullpath, const float& scale,
|
||||
const bool& invertT);
|
||||
|
||||
inline MeshBuilderData* load(const std::string& fullpath, const float& scale,
|
||||
const bool& invertT) {
|
||||
inline MeshBuilder2Data* load(const std::string& fullpath, const float& scale,
|
||||
const bool& invertT) {
|
||||
return load(fullpath.c_str(), scale, invertT);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,10 +34,16 @@ class ObjLoader : public Loader {
|
||||
}
|
||||
|
||||
private:
|
||||
void setInitialData(MeshBuilder2Data* output, const tinyobj::attrib_t& attrib,
|
||||
const std::vector<tinyobj::shape_t>& shapes,
|
||||
const std::vector<tinyobj::material_t>& materials,
|
||||
const u16& framesCount);
|
||||
void addOutputMaterialsAndFrames(
|
||||
MeshBuilder2Data* output, const tinyobj::attrib_t& attrib,
|
||||
const std::vector<tinyobj::shape_t>& shapes,
|
||||
const std::vector<tinyobj::material_t>& materials,
|
||||
const u16& framesCount);
|
||||
|
||||
void scan(MeshBuilder2Data* output, const tinyobj::attrib_t& attrib,
|
||||
const std::vector<tinyobj::shape_t>& shapes,
|
||||
const std::vector<tinyobj::material_t>& materials,
|
||||
const u16& frameIndex);
|
||||
|
||||
void importFrame(MeshBuilder2Data* output, const tinyobj::attrib_t& attrib,
|
||||
const std::vector<tinyobj::shape_t>& shapes,
|
||||
|
||||
Reference in New Issue
Block a user