mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Revert joint connection code, fix compass needle
This commit is contained in:
parent
0620e83125
commit
04b659b410
2 changed files with 32 additions and 18 deletions
|
@ -3303,6 +3303,7 @@ namespace TEN::Gui
|
||||||
while (g_Synchronizer.Synced())
|
while (g_Synchronizer.Synced())
|
||||||
{
|
{
|
||||||
TimeInMenu++;
|
TimeInMenu++;
|
||||||
|
GlobalCounter++;
|
||||||
SaveGame::Statistics.Game.TimeTaken++;
|
SaveGame::Statistics.Game.TimeTaken++;
|
||||||
SaveGame::Statistics.Level.TimeTaken++;
|
SaveGame::Statistics.Level.TimeTaken++;
|
||||||
|
|
||||||
|
@ -3451,7 +3452,7 @@ namespace TEN::Gui
|
||||||
needleOrient.Lerp(EulerAngles(0, item->Pose.Orientation.y, 0), LERP_ALPHA);
|
needleOrient.Lerp(EulerAngles(0, item->Pose.Orientation.y, 0), LERP_ALPHA);
|
||||||
|
|
||||||
float wibble = std::sin((float(GlobalCounter & 0x3F) / (float)0x3F) * PI_MUL_2);
|
float wibble = std::sin((float(GlobalCounter & 0x3F) / (float)0x3F) * PI_MUL_2);
|
||||||
CompassNeedleAngle = needleOrient.y + ANGLE(wibble / 2);
|
CompassNeedleAngle = needleOrient.y + ANGLE(wibble);
|
||||||
|
|
||||||
// HACK: Needle is rotated in the draw function.
|
// HACK: Needle is rotated in the draw function.
|
||||||
const auto& invObject = InventoryObjectTable[INV_OBJECT_COMPASS];
|
const auto& invObject = InventoryObjectTable[INV_OBJECT_COMPASS];
|
||||||
|
|
|
@ -671,12 +671,18 @@ namespace TEN::Renderer
|
||||||
{
|
{
|
||||||
auto* skinVertex = &_moveablesVertices[skinBucket->StartVertex + v2];
|
auto* skinVertex = &_moveablesVertices[skinBucket->StartVertex + v2];
|
||||||
|
|
||||||
auto vertex0 = _moveablesVertices[jointBucket->StartVertex + v1].Position + jointBone->GlobalTranslation;
|
// NOTE: Don't vectorize these coordinates, it breaks the connection in some cases. -- Lwmte, 21.12.24
|
||||||
auto vertex1 = _moveablesVertices[skinBucket->StartVertex + v2].Position + skinBone->GlobalTranslation;
|
|
||||||
|
|
||||||
if (Vector3::Distance(vertex0, vertex1) > 2)
|
int x1 = _moveablesVertices[jointBucket->StartVertex + v1].Position.x + jointBone->GlobalTranslation.x;
|
||||||
continue;
|
int y1 = _moveablesVertices[jointBucket->StartVertex + v1].Position.y + jointBone->GlobalTranslation.y;
|
||||||
|
int z1 = _moveablesVertices[jointBucket->StartVertex + v1].Position.z + jointBone->GlobalTranslation.z;
|
||||||
|
|
||||||
|
int x2 = _moveablesVertices[skinBucket->StartVertex + v2].Position.x + skinBone->GlobalTranslation.x;
|
||||||
|
int y2 = _moveablesVertices[skinBucket->StartVertex + v2].Position.y + skinBone->GlobalTranslation.y;
|
||||||
|
int z2 = _moveablesVertices[skinBucket->StartVertex + v2].Position.z + skinBone->GlobalTranslation.z;
|
||||||
|
|
||||||
|
if (abs(x1 - x2) < 2 && abs(y1 - y2) < 2 && abs(z1 - z2) < 2)
|
||||||
|
{
|
||||||
jointVertex->Bone = bonesToCheck[k];
|
jointVertex->Bone = bonesToCheck[k];
|
||||||
jointVertex->Position = skinVertex->Position;
|
jointVertex->Position = skinVertex->Position;
|
||||||
jointVertex->Normal = skinVertex->Normal;
|
jointVertex->Normal = skinVertex->Normal;
|
||||||
|
@ -684,6 +690,7 @@ namespace TEN::Renderer
|
||||||
isDone = true;
|
isDone = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isDone)
|
if (isDone)
|
||||||
break;
|
break;
|
||||||
|
@ -765,13 +772,18 @@ namespace TEN::Renderer
|
||||||
{
|
{
|
||||||
auto* parentVertex = &_moveablesVertices[parentBucket->StartVertex + v2];
|
auto* parentVertex = &_moveablesVertices[parentBucket->StartVertex + v2];
|
||||||
|
|
||||||
auto vertex1 = _moveablesVertices[currentBucket.StartVertex + v1].Position + currentBone->GlobalTranslation;
|
int x1 = _moveablesVertices[currentBucket.StartVertex + v1].Position.x + currentBone->GlobalTranslation.x;
|
||||||
auto vertex2 = _moveablesVertices[parentBucket->StartVertex + v2].Position + parentBone->GlobalTranslation;
|
int y1 = _moveablesVertices[currentBucket.StartVertex + v1].Position.y + currentBone->GlobalTranslation.y;
|
||||||
|
int z1 = _moveablesVertices[currentBucket.StartVertex + v1].Position.z + currentBone->GlobalTranslation.z;
|
||||||
|
|
||||||
|
int x2 = _moveablesVertices[parentBucket->StartVertex + v2].Position.x + parentBone->GlobalTranslation.x;
|
||||||
|
int y2 = _moveablesVertices[parentBucket->StartVertex + v2].Position.y + parentBone->GlobalTranslation.y;
|
||||||
|
int z2 = _moveablesVertices[parentBucket->StartVertex + v2].Position.z + parentBone->GlobalTranslation.z;
|
||||||
|
|
||||||
// FIXME: If a tolerance is used, a strange bug occurs where certain vertices don't connect. -- Lwmte, 14.12.2024
|
// FIXME: If a tolerance is used, a strange bug occurs where certain vertices don't connect. -- Lwmte, 14.12.2024
|
||||||
if (vertex1 != vertex2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
if (abs(x1 - x2) == 0 && abs(y1 - y2) == 0 && abs(z1 - z2) == 0)
|
||||||
|
{
|
||||||
currentVertex->Bone = j;
|
currentVertex->Bone = j;
|
||||||
currentVertex->Position = parentVertex->Position;
|
currentVertex->Position = parentVertex->Position;
|
||||||
currentVertex->Normal = parentVertex->Normal;
|
currentVertex->Normal = parentVertex->Normal;
|
||||||
|
@ -786,6 +798,7 @@ namespace TEN::Renderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_moveablesVertexBuffer = VertexBuffer<Vertex>(_device.Get(), (int)_moveablesVertices.size(), &_moveablesVertices[0]);
|
_moveablesVertexBuffer = VertexBuffer<Vertex>(_device.Get(), (int)_moveablesVertices.size(), &_moveablesVertices[0]);
|
||||||
_moveablesIndexBuffer = IndexBuffer(_device.Get(), (int)_moveablesIndices.size(), _moveablesIndices.data());
|
_moveablesIndexBuffer = IndexBuffer(_device.Get(), (int)_moveablesIndices.size(), _moveablesIndices.data());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue