mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-17 02:07:58 -05:00
Reformat code with clang format
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
#include "AbstractXModelWriter.h"
|
||||
|
||||
AbstractXModelWriter::AbstractXModelWriter()
|
||||
= default;
|
||||
AbstractXModelWriter::AbstractXModelWriter() = default;
|
||||
|
||||
void AbstractXModelWriter::AddObject(XModelObject object)
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Model/XModel/XModelCommon.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class AbstractXModelWriter
|
||||
{
|
||||
protected:
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "XModelExportWriter.h"
|
||||
|
||||
#include "Math/Quaternion.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
#include "Math/Quaternion.h"
|
||||
|
||||
class XModelExportWriterBase : public XModelExportWriter
|
||||
{
|
||||
protected:
|
||||
@ -20,21 +20,12 @@ protected:
|
||||
auto vertexOffset = 0u;
|
||||
for (const auto& vertex : m_vertices)
|
||||
{
|
||||
XModelVertexBoneWeights weights{
|
||||
nullptr,
|
||||
0
|
||||
};
|
||||
XModelVertexBoneWeights weights{nullptr, 0};
|
||||
|
||||
if(vertexOffset < m_vertex_bone_weights.size())
|
||||
if (vertexOffset < m_vertex_bone_weights.size())
|
||||
weights = m_vertex_bone_weights[vertexOffset];
|
||||
|
||||
m_vertex_merger.Add(VertexMergerPos{
|
||||
vertex.coordinates[0],
|
||||
vertex.coordinates[1],
|
||||
vertex.coordinates[2],
|
||||
weights.weights,
|
||||
weights.weightCount
|
||||
});
|
||||
m_vertex_merger.Add(VertexMergerPos{vertex.coordinates[0], vertex.coordinates[1], vertex.coordinates[2], weights.weights, weights.weightCount});
|
||||
|
||||
vertexOffset++;
|
||||
}
|
||||
@ -72,25 +63,20 @@ protected:
|
||||
{
|
||||
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 << 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";
|
||||
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";
|
||||
|
||||
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 << "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";
|
||||
boneNum++;
|
||||
}
|
||||
@ -114,15 +100,14 @@ class XModelExportWriter6 final : public XModelExportWriterBase
|
||||
{
|
||||
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 << 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";
|
||||
|
||||
for (auto weightIndex = 0u; weightIndex < vertexPos.weightCount; weightIndex++)
|
||||
{
|
||||
stream << "BONE " << vertexPos.weights[weightIndex].boneIndex
|
||||
<< " " << std::setprecision(6) << std::fixed << vertexPos.weights[weightIndex].weight << "\n";
|
||||
stream << "BONE " << vertexPos.weights[weightIndex].boneIndex << " " << std::setprecision(6) << std::fixed
|
||||
<< vertexPos.weights[weightIndex].weight << "\n";
|
||||
}
|
||||
stream << "\n";
|
||||
vertexNum++;
|
||||
@ -132,15 +117,11 @@ class XModelExportWriter6 final : public XModelExportWriterBase
|
||||
static void WriteFaceVertex(std::ostream& stream, const size_t index, const XModelVertex& vertex)
|
||||
{
|
||||
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";
|
||||
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";
|
||||
}
|
||||
|
||||
void WriteFaces(std::ostream& stream) const
|
||||
@ -148,12 +129,9 @@ class XModelExportWriter6 final : public XModelExportWriterBase
|
||||
stream << "NUMFACES " << m_faces.size() << "\n";
|
||||
for (const auto& face : m_faces)
|
||||
{
|
||||
const size_t distinctPositions[3]
|
||||
{
|
||||
m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[0]),
|
||||
m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[1]),
|
||||
m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[2])
|
||||
};
|
||||
const size_t distinctPositions[3]{m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[0]),
|
||||
m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[1]),
|
||||
m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[2])};
|
||||
|
||||
const XModelVertex& v0 = m_vertices[face.vertexIndex[0]];
|
||||
const XModelVertex& v1 = m_vertices[face.vertexIndex[1]];
|
||||
@ -187,40 +165,30 @@ class XModelExportWriter6 final : public XModelExportWriterBase
|
||||
{
|
||||
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 << "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";
|
||||
materialNum++;
|
||||
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <ostream>
|
||||
#include <memory>
|
||||
|
||||
#include "AbstractXModelWriter.h"
|
||||
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
|
||||
class XModelExportWriter : public AbstractXModelWriter
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user