chore: update xmodel common to be a struct with substructs

This commit is contained in:
Jan
2024-04-02 21:34:51 +02:00
parent 0a65c93aa5
commit 826e59d627
13 changed files with 413 additions and 451 deletions

View File

@ -1,33 +0,0 @@
#include "AbstractXModelWriter.h"
AbstractXModelWriter::AbstractXModelWriter() = default;
void AbstractXModelWriter::AddObject(XModelObject object)
{
m_objects.emplace_back(std::move(object));
}
void AbstractXModelWriter::AddBone(XModelBone bone)
{
m_bones.emplace_back(std::move(bone));
}
void AbstractXModelWriter::AddMaterial(XModelMaterial material)
{
m_materials.emplace_back(std::move(material));
}
void AbstractXModelWriter::AddVertex(XModelVertex vertex)
{
m_vertices.emplace_back(vertex);
}
void AbstractXModelWriter::AddVertexBoneWeights(XModelVertexBoneWeights vertexBoneWeights)
{
m_vertex_bone_weights.emplace_back(vertexBoneWeights);
}
void AbstractXModelWriter::AddFace(XModelFace face)
{
m_faces.emplace_back(face);
}

View File

@ -1,26 +0,0 @@
#pragma once
#include "XModel/XModelCommon.h"
#include <vector>
class AbstractXModelWriter
{
protected:
std::vector<XModelObject> m_objects;
std::vector<XModelBone> m_bones;
std::vector<XModelMaterial> m_materials;
std::vector<XModelVertex> m_vertices;
std::vector<XModelVertexBoneWeights> m_vertex_bone_weights;
std::vector<XModelFace> m_faces;
public:
AbstractXModelWriter();
void AddObject(XModelObject object);
void AddBone(XModelBone bone);
void AddMaterial(XModelMaterial material);
void AddVertex(XModelVertex vertex);
void AddVertexBoneWeights(XModelVertexBoneWeights vertexBoneWeights);
void AddFace(XModelFace face);
};

View File

