This commit is contained in:
h4570
2022-08-29 19:00:47 +02:00
parent 2ae1ccd761
commit e359bcbe2b
30 changed files with 174 additions and 152 deletions
+5
View File
@@ -32,6 +32,11 @@ class FileUtils {
static std::string fromCwd(const std::string& relativePath);
static std::string fromCwd(const char* relativePath);
static std::string getFilenameFromPath(const std::string& path);
static std::string getPathFromFilename(const std::string& path);
static std::string getFilenameWithoutExtension(const std::string& filename);
static std::string getExtensionOfFilename(const std::string& filename);
const char* getElfName() const { return elfName; };
const char* getElfPath() const { return elfPath; };
@@ -28,7 +28,7 @@ class MeshBuilderData {
std::vector<MeshBuilderMaterialData*> materials;
bool textureCoordsEnabled, normalsEnabled, lightMapEnabled;
bool loadNormals, loadLightmap;
};
} // namespace Tyra
@@ -13,6 +13,7 @@
#include <vector>
#include <string>
#include <optional>
#include "./mesh_builder_material_frame_data.hpp"
#include "renderer/models/color.hpp"
@@ -25,6 +26,7 @@ class MeshBuilderMaterialData {
std::vector<MeshBuilderMaterialFrameData*> frames;
std::string name;
std::optional<std::string> texturePath;
Color ambient;
};
@@ -10,7 +10,6 @@
#pragma once
#include "../../loader.hpp"
#include "../builder/mesh_builder_data.hpp"
#include <string>
#include <memory>
@@ -23,7 +22,7 @@ struct MD2LoaderOptions {
};
/** Class responsible for loading & parsing Quake's II ".md2" 3D files */
class MD2Loader : public Loader {
class MD2Loader {
public:
static std::unique_ptr<MeshBuilderData> load(const char* fullpath);
static std::unique_ptr<MeshBuilderData> load(const char* fullpath,
@@ -10,12 +10,12 @@
#pragma once
#include "../../loader.hpp"
#include "../builder/mesh_builder_data.hpp"
#include <string>
#include "renderer/models/color.hpp"
#include "loaders/3d/obj_loader/tiny_obj_loader.hpp"
#include <memory.h>
#include <optional>
namespace Tyra {
@@ -36,7 +36,7 @@ struct MaterialVertexCount {
};
/** Class responsible for loading & parsing obj files */
class ObjLoader : public Loader {
class ObjLoader {
public:
static std::unique_ptr<MeshBuilderData> load(const char* fullpath);
static std::unique_ptr<MeshBuilderData> load(const char* fullpath,
-25
View File
@@ -1,25 +0,0 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <string>
namespace Tyra {
class Loader {
protected:
static std::string getFilenameFromPath(const std::string& path);
static std::string getPathFromFilename(const std::string& path);
static std::string getFilenameWithoutExtension(const std::string& filename);
static std::string getExtensionOfFilename(const std::string& filename);
};
} // namespace Tyra
@@ -10,13 +10,12 @@
#pragma once
#include "loaders/loader.hpp"
#include "loaders/texture/builder/texture_builder_data.hpp"
#include "renderer/core/texture/models/texture_bpp.hpp"
#include <string>
namespace Tyra {
class TextureLoader : public Loader {
class TextureLoader {
public:
/**
* @brief Loads texture data from file.
@@ -13,6 +13,7 @@
#include "debug/debug.hpp"
#include "./mesh_material_frame.hpp"
#include "loaders/3d/builder/mesh_builder_data.hpp"
#include <optional>
namespace Tyra {
@@ -23,11 +24,9 @@ class MeshMaterial {
~MeshMaterial();
bool isMother, lightmapFlag;
u32 id;
std::string name;
std::optional<std::string> textureName;
Color ambient;
std::vector<MeshMaterialFrame*> frames;
@@ -44,8 +44,7 @@ class DynPipRenderer {
void uploadPrograms();
void setDoubleBuffer();
void addBufferDataToPacket(DynPipVU1Program* program, DynPipBag** bags,
const u32& count);
void addBufferDataToPacket(DynPipBag** bags, const u32& count);
void sendPacket();
prim_t* prim;
@@ -59,7 +59,7 @@ class DynamicPipeline : public Renderer3DPipeline {
void setBuffer(DynPipBag* buffers, DynPipBag* buffer, u16* bufferIndex);
void sendRestOfBuffers(DynPipBag* buffers, u16* bufferIndex);
void sendRestOfBuffers(DynPipBag* buffers, const u16& bufferIndex);
void addVertices(const MeshMaterialFrame* materialFrameFrom,
const MeshMaterialFrame* materialFrameTo, DynPipBag* bag,