mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-05-17 07:21:43 +00:00
chore: use ordered_json for gltf
order is based on what blender does https://github.com/KhronosGroup/glTF-Blender-IO/blob/7bea3666f8b5043292e578501a779f244d8e8f06/addons/io_scene_gltf2/io/exp/export.py#L48
This commit is contained in:
@@ -33,7 +33,7 @@ std::optional<std::string> BinOutput::CreateBufferUri(const void* buffer, size_t
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void BinOutput::EmitJson(const nlohmann::json& json) const
|
||||
void BinOutput::EmitJson(const nlohmann::ordered_json& json) const
|
||||
{
|
||||
static constexpr uint32_t ZERO = 0u;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace gltf
|
||||
explicit BinOutput(std::ostream& stream);
|
||||
|
||||
std::optional<std::string> CreateBufferUri(const void* buffer, size_t bufferSize) const override;
|
||||
void EmitJson(const nlohmann::json& json) const override;
|
||||
void EmitJson(const nlohmann::ordered_json& json) const override;
|
||||
void EmitBuffer(const void* buffer, size_t bufferSize) const override;
|
||||
void Finalize() const override;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace gltf
|
||||
|
||||
public:
|
||||
virtual std::optional<std::string> CreateBufferUri(const void* buffer, size_t bufferSize) const = 0;
|
||||
virtual void EmitJson(const nlohmann::json& json) const = 0;
|
||||
virtual void EmitJson(const nlohmann::ordered_json& json) const = 0;
|
||||
virtual void EmitBuffer(const void* buffer, size_t bufferSize) const = 0;
|
||||
virtual void Finalize() const = 0;
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ std::optional<std::string> TextOutput::CreateBufferUri(const void* buffer, const
|
||||
return output;
|
||||
}
|
||||
|
||||
void TextOutput::EmitJson(const nlohmann::json& json) const
|
||||
void TextOutput::EmitJson(const nlohmann::ordered_json& json) const
|
||||
{
|
||||
m_stream << std::setw(4) << json;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace gltf
|
||||
explicit TextOutput(std::ostream& stream);
|
||||
|
||||
std::optional<std::string> CreateBufferUri(const void* buffer, size_t bufferSize) const override;
|
||||
void EmitJson(const nlohmann::json& json) const override;
|
||||
void EmitJson(const nlohmann::ordered_json& json) const override;
|
||||
void EmitBuffer(const void* buffer, size_t bufferSize) const override;
|
||||
void Finalize() const override;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace
|
||||
FillBufferData(gltf, xmodel, bufferData);
|
||||
CreateBuffer(gltf, xmodel, bufferData);
|
||||
|
||||
const json jRoot = gltf;
|
||||
const ordered_json jRoot = gltf;
|
||||
m_output->EmitJson(jRoot);
|
||||
|
||||
if (!bufferData.empty())
|
||||
|
||||
Reference in New Issue
Block a user