more castings

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-12 18:37:59 -07:00
parent 8b3ab8eb0b
commit 3522f622f3
13 changed files with 37 additions and 33 deletions
+5 -2
View File
@@ -63,7 +63,7 @@ void DisplayContext::InternalDrawLine(const Vec3& v0, const ColorB& colV0, const
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawPoint(const Vec3& p, int nSize)
{
pRenderAuxGeom->DrawPoint(ToWorldSpacePosition(p), m_color4b, nSize);
pRenderAuxGeom->DrawPoint(ToWorldSpacePosition(p), m_color4b, static_cast<uint8>(nSize));
}
//////////////////////////////////////////////////////////////////////////
@@ -856,7 +856,10 @@ void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const ColorF& col1
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const QColor& rgb1, const QColor& rgb2)
{
InternalDrawLine(ToWorldSpacePosition(p1), ColorB(rgb1.red(), rgb1.green(), rgb1.blue(), 255), ToWorldSpacePosition(p2), ColorB(rgb2.red(), rgb2.green(), rgb2.blue(), 255));
InternalDrawLine(ToWorldSpacePosition(p1),
ColorB(static_cast<uint8>(rgb1.red()), static_cast<uint8>(rgb1.green()), static_cast<uint8>(rgb1.blue()), 255),
ToWorldSpacePosition(p2),
ColorB(static_cast<uint8>(rgb2.red()), static_cast<uint8>(rgb2.green()), static_cast<uint8>(rgb2.blue()), 255));
}
//////////////////////////////////////////////////////////////////////////
+1
View File
@@ -503,6 +503,7 @@ set(FILES
LogFileImpl.h
Objects/ClassDesc.cpp
Objects/ClassDesc.h
Objects/DisplayContextShared.inl
Objects/IEntityObjectListener.h
Objects/SelectionGroup.cpp
Objects/SelectionGroup.h
@@ -583,7 +583,7 @@ namespace UnitTest
AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::EventResult(
m_mouseInteractionResult, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions,
vi::MouseInteractionEvent(mouseInteraction, ev->angleDelta().y()));
vi::MouseInteractionEvent(mouseInteraction, static_cast<float>(ev->angleDelta().y())));
}
MouseInteractionResult m_mouseInteractionResult;
@@ -16,7 +16,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefabs_SingleEntityEach)(::benchmark::State& state)
{
const unsigned int numEntities = state.range();
const unsigned int numEntities = static_cast<unsigned int>(state.range());
const unsigned int numInstances = numEntities;
CreateFakePaths(numInstances);
@@ -58,7 +58,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromEntities)(::benchmark::State& state)
{
const unsigned int numEntities = state.range();
const unsigned int numEntities = static_cast<unsigned int>(state.range());
for (auto _ : state)
{
@@ -93,7 +93,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromSingleDepthInstances)(::benchmark::State& state)
{
const unsigned int numInstancesToAdd = state.range();
const unsigned int numInstancesToAdd = static_cast<unsigned int>(state.range());
const unsigned int numEntities = numInstancesToAdd;
// Create fake paths for all the nested instances
@@ -144,7 +144,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromLinearNestingOfInstances)(::benchmark::State& state)
{
const unsigned int numInstances = state.range();
const unsigned int numInstances = static_cast<unsigned int>(state.range());
// Create fake paths for all the nested instances
// plus the root instance
@@ -16,7 +16,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabInstantiate, InstantiatePrefab_SingleEntityInstance)(::benchmark::State& state)
{
const unsigned int numInstances = state.range();
const unsigned int numInstances = static_cast<unsigned int>(state.range());
AZStd::unique_ptr<Instance> firstInstance = m_prefabSystemComponent->CreatePrefab(
{ CreateEntity("Entity1") },
@@ -18,7 +18,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_SingeEntityInstances)(::benchmark::State& state)
{
const unsigned int numInstances = state.range();
const unsigned int numInstances = static_cast<unsigned int>(state.range());
CreateFakePaths(2);
const auto& nestedTemplatePath = m_paths.front();
@@ -80,7 +80,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_SingleLinearNestingOfInstances)(::benchmark::State& state)
{
const unsigned int maxDepth = state.range();
const unsigned int maxDepth = static_cast<unsigned int>(state.range());
CreateFakePaths(maxDepth);
const unsigned int numInstances = maxDepth;
@@ -131,8 +131,8 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_MultipleLinearNestingOfInstances)(::benchmark::State& state)
{
const unsigned int numRootInstances = state.range();
const unsigned int maxDepth = state.range();
const unsigned int numRootInstances = static_cast<unsigned int>(state.range());
const unsigned int maxDepth = static_cast<unsigned int>(state.range());
CreateFakePaths(maxDepth);
const unsigned int numInstances = numRootInstances * maxDepth;
@@ -192,7 +192,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_BinaryTreeNestedInstanceHierarchy)(::benchmark::State& state)
{
const unsigned int maxDepth = state.range();
const unsigned int maxDepth = static_cast<unsigned int>(state.range());
CreateFakePaths(maxDepth);
const unsigned int numInstances = (1 << maxDepth) - 1;
@@ -18,7 +18,7 @@ namespace Benchmark
BENCHMARK_DEFINE_F(BM_SpawnableCreate, CreateSpawnable_SingleEntityInstance)(::benchmark::State& state)
{
const unsigned int numSpawnables = state.range();
const unsigned int numSpawnables = static_cast<unsigned int>(state.range());
AZStd::unique_ptr<Instance> instance(m_prefabSystemComponent->CreatePrefab(
{ CreateEntity("Entity1") },
@@ -17,7 +17,7 @@ namespace ImageProcessingAtom
{
float round(float x)
{
return ((x) >= 0) ? floor((x) + 0.5) : ceil((x)-0.5);
return ((x) >= 0.f) ? floor((x) + 0.5f) : ceil((x) - 0.5f);
}
void calculateFilterRange(unsigned int srcFactor, int& srcFirst, int& srcLast,
@@ -220,7 +220,7 @@ namespace ImageProcessingAtom
/* normalize against the peak sumWeights, because the sums are not allowed to leave -32768/32767 */
fWeight = fWeight * nrmWeights;
iWeight = int(round(fWeight));
iWeight = int(round(static_cast<float>(fWeight)));
/* find first nonzero */
if (stillzero && (iWeight == 0))
@@ -246,7 +246,7 @@ namespace ImageProcessingAtom
/* add weight to table, interleaved sign */
for (n = 0; n < -numRepetitions; n++)
{
*weightsPtr++ = sgnextend(n, -iWeight);
*weightsPtr++ = static_cast<signed short int>(sgnextend(n, -iWeight));
}
}
else
@@ -254,7 +254,7 @@ namespace ImageProcessingAtom
/* add weight to table */
for (n = 0; n < numRepetitions; n++)
{
*weightsPtr++ = -iWeight;
*weightsPtr++ = static_cast<signed short int>(-iWeight);
}
}
@@ -311,7 +311,7 @@ namespace ImageProcessingAtom
for (n = 0, weightsPtr = weightsMem + (i - i0) * numRepetitions; n < numRepetitions; n++)
{
*weightsPtr++ -= iWeight;
*weightsPtr++ -= static_cast<signed short int>(iWeight);
}
}
}
@@ -114,7 +114,7 @@ namespace EMStudio
}
// Set the current history index in case the user called undo.
m_list->setCurrentRow(commandManager->GetHistoryIndex());
m_list->setCurrentRow(static_cast<int>(commandManager->GetHistoryIndex()));
}
@@ -1176,7 +1176,7 @@ namespace EMStudio
}
else
{
settingsInfo->m_axis = elementID;
settingsInfo->m_axis = static_cast<uint8>(elementID);
}
}
else
@@ -1188,7 +1188,7 @@ namespace EMStudio
}
else
{
settingsInfo->m_axis = value - 1;
settingsInfo->m_axis = static_cast<uint8>(value - 1);
}
}
#else
@@ -1619,7 +1619,7 @@ namespace EMStudio
const uint32 numButtons = m_gameController->GetNumButtons();
for (uint32 i = 0; i < numButtons; ++i)
{
const bool isPressed = m_gameController->GetIsButtonPressed(i);
const bool isPressed = m_gameController->GetIsButtonPressed(static_cast<uint8>(i));
// get the game controller settings info for the given button
EMotionFX::AnimGraphGameControllerSettings::ButtonInfo* settingsInfo = activePreset->FindButtonInfo(i);
@@ -1792,7 +1792,7 @@ namespace EMStudio
m_string.clear();
for (uint32 i = 0; i < numButtons; ++i)
{
if (m_gameController->GetIsButtonPressed(i))
if (m_gameController->GetIsButtonPressed(static_cast<uint8>(i)))
{
m_string += AZStd::string::format("%s%d ", (i < 10) ? "0" : "", i);
}
@@ -52,8 +52,8 @@ namespace UnitTest
}
};
MapOf<AZ::u8, AZ::u32> m_indexOfu8tou32 { {1, 4}, {2, 5}, {3, 6}, {4, 7} };
MapOf<AZ::u16, float> m_indexOfu16toFloat { {1, 0.4f}, {2, 0.5f}, {3, 0.6f}, {4, 0.7f} };
MapOf<AZ::u8, AZ::u32> m_indexOfu8tou32 { {AZ::u8(1), 4u}, {AZ::u8(2), 5u}, {AZ::u8(3), 6u}, {AZ::u8(4), 7u} };
MapOf<AZ::u16, float> m_indexOfu16toFloat { {AZ::u16(1u), 0.4f}, {AZ::u16(2u), 0.5f}, {AZ::u16(3u), 0.6f}, {AZ::u16(4u), 0.7f} };
MapOf<AZStd::string, AZ::s32> m_indexOfStringTos32 { {"1", -4}, {"2", 5}, {"3", -6}, {"4", 7} };
MapOf<AZStd::string, AZStd::string> m_indexOfStringToString { {"hello", "foo"}, {"world", "bar"}, {"bye", "baz"}, {"sky", "qux"} };
MapOf<AZStd::string, AZ::Vector3> m_indexOfStringToVec3{ {"up", AZ::Vector3{ 0, 1.0, 0 }}, {"down", AZ::Vector3{0, -1.0, 0}},
@@ -109,7 +109,7 @@ protected:
TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_NoDependencies)
{
SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt);
SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt);
TestSuccessCaseNoDependencies(exportProduct);
}
@@ -122,7 +122,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen
#endif // AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
AssetBuilderSDK::ProductPathDependency expectedPathDependency(absolutePathToFile, AssetBuilderSDK::ProductPathDependencyType::SourceFile);
SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt);
SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt);
product.m_legacyPathDependencies.push_back(absolutePathToFile);
TestSuccessCase(product, &expectedPathDependency);
@@ -134,7 +134,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen
AssetBuilderSDK::ProductPathDependency expectedPathDependency(relativeDependencyPathToFile, AssetBuilderSDK::ProductPathDependencyType::ProductFile);
SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt);
SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt);
product.m_legacyPathDependencies.push_back(relativeDependencyPathToFile);
TestSuccessCase(product, &expectedPathDependency);
@@ -150,7 +150,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen
const char* absolutePathToFile = "/some/test/file.mtl";
#endif // AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt);
SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt);
exportProduct.m_legacyPathDependencies.push_back(absolutePathToFile);
exportProduct.m_legacyPathDependencies.push_back(relativeDependencyPathToFile);
@@ -164,7 +164,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen
TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductDependency)
{
AZ::Uuid dependencyId = AZ::Uuid::CreateRandom();
SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt);
SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt);
exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt));
TestSuccessCase(exportProduct, nullptr, &dependencyId);
@@ -173,7 +173,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductDe
TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductAndPathDependencies)
{
AZ::Uuid dependencyId = AZ::Uuid::CreateRandom();
SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt);
SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt);
exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt));
const char* relativeDependencyPathToFile = "some/test/file.mtl";
@@ -568,7 +568,7 @@ namespace ScriptCanvasEditor
// Show the selection dialog
bool createSlot = false;
VariablePaletteRequests::SlotSetup selectedSlotSetup;
QPoint scenePoint(scenePos.GetX(), scenePos.GetY());
QPoint scenePoint(static_cast<int>(scenePos.GetX()), static_cast<int>(scenePos.GetY()));
VariablePaletteRequestBus::BroadcastResult(createSlot, &VariablePaletteRequests::ShowSlotTypeSelector, slot, scenePoint, selectedSlotSetup);
bool changed = false;