@ -6,25 +6,20 @@
#include <iomanip>
#include <iostream>
class XModelExportWriterBase : public XModelExportWriter
class XModelExportWriterBase : public XModelWriter
{
protected:
std::string m_game_name;
std::string m_zone_name;
VertexMerger m_vertex_merger;
void PrepareVertexMerger()
void PrepareVertexMerger(const XModelCommon& xmodel)
{
m_vertex_merger = VertexMerger(m_vertices.size());
m_vertex_merger = VertexMerger(xmodel.m_vertices.size());
auto vertexOffset = 0u;
for (const auto& vertex : m_vertices)
for (const auto& vertex : xmodel.m_vertices)
{
XModelVertexBoneWeights weights{nullptr, 0};
if (vertexOffset < m_vertex_bone_weights.size())
weights = m_vertex_bone_weights[vertexOffset];
if (vertexOffset < xmodel.m_vertex_bone_weights.size())
weights = xmodel.m_vertex_bone_weights[vertexOffset];
m_vertex_merger.Add(VertexMergerPos{vertex.coordinates[0], vertex.coordinates[1], vertex.coordinates[2], weights.weights, weights.weightCount});
@ -32,103 +27,99 @@ protected:
}
}
void WriteHeader(std::ostream& stream, const int version) const
void WriteHeader(const int version) const
{
stream << "// OpenAssetTools XMODEL_EXPORT File\n";
stream << "// Game Origin: " << m_game_name << "\n";
stream << "// Zone Origin: " << m_zone_name << "\n";
stream << "MODEL\n";
stream << "VERSION " << version << "\n";
stream << "\n";
m_stream << "// OpenAssetTools XMODEL_EXPORT File\n";
m_stream << "// Game Origin: " << m_game_name << "\n";
m_stream << "// Zone Origin: " << m_zone_name << "\n";
m_stream << "MODEL\n";
m_stream << "VERSION " << version << "\n";
m_stream << "\n";
}
void WriteBones(std::ostream& stream) const
void WriteBones(const XModelCommon& xmodel) const
{
stream << "NUMBONES " << m_bones.size() << "\n";
m_stream << "NUMBONES " << xmodel.m_bones.size() << "\n";
size_t boneNum = 0u;
for (const auto& bone : m_bones)
for (const auto& bone : xmodel.m_bones)
{
stream << "BONE " << boneNum << " ";
m_stream << "BONE " << boneNum << " ";
if (bone.parentIndex < 0)
stream << "-1";
m_stream << "-1";
else
stream << bone.parentIndex;
m_stream << bone.parentIndex;
stream << " \"" << bone.name << "\"\n";
m_stream << " \"" << bone.name << "\"\n";
boneNum++;
}
stream << "\n";
m_stream << "\n";
boneNum = 0u;
for (const auto& bone : m_bones)
for (const auto& bone : xmodel.m_bones)
{
stream << "BONE " << boneNum << "\n";
stream << "OFFSET ";
stream << std::setprecision(6) << std::fixed << bone.globalOffset[0] << ", " << std::setprecision(6) << std::fixed << bone.globalOffset[1] << ", "
<< std::setprecision(6) << std::fixed << bone.globalOffset[2] << "\n";
stream << "SCALE ";
stream << std::setprecision(6) << std::fixed << bone.scale[0] << ", " << std::setprecision(6) << std::fixed << bone.scale[1] << ", "
<< std::setprecision(6) << std::fixed << bone.scale[2] << "\n";
m_stream << "BONE " << boneNum << "\n";
m_stream << std::format("OFFSET {:.6f}, {:.6f}, {:.6f}\n", bone.globalOffset[0], bone.globalOffset[1], bone.globalOffset[2]);
m_stream << std::format("SCALE {:.6f}, {:.6f}, {:.6f}\n", bone.scale[0], bone.scale[1], bone.scale[2]);
const Matrix32 mat = bone.globalRotation.ToMatrix();
stream << "X " << std::setprecision(6) << std::fixed << mat.m_data[0][0] << ", " << std::setprecision(6) << std::fixed << mat.m_data[1][0] << ", "
<< std::setprecision(6) << std::fixed << mat.m_data[2][0] << "\n";
stream << "Y " << std::setprecision(6) << std::fixed << mat.m_data[0][1] << ", " << std::setprecision(6) << std::fixed << mat.m_data[1][1] << ", "
<< std::setprecision(6) << std::fixed << mat.m_data[2][1] << "\n";
stream << "Z " << std::setprecision(6) << std::fixed << mat.m_data[0][2] << ", " << std::setprecision(6) << std::fixed << mat.m_data[1][2] << ", "
<< std::setprecision(6) << std::fixed << mat.m_data[2][2] << "\n";
stream << "\n";
m_stream << std::format("X {:.6f}, {:.6f}, {:.6f}\n", mat.m_data[0][0], mat.m_data[1][0], mat.m_data[2][0]);
m_stream << std::format("Y {:.6f}, {:.6f}, {:.6f}\n", mat.m_data[0][1], mat.m_data[1][1], mat.m_data[2][1]);
m_stream << std::format("Z {:.6f}, {:.6f}, {:.6f}\n", mat.m_data[0][2], mat.m_data[1][2], mat.m_data[2][2]);
m_stream << '\n';
boneNum++;
}
}
XModelExportWriterBase(std::string gameName, std::string zoneName)
: m_game_name(std::move(gameName)),
XModelExportWriterBase(std::ostream& stream, std::string gameName, std::string zoneName)
: m_stream(stream),
m_game_name(std::move(gameName)),
m_zone_name(std::move(zoneName))
{
}
std::ostream& m_stream;
std::string m_game_name;
std::string m_zone_name;
VertexMerger m_vertex_merger;
};
class XModelExportWriter6 final : public XModelExportWriterBase
{
void WriteVertices(std::ostream& stream) const
void WriteVertices(const XModelCommon& xmodel) const
{
const auto& distinctVertexValues = m_vertex_merger.GetDistinctValues();
stream << "NUMVERTS " << distinctVertexValues.size() << "\n";
m_stream << "NUMVERTS " << distinctVertexValues.size() << "\n";
size_t vertexNum = 0u;
for (const auto& vertexPos : distinctVertexValues)
{
stream << "VERT " << vertexNum << "\n";
stream << "OFFSET ";
stream << std::setprecision(6) << std::fixed << vertexPos.x << ", " << std::setprecision(6) << std::fixed << vertexPos.y << ", "
<< std::setprecision(6) << std::fixed << vertexPos.z << "\n";
stream << "BONES " << vertexPos.weightCount << "\n";
m_stream << "VERT " << vertexNum << "\n";
m_stream << std::format("OFFSET {:.6f}, {:.6f}, {:.6f}\n", vertexPos.x, vertexPos.y, vertexPos.z);
m_stream << "BONES " << vertexPos.weightCount << "\n";
for (auto weightIndex = 0u; weightIndex < vertexPos.weightCount; weightIndex++)
{
stream << "BONE " << vertexPos.weights[weightIndex].boneIndex << " " << std::setprecision(6) << std::fixed
<< vertexPos.weights[weightIndex].weight << "\n";
const auto& weight = vertexPos.weights[weightIndex];
m_stream << std::format("BONE {} {:.6f}\n", weight.boneIndex, weight.weight);
}
stream << "\n";
m_stream << "\n";
vertexNum++;
}
}
static void WriteFaceVertex(std::ostream& stream, const size_t index, const XModelVertex& vertex)
void WriteFaceVertex(const size_t index, const XModelVertex& vertex) const
{
stream << "VERT " << index << "\n";
stream << "NORMAL " << std::setprecision(6) << std::fixed << vertex.normal[0] << " " << std::setprecision(6) << std::fixed << vertex.normal[1] << " "
<< std::setprecision(6) << std::fixed << vertex.normal[2] << "\n";
stream << "COLOR " << std::setprecision(6) << std::fixed << vertex.color[0] << " " << std::setprecision(6) << std::fixed << vertex.color[1] << " "
<< std::setprecision(6) << std::fixed << vertex.color[2] << " " << std::setprecision(6) << std::fixed << vertex.color[3] << "\n";
stream << "UV 1 " << std::setprecision(6) << std::fixed << vertex.uv[0] << " " << std::setprecision(6) << std::fixed << vertex.uv[1] << "\n";
m_stream << "VERT " << index << "\n";
m_stream << std::format("NORMAL {:.6f} {:.6f} {:.6f}\n", vertex.normal[0], vertex.normal[1], vertex.normal[2]);
m_stream << "NORMAL " << std::setprecision(6) << std::fixed << vertex.normal[0] << " " << std::setprecision(6) << std::fixed << vertex.normal[1] << " "
<< std::setprecision(6) << std::fixed << vertex.normal[2] << "\n";
m_stream << std::format("COLOR {:.6f} {:.6f} {:.6f} {:.6f}\n", vertex.color[0], vertex.color[1], vertex.color[2], vertex.color[3]);
m_stream << std::format("UV 1 {:.6f} {:.6f}\n", vertex.uv[0], vertex.uv[1]);
}
void WriteFaces(std::ostream& stream) const
void WriteFaces(const XModelCommon& xmodel) const
{
stream << "NUMFACES " << m_faces.size() << "\n";
for (const auto& face : m_faces)
m_stream << "NUMFACES " << xmodel.m_faces.size() << "\n";
for (const auto& face : xmodel.m_faces)
{
const size_t distinctPositions[3]{
m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[0]),
@ -136,87 +127,97 @@ class XModelExportWriter6 final : public XModelExportWriterBase
m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[2]),
};
const XModelVertex& v0 = m_vertices[face.vertexIndex[0]];
const XModelVertex& v1 = m_vertices[face.vertexIndex[1]];
const XModelVertex& v2 = m_vertices[face.vertexIndex[2]];
const XModelVertex& v0 = xmodel.m_vertices[face.vertexIndex[0]];
const XModelVertex& v1 = xmodel.m_vertices[face.vertexIndex[1]];
const XModelVertex& v2 = xmodel.m_vertices[face.vertexIndex[2]];
stream << "TRI " << face.objectIndex << " " << m_objects[face.objectIndex].materialIndex << " 0 0\n";
WriteFaceVertex(stream, distinctPositions[0], v0);
WriteFaceVertex(stream, distinctPositions[1], v1);
WriteFaceVertex(stream, distinctPositions[2], v2);
stream << "\n";
m_stream << "TRI " << face.objectIndex << " " << xmodel.m_objects[face.objectIndex].materialIndex << " 0 0\n";
WriteFaceVertex(distinctPositions[0], v0);
WriteFaceVertex(distinctPositions[1], v1);
WriteFaceVertex(distinctPositions[2], v2);
m_stream << "\n";
}
}
void WriteObjects(std::ostream& stream) const
void WriteObjects(const XModelCommon& xmodel) const
{
stream << "NUMOBJECTS " << m_objects.size() << "\n";
m_stream << "NUMOBJECTS " << xmodel.m_objects.size() << "\n";
size_t objectNum = 0u;
for (const auto& object : m_objects)
for (const auto& object : xmodel.m_objects)
{
stream << "OBJECT " << objectNum << " \"" << object.name << "\"\n";
m_stream << "OBJECT " << objectNum << " \"" << object.name << "\"\n";
objectNum++;
}
stream << "\n";
m_stream << "\n";
}
void WriteMaterials(std::ostream& stream) const
void WriteMaterials(const XModelCommon& xmodel) const
{
stream << "NUMMATERIALS " << m_materials.size() << "\n";
m_stream << "NUMMATERIALS " << xmodel.m_materials.size() << "\n";
size_t materialNum = 0u;
for (const auto& material : m_materials)
for (const auto& material : xmodel.m_materials)
{
const auto colorMapPath = "../images/" + material.colorMapName + ".dds";
stream << "MATERIAL " << materialNum << " \"" << material.name << "\" \"" << material.materialTypeName << "\" \"" << colorMapPath << "\"\n";
stream << "COLOR " << std::setprecision(6) << std::fixed << material.color[0] << " " << std::setprecision(6) << std::fixed << material.color[1]
<< " " << std::setprecision(6) << std::fixed << material.color[2] << " " << std::setprecision(6) << std::fixed << material.color[3] << "\n";
stream << "TRANSPARENCY " << std::setprecision(6) << std::fixed << material.transparency[0] << " " << std::setprecision(6) << std::fixed
<< material.transparency[1] << " " << std::setprecision(6) << std::fixed << material.transparency[2] << " " << std::setprecision(6)
<< std::fixed << material.transparency[3] << "\n";
stream << "AMBIENTCOLOR " << std::setprecision(6) << std::fixed << material.ambientColor[0] << " " << std::setprecision(6) << std::fixed
<< material.ambientColor[1] << " " << std::setprecision(6) << std::fixed << material.ambientColor[2] << " " << std::setprecision(6)
<< std::fixed << material.ambientColor[3] << "\n";
stream << "INCANDESCENCE " << std::setprecision(6) << std::fixed << material.incandescence[0] << " " << std::setprecision(6) << std::fixed
<< material.incandescence[1] << " " << std::setprecision(6) << std::fixed << material.incandescence[2] << " " << std::setprecision(6)
<< std::fixed << material.incandescence[3] << "\n";
stream << "COEFFS " << std::setprecision(6) << std::fixed << material.coeffs[0] << " " << std::setprecision(6) << std::fixed << material.coeffs[1]
<< "\n";
stream << "GLOW " << std::setprecision(6) << std::fixed << material.glow.x << " " << material.glow.y << "\n";
stream << "REFRACTIVE " << material.refractive.x << " " << std::setprecision(6) << std::fixed << material.refractive.y << "\n";
stream << "SPECULARCOLOR " << std::setprecision(6) << std::fixed << material.specularColor[0] << " " << std::setprecision(6) << std::fixed
<< material.specularColor[1] << " " << std::setprecision(6) << std::fixed << material.specularColor[2] << " " << std::setprecision(6)
<< std::fixed << material.specularColor[3] << "\n";
stream << "REFLECTIVECOLOR " << std::setprecision(6) << std::fixed << material.reflectiveColor[0] << " " << std::setprecision(6) << std::fixed
<< material.reflectiveColor[1] << " " << std::setprecision(6) << std::fixed << material.reflectiveColor[2] << " " << std::setprecision(6)
<< std::fixed << material.reflectiveColor[3] << "\n";
stream << "REFLECTIVE " << material.reflective.x << " " << std::setprecision(6) << std::fixed << material.reflective.y << "\n";
stream << "BLINN " << std::setprecision(6) << std::fixed << material.blinn[0] << " " << std::setprecision(6) << std::fixed << material.blinn[1]
<< "\n";
stream << "PHONG " << std::setprecision(6) << std::fixed << material.phong << "\n";
stream << "\n";
m_stream << "MATERIAL " << materialNum << " \"" << material.name << "\" \"" << material.materialTypeName << "\" \"" << colorMapPath << "\"\n";
m_stream << std::format("COLOR {:.6f} {:.6f} {:.6f} {:.6f}\n", material.color[0], material.color[1], material.color[2], material.color[3]);
m_stream << std::format("TRANSPARENCY {:.6f} {:.6f} {:.6f} {:.6f}\n",
material.transparency[0],
material.transparency[1],
material.transparency[2],
material.transparency[3]);
m_stream << std::format("AMBIENTCOLOR {:.6f} {:.6f} {:.6f} {:.6f}\n",
material.ambientColor[0],
material.ambientColor[1],
material.ambientColor[2],
material.ambientColor[3]);
m_stream << std::format("INCANDESCENCE {:.6f} {:.6f} {:.6f} {:.6f}\n",
material.incandescence[0],
material.incandescence[1],
material.incandescence[2],
material.incandescence[3]);
m_stream << std::format("COEFFS {:.6f} {:.6f}\n", material.coeffs[0], material.coeffs[1]);
m_stream << std::format("GLOW {:.6f} {}\n", material.glow.x, material.glow.y);
m_stream << std::format("REFRACTIVE {} {:.6f}\n", material.refractive.x, material.refractive.y);
m_stream << std::format("SPECULARCOLOR {:.6f} {:.6f} {:.6f} {:.6f}\n",
material.specularColor[0],
material.specularColor[1],
material.specularColor[2],
material.specularColor[3]);
m_stream << std::format("REFLECTIVECOLOR {:.6f} {:.6f} {:.6f} {:.6f}\n",
material.reflectiveColor[0],
material.reflectiveColor[1],
material.reflectiveColor[2],
material.reflectiveColor[3]);
m_stream << std::format("REFLECTIVE {} {:.6f}\n", material.reflective.x, material.reflective.y);
m_stream << std::format("BLINN {:.6f} {:.6f}\n", material.blinn[0], material.blinn[1]);
m_stream << std::format("PHONG {:.6f}\n", material.phong);
m_stream << '\n';
materialNum++;
}
}
public:
XModelExportWriter6(std::string gameName, std::string zoneName)
: XModelExportWriterBase(std::move(gameName), std::move(zoneName))
XModelExportWriter6(std::ostream& stream, std::string gameName, std::string zoneName)
: XModelExportWriterBase(stream, std::move(gameName), std::move(zoneName))
{
}
void Write(std::ostream& stream) override
void Write(const XModelCommon& xmodel) override
{
PrepareVertexMerger();
WriteHeader(stream, 6);
WriteBones(stream);
WriteVertices(stream);
WriteFaces(stream);
WriteObjects(stream);
WriteMaterials(stream);
PrepareVertexMerger(xmodel);
WriteHeader(6);
WriteBones(xmodel);
WriteVertices(xmodel);
WriteFaces(xmodel);
WriteObjects(xmodel);
WriteMaterials(xmodel);
}
};
std::unique_ptr<XModelExportWriter> XModelExportWriter::CreateWriterForVersion6(std::string gameName, std::string zoneName)
namespace xmodel_export
{
return std::make_unique<XModelExportWriter6>(std::move(gameName), std::move(zoneName));
}
std::unique_ptr<XModelWriter> CreateWriterForVersion6(std::ostream& stream, std::string gameName, std::string zoneName)
{
return std::make_unique<XModelExportWriter6>(stream, std::move(gameName), std::move(zoneName));
}
} // namespace xmodel_export

