mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
chore: update code style
This commit is contained in:
parent
aab510c917
commit
e13eb256bb
@ -286,7 +286,7 @@ namespace
|
||||
|
||||
common.m_vertices.emplace_back(vertex);
|
||||
|
||||
XModelVertexBoneWeights vertexWeights{common.m_bone_weight_data.weights.size(), 0u};
|
||||
XModelVertexBoneWeights vertexWeights{.weightOffset = common.m_bone_weight_data.weights.size(), .weightCount = 0u};
|
||||
for (auto i = 0u; i < std::extent_v<decltype(joints)>; i++)
|
||||
{
|
||||
if (std::abs(weights[i]) < std::numeric_limits<float>::epsilon())
|
||||
@ -315,12 +315,12 @@ namespace
|
||||
throw GltfLoadException("Requires primitives attribute POSITION");
|
||||
|
||||
AccessorsForVertex accessorsForVertex{
|
||||
*primitives.attributes.POSITION,
|
||||
primitives.attributes.NORMAL,
|
||||
primitives.attributes.COLOR_0,
|
||||
primitives.attributes.TEXCOORD_0,
|
||||
primitives.attributes.JOINTS_0,
|
||||
primitives.attributes.WEIGHTS_0,
|
||||
.positionAccessor = *primitives.attributes.POSITION,
|
||||
.normalAccessor = primitives.attributes.NORMAL,
|
||||
.colorAccessor = primitives.attributes.COLOR_0,
|
||||
.uvAccessor = primitives.attributes.TEXCOORD_0,
|
||||
.jointsAccessor = primitives.attributes.JOINTS_0,
|
||||
.weightsAccessor = primitives.attributes.WEIGHTS_0,
|
||||
};
|
||||
|
||||
const auto existingVertices = m_vertex_offset_for_accessors.find(accessorsForVertex);
|
||||
@ -328,7 +328,7 @@ namespace
|
||||
existingVertices == m_vertex_offset_for_accessors.end() ? CreateVertices(common, accessorsForVertex) : existingVertices->second;
|
||||
|
||||
// clang-format off
|
||||
auto* indexAccessor = GetAccessorForIndex(
|
||||
const auto* indexAccessor = GetAccessorForIndex(
|
||||
"INDICES",
|
||||
primitives.indices,
|
||||
{JsonAccessorType::SCALAR},
|
||||
@ -552,7 +552,7 @@ namespace
|
||||
common.m_bones.resize(skinBoneOffset + skin.joints.size());
|
||||
|
||||
constexpr float defaultTranslation[3]{0.0f, 0.0f, 0.0f};
|
||||
constexpr XModelQuaternion defaultRotation{0.0f, 0.0f, 0.0f, 1.0f};
|
||||
constexpr XModelQuaternion defaultRotation{.x = 0.0f, .y = 0.0f, .z = 0.0f, .w = 1.0f};
|
||||
constexpr float defaultScale[3]{1.0f, 1.0f, 1.0f};
|
||||
|
||||
return ConvertJoint(jRoot, skin, common, skinBoneOffset, rootNode, std::nullopt, defaultTranslation, defaultRotation, defaultScale);
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include JSON_HEADER
|
||||
|
||||
#include "Asset/AssetRegistration.h"
|
||||
#include "ObjLoading.h"
|
||||
#include "Utils/QuatInt16.h"
|
||||
#include "Utils/StringUtils.h"
|
||||
#include "XModel/Gltf/GltfBinInput.h"
|
||||
@ -44,7 +43,6 @@
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
#include <numeric>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
using namespace GAME;
|
||||
@ -146,17 +144,17 @@ namespace
|
||||
assert(common.m_vertex_bone_weights.size() == common.m_vertices.size());
|
||||
|
||||
XModelBone rootBone{
|
||||
"root",
|
||||
std::nullopt,
|
||||
{1.0f, 1.0f, 1.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{0.0f, 0.0f, 0.0f, 1.0f},
|
||||
.name = "root",
|
||||
.parentIndex = std::nullopt,
|
||||
.scale = {1.0f, 1.0f, 1.0f},
|
||||
.globalOffset = {0.0f, 0.0f, 0.0f},
|
||||
.localOffset = {0.0f, 0.0f, 0.0f},
|
||||
.globalRotation = {.x = 0.0f, .y = 0.0f, .z = 0.0f, .w = 1.0f},
|
||||
.localRotation = {.x = 0.0f, .y = 0.0f, .z = 0.0f, .w = 1.0f},
|
||||
};
|
||||
common.m_bones.emplace_back(rootBone);
|
||||
|
||||
XModelBoneWeight rootWeight{0, 1.0f};
|
||||
XModelBoneWeight rootWeight{.boneIndex = 0, .weight = 1.0f};
|
||||
common.m_bone_weight_data.weights.emplace_back(rootWeight);
|
||||
|
||||
for (auto& vertexBoneWeights : common.m_vertex_bone_weights)
|
||||
@ -401,7 +399,7 @@ namespace
|
||||
}
|
||||
|
||||
static std::vector<std::optional<size_t>>
|
||||
GetRigidBoneIndicesForTris(const std::vector<size_t>& vertexIndices, XSurface& surface, const XModelCommon& common)
|
||||
GetRigidBoneIndicesForTris(const std::vector<size_t>& vertexIndices, const XSurface& surface, const XModelCommon& common)
|
||||
{
|
||||
std::vector<std::optional<size_t>> rigidBoneIndexForTri;
|
||||
rigidBoneIndexForTri.reserve(surface.triCount);
|
||||
@ -422,7 +420,7 @@ namespace
|
||||
return rigidBoneIndexForTri;
|
||||
}
|
||||
|
||||
static void ReorderRigidTrisByBoneIndex(const std::vector<size_t>& vertexIndices, XSurface& surface, const XModelCommon& common)
|
||||
static void ReorderRigidTrisByBoneIndex(const std::vector<size_t>& vertexIndices, const XSurface& surface, const XModelCommon& common)
|
||||
{
|
||||
const auto rigidBoneIndexForTri = GetRigidBoneIndicesForTris(vertexIndices, surface, common);
|
||||
|
||||
@ -512,7 +510,7 @@ namespace
|
||||
// TODO
|
||||
}
|
||||
|
||||
static void ReorderVerticesByWeightCount(std::vector<size_t>& vertexIndices, XSurface& surface, const XModelCommon& common)
|
||||
static void ReorderVerticesByWeightCount(std::vector<size_t>& vertexIndices, const XSurface& surface, const XModelCommon& common)
|
||||
{
|
||||
if (common.m_bone_weight_data.weights.empty())
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user