mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
-1 -> NO_VALUE and other formatting
This commit is contained in:
parent
4a6f30a152
commit
ebb20121ac
1 changed files with 26 additions and 25 deletions
|
@ -769,8 +769,8 @@ namespace TEN::Renderer
|
|||
{
|
||||
constexpr auto AMBIENT_LIGHT_COLOR = Vector4(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
|
||||
UINT stride = sizeof(Vertex);
|
||||
UINT offset = 0;
|
||||
unsigned int stride = sizeof(Vertex);
|
||||
unsigned int offset = 0;
|
||||
|
||||
auto screenRes = GetScreenResolution();
|
||||
auto factor = Vector2(
|
||||
|
@ -780,10 +780,10 @@ namespace TEN::Renderer
|
|||
pos2D *= factor;
|
||||
scale *= (factor.x > factor.y) ? factor.y : factor.x;
|
||||
|
||||
int index = g_Gui.ConvertObjectToInventoryItem(objectNumber);
|
||||
if (index != -1)
|
||||
int invObjectID = g_Gui.ConvertObjectToInventoryItem(objectNumber);
|
||||
if (invObjectID != NO_VALUE)
|
||||
{
|
||||
const auto& invObject = InventoryObjectTable[index];
|
||||
const auto& invObject = InventoryObjectTable[invObjectID];
|
||||
|
||||
pos2D.y += invObject.YOffset;
|
||||
orient += invObject.Orientation;
|
||||
|
@ -793,7 +793,7 @@ namespace TEN::Renderer
|
|||
auto projMatrix = Matrix::CreateOrthographic(_screenWidth, _screenHeight, -BLOCK(1), BLOCK(1));
|
||||
|
||||
auto& moveableObject = _moveableObjects[objectNumber];
|
||||
if (!moveableObject)
|
||||
if (!moveableObject.has_value())
|
||||
return;
|
||||
|
||||
const auto& object = Objects[objectNumber];
|
||||
|
@ -805,7 +805,7 @@ namespace TEN::Renderer
|
|||
&g_Level.Frames[GetAnimData(object.animIndex).FramePtr],
|
||||
0.0f
|
||||
};
|
||||
UpdateAnimation(nullptr, *moveableObject, frameData, 0xFFFFFFFF);
|
||||
UpdateAnimation(nullptr, *moveableObject, frameData, UINT_MAX);
|
||||
}
|
||||
|
||||
auto pos = _viewportToolkit.Unproject(Vector3(pos2D.x, pos2D.y, 1.0f), projMatrix, viewMatrix, Matrix::Identity);
|
||||
|
@ -820,35 +820,37 @@ namespace TEN::Renderer
|
|||
_shaders.Bind(Shader::Inventory);
|
||||
|
||||
// Set matrices.
|
||||
CCameraMatrixBuffer hudCamera;
|
||||
auto hudCamera = CCameraMatrixBuffer{};
|
||||
hudCamera.CamDirectionWS = -Vector4::UnitZ;
|
||||
hudCamera.ViewProjection = viewMatrix * projMatrix;
|
||||
_cbCameraMatrices.UpdateData(hudCamera, _context.Get());
|
||||
BindConstantBufferVS(ConstantBufferRegister::Camera, _cbCameraMatrices.get());
|
||||
|
||||
for (int n = 0; n < (*moveableObject).ObjectMeshes.size(); n++)
|
||||
for (int i = 0; i < moveableObject->ObjectMeshes.size(); i++)
|
||||
{
|
||||
if (meshBits && !(meshBits & (1 << n)))
|
||||
if (meshBits && !(meshBits & (1 << i)))
|
||||
continue;
|
||||
|
||||
auto* mesh = (*moveableObject).ObjectMeshes[n];
|
||||
|
||||
// HACK: Rotate compass needle.
|
||||
if (objectNumber == ID_COMPASS_ITEM && n == 1)
|
||||
(*moveableObject).LinearizedBones[n]->ExtraRotation = EulerAngles(0, g_Gui.CompassNeedleAngle - ANGLE(180.0f), 0).ToQuaternion();
|
||||
if (objectNumber == ID_COMPASS_ITEM && i == 1)
|
||||
moveableObject->LinearizedBones[i]->ExtraRotation = EulerAngles(0, g_Gui.CompassNeedleAngle - ANGLE(180.0f), 0).ToQuaternion();
|
||||
|
||||
// Construct world matrix.
|
||||
auto tMatrix = Matrix::CreateTranslation(pos.x, pos.y, pos.z + BLOCK(1));
|
||||
auto translationMatrix = Matrix::CreateTranslation(pos.x, pos.y, pos.z + BLOCK(1));
|
||||
auto rotMatrix = orient.ToRotationMatrix();
|
||||
auto scaleMatrix = Matrix::CreateScale(scale);
|
||||
auto worldMatrix = scaleMatrix * rotMatrix * tMatrix;
|
||||
auto worldMatrix = scaleMatrix * rotMatrix * translationMatrix;
|
||||
|
||||
if (object.animIndex != -1)
|
||||
_stItem.World = (*moveableObject).AnimationTransforms[n] * worldMatrix;
|
||||
if (object.animIndex != NO_VALUE)
|
||||
{
|
||||
_stItem.World = moveableObject->AnimationTransforms[i] * worldMatrix;
|
||||
}
|
||||
else
|
||||
_stItem.World = (*moveableObject).BindPoseTransforms[n] * worldMatrix;
|
||||
{
|
||||
_stItem.World = moveableObject->BindPoseTransforms[i] * worldMatrix;
|
||||
}
|
||||
|
||||
_stItem.BoneLightModes[n] = (int)LightMode::Dynamic;
|
||||
_stItem.BoneLightModes[i] = (int)LightMode::Dynamic;
|
||||
_stItem.Color = Vector4::One;
|
||||
_stItem.AmbientLight = AMBIENT_LIGHT_COLOR;
|
||||
|
||||
|
@ -856,7 +858,8 @@ namespace TEN::Renderer
|
|||
BindConstantBufferVS(ConstantBufferRegister::Item, _cbItem.get());
|
||||
BindConstantBufferPS(ConstantBufferRegister::Item, _cbItem.get());
|
||||
|
||||
for (const auto& bucket : mesh->Buckets)
|
||||
const auto& mesh = *moveableObject->ObjectMeshes[i];
|
||||
for (const auto& bucket : mesh.Buckets)
|
||||
{
|
||||
if (bucket.NumVertices == 0)
|
||||
continue;
|
||||
|
@ -869,11 +872,9 @@ namespace TEN::Renderer
|
|||
BindTexture(TextureRegister::NormalMap, &std::get<1>(_moveablesTextures[bucket.Texture]), SamplerStateRegister::AnisotropicClamp);
|
||||
|
||||
if (bucket.BlendMode != BlendMode::Opaque)
|
||||
Renderer::SetBlendMode(bucket.BlendMode, true);
|
||||
SetBlendMode(bucket.BlendMode, true);
|
||||
|
||||
SetAlphaTest(
|
||||
(bucket.BlendMode == BlendMode::AlphaTest) ? AlphaTestMode::GreatherThan : AlphaTestMode::None,
|
||||
ALPHA_TEST_THRESHOLD);
|
||||
SetAlphaTest((bucket.BlendMode == BlendMode::AlphaTest) ? AlphaTestMode::GreatherThan : AlphaTestMode::None, ALPHA_TEST_THRESHOLD);
|
||||
|
||||
DrawIndexedTriangles(bucket.NumIndices, bucket.StartIndex, 0);
|
||||
_numMoveablesDrawCalls++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue