SpiecsEngine
 
Loading...
Searching...
No Matches

◆ LoadFromSASSET()

bool Spices::MaterialLoader::LoadFromSASSET ( const std::string & fileName,
Material * outMaterial )
staticprivate

Load data from a .sasset file.

Parameters
[in]fileNameMaterial path in disk.
[in,out]outMaterialMaterial pointer, only pass this to it.
Returns
Returns true if load data successfully.
Todo
Finish it.

Definition at line 225 of file MaterialLoader.cpp.

226 {
228
229 bool isFind = false;
230 std::string filePath;
231 for (auto& it : ResourceSystem::GetSearchFolder())
232 {
233 filePath = it + defaultBinMaterialPath + "Material." + fileName + ".sasset";
234 if (FileLibrary::FileLibrary_Exists(filePath.c_str()))
235 {
236 isFind = true;
237 break;
238 }
239 }
240 if (!isFind) return false;
241
242 FileHandle f;
243 FileLibrary::FileLibrary_Open(filePath.c_str(), FILE_MODE_READ, true, &f);
244
245 uint64_t read = 0;
246
247 char startSign[100];
248 FileLibrary::FileLibrary_Read(&f, sizeof(char) * 100, &startSign, &read);
249
251 {
253 return false;
254 }
255
256 // TODO: ReadData
257
258 char overSign[100];
259 FileLibrary::FileLibrary_Read(&f, sizeof(char) * 100, &overSign, &read);
260
262 {
264 return false;
265 }
266
268
269 return true;
270 }
#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_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.
static bool StringsEqual(const char *str0, const char *str1)
Determine if the strings given are equal. Platform Specific.
const std::string defaultBinMaterialPath
Const variable: Bin Material File Path.
constexpr char LoaderSignStart[100]
Const variable: Material File Confirm header start.
constexpr char LoaderSignOver[100]
Const variable: Material File Confirm header over.
@ FILE_MODE_READ
model : read
Definition FileLibrary.h:37

References Spices::FILE_MODE_READ, Spices::FileLibrary::FileLibrary_Close(), Spices::FileLibrary::FileLibrary_Open(), Spices::FileLibrary::FileLibrary_Read(), Spices::LoaderSignOver, Spices::LoaderSignStart, and Spices::StringLibrary::StringsEqual().

Referenced by Load().