SpiecsEngine
 
Loading...
Searching...
No Matches
MeshLoader.h
Go to the documentation of this file.
1/**
2* @file MeshLoader.h.
3* @brief The MeshLoader Class Definitions.
4* @author Spices.
5*/
6
7#pragma once
8#include "Core/Core.h"
9
10namespace Spices {
11
12 /**
13 * @brief Forward declare.
14 */
15 class MeshPack;
16
17 /**
18 * @brief This enum defines tree types of mesh file.
19 */
21 {
22 /**
23 * @brief error type
24 */
26
27 /**
28 * @brief obj type
29 */
30 OBJ = 1,
31
32 /**
33 * @brief fbx type
34 */
35 FBX = 2,
36
37 /**
38 * @brief binary type
39 */
40 SASSET = 3,
41 };
42
43 /**
44 * @brief MeshLoader Class.
45 * This class only defines static function for load data from mesh file.
46 */
48 {
49 public:
50
51 /**
52 * @brief Public called API, it is entrance.
53 * @param[in] fileName mesh file name.
54 * @param[in,out] outMeshPack mesh pack pointer, only pass this to it.
55 * Feel free for using row pointer here, it's very safe, for this API only called during MeshPack.
56 * @return Returns true if load data successfully.
57 */
58 static bool Load(const std::string& fileName, MeshPack* outMeshPack);
59
60 private:
61
62 /**
63 * @brief Load data from a .obj file.
64 * @param[in] fileName Mesh file path in disk.
65 * @param[in,out] outMeshPack mesh pack pointer, only pass this to it.
66 * @return Returns true if load data successfully.
67 */
68 static bool LoadFromOBJ(const std::string& fileName, MeshPack* outMeshPack);
69
70 /**
71 * @brief Load data from a .fbx file.
72 * @param[in] fileName Mesh file path in disk.
73 * @param[in,out] outMeshPack mesh pack pointer, only pass this to it.
74 * @return Returns true if load data successfully.
75 */
76 static bool LoadFromFBX(const std::string& fileName, MeshPack* outMeshPack);
77
78 /**
79 * @brief Load data from a .sasset file.
80 * @param[in] fileName Mesh file path in disk.
81 * @param[in,out] outMeshPack mesh pack pointer, only pass this to it.
82 * @return Returns true if load data successfully.
83 */
84 static bool LoadFromSASSET(const std::string& fileName, const MeshPack* outMeshPack);
85
86 /**
87 * @brief Write the read data to the sasset file.
88 * @param[in] fileName Mesh file path in disk.
89 * @param[in] folderIndex Index of Resource Folder.
90 * @param[in,out] outMeshPack mesh pack pointer, only pass this to it.
91 * @return Returns true if write data successfully.
92 */
93 static bool WriteSASSET(int folderIndex, const std::string& fileName, const MeshPack* outMeshPack);
94 };
95}
#define SPICES_PROFILE_ZONE
static bool FileLibrary_Read(const FileHandle *handle, uint64_t data_size, void *out_data, uint64_t *out_bytes_read)
Read Specific size of data form the current file handle pointer, and move pointer the same size.
static bool FileLibrary_Write(const FileHandle *handle, uint64_t data_size, const void *data, uint64_t *out_bytes_written)
Write given data to the file handle pointer.
static bool FileLibrary_Open(const char *path, FileModes mode, bool binary, FileHandle *out_handle)
Open the file using given string.
static void FileLibrary_Close(FileHandle *handle)
Close the file by the file handle.
static bool FileLibrary_Exists(const char *path)
Determine whether the given string is existing a file.
File Static Function Library.
Definition FileLibrary.h:49
static bool Load(const std::string &fileName, MeshPack *outMeshPack)
Public called API, it is entrance.
static bool WriteSASSET(int folderIndex, const std::string &fileName, const MeshPack *outMeshPack)
Write the read data to the sasset file.
static bool LoadFromSASSET(const std::string &fileName, const MeshPack *outMeshPack)
Load data from a .sasset file.
static bool LoadFromFBX(const std::string &fileName, MeshPack *outMeshPack)
Load data from a .fbx file.
static bool LoadFromOBJ(const std::string &fileName, MeshPack *outMeshPack)
Load data from a .obj file.
MeshLoader Class. This class only defines static function for load data from mesh file.
Definition MeshLoader.h:48
MeshPack Class. This class defines some basic behaves and variables. This class need to be inherited ...
Definition MeshPack.h:156
static void GenerateMeshLodClusterHierarchy(MeshPack *meshPack)
Generate Mesh Lod Resources.
Class for provide functions of process Meshpack.
static bool StringsEqual(const char *str0, const char *str1)
Determine if the strings given are equal. Platform Specific.
String Static Function Library.
const std::string defaultFBXMeshPath
Const variable: FBX Mesh File Path.
constexpr char MeshLoaderSignOver[100]
Const variable: Mesh File Confirm header over.
constexpr char MeshLoaderSignStart[100]
Const variable: Mesh File Confirm header staer.
const std::string defaultBinMeshPath
Const variable: Bin Mesh File Path.
const std::string defaultOBJMeshPath
Const variable: OBJ Mesh File Path.
@ FILE_MODE_READ
model : read
Definition FileLibrary.h:37
@ FILE_MODE_WRITE
model : write
Definition FileLibrary.h:42
MeshExtension
This enum defines tree types of mesh file.
Definition MeshLoader.h:21
@ SASSET
binary type
Definition MeshLoader.h:40
@ FBX
fbx type
Definition MeshLoader.h:35
@ OBJ
obj type
Definition MeshLoader.h:30
@ UNKNOWN
error type
Definition MeshLoader.h:25
This Struct is FILE* handle pointer Wrapper.
Definition FileLibrary.h:15
Lod Data.
Definition MeshPack.h:28
Meshlet Class. This class defines what Meshlet data.
Definition Vertex.h:58