mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-15 23:10:26 +01:00
Now we're climbing up the ladder
This commit is contained in:
parent
9483f17816
commit
aad38e8a49
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"iostream": "cpp",
|
||||||
|
"fstream": "cpp"
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,9 +3,13 @@
|
||||||
#include "IAnimatedMesh.h"
|
#include "IAnimatedMesh.h"
|
||||||
#include "IReadFile.h"
|
#include "IReadFile.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "json/json.hpp"
|
#include <iostream>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "json/json.hpp"
|
||||||
|
#include <array>
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
using namespace nlohmann::literals;
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
|
@ -38,6 +42,10 @@ bool CB3DJSONMeshFileLoader::isALoadableFileExtension(
|
||||||
return core::hasFileExtension(fileName, "json");
|
return core::hasFileExtension(fileName, "json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void parseModel(json model) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
IAnimatedMesh* CB3DJSONMeshFileLoader::createMesh(io::IReadFile* file) {
|
IAnimatedMesh* CB3DJSONMeshFileLoader::createMesh(io::IReadFile* file) {
|
||||||
|
|
||||||
// Less than zero? What is this file a black hole?
|
// Less than zero? What is this file a black hole?
|
||||||
|
@ -57,22 +65,29 @@ IAnimatedMesh* CB3DJSONMeshFileLoader::createMesh(io::IReadFile* file) {
|
||||||
// std::string err {};
|
// std::string err {};
|
||||||
// std::string warn {};
|
// std::string warn {};
|
||||||
|
|
||||||
// Try changing the type from auto to see why it's auto.
|
// auto buffer = std::make_unique<char[]>(file->getSize());
|
||||||
auto buffer = std::make_unique<char[]>(file->getSize());
|
char* buffer = new char[file->getSize()];
|
||||||
|
|
||||||
// Now we read that dang JSON.
|
// Now we read that dang JSON.
|
||||||
file->read(buffer.get(), file->getSize());
|
file->read(buffer, file->getSize());
|
||||||
|
|
||||||
const json data = json::parse("{\"hi\": 1}");
|
char* clone = strdup(buffer);
|
||||||
|
|
||||||
const auto test = data["hi"];
|
// Dereference then borrow it.
|
||||||
printf("is this a number? ");
|
json data = json::parse(&*clone);
|
||||||
println(boolToString(test.is_number()));
|
|
||||||
println(test.dump().c_str());
|
if (!data.contains("format") || !data["format"].is_string() || data["format"] != "BB3DJSON") {
|
||||||
|
os::Printer::log("No format in B3D JSON!", ELL_WARNING);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
if (!data.contains("version") || !data["version"].is_number_integer() || data["version"] != 1) {
|
||||||
|
os::Printer::log("Wrong version in B3D JSON!", ELL_WARNING);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
parseModel(data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! I'm sure this isn't a horrible idea!
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user