Fix typos

This commit is contained in:
2024-05-31 23:52:22 +03:00
parent cd1853f853
commit a9aa3b6cd8

View File

@@ -15,12 +15,12 @@
#define USE_MIKKTSPACE 1 #define USE_MIKKTSPACE 1
#include "ThirdParty/MikkTSpace/mikktspace.h" #include "ThirdParty/MikkTSpace/mikktspace.h"
#if USE_ASSIMP #if USE_ASSIMP
#define USE_SPARIAL_SORT 1 #define USE_SPATIAL_SORT 1
#define ASSIMP_BUILD_NO_EXPORT #define ASSIMP_BUILD_NO_EXPORT
#include "Engine/Tools/ModelTool/SpatialSort.h" #include "Engine/Tools/ModelTool/SpatialSort.h"
//#include <ThirdParty/assimp/SpatialSort.h> //#include <ThirdParty/assimp/SpatialSort.h>
#else #else
#define USE_SPARIAL_SORT 0 #define USE_SPATIAL_SORT 0
#endif #endif
#include <stack> #include <stack>
@@ -155,18 +155,18 @@ bool MeshData::GenerateLightmapUVs()
} }
int32 FindVertex(const MeshData& mesh, int32 vertexIndex, int32 startIndex, int32 searchRange, const Array<int32>& mapping int32 FindVertex(const MeshData& mesh, int32 vertexIndex, int32 startIndex, int32 searchRange, const Array<int32>& mapping
#if USE_SPARIAL_SORT #if USE_SPATIAL_SORT
, const Assimp::SpatialSort& spatialSort , const Assimp::SpatialSort& spatialSort
, std::vector<unsigned int>& sparialSortCache , std::vector<unsigned int>& spatialSortCache
#endif #endif
) )
{ {
const float uvEpsSqr = (1.0f / 250.0f) * (1.0f / 250.0f); const float uvEpsSqr = (1.0f / 250.0f) * (1.0f / 250.0f);
#if USE_SPARIAL_SORT #if USE_SPATIAL_SORT
const Float3 vPosition = mesh.Positions[vertexIndex]; const Float3 vPosition = mesh.Positions[vertexIndex];
spatialSort.FindPositions(*(aiVector3D*)&vPosition, 1e-4f, sparialSortCache); spatialSort.FindPositions(*(aiVector3D*)&vPosition, 1e-4f, spatialSortCache);
if (sparialSortCache.empty()) if (spatialSortCache.empty())
return INVALID_INDEX; return INVALID_INDEX;
const Float2 vUV = mesh.UVs.HasItems() ? mesh.UVs[vertexIndex] : Float2::Zero; const Float2 vUV = mesh.UVs.HasItems() ? mesh.UVs[vertexIndex] : Float2::Zero;
@@ -177,9 +177,9 @@ int32 FindVertex(const MeshData& mesh, int32 vertexIndex, int32 startIndex, int3
const int32 end = startIndex + searchRange; const int32 end = startIndex + searchRange;
for (size_t i = 0; i < sparialSortCache.size(); i++) for (size_t i = 0; i < spatialSortCache.size(); i++)
{ {
const int32 v = sparialSortCache[i]; const int32 v = spatialSortCache[i];
if (v < startIndex || v >= end) if (v < startIndex || v >= end)
continue; continue;
#else #else
@@ -247,11 +247,11 @@ void MeshData::BuildIndexBuffer()
mapping.Resize(vertexCount); mapping.Resize(vertexCount);
int32 newVertexCounter = 0; int32 newVertexCounter = 0;
#if USE_SPARIAL_SORT #if USE_SPATIAL_SORT
// Set up a SpatialSort to quickly find all vertices close to a given position // Set up a SpatialSort to quickly find all vertices close to a given position
Assimp::SpatialSort vertexFinder; Assimp::SpatialSort vertexFinder;
vertexFinder.Fill((const aiVector3D*)Positions.Get(), vertexCount, sizeof(Float3)); vertexFinder.Fill((const aiVector3D*)Positions.Get(), vertexCount, sizeof(Float3));
std::vector<unsigned int> sparialSortCache; std::vector<unsigned int> spatialSortCache;
#endif #endif
// Build index buffer // Build index buffer
@@ -259,8 +259,8 @@ void MeshData::BuildIndexBuffer()
{ {
// Find duplicated vertex before the current one // Find duplicated vertex before the current one
const int32 reuseVertexIndex = FindVertex(*this, vertexIndex, 0, vertexIndex, mapping const int32 reuseVertexIndex = FindVertex(*this, vertexIndex, 0, vertexIndex, mapping
#if USE_SPARIAL_SORT #if USE_SPATIAL_SORT
, vertexFinder, sparialSortCache , vertexFinder, spatialSortCache
#endif #endif
); );
if (reuseVertexIndex == INVALID_INDEX) if (reuseVertexIndex == INVALID_INDEX)
@@ -376,7 +376,7 @@ bool MeshData::GenerateNormals(float smoothingAngle)
Float3::Max(max, v3, max); Float3::Max(max, v3, max);
} }
#if USE_SPARIAL_SORT #if USE_SPATIAL_SORT
// Set up a SpatialSort to quickly find all vertices close to a given position // Set up a SpatialSort to quickly find all vertices close to a given position
Assimp::SpatialSort vertexFinder; Assimp::SpatialSort vertexFinder;
vertexFinder.Fill((const aiVector3D*)Positions.Get(), vertexCount, sizeof(Float3)); vertexFinder.Fill((const aiVector3D*)Positions.Get(), vertexCount, sizeof(Float3));
@@ -399,7 +399,7 @@ bool MeshData::GenerateNormals(float smoothingAngle)
continue; continue;
// Get all vertices that share this one // Get all vertices that share this one
#if USE_SPARIAL_SORT #if USE_SPATIAL_SORT
vertexFinder.FindPositions(*(aiVector3D*)&Positions[i], posEpsilon, verticesFound); vertexFinder.FindPositions(*(aiVector3D*)&Positions[i], posEpsilon, verticesFound);
const int32 verticesFoundCount = (int32)verticesFound.size(); const int32 verticesFoundCount = (int32)verticesFound.size();
#else #else
@@ -429,7 +429,7 @@ bool MeshData::GenerateNormals(float smoothingAngle)
for (int32 i = 0; i < vertexCount; i++) for (int32 i = 0; i < vertexCount; i++)
{ {
// Get all vertices that share this one // Get all vertices that share this one
#if USE_SPARIAL_SORT #if USE_SPATIAL_SORT
vertexFinder.FindPositions(*(aiVector3D*)&Positions[i], posEpsilon, verticesFound); vertexFinder.FindPositions(*(aiVector3D*)&Positions[i], posEpsilon, verticesFound);
const int32 verticesFoundCount = (int32)verticesFound.size(); const int32 verticesFoundCount = (int32)verticesFound.size();
#else #else
@@ -623,7 +623,7 @@ bool MeshData::GenerateTangents(float smoothingAngle)
} }
} }
#if USE_SPARIAL_SORT #if USE_SPATIAL_SORT
// Set up a SpatialSort to quickly find all vertices close to a given position // Set up a SpatialSort to quickly find all vertices close to a given position
Assimp::SpatialSort vertexFinder; Assimp::SpatialSort vertexFinder;
vertexFinder.Fill((const aiVector3D*)Positions.Get(), vertexCount, sizeof(Float3)); vertexFinder.Fill((const aiVector3D*)Positions.Get(), vertexCount, sizeof(Float3));
@@ -648,7 +648,7 @@ bool MeshData::GenerateTangents(float smoothingAngle)
closeVertices.Clear(); closeVertices.Clear();
// Find all vertices close to that position // Find all vertices close to that position
#if USE_SPARIAL_SORT #if USE_SPATIAL_SORT
vertexFinder.FindPositions(*(aiVector3D*)&origPos, posEpsilon, verticesFound); vertexFinder.FindPositions(*(aiVector3D*)&origPos, posEpsilon, verticesFound);
const int32 verticesFoundCount = (int32)verticesFound.size(); const int32 verticesFoundCount = (int32)verticesFound.size();
#else #else