Code/Editor
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
+42
-38
@@ -70,9 +70,9 @@ static void OnMenuGrid()
|
||||
inline Vec3 SnapToSize(Vec3 v, double size)
|
||||
{
|
||||
Vec3 snapped;
|
||||
snapped.x = floor((v.x / size) + 0.5) * size;
|
||||
snapped.y = floor((v.y / size) + 0.5) * size;
|
||||
snapped.z = floor((v.z / size) + 0.5) * size;
|
||||
snapped.x = static_cast<f32>(floor((v.x / size) + 0.5) * size);
|
||||
snapped.y = static_cast<f32>(floor((v.y / size) + 0.5) * size);
|
||||
snapped.z = static_cast<f32>(floor((v.z / size) + 0.5) * size);
|
||||
return snapped;
|
||||
}
|
||||
|
||||
@@ -479,8 +479,8 @@ void Q2DViewport::SetZoom(float fZoomFactor, const QPoint& center)
|
||||
SetZoomFactor(fZoomFactor);
|
||||
|
||||
// Calculate new offset to center zoom on mouse.
|
||||
float x2 = center.x();
|
||||
float y2 = m_rcClient.height() - center.y();
|
||||
float x2 = static_cast<float>(center.x());
|
||||
float y2 = static_cast<float>(m_rcClient.height() - center.y());
|
||||
ofsx = -(x2 / s2 - x2 / s1 - ofsx);
|
||||
ofsy = -(y2 / s2 - y2 / s1 - ofsy);
|
||||
SetScrollOffset(ofsx, ofsy, true);
|
||||
@@ -544,21 +544,21 @@ void Q2DViewport::Update()
|
||||
QPoint Q2DViewport::WorldToView(const Vec3& wp) const
|
||||
{
|
||||
Vec3 sp = m_screenTM.TransformPoint(wp);
|
||||
QPoint p = QPoint(sp.x, sp.y);
|
||||
QPoint p = QPoint(static_cast<int>(sp.x), static_cast<int>(sp.y));
|
||||
return p;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QPoint Q2DViewport::WorldToViewParticleEditor(const Vec3& wp, [[maybe_unused]] int width, [[maybe_unused]] int height) const //Eric@conffx implement for the children class of IDisplayViewport
|
||||
{
|
||||
Vec3 sp = m_screenTM.TransformPoint(wp);
|
||||
QPoint p = QPoint(sp.x, sp.y);
|
||||
QPoint p = QPoint(static_cast<int>(sp.x), static_cast<int>(sp.y));
|
||||
return p;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Vec3 Q2DViewport::ViewToWorld(const QPoint& vp, [[maybe_unused]] bool* collideWithTerrain, [[maybe_unused]] bool onlyTerrain, [[maybe_unused]] bool bSkipVegetation, [[maybe_unused]] bool bTestRenderMesh, [[maybe_unused]] bool* collideWithObject) const
|
||||
{
|
||||
Vec3 wp = m_screenTM_Inverted.TransformPoint(Vec3(vp.x(), vp.y(), 0));
|
||||
Vec3 wp = m_screenTM_Inverted.TransformPoint(Vec3(static_cast<f32>(vp.x()), static_cast<f32>(vp.y()), 0.0f));
|
||||
switch (m_axis)
|
||||
{
|
||||
case VPA_XY:
|
||||
@@ -694,10 +694,10 @@ void Q2DViewport::DrawGrid(DisplayContext& dc, bool bNoXNumbers)
|
||||
Matrix34 viewTM = GetViewTM().GetInverted() * m_screenTM_Inverted;
|
||||
Matrix34 viewTM_Inv = m_screenTM * GetViewTM();
|
||||
|
||||
Vec3 viewP0 = viewTM.TransformPoint(Vec3(0, 0, 0));
|
||||
Vec3 viewP1 = viewTM.TransformPoint(Vec3(m_rcClient.width(), m_rcClient.height(), 0));
|
||||
Vec3 viewP0 = viewTM.TransformPoint(Vec3(0.0f, 0.0f, 0.0f));
|
||||
Vec3 viewP1 = viewTM.TransformPoint(Vec3(static_cast<f32>(m_rcClient.width()), static_cast<f32>(m_rcClient.height()), 0.0f));
|
||||
|
||||
Vec3 viewP_Text = viewTM.TransformPoint(Vec3(0, m_rcClient.height(), 0));
|
||||
Vec3 viewP_Text = viewTM.TransformPoint(Vec3(0.0f, static_cast<f32>(m_rcClient.height()), 0.0f));
|
||||
|
||||
if (m_bShowMinorGridLines && (!m_bAutoAdjustGrids || pixelsPerGrid > 5))
|
||||
{
|
||||
@@ -806,8 +806,8 @@ void Q2DViewport::DrawGrid(DisplayContext& dc, bool bNoXNumbers)
|
||||
{
|
||||
Vec3 org = m_screenTM.TransformPoint(Vec3(0, 0, 0));
|
||||
dc.SetColor(AXIS_GRID_COLOR);
|
||||
dc.DrawLine(Vec3(org.x, 0, fZ), Vec3(org.x, height, fZ));
|
||||
dc.DrawLine(Vec3(0, org.y, fZ), Vec3(width, org.y, fZ));
|
||||
dc.DrawLine(Vec3(org.x, 0.0f, fZ), Vec3(org.x, static_cast<f32>(height), fZ));
|
||||
dc.DrawLine(Vec3(0.0f, org.y, fZ), Vec3(static_cast<f32>(width), org.y, fZ));
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
@@ -860,18 +860,18 @@ void Q2DViewport::DrawAxis(DisplayContext& dc)
|
||||
int height = m_rcClient.height();
|
||||
|
||||
int size = 25;
|
||||
Vec3 pos(30, height - 15, 1);
|
||||
Vec3 pos(30.0f, static_cast<f32>(height - 15), 1.0f);
|
||||
|
||||
dc.SetColor(colx.x, colx.y, colx.z, 1);
|
||||
dc.DrawLine(pos, pos + Vec3(size, 0, 0));
|
||||
dc.DrawLine(pos, pos + Vec3(static_cast<f32>(size), 0.0f, 0.0f));
|
||||
|
||||
dc.SetColor(coly.x, coly.y, coly.z, 1);
|
||||
dc.DrawLine(pos, pos - Vec3(0, size, 0));
|
||||
dc.SetColor(coly.x, coly.y, coly.z, 1.0f);
|
||||
dc.DrawLine(pos, pos - Vec3(0.0f, static_cast<f32>(size), 0.0f));
|
||||
|
||||
dc.SetColor(m_colorAxisText);
|
||||
pos.x -= 3;
|
||||
pos.y -= 4;
|
||||
pos.z = 2;
|
||||
pos.x -= 3.0f;
|
||||
pos.y -= 4.0f;
|
||||
pos.z = 2.0f;
|
||||
dc.Draw2dTextLabel(pos.x + size + 4, pos.y - 2, 1, xstr);
|
||||
dc.Draw2dTextLabel(pos.x + 3, pos.y - size, 1, ystr);
|
||||
dc.Draw2dTextLabel(pos.x - 5, pos.y + 5, 1, zstr);
|
||||
@@ -910,10 +910,14 @@ void Q2DViewport::DrawSelection(DisplayContext& dc)
|
||||
dc.SetColor(SELECTION_RECT_COLOR.x, SELECTION_RECT_COLOR.y, SELECTION_RECT_COLOR.z, 1);
|
||||
QPoint p1(m_selectedRect.left(), m_selectedRect.top());
|
||||
QPoint p2(m_selectedRect.right() + 1, m_selectedRect.bottom() +1);
|
||||
dc.DrawLine(Vec3(p1.x(), p1.y(), 0), Vec3(p2.x(), p1.y(), 0));
|
||||
dc.DrawLine(Vec3(p1.x(), p2.y(), 0), Vec3(p2.x(), p2.y(), 0));
|
||||
dc.DrawLine(Vec3(p1.x(), p1.y(), 0), Vec3(p1.x(), p2.y(), 0));
|
||||
dc.DrawLine(Vec3(p2.x(), p1.y(), 0), Vec3(p2.x(), p2.y(), 0));
|
||||
dc.DrawLine(
|
||||
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p1.y()), 0.0f), Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p1.y()), 0.0f));
|
||||
dc.DrawLine(
|
||||
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p2.y()), 0.0f), Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p2.y()), 0.0f));
|
||||
dc.DrawLine(
|
||||
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p1.y()), 0.0f), Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p2.y()), 0.0f));
|
||||
dc.DrawLine(
|
||||
Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p1.y()), 0.0f), Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p2.y()), 0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1038,16 +1042,16 @@ AABB Q2DViewport::GetWorldBounds(const QPoint& pnt1, const QPoint& pnt2)
|
||||
{
|
||||
case VPA_XY:
|
||||
case VPA_YX:
|
||||
box.min.z = -maxSize;
|
||||
box.max.z = maxSize;
|
||||
box.min.z = static_cast<f32>(-maxSize);
|
||||
box.max.z = static_cast<f32>(maxSize);
|
||||
break;
|
||||
case VPA_XZ:
|
||||
box.min.y = -maxSize;
|
||||
box.max.y = maxSize;
|
||||
box.min.y = static_cast<f32>(-maxSize);
|
||||
box.max.y = static_cast<f32>(maxSize);
|
||||
break;
|
||||
case VPA_YZ:
|
||||
box.min.x = -maxSize;
|
||||
box.max.x = maxSize;
|
||||
box.min.x = static_cast<f32>(-maxSize);
|
||||
box.max.x = static_cast<f32>(maxSize);
|
||||
break;
|
||||
}
|
||||
return box;
|
||||
@@ -1076,32 +1080,32 @@ void Q2DViewport::OnDragSelectRectangle(const QRect &rect, [[maybe_unused]] bool
|
||||
switch (m_axis)
|
||||
{
|
||||
case VPA_XY:
|
||||
box.min.z = -maxSize;
|
||||
box.max.z = maxSize;
|
||||
box.min.z = static_cast<f32>(-maxSize);
|
||||
box.max.z = static_cast<f32>(maxSize);
|
||||
|
||||
w = box.max.x - box.min.x;
|
||||
h = box.max.y - box.min.y;
|
||||
sprintf_s(szNewStatusText, "X:%g Y:%g W:%g H:%g", org.x, org.y, w, h);
|
||||
break;
|
||||
case VPA_YX:
|
||||
box.min.z = -maxSize;
|
||||
box.max.z = maxSize;
|
||||
box.min.z = static_cast<f32>(-maxSize);
|
||||
box.max.z = static_cast<f32>(maxSize);
|
||||
|
||||
w = box.max.y - box.min.y;
|
||||
h = box.max.x - box.min.x;
|
||||
sprintf_s(szNewStatusText, "X:%g Y:%g W:%g H:%g", org.x, org.y, w, h);
|
||||
break;
|
||||
case VPA_XZ:
|
||||
box.min.y = -maxSize;
|
||||
box.max.y = maxSize;
|
||||
box.min.y = static_cast<f32>(-maxSize);
|
||||
box.max.y = static_cast<f32>(maxSize);
|
||||
|
||||
w = box.max.x - box.min.x;
|
||||
h = box.max.z - box.min.z;
|
||||
sprintf_s(szNewStatusText, "X:%g Z:%g W:%g H:%g", org.x, org.z, w, h);
|
||||
break;
|
||||
case VPA_YZ:
|
||||
box.min.x = -maxSize;
|
||||
box.max.x = maxSize;
|
||||
box.min.x = static_cast<f32>(-maxSize);
|
||||
box.max.x = static_cast<f32>(maxSize);
|
||||
|
||||
w = box.max.y - box.min.y;
|
||||
h = box.max.z - box.min.z;
|
||||
|
||||
@@ -72,7 +72,7 @@ void CColorGradientCtrl::resizeEvent(QResizeEvent* event)
|
||||
m_grid.rect = m_rcGradient;
|
||||
if (m_bNoZoom)
|
||||
{
|
||||
m_grid.zoom.x = m_grid.rect.width();
|
||||
m_grid.zoom.x = static_cast<f32>(m_grid.rect.width());
|
||||
}
|
||||
|
||||
m_rcKeys = rc;
|
||||
@@ -106,11 +106,6 @@ QPoint CColorGradientCtrl::KeyToPoint(int nKey)
|
||||
QPoint CColorGradientCtrl::TimeToPoint(float time)
|
||||
{
|
||||
return QPoint(m_grid.WorldToClient(Vec2(time, 0)).x(), m_rcGradient.height() / 2);
|
||||
|
||||
QPoint point;
|
||||
point.rx() = (time - m_fMinTime) * (m_rcGradient.width() / (m_fMaxTime - m_fMinTime)) + m_rcGradient.left();
|
||||
point.ry() = m_rcGradient.height() / 2;
|
||||
return point;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -833,15 +833,15 @@ static void SetEditorRange(EditorType* editor, IVariable* var)
|
||||
// If this variable has custom limits set, then use that as the min/max
|
||||
// Otherwise, the min/max for the input box will be bounded by the type
|
||||
// limit, but the slider will be constricted to a smaller default range
|
||||
static const double defaultMin = -100.0f;
|
||||
static const double defaultMax = 100.0f;
|
||||
static const float defaultMin = -100.0f;
|
||||
static const float defaultMax = 100.0f;
|
||||
if (var->HasCustomLimits())
|
||||
{
|
||||
editor->setRange(min, max);
|
||||
editor->setRange(static_cast<EditorType::value_type>(min), static_cast<EditorType::value_type>(max));
|
||||
}
|
||||
else
|
||||
{
|
||||
editor->setSoftRange(defaultMin, defaultMax);
|
||||
editor->setSoftRange(static_cast<EditorType::value_type>(defaultMin), static_cast<EditorType::value_type>(defaultMax));
|
||||
}
|
||||
|
||||
// Set the step size. The default variable step is 0, so if it's
|
||||
@@ -850,7 +850,7 @@ static void SetEditorRange(EditorType* editor, IVariable* var)
|
||||
// use that for the int values
|
||||
if (step > 0)
|
||||
{
|
||||
editor->spinbox()->setSingleStep(step);
|
||||
editor->spinbox()->setSingleStep(static_cast<int>(step));
|
||||
}
|
||||
else if (auto doubleSpinBox = qobject_cast<AzQtComponents::DoubleSpinBox*>(editor->spinbox()))
|
||||
{
|
||||
|
||||
@@ -175,7 +175,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
penSpikes = penColor;
|
||||
painter.setPen(Qt::black);
|
||||
painter.setBrush(Qt::white);
|
||||
rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), abs(rc.height() * m_graphHeightPercent)));
|
||||
rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), static_cast<int>(abs(rc.height() * m_graphHeightPercent))));
|
||||
painter.drawRect(rcGraph);
|
||||
painter.setPen(penSpikes);
|
||||
|
||||
@@ -193,7 +193,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
{
|
||||
float scale = 0;
|
||||
|
||||
i = ((float)x / graphWidth) * (kNumColorLevels - 1);
|
||||
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
|
||||
i = CLAMP(i, 0, kNumColorLevels - 1);
|
||||
|
||||
switch (m_drawMode)
|
||||
@@ -245,7 +245,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
}
|
||||
|
||||
crtX = static_cast<int>(rcGraph.left() + x + 1);
|
||||
painter.drawLine(crtX, graphBottom, crtX, graphBottom - scale * graphHeight);
|
||||
painter.drawLine(crtX, graphBottom, crtX, static_cast<int>(graphBottom - scale * graphHeight));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -258,7 +258,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
|
||||
for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x)
|
||||
{
|
||||
i = ((float)x / graphWidth) * (kNumColorLevels - 1);
|
||||
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
|
||||
i = CLAMP(i, 0, kNumColorLevels - 1);
|
||||
crtX = static_cast<UINT>(rcGraph.left() + x + 1);
|
||||
scaleR = scaleG = scaleB = scaleA = 0;
|
||||
@@ -283,10 +283,10 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
scaleA = (float)m_count[3][i] / m_maxCount[3];
|
||||
}
|
||||
|
||||
heightR = graphBottom - scaleR * graphHeight;
|
||||
heightG = graphBottom - scaleG * graphHeight;
|
||||
heightB = graphBottom - scaleB * graphHeight;
|
||||
heightA = graphBottom - scaleA * graphHeight;
|
||||
heightR = static_cast<int>(graphBottom - scaleR * graphHeight);
|
||||
heightG = static_cast<int>(graphBottom - scaleG * graphHeight);
|
||||
heightB = static_cast<int>(graphBottom - scaleB * graphHeight);
|
||||
heightA = static_cast<int>(graphBottom - scaleA * graphHeight);
|
||||
|
||||
if (lastHeight[0] == INT_MAX)
|
||||
{
|
||||
@@ -350,7 +350,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x)
|
||||
{
|
||||
pos = (float)x / graphWidth;
|
||||
i = (float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels;
|
||||
i = static_cast<int>((float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels);
|
||||
i = CLAMP(i, 0, kNumColorLevels - 1);
|
||||
scale = 0;
|
||||
|
||||
@@ -385,7 +385,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
}
|
||||
|
||||
painter.setPen(pPen);
|
||||
painter.drawLine(rcGraph.left() + static_cast<int>(x) + 1, graphBottom, rcGraph.left() + static_cast<int>(x) + 1, graphBottom - scale * graphHeight);
|
||||
painter.drawLine(rcGraph.left() + static_cast<int>(x) + 1, graphBottom, rcGraph.left() + static_cast<int>(x) + 1, static_cast<int>(graphBottom - scale * graphHeight));
|
||||
}
|
||||
|
||||
// then draw 3 lines so we separate the channels
|
||||
|
||||
@@ -422,7 +422,7 @@ void QBitmapPreviewDialogImp::paintEvent(QPaintEvent* e)
|
||||
|
||||
|
||||
curr_x = histogramRect.left() + x + 1;
|
||||
int i = ((float)x / (graphWidth - 1)) * (CImageHistogram::kNumColorLevels - 1);
|
||||
int i = static_cast<int>(((float)x / (graphWidth - 1)) * (CImageHistogram::kNumColorLevels - 1));
|
||||
if (m_histrogramMode == eHistogramMode_SplitRGB)
|
||||
{
|
||||
// Filter out to area which we are interested
|
||||
@@ -446,7 +446,7 @@ void QBitmapPreviewDialogImp::paintEvent(QPaintEvent* e)
|
||||
scale = (float)m_histogram.m_count[c][i] / m_histogram.m_maxCount[c];
|
||||
}
|
||||
|
||||
int height = graphBottom - graphHeight * scale;
|
||||
int height = static_cast<int>(graphBottom - graphHeight * scale);
|
||||
if (last_height == INT_MAX)
|
||||
{
|
||||
last_height = height;
|
||||
|
||||
@@ -308,7 +308,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlo
|
||||
int nMin(0), nMax(0);
|
||||
if (child->getAttr("min", nMin) && child->getAttr("max", nMax))
|
||||
{
|
||||
intVar->SetLimits(nMin, nMax);
|
||||
intVar->SetLimits(static_cast<float>(nMin), static_cast<float>(nMax));
|
||||
}
|
||||
}
|
||||
else if (!azstricmp(type, "float"))
|
||||
|
||||
@@ -39,20 +39,20 @@ namespace {
|
||||
hardMin = desc.m_bHardMin;
|
||||
hardMax = desc.m_bHardMax;
|
||||
}
|
||||
reflectedVar->m_softMinVal = min;
|
||||
reflectedVar->m_softMaxVal = max;
|
||||
reflectedVar->m_softMinVal = static_cast<R>(min);
|
||||
reflectedVar->m_softMaxVal = static_cast<R>(max);
|
||||
|
||||
if (hardMin)
|
||||
{
|
||||
reflectedVar->m_minVal = min;
|
||||
reflectedVar->m_minVal = static_cast<R>(min);
|
||||
}
|
||||
else
|
||||
{
|
||||
reflectedVar->m_minVal = std::numeric_limits<int>::lowest();
|
||||
reflectedVar->m_minVal = std::numeric_limits<R>::lowest();
|
||||
}
|
||||
if (hardMax)
|
||||
{
|
||||
reflectedVar->m_maxVal = max;
|
||||
reflectedVar->m_maxVal = static_cast<R>(max);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -64,9 +64,9 @@ namespace {
|
||||
../Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp:59:38: error: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Werror,-Wimplicit-int-float-conversion]
|
||||
reflectedVar->m_maxVal = std::numeric_limits<int>::max();
|
||||
*/
|
||||
reflectedVar->m_maxVal = static_cast<float>(std::numeric_limits<int>::max());
|
||||
reflectedVar->m_maxVal = static_cast<R>(std::numeric_limits<int>::max());
|
||||
}
|
||||
reflectedVar->m_stepSize = step;
|
||||
reflectedVar->m_stepSize = static_cast<R>(step);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@ void ReflectedVarIntAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
|
||||
{
|
||||
int intValue;
|
||||
pVariable->Get(intValue);
|
||||
value = intValue;
|
||||
value = static_cast<float>(intValue);
|
||||
}
|
||||
m_reflectedVar->m_value = std::round(value * m_valueMultiplier);
|
||||
m_reflectedVar->m_value = static_cast<int>(std::round(value * m_valueMultiplier));
|
||||
}
|
||||
|
||||
void ReflectedVarIntAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
|
||||
@@ -362,14 +362,14 @@ void ReflectedVarColorAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
|
||||
Vec3 v(0, 0, 0);
|
||||
pVariable->Get(v);
|
||||
const QColor col = ColorLinearToGamma(ColorF(v.x, v.y, v.z));
|
||||
m_reflectedVar->m_color.Set(col.redF(), col.greenF(), col.blueF());
|
||||
m_reflectedVar->m_color.Set(static_cast<float>(col.redF()), static_cast<float>(col.greenF()), static_cast<float>(col.blueF()));
|
||||
}
|
||||
else
|
||||
{
|
||||
int col(0);
|
||||
pVariable->Get(col);
|
||||
const QColor qcolor = ColorToQColor((uint32)col);
|
||||
m_reflectedVar->m_color.Set(qcolor.redF(), qcolor.greenF(), qcolor.blueF());
|
||||
m_reflectedVar->m_color.Set(static_cast<float>(qcolor.redF()), static_cast<float>(qcolor.greenF()), static_cast<float>(qcolor.blueF()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,9 +382,9 @@ void ReflectedVarColorAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
|
||||
}
|
||||
else
|
||||
{
|
||||
int ir = m_reflectedVar->m_color.GetX() * 255.0f;
|
||||
int ig = m_reflectedVar->m_color.GetY() * 255.0f;
|
||||
int ib = m_reflectedVar->m_color.GetZ() * 255.0f;
|
||||
int ir = static_cast<int>(m_reflectedVar->m_color.GetX() * 255.0f);
|
||||
int ig = static_cast<int>(m_reflectedVar->m_color.GetY() * 255.0f);
|
||||
int ib = static_cast<int>(m_reflectedVar->m_color.GetZ() * 255.0f);
|
||||
|
||||
pVariable->Set(static_cast<int>(RGB(ir, ig, ib)));
|
||||
}
|
||||
|
||||
@@ -86,13 +86,13 @@ QPoint CSplineCtrl::KeyToPoint(int nKey)
|
||||
QPoint CSplineCtrl::TimeToPoint(float time)
|
||||
{
|
||||
QPoint point;
|
||||
point.setX((time - m_fMinTime) * (m_rcSpline.width() / (m_fMaxTime - m_fMinTime)) + m_rcSpline.left());
|
||||
point.setX(static_cast<int>((time - m_fMinTime) * (m_rcSpline.width() / (m_fMaxTime - m_fMinTime)) + m_rcSpline.left()));
|
||||
float val = 0;
|
||||
if (m_pSpline)
|
||||
{
|
||||
m_pSpline->InterpolateFloat(time, val);
|
||||
}
|
||||
point.setY((floor((m_fMaxValue - val) * (m_rcSpline.height() / (m_fMaxValue - m_fMinValue)) + 0.5f) + m_rcSpline.top()));
|
||||
point.setY(static_cast<int>((floor((m_fMaxValue - val) * (m_rcSpline.height() / (m_fMaxValue - m_fMinValue)) + 0.5f) + m_rcSpline.top())));
|
||||
return point;
|
||||
}
|
||||
|
||||
|
||||
@@ -641,7 +641,7 @@ QPoint AbstractSplineWidget::TimeToPoint(float time, ISplineInterpolator* pSplin
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float AbstractSplineWidget::TimeToXOfs(float x)
|
||||
{
|
||||
return WorldToClient(Vec2(float(x), 0.0f)).x();
|
||||
return static_cast<float>(WorldToClient(Vec2(float(x), 0.0f)).x());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -832,8 +832,8 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float
|
||||
int nTotalNumberOfDimensions(0);
|
||||
int nCurrentDimension(0);
|
||||
|
||||
int left = TimeToXOfs(startTime);//rcClip.left;
|
||||
int right = TimeToXOfs(endTime);//rcClip.right;
|
||||
int left = static_cast<int>(TimeToXOfs(startTime));//rcClip.left;
|
||||
int right = static_cast<int>(TimeToXOfs(endTime));//rcClip.right;
|
||||
QPoint p0 = TimeToPoint(pSpline->GetKeyTime(0), pSpline);
|
||||
QPoint p1 = TimeToPoint(pSpline->GetKeyTime(pSpline->GetKeyCount() - 1), pSpline);
|
||||
|
||||
@@ -898,7 +898,7 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float
|
||||
|
||||
if ((x == right && pointsInLine >= 0) || (pointsInLine > 0 && fabs(lineStart.y() + gradient * (pt.x() - lineStart.x()) - pt.y()) > 1.0f))
|
||||
{
|
||||
lineStart = QPoint(pt.x() - 1, lineStart.y() + gradient * (pt.x() - 1 - lineStart.x()));
|
||||
lineStart = QPoint(pt.x() - 1, static_cast<int>(lineStart.y() + gradient * (pt.x() - 1 - lineStart.x())));
|
||||
path.lineTo(lineStart);
|
||||
gradient = float(pt.y() - lineStart.y()) / (pt.x() - lineStart.x());
|
||||
pointsInLine = 1;
|
||||
@@ -1063,7 +1063,7 @@ void SplineWidget::DrawTimeMarker(QPainter* painter)
|
||||
float x = TimeToXOfs(m_fTimeMarker);
|
||||
if (x >= m_rcSpline.left() && x <= m_rcSpline.right() + 1)
|
||||
{
|
||||
painter->drawLine(x, m_rcSpline.top(), x, m_rcSpline.bottom() + 1);
|
||||
painter->drawLine(static_cast<int>(x), m_rcSpline.top(), static_cast<int>(x), m_rcSpline.bottom() + 1);
|
||||
}
|
||||
painter->setPen(pOldPen);
|
||||
}
|
||||
@@ -2145,8 +2145,8 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT
|
||||
}
|
||||
}
|
||||
|
||||
int rangeMin = TimeToXOfs(affectedRangeMin);
|
||||
int rangeMax = TimeToXOfs(affectedRangeMax);
|
||||
int rangeMin = static_cast<int>(TimeToXOfs(affectedRangeMin));
|
||||
int rangeMax = static_cast<int>(TimeToXOfs(affectedRangeMax));
|
||||
|
||||
if (m_timeRange.start == affectedRangeMin)
|
||||
{
|
||||
@@ -2377,8 +2377,8 @@ void AbstractSplineWidget::RedrawWindowAroundMarker()
|
||||
UpdateKeyTimes();
|
||||
std::vector<KeyTime>::iterator itKeyTime = std::lower_bound(m_keyTimes.begin(), m_keyTimes.end(), KeyTime(m_fTimeMarker, 0));
|
||||
size_t keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size());
|
||||
int redrawRangeStart = (keyTimeIndex >= 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time) : m_rcSpline.left());
|
||||
int redrawRangeEnd = (keyTimeIndex < m_keyTimes.size() - 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time) : m_rcSpline.right() + 1);
|
||||
int redrawRangeStart = (keyTimeIndex >= 2 ? static_cast<int>(TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time)) : m_rcSpline.left());
|
||||
int redrawRangeEnd = (keyTimeIndex < m_keyTimes.size() - 2 ? static_cast<int>(TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time)) : m_rcSpline.right() + 1);
|
||||
|
||||
QRect rc(QPoint(redrawRangeStart, m_rcSpline.top()), QPoint(redrawRangeEnd, m_rcSpline.bottom() + 1) - QPoint(1, 1));
|
||||
rc = rc.normalized().intersected(m_rcSpline);
|
||||
|
||||
@@ -25,9 +25,9 @@ static const QColor ltgrayCol = QColor(110, 110, 110);
|
||||
|
||||
QColor InterpolateColor(const QColor& c1, const QColor& c2, float fraction)
|
||||
{
|
||||
const int r = (c2.red() - c1.red()) * fraction + c1.red();
|
||||
const int g = (c2.green() - c1.green()) * fraction + c1.green();
|
||||
const int b = (c2.blue() - c1.blue()) * fraction + c1.blue();
|
||||
const int r = static_cast<int>(static_cast<float>(c2.red() - c1.red()) * fraction + c1.red());
|
||||
const int g = static_cast<int>(static_cast<float>(c2.green() - c1.green()) * fraction + c1.green());
|
||||
const int b = static_cast<int>(static_cast<float>(c2.blue() - c1.blue()) * fraction + c1.blue());
|
||||
return QColor(r, g, b);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ float TimelineWidget::SnapTime(float time)
|
||||
{
|
||||
double t = floor((double)time * m_ticksStep + 0.5);
|
||||
t = t / m_ticksStep;
|
||||
return t;
|
||||
return static_cast<float>(t);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -153,10 +153,10 @@ void TimelineWidget::DrawTicks(QPainter* painter)
|
||||
painter->setPen(redpen);
|
||||
int x = TimeToClient(m_fTimeMarker);
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawRect(QRect(QPoint(x - 3, rc.top()), QPoint(x + 2, rc.bottom())));
|
||||
painter->drawRect(QRect(QPoint(x - 3, static_cast<int>(rc.top())), QPoint(x + 2, static_cast<int>(rc.bottom()))));
|
||||
|
||||
painter->setPen(redpen);
|
||||
painter->drawLine(x, rc.top(), x, rc.bottom());
|
||||
painter->drawLine(x, static_cast<int>(rc.top()), x, static_cast<int>(rc.bottom()));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
||||
// Draw vertical line showing current time.
|
||||
@@ -190,7 +190,7 @@ void TimelineWidget::DrawTicks(QPainter* painter)
|
||||
float keyTime = (m_pKeyTimeSet ? m_pKeyTimeSet->GetKeyTime(keyTimeIndex) : 0.0f);
|
||||
|
||||
int x2 = TimeToClient(keyTime);
|
||||
painter->drawRect(QRect(QPoint(x2 - 1, rc.top()), QPoint(x2 + 2, rc.bottom())));
|
||||
painter->drawRect(QRect(QPoint(x2 - 1, static_cast<int>(rc.top())), QPoint(x2 + 2, static_cast<int>(rc.bottom()))));
|
||||
}
|
||||
|
||||
painter->setPen(pOldPen);
|
||||
|
||||
@@ -2091,7 +2091,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
|
||||
}
|
||||
|
||||
// QVariant will not convert a void * to int, so do it manually.
|
||||
int nKey = reinterpret_cast<intptr_t>(pVar->GetUserData().value<void*>());
|
||||
int nKey = static_cast<int>(reinterpret_cast<intptr_t>(pVar->GetUserData().value<void*>()));
|
||||
|
||||
int nGroup = (nKey & 0xFFFF0000) >> 16;
|
||||
int nChild = (nKey & 0x0000FFFF);
|
||||
|
||||
@@ -46,7 +46,7 @@ void CDisplaySettings::SaveRegistry()
|
||||
SaveValue("Settings", "RenderFlags", m_renderFlags);
|
||||
SaveValue("Settings", "DisplayFlags", m_flags & SETTINGS_SERIALIZABLE_FLAGS_MASK);
|
||||
SaveValue("Settings", "DebugFlags", m_debugFlags);
|
||||
SaveValue("Settings", "LabelsDistance", m_labelsDistance);
|
||||
SaveValue("Settings", "LabelsDistance", static_cast<int>(m_labelsDistance));
|
||||
}
|
||||
|
||||
void CDisplaySettings::LoadRegistry()
|
||||
@@ -56,9 +56,9 @@ void CDisplaySettings::LoadRegistry()
|
||||
LoadValue("Settings", "DisplayFlags", m_flags);
|
||||
m_flags &= SETTINGS_SERIALIZABLE_FLAGS_MASK;
|
||||
LoadValue("Settings", "DebugFlags", m_debugFlags);
|
||||
int temp = m_labelsDistance;
|
||||
int temp = static_cast<int>(m_labelsDistance);
|
||||
LoadValue("Settings", "LabelsDistance", temp);
|
||||
m_labelsDistance = temp;
|
||||
m_labelsDistance = static_cast<float>(temp);
|
||||
|
||||
gSettings.objectHideMask = m_objectHideMask;
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ bool SubObjectSelectionReferenceFrameCalculator::GetFrame(Matrix34& refFrame)
|
||||
|
||||
if (this->nNormals > 0)
|
||||
{
|
||||
this->normal = this->normal / this->nNormals;
|
||||
this->normal = this->normal / static_cast<float>(this->nNormals);
|
||||
if (!this->normal.IsZero())
|
||||
{
|
||||
this->normal.Normalize();
|
||||
}
|
||||
|
||||
// Average position.
|
||||
this->pos = this->pos / this->nNormals;
|
||||
this->pos = this->pos / static_cast<float>(this->nNormals);
|
||||
refFrame.SetTranslation(this->pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -201,20 +201,24 @@ void CEditorPreferencesPage_ViewportGeneral::OnApply()
|
||||
ds->SetLabelsDistance(m_textLabels.m_labelsDistance);
|
||||
|
||||
gSettings.objectColorSettings.fChildGeomAlpha = m_selectionPreviewColor.m_childObjectGeomAlpha;
|
||||
gSettings.objectColorSettings.entityHighlight = QColor(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f,
|
||||
m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f,
|
||||
m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f);
|
||||
gSettings.objectColorSettings.groupHighlight = QColor(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f,
|
||||
m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f,
|
||||
m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f);
|
||||
gSettings.objectColorSettings.entityHighlight = QColor(
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f));
|
||||
gSettings.objectColorSettings.groupHighlight = QColor(
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f));
|
||||
gSettings.objectColorSettings.fBBoxAlpha = m_selectionPreviewColor.m_fBBoxAlpha;
|
||||
gSettings.objectColorSettings.fGeomAlpha = m_selectionPreviewColor.m_fgeomAlpha;
|
||||
gSettings.objectColorSettings.geometryHighlightColor = QColor(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f,
|
||||
m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f,
|
||||
m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f);
|
||||
gSettings.objectColorSettings.solidBrushGeometryColor = QColor(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f,
|
||||
m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f,
|
||||
m_selectionPreviewColor.m_solidBrushGeometryColor.GetB() * 255.0f);
|
||||
gSettings.objectColorSettings.geometryHighlightColor = QColor(
|
||||
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f));
|
||||
gSettings.objectColorSettings.solidBrushGeometryColor = QColor(
|
||||
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetB() * 255.0f));
|
||||
}
|
||||
|
||||
void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
|
||||
@@ -252,10 +256,10 @@ void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
|
||||
m_textLabels.m_labelsDistance = ds->GetLabelsDistance();
|
||||
|
||||
m_selectionPreviewColor.m_childObjectGeomAlpha = gSettings.objectColorSettings.fChildGeomAlpha;
|
||||
m_selectionPreviewColor.m_colorEntityBBox.Set(gSettings.objectColorSettings.entityHighlight.redF(), gSettings.objectColorSettings.entityHighlight.greenF(), gSettings.objectColorSettings.entityHighlight.blueF(), 1.0f);
|
||||
m_selectionPreviewColor.m_colorGroupBBox.Set(gSettings.objectColorSettings.groupHighlight.redF(), gSettings.objectColorSettings.groupHighlight.greenF(), gSettings.objectColorSettings.groupHighlight.blueF(), 1.0f);
|
||||
m_selectionPreviewColor.m_colorEntityBBox.Set(static_cast<float>(gSettings.objectColorSettings.entityHighlight.redF()), static_cast<float>(gSettings.objectColorSettings.entityHighlight.greenF()), static_cast<float>(gSettings.objectColorSettings.entityHighlight.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_colorGroupBBox.Set(static_cast<float>(gSettings.objectColorSettings.groupHighlight.redF()), static_cast<float>(gSettings.objectColorSettings.groupHighlight.greenF()), static_cast<float>(gSettings.objectColorSettings.groupHighlight.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_fBBoxAlpha = gSettings.objectColorSettings.fBBoxAlpha;
|
||||
m_selectionPreviewColor.m_fgeomAlpha = gSettings.objectColorSettings.fGeomAlpha;
|
||||
m_selectionPreviewColor.m_geometryHighlightColor.Set(gSettings.objectColorSettings.geometryHighlightColor.redF(), gSettings.objectColorSettings.geometryHighlightColor.greenF(), gSettings.objectColorSettings.geometryHighlightColor.blueF(), 1.0f);
|
||||
m_selectionPreviewColor.m_solidBrushGeometryColor.Set(gSettings.objectColorSettings.solidBrushGeometryColor.redF(), gSettings.objectColorSettings.solidBrushGeometryColor.greenF(), gSettings.objectColorSettings.solidBrushGeometryColor.blueF(), 1.0f);
|
||||
m_selectionPreviewColor.m_geometryHighlightColor.Set(static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.redF()), static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.greenF()), static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_solidBrushGeometryColor.Set(static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.redF()), static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.greenF()), static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.blueF()), 1.0f);
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ void EditorViewportWidget::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
const char* kFontName = "Arial";
|
||||
const QColor kTextColor(255, 255, 255);
|
||||
const QColor kTextShadowColor(0, 0, 0);
|
||||
const QFont font(kFontName, kFontSize / 10.0);
|
||||
const QFont font(kFontName, static_cast<int>(kFontSize / 10.0f));
|
||||
painter.setFont(font);
|
||||
|
||||
QString friendlyName = QFileInfo(GetIEditor()->GetLevelName()).fileName();
|
||||
@@ -815,29 +815,35 @@ void EditorViewportWidget::UpdateSafeFrame()
|
||||
float maxSafeFrameWidth = m_safeFrame.height() * targetAspectRatio;
|
||||
float widthDifference = m_safeFrame.width() - maxSafeFrameWidth;
|
||||
|
||||
m_safeFrame.setLeft(m_safeFrame.left() + widthDifference * 0.5);
|
||||
m_safeFrame.setRight(m_safeFrame.right() - widthDifference * 0.5);
|
||||
m_safeFrame.setLeft(static_cast<int>(m_safeFrame.left() + widthDifference * 0.5f));
|
||||
m_safeFrame.setRight(static_cast<int>(m_safeFrame.right() - widthDifference * 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
float maxSafeFrameHeight = m_safeFrame.width() / targetAspectRatio;
|
||||
float heightDifference = m_safeFrame.height() - maxSafeFrameHeight;
|
||||
|
||||
m_safeFrame.setTop(m_safeFrame.top() + heightDifference * 0.5);
|
||||
m_safeFrame.setBottom(m_safeFrame.bottom() - heightDifference * 0.5);
|
||||
m_safeFrame.setTop(static_cast<int>(m_safeFrame.top() + heightDifference * 0.5f));
|
||||
m_safeFrame.setBottom(static_cast<int>(m_safeFrame.bottom() - heightDifference * 0.5f));
|
||||
}
|
||||
|
||||
m_safeFrame.adjust(0, 0, -1, -1); // <-- aesthetic improvement.
|
||||
|
||||
const float SAFE_ACTION_SCALE_FACTOR = 0.05f;
|
||||
m_safeAction = m_safeFrame;
|
||||
m_safeAction.adjust(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR,
|
||||
-m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, -m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR);
|
||||
m_safeAction.adjust(
|
||||
static_cast<int>(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR),
|
||||
static_cast<int>(m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR),
|
||||
static_cast<int>(-m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR),
|
||||
static_cast<int>(-m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR));
|
||||
|
||||
const float SAFE_TITLE_SCALE_FACTOR = 0.1f;
|
||||
m_safeTitle = m_safeFrame;
|
||||
m_safeTitle.adjust(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR,
|
||||
-m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, -m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR);
|
||||
m_safeTitle.adjust(
|
||||
static_cast<int>(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR),
|
||||
static_cast<int>(m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR),
|
||||
static_cast<int>(-m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR),
|
||||
static_cast<int>(-m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -856,8 +862,8 @@ void EditorViewportWidget::RenderSafeFrame(const QRect& frame, float r, float g,
|
||||
const int LINE_WIDTH = 2;
|
||||
for (int i = 0; i < LINE_WIDTH; i++)
|
||||
{
|
||||
AZ::Vector3 topLeft(frame.left() + i, frame.top() + i, 0);
|
||||
AZ::Vector3 bottomRight(frame.right() - i, frame.bottom() - i, 0);
|
||||
AZ::Vector3 topLeft(static_cast<float>(frame.left() + i), static_cast<float>(frame.top() + i), 0.0f);
|
||||
AZ::Vector3 bottomRight(static_cast<float>(frame.right() - i), static_cast<float>(frame.bottom() - i), 0.0f);
|
||||
m_debugDisplay->DrawWireBox(topLeft, bottomRight);
|
||||
}
|
||||
}
|
||||
@@ -1936,8 +1942,8 @@ QPoint EditorViewportWidget::WorldToViewParticleEditor(const Vec3& wp, int width
|
||||
ProjectToScreen(wp.x, wp.y, wp.z, &x, &y, &z);
|
||||
if (_finite(x) || _finite(y))
|
||||
{
|
||||
p.rx() = (x / 100) * width;
|
||||
p.ry() = (y / 100) * height;
|
||||
p.rx() = static_cast<int>((x / 100) * width);
|
||||
p.ry() = static_cast<int>((y / 100) * height);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2091,8 +2097,8 @@ void EditorViewportWidget::UnProjectFromScreen(float sx, float sy, float sz, flo
|
||||
void EditorViewportWidget::ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const
|
||||
{
|
||||
AzFramework::ScreenPoint screenPosition = m_renderViewport->ViewportWorldToScreen(AZ::Vector3{ptx, pty, ptz});
|
||||
*sx = screenPosition.m_x;
|
||||
*sy = screenPosition.m_y;
|
||||
*sx = static_cast<float>(screenPosition.m_x);
|
||||
*sy = static_cast<float>(screenPosition.m_y);
|
||||
*sz = 0.f;
|
||||
}
|
||||
|
||||
@@ -2103,7 +2109,7 @@ void EditorViewportWidget::ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3&
|
||||
|
||||
Vec3 pos0, pos1;
|
||||
float wx, wy, wz;
|
||||
UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 0, &wx, &wy, &wz);
|
||||
UnProjectFromScreen(static_cast<float>(vp.x()), static_cast<float>(rc.bottom() - vp.y()), 0.0f, &wx, &wy, &wz);
|
||||
if (!_finite(wx) || !_finite(wy) || !_finite(wz))
|
||||
{
|
||||
return;
|
||||
@@ -2113,7 +2119,7 @@ void EditorViewportWidget::ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3&
|
||||
return;
|
||||
}
|
||||
pos0(wx, wy, wz);
|
||||
UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 1, &wx, &wy, &wz);
|
||||
UnProjectFromScreen(static_cast<float>(vp.x()), static_cast<float>(rc.bottom() - vp.y()), 1.0f, &wx, &wy, &wz);
|
||||
if (!_finite(wx) || !_finite(wy) || !_finite(wz))
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -45,7 +45,7 @@ bool GetPositionFromString(QString er, float* x, float* y, float* z)
|
||||
}
|
||||
if (ind > 0)
|
||||
{
|
||||
*x = er.mid(0, ind).toDouble();
|
||||
*x = er.mid(0, ind).toFloat();
|
||||
er = er.mid(ind);
|
||||
er.remove(QRegExp("^[ ,]*"));
|
||||
|
||||
@@ -57,12 +57,12 @@ bool GetPositionFromString(QString er, float* x, float* y, float* z)
|
||||
}
|
||||
if (ind > 0)
|
||||
{
|
||||
*y = er.mid(0, ind).toDouble();
|
||||
*y = er.mid(0, ind).toFloat();
|
||||
er = er.mid(ind);
|
||||
er.remove(QRegExp("^[ ,]*"));
|
||||
if (er.length())
|
||||
{
|
||||
*z = er.toDouble();
|
||||
*z = er.toFloat();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,15 +40,6 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
void SetTexture(Export::TPath& outName, IRenderShaderResources* pRes, int nSlot)
|
||||
{
|
||||
SEfResTexture* pTex = pRes->GetTextureResource(nSlot);
|
||||
if (pTex)
|
||||
{
|
||||
azstrcat(outName, AZ_ARRAY_SIZE(outName), Path::GamePathToFullPath(pTex->m_Name.c_str()).toUtf8().data());
|
||||
}
|
||||
}
|
||||
|
||||
inline Export::Vector3D Vec3ToVector3D(const Vec3& vec)
|
||||
{
|
||||
Export::Vector3D ret;
|
||||
@@ -1164,7 +1155,7 @@ bool CExportManager::Export(const char* defaultName, const char* defaultExt, con
|
||||
// Export the whole sequence with baked keys
|
||||
if (ShowFBXExportDialog())
|
||||
{
|
||||
m_numberOfExportFrames = pSequence->GetTimeRange().end * m_FBXBakedExportFPS;
|
||||
m_numberOfExportFrames = static_cast<int>(pSequence->GetTimeRange().end * m_FBXBakedExportFPS);
|
||||
|
||||
if (!m_bExportOnlyPrimaryCamera)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
namespace
|
||||
{
|
||||
const uint kDefaultFPS = 30.0f;
|
||||
const uint kDefaultFPS = 30u;
|
||||
}
|
||||
|
||||
CFBXExporterDialog::CFBXExporterDialog(bool bDisplayOnlyFPSSetting, QWidget* pParent)
|
||||
@@ -43,7 +43,7 @@ CFBXExporterDialog::~CFBXExporterDialog()
|
||||
|
||||
float CFBXExporterDialog::GetFPS() const
|
||||
{
|
||||
return m_ui->m_fpsCombo->currentText().toDouble();
|
||||
return m_ui->m_fpsCombo->currentText().toFloat();
|
||||
}
|
||||
|
||||
bool CFBXExporterDialog::GetExportCoordsLocalToTheSelectedObject() const
|
||||
|
||||
@@ -201,7 +201,7 @@ void CTriMesh::SetFromMesh(CMesh& mesh)
|
||||
face.v [j] = numv;
|
||||
face.uv[j] = numv;
|
||||
face.n [j] = mesh.m_pNorms[idx].GetN();
|
||||
face.MatID = subset.nMatID;
|
||||
face.MatID = static_cast<unsigned char>(subset.nMatID);
|
||||
face.flags = 0;
|
||||
|
||||
numv++;
|
||||
@@ -269,7 +269,7 @@ void CTriMesh::SharePositions()
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
const Vec3& v = pVertices[face.v[i]].pos;
|
||||
uint8 nHash = RoundFloatToInt((v.x + v.y + v.z) * fHashScale);
|
||||
uint8 nHash = static_cast<uint8>(RoundFloatToInt((v.x + v.y + v.z) * fHashScale));
|
||||
|
||||
int find = FindVertexInHash(v, pNewVerts, arrHashTable[nHash], fEpsilon);
|
||||
if (find < 0)
|
||||
@@ -320,7 +320,7 @@ void CTriMesh::ShareUV()
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
const Vec2 uv = pUV[face.uv[i]].GetUV();
|
||||
uint8 nHash = RoundFloatToInt((uv.x + uv.y) * fHashScale);
|
||||
uint8 nHash = static_cast<uint8>(RoundFloatToInt((uv.x + uv.y) * fHashScale));
|
||||
|
||||
int find = FindTexCoordInHash(pUV[face.uv[i]], pNewUV, arrHashTable[nHash], fEpsilon);
|
||||
if (find < 0)
|
||||
@@ -380,7 +380,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
|
||||
// To find really used materials
|
||||
std::vector<int> usedMaterialIds;
|
||||
uint16 MatIdToSubset[MAX_SUB_MATERIALS];
|
||||
int nLastSubsetId = 0;
|
||||
uint16 nLastSubsetId = 0;
|
||||
memset(MatIdToSubset, 0, sizeof(MatIdToSubset));
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -398,7 +398,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
|
||||
MatIdToSubset[face.MatID] = 1 + nLastSubsetId++;
|
||||
usedMaterialIds.push_back(face.MatID); // Order of material ids in usedMaterialIds correspond to the indices of chunks.
|
||||
}
|
||||
meshFace.nSubset = MatIdToSubset[face.MatID] - 1;
|
||||
meshFace.nSubset = static_cast<unsigned char>(MatIdToSubset[face.MatID] - 1);
|
||||
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ void GotoPositionDialog::OnChangeEdit()
|
||||
const QStringList parts = m_transform.split(QRegularExpression("[\\s,;\\t]"), Qt::SkipEmptyParts);
|
||||
for (int i = 0; i < argCount && i < parts.count(); ++i)
|
||||
{
|
||||
transform[i] = parts[i].toDouble();
|
||||
transform[i] = parts[i].toFloat();
|
||||
}
|
||||
|
||||
m_ui->m_dymX->setValue(transform[0]);
|
||||
|
||||
@@ -504,7 +504,7 @@ static inline QString CopyAndRemoveColorCode(const char* sText)
|
||||
*d++ = *s++;
|
||||
}
|
||||
|
||||
ret.resize(d - ret.data());
|
||||
ret.resize(static_cast<int>(d - ret.data()));
|
||||
|
||||
return QString::fromLatin1(ret);
|
||||
}
|
||||
|
||||
@@ -1022,10 +1022,10 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l
|
||||
if (camDist < dc.settings->GetLabelsDistance() || (dc.flags & DISPLAY_SELECTION_HELPERS))
|
||||
{
|
||||
float range = maxDist / 2.0f;
|
||||
Vec3 c(labelColor.redF(), labelColor.greenF(), labelColor.redF());
|
||||
Vec3 c(static_cast<f32>(labelColor.redF()), static_cast<f32>(labelColor.greenF()), static_cast<f32>(labelColor.redF()));
|
||||
if (IsSelected())
|
||||
{
|
||||
c = Vec3(dc.GetSelectedColor().redF(), dc.GetSelectedColor().greenF(), dc.GetSelectedColor().blueF());
|
||||
c = Vec3(static_cast<f32>(dc.GetSelectedColor().redF()), static_cast<f32>(dc.GetSelectedColor().greenF()), static_cast<f32>(dc.GetSelectedColor().blueF()));
|
||||
}
|
||||
|
||||
float col[4] = { c.x, c.y, c.z, 1 };
|
||||
@@ -1033,7 +1033,7 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l
|
||||
{
|
||||
if (IsHighlighted())
|
||||
{
|
||||
c = Vec3(dc.GetSelectedColor().redF(), dc.GetSelectedColor().greenF(), dc.GetSelectedColor().blueF());
|
||||
c = Vec3(static_cast<f32>(dc.GetSelectedColor().redF()), static_cast<f32>(dc.GetSelectedColor().greenF()), static_cast<f32>(dc.GetSelectedColor().blueF()));
|
||||
}
|
||||
col[0] = c.x;
|
||||
col[1] = c.y;
|
||||
@@ -1263,9 +1263,9 @@ int CBaseObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint&
|
||||
|
||||
if (event == eMouseWheel)
|
||||
{
|
||||
double angle = 1;
|
||||
float angle = 1;
|
||||
Quat rot = GetRotation();
|
||||
rot.SetRotationXYZ(Ang3(0, 0, rot.GetRotZ() + DEG2RAD(flags > 0 ? angle * (-1) : angle)));
|
||||
rot.SetRotationXYZ(Ang3(0.f, 0.f, rot.GetRotZ() + DEG2RAD(flags > 0 ? angle * (-1) : angle)));
|
||||
SetRotation(rot);
|
||||
}
|
||||
return MOUSECREATE_CONTINUE;
|
||||
@@ -1857,10 +1857,10 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
|
||||
|
||||
const int kMaxSizeOfEdgeList0(4);
|
||||
Edge2D edgelist0[kMaxSizeOfEdgeList0] = {
|
||||
Edge2D(Vec2(hc.rect.left(), hc.rect.top()), Vec2(hc.rect.right(), hc.rect.top())),
|
||||
Edge2D(Vec2(hc.rect.right(), hc.rect.top()), Vec2(hc.rect.right(), hc.rect.bottom())),
|
||||
Edge2D(Vec2(hc.rect.right(), hc.rect.bottom()), Vec2(hc.rect.left(), hc.rect.bottom())),
|
||||
Edge2D(Vec2(hc.rect.left(), hc.rect.bottom()), Vec2(hc.rect.left(), hc.rect.top()))
|
||||
Edge2D(Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.top())), Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.top()))),
|
||||
Edge2D(Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.top())), Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.bottom()))),
|
||||
Edge2D(Vec2(static_cast<f32>(hc.rect.right()), static_cast<f32>(hc.rect.bottom())), Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.bottom()))),
|
||||
Edge2D(Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.bottom())), Vec2(static_cast<f32>(hc.rect.left()), static_cast<f32>(hc.rect.top())))
|
||||
};
|
||||
|
||||
const int kMaxSizeOfEdgeList1(8);
|
||||
@@ -1888,7 +1888,7 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
|
||||
pointsForRegion1.reserve(kMaxSizeOfEdgeList1);
|
||||
for (int i = 0; i < kMaxSizeOfEdgeList1; ++i)
|
||||
{
|
||||
pointsForRegion1.push_back(Vec3(obb_p[i].x(), obb_p[i].y(), 0));
|
||||
pointsForRegion1.push_back(Vec3(static_cast<f32>(obb_p[i].x()), static_cast<f32>(obb_p[i].y()), 0.0f));
|
||||
}
|
||||
|
||||
std::vector<Vec3> convexHullForRegion1;
|
||||
|
||||
@@ -157,7 +157,7 @@ Vec3 CSelectionGroup::GetCenter() const
|
||||
}
|
||||
if (GetCount() > 0)
|
||||
{
|
||||
c /= GetCount();
|
||||
c /= static_cast<f32>(GetCount());
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ IClassDesc* CClassFactory::FindClass(const char* pClassName) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString name = QString(pClassName).left(pSubClassName - pClassName);
|
||||
QString name = QString(pClassName).left(static_cast<int>(pSubClassName - pClassName));
|
||||
|
||||
return stl::find_in_map(m_nameToClass, name, (IClassDesc*)nullptr);
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ void CPluginManager::RegisterPlugin(QLibrary* dllHandle, IPlugin* pPlugin)
|
||||
entry.hLibrary = dllHandle;
|
||||
entry.pPlugin = pPlugin;
|
||||
m_plugins.push_back(entry);
|
||||
m_uuidPluginMap[m_currentUUID] = pPlugin;
|
||||
m_uuidPluginMap[static_cast<unsigned char>(m_currentUUID)] = pPlugin;
|
||||
++m_currentUUID;
|
||||
}
|
||||
|
||||
|
||||
@@ -661,8 +661,8 @@ bool CComponentEntityObject::HitHelperTest(HitContext& hc)
|
||||
if (IsEntityIconVisible())
|
||||
{
|
||||
const QPoint entityScreenPos = hc.view->WorldToView(GetWorldPos());
|
||||
const float screenPosX = entityScreenPos.x();
|
||||
const float screenPosY = entityScreenPos.y();
|
||||
const float screenPosX = static_cast<float>(entityScreenPos.x());
|
||||
const float screenPosY = static_cast<float>(entityScreenPos.y());
|
||||
const float iconRange = static_cast<float>(s_kIconSize / 2);
|
||||
|
||||
if ((hc.point2d.x() >= screenPosX - iconRange && hc.point2d.x() <= screenPosX + iconRange)
|
||||
|
||||
@@ -626,7 +626,7 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con
|
||||
{
|
||||
view->GetDimensions(&width, &height);
|
||||
}
|
||||
m_contextMenuViewPoint.Set(width / 2, height / 2);
|
||||
m_contextMenuViewPoint.Set(static_cast<float>(width / 2), static_cast<float>(height / 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -998,7 +998,7 @@ void SandboxIntegrationManager::HandleObjectModeSelection(const AZ::Vector2& poi
|
||||
if (m_inObjectPickMode)
|
||||
{
|
||||
CViewport* view = GetIEditor()->GetViewManager()->GetGameViewport();
|
||||
const QPoint viewPoint(point.GetX(), point.GetY());
|
||||
const QPoint viewPoint(static_cast<int>(point.GetX()), static_cast<int>(point.GetY()));
|
||||
|
||||
HitContext hitInfo;
|
||||
hitInfo.view = view;
|
||||
@@ -1440,7 +1440,7 @@ void SandboxIntegrationManager::ContextMenu_NewEntity()
|
||||
// will be created at the origin.
|
||||
if (view)
|
||||
{
|
||||
const QPoint viewPoint(m_contextMenuViewPoint.GetX(), m_contextMenuViewPoint.GetY());
|
||||
const QPoint viewPoint(static_cast<int>(m_contextMenuViewPoint.GetX()), static_cast<int>(m_contextMenuViewPoint.GetY()));
|
||||
worldPosition = view->GetHitLocation(viewPoint);
|
||||
}
|
||||
|
||||
@@ -1630,7 +1630,7 @@ void SandboxIntegrationManager::InstantiateSliceFromAssetId(const AZ::Data::Asse
|
||||
// will be instantiated at the origin.
|
||||
if (view)
|
||||
{
|
||||
const QPoint viewPoint(m_contextMenuViewPoint.GetX(), m_contextMenuViewPoint.GetY());
|
||||
const QPoint viewPoint(static_cast<int>(m_contextMenuViewPoint.GetX()), static_cast<int>(m_contextMenuViewPoint.GetY()));
|
||||
sliceWorldTransform = AZ::Transform::CreateTranslation(LYVec3ToAZVec3(view->SnapToGrid(view->ViewToWorld(viewPoint))));
|
||||
}
|
||||
|
||||
|
||||
@@ -2476,10 +2476,10 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
|
||||
|
||||
auto backgroundBoxRect = option.rect;
|
||||
|
||||
backgroundBoxRect.setX(backgroundBoxRect.x() + 0.5);
|
||||
backgroundBoxRect.setY(backgroundBoxRect.y() + 2.5);
|
||||
backgroundBoxRect.setWidth(backgroundBoxRect.width() - 1.0);
|
||||
backgroundBoxRect.setHeight(backgroundBoxRect.height() - 1.0);
|
||||
backgroundBoxRect.setX(static_cast<int>(backgroundBoxRect.x() + 0.5f));
|
||||
backgroundBoxRect.setY(static_cast<int>(backgroundBoxRect.y() + 2.5f));
|
||||
backgroundBoxRect.setWidth(static_cast<int>(backgroundBoxRect.width() - 1.0f));
|
||||
backgroundBoxRect.setHeight(static_cast<int>(backgroundBoxRect.height() - 1.0f));
|
||||
|
||||
const qreal sliceBorderHeight = 0.8f;
|
||||
|
||||
@@ -2513,7 +2513,7 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
|
||||
else
|
||||
{
|
||||
auto newRect = option.rect;
|
||||
newRect.setHeight(newRect.height() - 1.0);
|
||||
newRect.setHeight(static_cast<int>(newRect.height() - 1.0f));
|
||||
path.addRect(newRect);
|
||||
}
|
||||
|
||||
|
||||
@@ -274,8 +274,8 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const
|
||||
// if the item has children offset the drawn line to compensate for drawn expander buttons
|
||||
bool hasChildren = previousIndex.model()->index(0, 0, previousIndex).isValid();
|
||||
int horizontalLineY = rect.top() + rectHalfHeight;
|
||||
int horizontalLineLeft = rect.right() - indentation() * 1.5f;
|
||||
int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : (lineBaseX - indentation() * 0.5f);
|
||||
int horizontalLineLeft = static_cast<int>(rect.right() - indentation() * 1.5f);
|
||||
int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : static_cast<int>(lineBaseX - indentation() * 0.5f);
|
||||
painter->drawLine(horizontalLineLeft, horizontalLineY, horizontalLineRight, horizontalLineY);
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const
|
||||
bool hasNext = previousIndex.sibling(previousIndex.row() + 1, previousIndex.column()).isValid();
|
||||
if (hasNext || previousIndex == index)
|
||||
{
|
||||
int verticalLineX = lineBaseX - indentation() * 1.5f;
|
||||
int verticalLineX = static_cast<int>(lineBaseX - indentation() * 1.5f);
|
||||
int verticalLineTop = rect.top();
|
||||
int verticalLineBottom = hasNext ? rect.bottom() : rect.bottom() - rectHalfHeight;
|
||||
painter->drawLine(verticalLineX, verticalLineTop, verticalLineX, verticalLineBottom);
|
||||
|
||||
@@ -500,10 +500,10 @@ void AssetImporterWindow::SetTitle(const char* filePath)
|
||||
AZStd::string extension;
|
||||
if (AzFramework::StringFunc::Path::GetExtension(filePath, extension, false))
|
||||
{
|
||||
extension[0] = toupper(extension[0]);
|
||||
extension[0] = static_cast<char>(toupper(extension[0]));
|
||||
for (size_t i = 1; i < extension.size(); ++i)
|
||||
{
|
||||
extension[i] = tolower(extension[i]);
|
||||
extension[i] = static_cast<char>(tolower(extension[i]));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace
|
||||
}
|
||||
else if (pCVar->GetType() == CVAR_FLOAT)
|
||||
{
|
||||
PySetCVarFromFloat(pName, std::stod(pValue));
|
||||
PySetCVarFromFloat(pName, static_cast<float>(std::stod(pValue)));
|
||||
}
|
||||
else if (pCVar->GetType() != CVAR_STRING)
|
||||
{
|
||||
@@ -152,11 +152,11 @@ namespace
|
||||
}
|
||||
else if (pCVar->GetType() == CVAR_INT)
|
||||
{
|
||||
PySetCVarFromInt(pName, AZStd::any_cast<AZ::s64>(value));
|
||||
PySetCVarFromInt(pName, static_cast<int>(AZStd::any_cast<AZ::s64>(value)));
|
||||
}
|
||||
else if (pCVar->GetType() == CVAR_FLOAT)
|
||||
{
|
||||
PySetCVarFromFloat(pName, AZStd::any_cast<double>(value));
|
||||
PySetCVarFromFloat(pName, static_cast<float>(AZStd::any_cast<double>(value)));
|
||||
}
|
||||
else if (pCVar->GetType() == CVAR_STRING)
|
||||
{
|
||||
@@ -548,13 +548,11 @@ namespace
|
||||
if (title.empty())
|
||||
{
|
||||
throw std::runtime_error("Incorrect title argument passed in. ");
|
||||
return result;
|
||||
}
|
||||
|
||||
if (values.size() == 0)
|
||||
{
|
||||
throw std::runtime_error("Empty value list passed in. ");
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList list;
|
||||
|
||||
@@ -31,7 +31,7 @@ int PixmapLabelPreview::heightForWidth(int width) const
|
||||
return width;
|
||||
}
|
||||
|
||||
return ((qreal)m_pixmap.height() * width) / m_pixmap.width();
|
||||
return static_cast<int>(((qreal)m_pixmap.height() * width) / m_pixmap.width());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1102,7 +1102,7 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
|
||||
entityInspectorViewPane->m_dockWidget->setFloating(false);
|
||||
|
||||
static const float tabWidgetWidthPercentage = 0.2f;
|
||||
int newWidth = (float)screenWidth * tabWidgetWidthPercentage;
|
||||
int newWidth = static_cast<int>((float)screenWidth * tabWidgetWidthPercentage);
|
||||
|
||||
if (levelInspectorPane)
|
||||
{
|
||||
@@ -1139,7 +1139,7 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
|
||||
// so that they get an appropriate default width since the minimum sizes have
|
||||
// been removed from these widgets
|
||||
static const float entityOutlinerWidthPercentage = 0.15f;
|
||||
int newWidth = (float)screenWidth * entityOutlinerWidthPercentage;
|
||||
int newWidth = static_cast<int>((float)screenWidth * entityOutlinerWidthPercentage);
|
||||
m_mainWindow->resizeDocks({ entityOutlinerViewPane->m_dockWidget }, { newWidth }, Qt::Horizontal);
|
||||
}
|
||||
|
||||
|
||||
@@ -394,7 +394,7 @@ void SEditorSettings::LoadValue(const char* sSection, const char* sKey, float& v
|
||||
{
|
||||
const SettingsGroup sg(sSection);
|
||||
const QString defaultVal = s_editorSettings()->value(sKey, QString::number(value)).toString();
|
||||
value = defaultVal.toDouble();
|
||||
value = defaultVal.toFloat();
|
||||
|
||||
if (GetIEditor()->GetSettingsManager())
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ void CToolBoxCommand::Execute() const
|
||||
// Toggle the variable.
|
||||
float val = GetIEditor()->GetConsoleVar(m_text.toUtf8().data());
|
||||
bool bOn = val != 0;
|
||||
GetIEditor()->SetConsoleVar(m_text.toUtf8().data(), (bOn) ? 0 : 1);
|
||||
GetIEditor()->SetConsoleVar(m_text.toUtf8().data(), (bOn) ? 0.0f : 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -186,7 +186,6 @@ const CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox) const
|
||||
assert(0 <= iIndex && iIndex < m_shelveMacros.size());
|
||||
return m_shelveMacros[iIndex];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -202,7 +201,6 @@ CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox)
|
||||
assert(0 <= iIndex && iIndex < m_shelveMacros.size());
|
||||
return m_shelveMacros[iIndex];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -275,7 +273,6 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in
|
||||
m_shelveMacros.push_back(pNewTool);
|
||||
return pNewTool;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -93,7 +93,7 @@ static void UpdateAtomOutputFrameCaptureView(TrackView::AtomOutputFrameCapture&
|
||||
const AZ::EntityId activeCameraEntityId = TrackView::ActiveCameraEntityId();
|
||||
atomOutputFrameCapture.UpdateView(
|
||||
TrackView::TransformFromEntityId(activeCameraEntityId),
|
||||
TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, width, height));
|
||||
TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, static_cast<float>(width), static_cast<float>(height)));
|
||||
}
|
||||
|
||||
CSequenceBatchRenderDialog::CSequenceBatchRenderDialog(float fps, QWidget* pParent /* = nullptr */)
|
||||
@@ -170,10 +170,10 @@ void CSequenceBatchRenderDialog::OnInitDialog()
|
||||
connect(m_ui->m_endFrame, editingFinished, this, &CSequenceBatchRenderDialog::OnEndFrameChange);
|
||||
connect(m_ui->m_imageFormatCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &CSequenceBatchRenderDialog::OnImageFormatChange);
|
||||
|
||||
const float bigEnoughNumber = 1000000.0f;
|
||||
m_ui->m_startFrame->setRange(0.0f, bigEnoughNumber);
|
||||
const int bigEnoughNumber = 1000000;
|
||||
m_ui->m_startFrame->setRange(0, bigEnoughNumber);
|
||||
|
||||
m_ui->m_endFrame->setRange(0.0f, bigEnoughNumber);
|
||||
m_ui->m_endFrame->setRange(0, bigEnoughNumber);
|
||||
|
||||
// Fill the sequence combo box.
|
||||
bool activeSequenceWasSet = false;
|
||||
@@ -301,8 +301,8 @@ void CSequenceBatchRenderDialog::OnRenderItemSelChange()
|
||||
}
|
||||
}
|
||||
// frame range
|
||||
m_ui->m_startFrame->setValue(item.frameRange.start * m_fpsForTimeToFrameConversion);
|
||||
m_ui->m_endFrame->setValue(item.frameRange.end * m_fpsForTimeToFrameConversion);
|
||||
m_ui->m_startFrame->setValue(static_cast<int>(item.frameRange.start * m_fpsForTimeToFrameConversion));
|
||||
m_ui->m_endFrame->setValue(static_cast<int>(item.frameRange.end * m_fpsForTimeToFrameConversion));
|
||||
// folder
|
||||
m_ui->m_destinationEdit->setText(item.folder);
|
||||
// fps
|
||||
@@ -580,12 +580,12 @@ void CSequenceBatchRenderDialog::OnSequenceSelected()
|
||||
// Adjust the frame range.
|
||||
float sFrame = pSequence->GetTimeRange().start * m_fpsForTimeToFrameConversion;
|
||||
float eFrame = pSequence->GetTimeRange().end * m_fpsForTimeToFrameConversion;
|
||||
m_ui->m_startFrame->setRange(0.0f, eFrame);
|
||||
m_ui->m_endFrame->setRange(0.0f, eFrame);
|
||||
m_ui->m_startFrame->setRange(0, static_cast<int>(eFrame));
|
||||
m_ui->m_endFrame->setRange(0, static_cast<int>(eFrame));
|
||||
|
||||
// Set the default start/end frames properly.
|
||||
m_ui->m_startFrame->setValue(sFrame);
|
||||
m_ui->m_endFrame->setValue(eFrame);
|
||||
m_ui->m_startFrame->setValue(static_cast<int>(sFrame));
|
||||
m_ui->m_endFrame->setValue(static_cast<int>(eFrame));
|
||||
|
||||
m_ui->m_shotCombo->clear();
|
||||
// Fill the shot combo box with the names of director nodes.
|
||||
|
||||
@@ -367,7 +367,7 @@ bool CTVCustomizeTrackColorsDlg::Import(const QString& fullPath)
|
||||
{
|
||||
return entry.paramType == paramType;
|
||||
});
|
||||
int entryIndex = pEntry - g_trackEntries;
|
||||
int entryIndex = static_cast<int>(pEntry - g_trackEntries);
|
||||
if (entryIndex >= arraysize(g_trackEntries)) // If not found, skip this.
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -106,8 +106,8 @@ void CTVSequenceProps::MoveScaleKeys()
|
||||
// Move/Rescale the sequence to a new time range.
|
||||
Range timeRangeOld = m_pSequence->GetTimeRange();
|
||||
Range timeRangeNew;
|
||||
timeRangeNew.start = ui->START_TIME->value();
|
||||
timeRangeNew.end = ui->END_TIME->value();
|
||||
timeRangeNew.start = static_cast<float>(ui->START_TIME->value());
|
||||
timeRangeNew.end = static_cast<float>(ui->END_TIME->value());
|
||||
|
||||
if (!(timeRangeNew == timeRangeOld))
|
||||
{
|
||||
@@ -123,14 +123,14 @@ void CTVSequenceProps::UpdateSequenceProps(const QString& name)
|
||||
}
|
||||
|
||||
Range timeRange;
|
||||
timeRange.start = ui->START_TIME->value();
|
||||
timeRange.end = ui->END_TIME->value();
|
||||
timeRange.start = static_cast<float>(ui->START_TIME->value());
|
||||
timeRange.end = static_cast<float>(ui->END_TIME->value());
|
||||
|
||||
if (m_timeUnit == Frames)
|
||||
{
|
||||
float invFPS = 1.0f / m_FPS;
|
||||
timeRange.start = ui->START_TIME->value() * invFPS;
|
||||
timeRange.end = ui->END_TIME->value() * invFPS;
|
||||
timeRange.start = static_cast<float>(ui->START_TIME->value()) * invFPS;
|
||||
timeRange.end = static_cast<float>(ui->END_TIME->value()) * invFPS;
|
||||
}
|
||||
|
||||
m_pSequence->SetTimeRange(timeRange);
|
||||
|
||||
@@ -1765,7 +1765,7 @@ void CTrackViewDialog::OnSnapFPS()
|
||||
if (ok)
|
||||
{
|
||||
m_wndDopeSheet->SetSnapFPS(fps);
|
||||
m_wndCurveEditor->SetFPS(fps);
|
||||
m_wndCurveEditor->SetFPS(static_cast<float>(fps));
|
||||
|
||||
SetCursorPosText(GetIEditor()->GetAnimation()->GetTime());
|
||||
}
|
||||
@@ -1828,7 +1828,7 @@ void CTrackViewDialog::ReadMiscSettings()
|
||||
|
||||
if (settings.contains(s_kFrameSnappingFPSEntry))
|
||||
{
|
||||
float fps = settings.value(s_kFrameSnappingFPSEntry).toDouble();
|
||||
float fps = settings.value(s_kFrameSnappingFPSEntry).toFloat();
|
||||
if (fps >= s_kMinimumFrameSnappingFPS && fps <= s_kMaximumFrameSnappingFPS)
|
||||
{
|
||||
m_wndDopeSheet->SetSnapFPS(FloatToIntRet(fps));
|
||||
|
||||
@@ -146,8 +146,7 @@ CTrackViewDopeSheetBase::~CTrackViewDopeSheetBase()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CTrackViewDopeSheetBase::TimeToClient(float time) const
|
||||
{
|
||||
int x = m_leftOffset - m_scrollOffset.x() + (time * m_timeScale);
|
||||
return x;
|
||||
return static_cast<int>(m_leftOffset - m_scrollOffset.x() + (time * m_timeScale));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -193,7 +192,7 @@ void CTrackViewDopeSheetBase::SetTimeRange(float start, float end)
|
||||
|
||||
m_timeRange.Set(start, end);
|
||||
|
||||
SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale - m_leftOffset);
|
||||
SetHorizontalExtent(-m_leftOffset, static_cast<int>(m_timeRange.end * m_timeScale - m_leftOffset));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -263,7 +262,7 @@ void CTrackViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime)
|
||||
|
||||
update();
|
||||
|
||||
SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale);
|
||||
SetHorizontalExtent(-m_leftOffset, static_cast<int>(m_timeRange.end * m_timeScale));
|
||||
|
||||
ComputeFrameSteps(GetVisibleRange());
|
||||
|
||||
@@ -353,15 +352,15 @@ float CTrackViewDopeSheetBase::TickSnap(float time) const
|
||||
double tickTime = GetTickTime();
|
||||
double t = floor(((double)time / tickTime) + 0.5);
|
||||
t *= tickTime;
|
||||
return t;
|
||||
return static_cast<float>(t);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
float CTrackViewDopeSheetBase::TimeFromPoint(const QPoint& point) const
|
||||
{
|
||||
int x = point.x() - m_leftOffset + m_scrollOffset.x();
|
||||
double t = (double)x / m_timeScale;
|
||||
return (float)TickSnap(t);
|
||||
float t = static_cast<float>(x) / m_timeScale;
|
||||
return TickSnap(t);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -369,7 +368,7 @@ float CTrackViewDopeSheetBase::TimeFromPointUnsnapped(const QPoint& point) const
|
||||
{
|
||||
int x = point.x() - m_leftOffset + m_scrollOffset.x();
|
||||
double t = (double)x / m_timeScale;
|
||||
return t;
|
||||
return static_cast<float>(t);
|
||||
}
|
||||
|
||||
void CTrackViewDopeSheetBase::mousePressEvent(QMouseEvent* event)
|
||||
@@ -1783,7 +1782,7 @@ float CTrackViewDopeSheetBase::FrameSnap(float time) const
|
||||
{
|
||||
double t = floor((double)time / m_snapFrameTime + 0.5);
|
||||
t = t * m_snapFrameTime;
|
||||
return t;
|
||||
return static_cast<float>(t);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -2003,9 +2002,10 @@ bool CTrackViewDopeSheetBase::CreateColorKey(CTrackViewTrack* pTrack, float keyT
|
||||
Vec3 vColor(0, 0, 0);
|
||||
pTrack->GetValue(keyTime, vColor);
|
||||
|
||||
const AZ::Color defaultColor(clamp_tpl<AZ::u8>(FloatToIntRet(vColor.x), 0, 255),
|
||||
clamp_tpl<AZ::u8>(FloatToIntRet(vColor.y), 0, 255),
|
||||
clamp_tpl<AZ::u8>(FloatToIntRet(vColor.z), 0, 255),
|
||||
const AZ::Color defaultColor(
|
||||
clamp_tpl<AZ::u8>(static_cast<AZ::u8>(FloatToIntRet(vColor.x)), 0, 255),
|
||||
clamp_tpl<AZ::u8>(static_cast<AZ::u8>(FloatToIntRet(vColor.y)), 0, 255),
|
||||
clamp_tpl<AZ::u8>(static_cast<AZ::u8>(FloatToIntRet(vColor.z)), 0, 255),
|
||||
255);
|
||||
AzQtComponents::ColorPicker dlg(AzQtComponents::ColorPicker::Configuration::RGB, QString(), this);
|
||||
dlg.setWindowTitle(tr("Select Color"));
|
||||
@@ -2054,7 +2054,7 @@ void CTrackViewDopeSheetBase::OnCurrentColorChange(const AZ::Color& color)
|
||||
|
||||
void CTrackViewDopeSheetBase::UpdateColorKey(const QColor& color, bool addToUndo)
|
||||
{
|
||||
ColorF colArray(color.red(), color.green(), color.blue(), color.alpha());
|
||||
ColorF colArray(static_cast<f32>(color.redF()), static_cast<f32>(color.greenF()), static_cast<f32>(color.blueF()), static_cast<f32>(color.alphaF()));
|
||||
|
||||
CTrackViewSequence* sequence = m_colorUpdateTrack->GetSequence();
|
||||
if (nullptr != sequence)
|
||||
@@ -2119,9 +2119,10 @@ void CTrackViewDopeSheetBase::EditSelectedColorKey(CTrackViewTrack* pTrack)
|
||||
Vec3 color;
|
||||
pTrack->GetValue(m_colorUpdateKeyTime, color);
|
||||
|
||||
const AZ::Color defaultColor(clamp_tpl<AZ::u8>(FloatToIntRet(color.x), 0, 255),
|
||||
clamp_tpl<AZ::u8>(FloatToIntRet(color.y), 0, 255),
|
||||
clamp_tpl<AZ::u8>(FloatToIntRet(color.z), 0, 255),
|
||||
const AZ::Color defaultColor(
|
||||
clamp_tpl(static_cast<AZ::u8>(FloatToIntRet(color.x)), AZ::u8(0), AZ::u8(255)),
|
||||
clamp_tpl(static_cast<AZ::u8>(FloatToIntRet(color.y)), AZ::u8(0), AZ::u8(255)),
|
||||
clamp_tpl(static_cast<AZ::u8>(FloatToIntRet(color.z)), AZ::u8(0), AZ::u8(255)),
|
||||
255);
|
||||
|
||||
AzQtComponents::ColorPicker picker(AzQtComponents::ColorPicker::Configuration::RGB);
|
||||
@@ -2369,12 +2370,12 @@ void CTrackViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Rang
|
||||
nNumberTicks = 8;
|
||||
}
|
||||
|
||||
double start = TickSnap(timeRange.start);
|
||||
double step = 1.0 / m_ticksStep;
|
||||
float start = TickSnap(timeRange.start);
|
||||
float step = 1.0f / static_cast<float>(m_ticksStep);
|
||||
|
||||
for (double t = 0.0f; t <= timeRange.end + step; t += step)
|
||||
for (float t = 0.0f; t <= timeRange.end + step; t += step)
|
||||
{
|
||||
double st = TickSnap(t);
|
||||
float st = TickSnap(t);
|
||||
if (st > timeRange.end)
|
||||
{
|
||||
st = timeRange.end;
|
||||
@@ -2393,7 +2394,7 @@ void CTrackViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Rang
|
||||
continue;
|
||||
}
|
||||
|
||||
int k = RoundFloatToInt(st * m_ticksStep);
|
||||
int k = RoundFloatToInt(st * static_cast<float>(m_ticksStep));
|
||||
if (k % nNumberTicks == 0)
|
||||
{
|
||||
if (st >= start)
|
||||
@@ -3218,7 +3219,7 @@ void CTrackViewDopeSheetBase::ComputeFrameSteps(const Range& visRange)
|
||||
float nBIntermediateTicks = 5;
|
||||
m_fFrameLabelStep = fFact * afStepTable[nStepIdx];
|
||||
|
||||
if (TimeToClient(m_fFrameLabelStep) - TimeToClient(0) > 1300)
|
||||
if (TimeToClient(static_cast<float>(m_fFrameLabelStep)) - TimeToClient(0.0f) > 1300)
|
||||
{
|
||||
nBIntermediateTicks = 10;
|
||||
}
|
||||
@@ -3230,7 +3231,7 @@ void CTrackViewDopeSheetBase::ComputeFrameSteps(const Range& visRange)
|
||||
void CTrackViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRect& rc, [[maybe_unused]] const QColor& lineCol, const QColor& textCol, [[maybe_unused]] double step)
|
||||
{
|
||||
float fFramesPerSec = 1.0f / m_snapFrameTime;
|
||||
float fInvFrameLabelStep = 1.0f / m_fFrameLabelStep;
|
||||
float fInvFrameLabelStep = 1.0f / static_cast<float>(m_fFrameLabelStep);
|
||||
Range VisRange = GetVisibleRange();
|
||||
|
||||
const Range& timeRange = m_timeRange;
|
||||
@@ -3238,9 +3239,9 @@ void CTrackViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRec
|
||||
const QPen ltgray(QColor(90, 90, 90));
|
||||
const QPen black(textCol);
|
||||
|
||||
for (double t = TickSnap(timeRange.start); t <= timeRange.end + m_fFrameTickStep; t += m_fFrameTickStep)
|
||||
for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast<float>(m_fFrameTickStep); t += static_cast<float>(m_fFrameTickStep))
|
||||
{
|
||||
double st = t;
|
||||
float st = t;
|
||||
if (st > timeRange.end)
|
||||
{
|
||||
st = timeRange.end;
|
||||
@@ -3285,9 +3286,9 @@ void CTrackViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QRe
|
||||
const QPen ltgray(QColor(90, 90, 90));
|
||||
const QPen black(textCol);
|
||||
|
||||
for (double t = TickSnap(timeRange.start); t <= timeRange.end + step; t += step)
|
||||
for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast<float>(step); t += static_cast<float>(step))
|
||||
{
|
||||
double st = TickSnap(t);
|
||||
float st = TickSnap(t);
|
||||
if (st > timeRange.end)
|
||||
{
|
||||
st = timeRange.end;
|
||||
@@ -3306,7 +3307,7 @@ void CTrackViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QRe
|
||||
}
|
||||
int x = TimeToClient(st);
|
||||
|
||||
int k = RoundFloatToInt(st * m_ticksStep);
|
||||
int k = RoundFloatToInt(st * static_cast<float>(m_ticksStep));
|
||||
if (k % nNumberTicks == 0)
|
||||
{
|
||||
painter->setPen(black);
|
||||
|
||||
@@ -1419,7 +1419,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point)
|
||||
{
|
||||
if (animNode)
|
||||
{
|
||||
UINT_PTR menuId = cmd - eMI_AddTrackBase;
|
||||
unsigned int menuId = cmd - eMI_AddTrackBase;
|
||||
|
||||
if (animNode->GetType() != AnimNodeType::AzEntity)
|
||||
{
|
||||
|
||||
@@ -158,11 +158,11 @@ static Quatern Qt_FromMatrix(HMatrix mat)
|
||||
if (tr >= 0.0)
|
||||
{
|
||||
s = sqrt(tr + mat[W][W]);
|
||||
qu.w = s * 0.5;
|
||||
qu.w = static_cast<float>(s * 0.5);
|
||||
s = 0.5 / s;
|
||||
qu.x = (mat[Z][Y] - mat[Y][Z]) * s;
|
||||
qu.y = (mat[X][Z] - mat[Z][X]) * s;
|
||||
qu.z = (mat[Y][X] - mat[X][Y]) * s;
|
||||
qu.x = static_cast<float>((mat[Z][Y] - mat[Y][Z]) * s);
|
||||
qu.y = static_cast<float>((mat[X][Z] - mat[Z][X]) * s);
|
||||
qu.z = static_cast<float>((mat[Y][X] - mat[X][Y]) * s);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -180,11 +180,11 @@ static Quatern Qt_FromMatrix(HMatrix mat)
|
||||
#define caseMacro(i, j, k, I, J, K) \
|
||||
case I: \
|
||||
s = sqrt((mat[I][I] - (mat[J][J] + mat[K][K])) + mat[W][W]); \
|
||||
qu.i = s * 0.5; \
|
||||
qu.i = static_cast<float>(s * 0.5); \
|
||||
s = 0.5 / s; \
|
||||
qu.j = (mat[I][J] + mat[J][I]) * s; \
|
||||
qu.k = (mat[K][I] + mat[I][K]) * s; \
|
||||
qu.w = (mat[K][J] - mat[J][K]) * s; \
|
||||
qu.j = static_cast<float>((mat[I][J] + mat[J][I]) * s); \
|
||||
qu.k = static_cast<float>((mat[K][I] + mat[I][K]) * s); \
|
||||
qu.w = static_cast<float>((mat[K][J] - mat[J][K]) * s); \
|
||||
break
|
||||
caseMacro(x, y, z, X, Y, Z);
|
||||
caseMacro(y, z, x, Y, Z, X);
|
||||
@@ -263,7 +263,7 @@ static void make_reflector(float* v, float* u)
|
||||
u[0] = v[0];
|
||||
u[1] = v[1];
|
||||
u[2] = v[2] + ((v[2] < 0.0) ? -s : s);
|
||||
s = sqrt(2.0 / vdot(u, u));
|
||||
s = static_cast<float>(sqrt(2.0f / vdot(u, u)));
|
||||
u[0] = u[0] * s;
|
||||
u[1] = u[1] * s;
|
||||
u[2] = u[2] * s;
|
||||
@@ -407,8 +407,8 @@ float polar_decomp(HMatrix M, HMatrix Q, HMatrix S)
|
||||
MadjT_one = norm_one(MadjTk);
|
||||
MadjT_inf = norm_inf(MadjTk);
|
||||
gamma = sqrt(sqrt((MadjT_one * MadjT_inf) / (M_one * M_inf)) / fabs(det));
|
||||
g1 = gamma * 0.5;
|
||||
g2 = 0.5 / (gamma * det);
|
||||
g1 = gamma * 0.5f;
|
||||
g2 = 0.5f / (gamma * det);
|
||||
mat_copy(Ek, =, Mk, 3);
|
||||
mat_binop(Mk, =, g1 * Mk, +, g2 * MadjTk, 3);
|
||||
mat_copy(Ek, -=, Mk, 3);
|
||||
@@ -424,7 +424,7 @@ float polar_decomp(HMatrix M, HMatrix Q, HMatrix S)
|
||||
{
|
||||
for (int j = i; j < 3; j++)
|
||||
{
|
||||
S[i][j] = S[j][i] = 0.5 * (S[i][j] + S[j][i]);
|
||||
S[i][j] = S[j][i] = 0.5f * (S[i][j] + S[j][i]);
|
||||
}
|
||||
}
|
||||
return (det);
|
||||
@@ -454,7 +454,7 @@ HVect spect_decomp(HMatrix S, HMatrix U)
|
||||
OffD[Z] = S[X][Y];
|
||||
for (sweep = 20; sweep > 0; sweep--)
|
||||
{
|
||||
float sm = fabs(OffD[X]) + fabs(OffD[Y]) + fabs(OffD[Z]);
|
||||
float sm = static_cast<float>(fabs(OffD[X]) + fabs(OffD[Y]) + fabs(OffD[Z]));
|
||||
if (sm == 0.0)
|
||||
{
|
||||
break;
|
||||
@@ -496,16 +496,16 @@ HVect spect_decomp(HMatrix S, HMatrix U)
|
||||
{
|
||||
a = U[j][p];
|
||||
b = U[j][q];
|
||||
U[j][p] -= s * (b + tau * a);
|
||||
U[j][q] += s * (a - tau * b);
|
||||
U[j][p] -= static_cast<float>(s * (b + tau * a));
|
||||
U[j][q] += static_cast<float>(s * (a - tau * b));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
kv.x = Diag[X];
|
||||
kv.y = Diag[Y];
|
||||
kv.z = Diag[Z];
|
||||
kv.w = 1.0;
|
||||
kv.x = static_cast<float>(Diag[X]);
|
||||
kv.y = static_cast<float>(Diag[Y]);
|
||||
kv.z = static_cast<float>(Diag[Z]);
|
||||
kv.w = 1.0f;
|
||||
return (kv);
|
||||
}
|
||||
|
||||
@@ -650,7 +650,7 @@ Quatern snuggle(Quatern q, HVect* k)
|
||||
}
|
||||
qp = Qt_Mul(q, p);
|
||||
t = sqrt(mag[win] + 0.5);
|
||||
p = Qt_Mul(p, Qt_(0.0, 0.0, -qp.z / t, qp.w / t));
|
||||
p = Qt_Mul(p, Qt_(0.0f, 0.0f, static_cast<float>(-qp.z / t), static_cast<float>(qp.w / t)));
|
||||
p = Qt_Mul(qtoz, Qt_Conj(p));
|
||||
}
|
||||
else
|
||||
@@ -721,14 +721,14 @@ Quatern snuggle(Quatern q, HVect* k)
|
||||
int ii;
|
||||
for (ii = 0; ii < 4; ii++)
|
||||
{
|
||||
pa[ii] = sgn(neg[ii], 0.5);
|
||||
pa[ii] = static_cast<float>(sgn(neg[ii], 0.5f));
|
||||
}
|
||||
}
|
||||
cycle(ka, par)
|
||||
}
|
||||
else
|
||||
{ /*big*/
|
||||
pa[hi] = sgn(neg[hi], 1.0);
|
||||
pa[hi] = static_cast<float>(sgn(neg[hi], 1.0f));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -752,7 +752,7 @@ Quatern snuggle(Quatern q, HVect* k)
|
||||
}
|
||||
else
|
||||
{ /*big*/
|
||||
pa[hi] = sgn(neg[hi], 1.0);
|
||||
pa[hi] = static_cast<float>(sgn(neg[hi], 1.0f));
|
||||
}
|
||||
}
|
||||
p.x = -pa[0];
|
||||
|
||||
@@ -455,7 +455,7 @@ bool CFileUtil::ExtractDccFilenameUsingNamingConventions(const QString& assetFil
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CFileUtil::FormatFilterString(QString& filter)
|
||||
{
|
||||
const int numPipeChars = std::count(filter.begin(), filter.end(), '|');
|
||||
const int numPipeChars = static_cast<int>(std::count(filter.begin(), filter.end(), '|'));
|
||||
if (numPipeChars == 1)
|
||||
{
|
||||
filter = QStringLiteral("%1||").arg(filter);
|
||||
|
||||
@@ -15,43 +15,6 @@
|
||||
#include <QPainter>
|
||||
#include <QMessageBox>
|
||||
|
||||
bool ComputeThumbsLayoutInfo(float aContainerWidth, float aThumbWidth, float aMargin, UINT aThumbCount, UINT& rThumbsPerRow, float& rNewMargin)
|
||||
{
|
||||
rThumbsPerRow = 0;
|
||||
rNewMargin = 0;
|
||||
|
||||
if (aThumbWidth <= 0 || aMargin <= 0 || (aThumbWidth + aMargin * 2) <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aContainerWidth <= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
rThumbsPerRow = (int) aContainerWidth / (aThumbWidth + aMargin * 2);
|
||||
|
||||
if ((aThumbWidth + aMargin * 2) * aThumbCount < aContainerWidth)
|
||||
{
|
||||
rNewMargin = aMargin;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rThumbsPerRow > 0)
|
||||
{
|
||||
rNewMargin = (aContainerWidth - rThumbsPerRow * aThumbWidth);
|
||||
|
||||
if (rNewMargin > 0)
|
||||
{
|
||||
rNewMargin = (float)rNewMargin / rThumbsPerRow / 2.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QColor ScaleColor(const QColor& c, float aScale)
|
||||
{
|
||||
QColor aColor = c;
|
||||
|
||||
@@ -14,16 +14,6 @@
|
||||
#define CRYINCLUDE_EDITOR_UTIL_GDIUTIL_H
|
||||
#pragma once
|
||||
|
||||
//! function used to compute thumbs per row and spacing, used in asset browser and other tools where thumb layout is needed and maybe GDI canvas used
|
||||
//! \param aContainerWidth the thumbs' container width
|
||||
//! \param aThumbWidth the thumb image width
|
||||
//! \param aMargin the thumb default minimum horizontal margin
|
||||
//! \param aThumbCount the thumb count
|
||||
//! \param rThumbsPerRow returned thumb count per single row
|
||||
//! \param rNewMargin returned new computed margin between thumbs
|
||||
//! \note The margin between thumbs will grow/shrink dynamically to keep up with the thumb count per row
|
||||
bool ComputeThumbsLayoutInfo(float aContainerWidth, float aThumbWidth, float aMargin, UINT aThumbCount, UINT& rThumbsPerRow, float& rNewMargin);
|
||||
|
||||
QColor ScaleColor(const QColor& coor, float aScale);
|
||||
|
||||
//! This class loads alpha-channel bitmaps and holds a DC for use with AlphaBlend function
|
||||
|
||||
@@ -132,7 +132,7 @@ bool CImageASC::Load(const QString& fileName, CFloatImage& image)
|
||||
token = azstrtok(nullptr, 0, seps, &nextToken);
|
||||
validData = validData && (azstricmp(token, "nodata_value") == 0);
|
||||
token = azstrtok(nullptr, 0, seps, &nextToken);
|
||||
nodataValue = atof(token);
|
||||
nodataValue = static_cast<float>(atof(token));
|
||||
|
||||
if (!validData)
|
||||
{
|
||||
@@ -157,7 +157,7 @@ bool CImageASC::Load(const QString& fileName, CFloatImage& image)
|
||||
if (token != nullptr)
|
||||
{
|
||||
// Negative heights aren't supported, clamp to 0.
|
||||
pixelValue = max(0.0, atof(token));
|
||||
pixelValue = max<float>(0.0f, static_cast<float>(atof(token)));
|
||||
|
||||
// If this is a location we specifically don't have data for, set it to 0.
|
||||
if (pixelValue == nodataValue)
|
||||
|
||||
@@ -411,7 +411,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage)
|
||||
FreeCode = FirstFree;
|
||||
CurCode = OldCode = Code = ReadCode();
|
||||
FinChar = CurCode & BitMask;
|
||||
AddToPixel (FinChar);
|
||||
AddToPixel(static_cast<uint8>(FinChar));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -455,7 +455,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage)
|
||||
|
||||
for (i = OutCount - 1; i >= 0; i--)
|
||||
{
|
||||
AddToPixel (OutCode[i]);
|
||||
AddToPixel(static_cast<uint8>(OutCode[i]));
|
||||
}
|
||||
OutCount = 0;
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
b.resize((compsize + 1) << 3);
|
||||
out = (char*)b.m_bits;
|
||||
in = (char*)m_bits;
|
||||
*out++ = bsize;
|
||||
*out++ = static_cast<char>(bsize);
|
||||
for (i = 0; i < bsize; i++)
|
||||
{
|
||||
*out++ = in[i];
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
}
|
||||
}
|
||||
i--;
|
||||
*out++ = countz;
|
||||
*out++ = static_cast<char>(countz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ namespace
|
||||
if (viewPane && viewPane->GetViewport())
|
||||
{
|
||||
const QRect rcViewport = viewPane->GetViewport()->rect();
|
||||
return AZ::Vector2(rcViewport.width(), rcViewport.height());
|
||||
return AZ::Vector2(static_cast<float>(rcViewport.width()), static_cast<float>(rcViewport.height()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -419,7 +419,7 @@ void QtViewport::Update()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QPoint QtViewport::WorldToView(const Vec3& wp) const
|
||||
{
|
||||
return QPoint(wp.x, wp.y);
|
||||
return QPoint(static_cast<int>(wp.x), static_cast<int>(wp.y));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -427,8 +427,8 @@ Vec3 QtViewport::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nFlags) cons
|
||||
{
|
||||
QPoint p = WorldToView(wp);
|
||||
Vec3 out;
|
||||
out.x = p.x();
|
||||
out.y = p.y();
|
||||
out.x = static_cast<f32>(p.x());
|
||||
out.y = static_cast<f32>(p.y());
|
||||
out.z = wp.z;
|
||||
return out;
|
||||
}
|
||||
@@ -437,8 +437,8 @@ Vec3 QtViewport::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nFlags) cons
|
||||
Vec3 QtViewport::ViewToWorld(const QPoint& vp, bool* pCollideWithTerrain, [[maybe_unused]] bool onlyTerrain, [[maybe_unused]] bool bSkipVegetation, [[maybe_unused]] bool bTestRenderMesh, [[maybe_unused]] bool* collideWithObject) const
|
||||
{
|
||||
Vec3 wp;
|
||||
wp.x = vp.x();
|
||||
wp.y = vp.y();
|
||||
wp.x = static_cast<f32>(vp.x());
|
||||
wp.y = static_cast<f32>(vp.y());
|
||||
wp.z = 0;
|
||||
if (pCollideWithTerrain)
|
||||
{
|
||||
@@ -520,7 +520,7 @@ void QtViewport::mouseMoveEvent(QMouseEvent* event)
|
||||
|
||||
void QtViewport::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
OnMouseWheel(event->modifiers(), event->angleDelta().y(), event->position().toPoint());
|
||||
OnMouseWheel(event->modifiers(), static_cast<short>(event->angleDelta().y()), event->position().toPoint());
|
||||
event->accept();
|
||||
}
|
||||
|
||||
@@ -1276,9 +1276,9 @@ float QtViewport::GetDistanceToLine(const Vec3& lineP1, const Vec3& lineP2, cons
|
||||
QPoint p2 = WorldToView(lineP2);
|
||||
|
||||
return PointToLineDistance2D(
|
||||
Vec3(p1.x(), p1.y(), 0),
|
||||
Vec3(p2.x(), p2.y(), 0),
|
||||
Vec3(point.x(), point.y(), 0));
|
||||
Vec3(static_cast<f32>(p1.x()), static_cast<f32>(p1.y()), 0.0f),
|
||||
Vec3(static_cast<f32>(p2.x()), static_cast<f32>(p2.y()), 0.0f),
|
||||
Vec3(static_cast<f32>(point.x()), static_cast<f32>(point.y()), 0.0f));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -306,7 +306,7 @@ void CViewportTitleDlg::OnInitDialog()
|
||||
AZ::VR::VREventBus::Handler::BusConnect();
|
||||
|
||||
QFontMetrics metrics({});
|
||||
int width = metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier;
|
||||
int width = static_cast<int>(metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier);
|
||||
|
||||
m_cameraSpeed->setFixedWidth(width);
|
||||
|
||||
@@ -457,7 +457,7 @@ void CViewportTitleDlg::AddFOVMenus(QMenu* menu, std::function<void(float)> call
|
||||
|
||||
float fov = gSettings.viewports.fDefaultFov;
|
||||
bool ok;
|
||||
float f = customPreset.toDouble(&ok);
|
||||
float f = customPreset.toFloat(&ok);
|
||||
if (ok)
|
||||
{
|
||||
fov = std::max(1.0f, f);
|
||||
@@ -477,7 +477,7 @@ void CViewportTitleDlg::OnMenuFOVCustom()
|
||||
|
||||
if (ok)
|
||||
{
|
||||
m_pViewPane->SetViewportFOV(fov);
|
||||
m_pViewPane->SetViewportFOV(static_cast<float>(fov));
|
||||
|
||||
// Update the custom presets.
|
||||
const QString text = QString::number(fov);
|
||||
@@ -973,12 +973,12 @@ void CViewportTitleDlg::OnAngleSnappingToggled()
|
||||
|
||||
void CViewportTitleDlg::OnGridSpinBoxChanged(double value)
|
||||
{
|
||||
SandboxEditor::SetGridSnappingSize(value);
|
||||
SandboxEditor::SetGridSnappingSize(static_cast<float>(value));
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::OnAngleSpinBoxChanged(double value)
|
||||
{
|
||||
SandboxEditor::SetAngleSnappingSize(value);
|
||||
SandboxEditor::SetAngleSnappingSize(static_cast<float>(value));
|
||||
}
|
||||
|
||||
void CViewportTitleDlg::UpdateOverFlowMenuState()
|
||||
|
||||
Reference in New Issue
Block a user