View File

@ -1,21 +1,11 @@
#pragma once
#include "XModel/AbstractXModelWriter.h"
#include "XModel/XModelWriter.h"
#include <memory>
#include <ostream>
class XModelExportWriter : public AbstractXModelWriter
namespace xmodel_export
{
public:
XModelExportWriter() = default;
virtual ~XModelExportWriter() = default;
XModelExportWriter(const XModelExportWriter& other) = default;
XModelExportWriter(XModelExportWriter&& other) noexcept = default;
XModelExportWriter& operator=(const XModelExportWriter& other) = default;
XModelExportWriter& operator=(XModelExportWriter&& other) noexcept = default;
virtual void Write(std::ostream& stream) = 0;
static std::unique_ptr<XModelExportWriter> CreateWriterForVersion6(std::string gameName, std::string zoneName);
};
std::unique_ptr<XModelWriter> CreateWriterForVersion6(std::ostream& stream, std::string gameName, std::string zoneName);
}

View File

@ -24,15 +24,15 @@ namespace
{
}
void Write(std::ostream& stream) override
void Write(const XModelCommon& xmodel) override
{
JsonRoot gltf;
CreateJsonAsset(gltf.asset);
CreateMeshNode(gltf);
CreateMesh(gltf);
CreateSkeletonNodes(gltf);
CreateSkin(gltf);
CreateScene(gltf);
CreateMeshNode(gltf, xmodel);
CreateMesh(gltf, xmodel);
CreateSkeletonNodes(gltf, xmodel);
CreateSkin(gltf, xmodel);
CreateScene(gltf, xmodel);
const json jRoot = gltf;
m_output->EmitJson(jRoot);
@ -46,7 +46,7 @@ namespace
asset.generator = GLTF_GENERATOR;
}
void CreateMeshNode(JsonRoot& gltf) const
static void CreateMeshNode(JsonRoot& gltf, const XModelCommon& xmodel)
{
JsonNode meshNode;
@ -54,7 +54,7 @@ namespace
meshNode.mesh = 0u;
// Only add skin if the model has bones
if (!m_bones.empty())
if (!xmodel.m_bones.empty())
{
// We only have one skin
meshNode.skin = 0u;
@ -66,7 +66,7 @@ namespace
gltf.nodes->emplace_back(std::move(meshNode));
}
void CreateMesh(JsonRoot& gltf) const
static void CreateMesh(JsonRoot& gltf, const XModelCommon& xmodel)
{
if (!gltf.meshes.has_value())
gltf.meshes.emplace();
@ -76,19 +76,19 @@ namespace
gltf.meshes->emplace_back(std::move(mesh));
}
void CreateSkeletonNodes(JsonRoot& gltf) const
static void CreateSkeletonNodes(JsonRoot& gltf, const XModelCommon& xmodel)
{
if (m_bones.empty())
if (xmodel.m_bones.empty())
return;
if (!gltf.nodes.has_value())
gltf.nodes.emplace();
const auto boneCount = m_bones.size();
const auto boneCount = xmodel.m_bones.size();
for (auto boneIndex = 0u; boneIndex < boneCount; boneIndex++)
{
JsonNode boneNode;
const auto& bone = m_bones[boneIndex];
const auto& bone = xmodel.m_bones[boneIndex];
boneNode.name = bone.name;
boneNode.translation = std::to_array(bone.globalOffset);
@ -97,7 +97,7 @@ namespace
std::vector<unsigned> children;
for (auto maybeChildIndex = 0u; maybeChildIndex < boneCount; maybeChildIndex++)
{
if (m_bones[maybeChildIndex].parentIndex == static_cast<int>(boneIndex))
if (xmodel.m_bones[maybeChildIndex].parentIndex == static_cast<int>(boneIndex))
children.emplace_back(boneIndex + NODE_FIRST_INDEX_BONES);
}
if (!children.empty())
@ -107,9 +107,9 @@ namespace
}
}
void CreateSkin(JsonRoot& gltf) const
static void CreateSkin(JsonRoot& gltf, const XModelCommon& xmodel)
{
if (m_bones.empty())
if (xmodel.m_bones.empty())
return;
if (!gltf.skins.has_value())
@ -117,7 +117,7 @@ namespace
JsonSkin skin;
const auto boneCount = m_bones.size();
const auto boneCount = xmodel.m_bones.size();
skin.joints.reserve(boneCount);
for (auto boneIndex = 0u; boneIndex < boneCount; boneIndex++)
@ -126,12 +126,12 @@ namespace
gltf.skins->emplace_back(std::move(skin));
}
void CreateScene(JsonRoot& gltf) const
void CreateScene(JsonRoot& gltf, const XModelCommon& xmodel) const
{
JsonScene scene;
// Only add skin if the model has bones
if (m_bones.empty())
if (xmodel.m_bones.empty())
scene.nodes.emplace_back(NODE_INDEX_MESH);
else
scene.nodes.emplace_back(m_skeleton_node);

View File

@ -1,26 +1,24 @@
#pragma once
#include "GltfOutput.h"
#include "XModel/AbstractXModelWriter.h"
#include "XModel/Gltf/JsonGltf.h"
#include "XModel/XModelWriter.h"
#include <memory>
#include <ostream>
namespace gltf
{
class Writer : public AbstractXModelWriter
class Writer : public XModelWriter
{
public:
Writer() = default;
virtual ~Writer() = default;
~Writer() override = default;
Writer(const Writer& other) = default;
Writer(Writer&& other) noexcept = default;
Writer& operator=(const Writer& other) = default;
Writer& operator=(Writer&& other) noexcept = default;
virtual void Write(std::ostream& stream) = 0;
static std::unique_ptr<Writer> CreateWriter(const Output* output, std::string gameName, std::string zoneName);
};
} // namespace gltf

View File

@ -0,0 +1,18 @@
#pragma once
#include "XModel/XModelCommon.h"
#include <vector>
class XModelWriter
{
public:
XModelWriter() = default;
virtual ~XModelWriter() = default;
XModelWriter(const XModelWriter& other) = default;
XModelWriter(XModelWriter&& other) noexcept = default;
XModelWriter& operator=(const XModelWriter& other) = default;
XModelWriter& operator=(XModelWriter&& other) noexcept = default;
virtual void Write(const XModelCommon& xmodel) = 0;
};