Code/Editor
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user