mirror of
https://github.com/microsoft/UVAtlas
synced 2024-11-08 21:30:05 +00:00
Fixed -Wimplicit-int-float-conversion
This commit is contained in:
parent
2685ba9175
commit
0932faac93
@ -988,16 +988,16 @@ namespace
|
||||
if (v > 1.f)
|
||||
v = 1.f;
|
||||
|
||||
u = u * pTexDesc->uWidth;
|
||||
v = v * pTexDesc->uHeight;
|
||||
u = u * float(pTexDesc->uWidth);
|
||||
v = v * float(pTexDesc->uHeight);
|
||||
|
||||
int i = int(u);
|
||||
int j = int(v);
|
||||
int i2 = i + 1;
|
||||
int j2 = j + 1;
|
||||
|
||||
float du = u - i;
|
||||
float dv = v - j;
|
||||
float du = u - float(i);
|
||||
float dv = v - float(j);
|
||||
|
||||
i = std::max(0, std::min<int>(i, int(pTexDesc->uWidth) - 1));
|
||||
i2 = std::max(0, std::min<int>(i2, int(pTexDesc->uWidth) - 1));
|
||||
@ -1048,16 +1048,16 @@ namespace
|
||||
if (v > 1.f)
|
||||
v = 1.f;
|
||||
|
||||
u = u * pTexDesc->uWidth;
|
||||
v = v * pTexDesc->uHeight;
|
||||
u = u * float(pTexDesc->uWidth);
|
||||
v = v * float(pTexDesc->uHeight);
|
||||
|
||||
int i = int(u);
|
||||
int j = int(v);
|
||||
int i2 = i + 1;
|
||||
int j2 = j + 1;
|
||||
|
||||
float du = u - i;
|
||||
float dv = v - j;
|
||||
float du = u - float(i);
|
||||
float dv = v - float(j);
|
||||
|
||||
i = i % int(pTexDesc->uWidth);
|
||||
i2 = i2 % int(pTexDesc->uWidth);
|
||||
@ -1114,16 +1114,16 @@ namespace
|
||||
if (v < 0.f)
|
||||
v += 1.f;
|
||||
|
||||
u = u * pTexDesc->uWidth;
|
||||
v = v * pTexDesc->uHeight;
|
||||
u = u * float(pTexDesc->uWidth);
|
||||
v = v * float(pTexDesc->uHeight);
|
||||
|
||||
int i = int(u);
|
||||
int j = int(v);
|
||||
int i2 = i + 1;
|
||||
int j2 = j + 1;
|
||||
|
||||
float du = u - i;
|
||||
float dv = v - j;
|
||||
float du = u - float(i);
|
||||
float dv = v - float(j);
|
||||
|
||||
i = std::max(0, std::min<int>(i, int(pTexDesc->uWidth) - 1));
|
||||
i2 = std::max(0, std::min<int>(i2, int(pTexDesc->uWidth) - 1));
|
||||
@ -1178,16 +1178,16 @@ namespace
|
||||
if (v < 0.f)
|
||||
v += 1.f;
|
||||
|
||||
u = u * pTexDesc->uWidth;
|
||||
v = v * pTexDesc->uHeight;
|
||||
u = u * float(pTexDesc->uWidth);
|
||||
v = v * float(pTexDesc->uHeight);
|
||||
|
||||
int i = int(u);
|
||||
int j = int(v);
|
||||
int i2 = i + 1;
|
||||
int j2 = j + 1;
|
||||
|
||||
float du = u - i;
|
||||
float dv = v - j;
|
||||
float du = u - float(i);
|
||||
float dv = v - float(j);
|
||||
|
||||
i = i % int(pTexDesc->uWidth);
|
||||
i2 = i2 % int(pTexDesc->uWidth);
|
||||
@ -1392,16 +1392,16 @@ namespace
|
||||
if (v > 1.f)
|
||||
v = 1.f;
|
||||
|
||||
u = u * pTexDesc->uWidth;
|
||||
v = v * pTexDesc->uHeight;
|
||||
u = u * float(pTexDesc->uWidth);
|
||||
v = v * float(pTexDesc->uHeight);
|
||||
|
||||
int i = int(u);
|
||||
int j = int(v);
|
||||
int i2 = i + 1;
|
||||
int j2 = j + 1;
|
||||
|
||||
float du = u - i;
|
||||
float dv = v - j;
|
||||
float du = u - float(i);
|
||||
float dv = v - float(j);
|
||||
|
||||
i = std::max(0, std::min<int>(i, int(pTexDesc->uWidth) - 1));
|
||||
i2 = std::max(0, std::min<int>(i2, int(pTexDesc->uWidth) - 1));
|
||||
@ -1451,16 +1451,16 @@ namespace
|
||||
if (v > 1.f)
|
||||
v = 1.f;
|
||||
|
||||
u = u * pTexDesc->uWidth;
|
||||
v = v * pTexDesc->uHeight;
|
||||
u = u * float(pTexDesc->uWidth);
|
||||
v = v * float(pTexDesc->uHeight);
|
||||
|
||||
int i = int(u);
|
||||
int j = int(v);
|
||||
int i2 = i + 1;
|
||||
int j2 = j + 1;
|
||||
|
||||
float du = u - i;
|
||||
float dv = v - j;
|
||||
float du = u - float(i);
|
||||
float dv = v - float(j);
|
||||
|
||||
i = i % int(pTexDesc->uWidth);
|
||||
i2 = i2 % int(pTexDesc->uWidth);
|
||||
@ -1516,16 +1516,16 @@ namespace
|
||||
if (v < 0.f)
|
||||
v += 1.f;
|
||||
|
||||
u = u * pTexDesc->uWidth;
|
||||
v = v * pTexDesc->uHeight;
|
||||
u = u * float(pTexDesc->uWidth);
|
||||
v = v * float(pTexDesc->uHeight);
|
||||
|
||||
int i = int(u);
|
||||
int j = int(v);
|
||||
int i2 = i + 1;
|
||||
int j2 = j + 1;
|
||||
|
||||
float du = u - i;
|
||||
float dv = v - j;
|
||||
float du = u - float(i);
|
||||
float dv = v - float(j);
|
||||
|
||||
i = std::max(0, std::min<int>(i, int(pTexDesc->uWidth) - 1));
|
||||
i2 = std::max(0, std::min<int>(i2, int(pTexDesc->uWidth) - 1));
|
||||
@ -1579,16 +1579,16 @@ namespace
|
||||
if (v < 0.f)
|
||||
v += 1.f;
|
||||
|
||||
u = u * pTexDesc->uWidth;
|
||||
v = v * pTexDesc->uHeight;
|
||||
u = u * float(pTexDesc->uWidth);
|
||||
v = v * float(pTexDesc->uHeight);
|
||||
|
||||
int i = int(u);
|
||||
int j = int(v);
|
||||
int i2 = i + 1;
|
||||
int j2 = j + 1;
|
||||
|
||||
float du = u - i;
|
||||
float dv = v - j;
|
||||
float du = u - float(i);
|
||||
float dv = v - float(j);
|
||||
|
||||
i = i % int(pTexDesc->uWidth);
|
||||
i2 = i2 % int(pTexDesc->uWidth);
|
||||
|
@ -362,7 +362,7 @@ void CUVAtlasRepacker::AdjustEstimatedPercent()
|
||||
m_EstimatedSpacePercent = oldp * 0.9f;
|
||||
|
||||
m_PixelWidth = sqrtf(m_fChartsTotalArea /
|
||||
(m_EstimatedSpacePercent * m_dwAtlasWidth * m_dwAtlasHeight));
|
||||
(m_EstimatedSpacePercent * float(m_dwAtlasWidth * m_dwAtlasHeight)));
|
||||
}
|
||||
|
||||
/***************************************************************************\
|
||||
@ -403,7 +403,7 @@ void CUVAtlasRepacker::InitialSpacePercent()
|
||||
for (;;)
|
||||
{
|
||||
m_PixelWidth = sqrtf(m_fChartsTotalArea /
|
||||
(m_EstimatedSpacePercent * m_dwAtlasWidth * m_dwAtlasHeight));
|
||||
(m_EstimatedSpacePercent * float(m_dwAtlasWidth * m_dwAtlasHeight)));
|
||||
auto pCInfo = reinterpret_cast<ChartsInfo*>(&(m_ChartsInfo[m_SortedChartIndex[0]]));
|
||||
auto pPosInfo = reinterpret_cast<_PositionInfo*>(&(pCInfo->PosInfo[0]));
|
||||
|
||||
@ -443,16 +443,16 @@ void CUVAtlasRepacker::ComputeChartsLengthInPixel()
|
||||
|
||||
// adjust the chart to be in the middle of the bounding box in pixel
|
||||
// to avoid one side is too close and the other side is too far from bounding box edges
|
||||
float adjustX = (numX * m_PixelWidth - (pPosInfo->maxPoint.x - pPosInfo->minPoint.x)) / 2.0f;
|
||||
float adjustY = (numY * m_PixelWidth - (pPosInfo->maxPoint.y - pPosInfo->minPoint.y)) / 2.0f;
|
||||
float adjustX = (float(numX) * m_PixelWidth - (pPosInfo->maxPoint.x - pPosInfo->minPoint.x)) / 2.0f;
|
||||
float adjustY = (float(numY) * m_PixelWidth - (pPosInfo->maxPoint.y - pPosInfo->minPoint.y)) / 2.0f;
|
||||
|
||||
pPosInfo->adjustLen.x = adjustX;
|
||||
pPosInfo->adjustLen.y = adjustY;
|
||||
|
||||
// the base point is used to compute the rotate matrix of the chart when the
|
||||
// chart is rotated 90, 180 or 270 degrees
|
||||
pPosInfo->basePoint = XMFLOAT2(pPosInfo->minPoint.x - m_iGutter * m_PixelWidth - adjustX,
|
||||
pPosInfo->minPoint.y - m_iGutter * m_PixelWidth - adjustY);
|
||||
pPosInfo->basePoint = XMFLOAT2(pPosInfo->minPoint.x - float(m_iGutter) * m_PixelWidth - adjustX,
|
||||
pPosInfo->minPoint.y - float(m_iGutter) * m_PixelWidth - adjustY);
|
||||
|
||||
// the length should be added by gutter space of two sides
|
||||
pPosInfo->numX = numX + 2 * m_iGutter;
|
||||
@ -539,8 +539,8 @@ HRESULT CUVAtlasRepacker::PrepareRepack()
|
||||
|
||||
// save the first chart's transform matrix
|
||||
XMStoreFloat4x4(&m_ResultMatrix[index], XMMatrixTranslation(
|
||||
m_PixelWidth * m_fromX - m_ChartsInfo[index].PosInfo[0].basePoint.x,
|
||||
m_PixelWidth * m_fromY - m_ChartsInfo[index].PosInfo[0].basePoint.y,
|
||||
m_PixelWidth * float(m_fromX) - m_ChartsInfo[index].PosInfo[0].basePoint.x,
|
||||
m_PixelWidth * float(m_fromY) - m_ChartsInfo[index].PosInfo[0].basePoint.y,
|
||||
0.0f));
|
||||
|
||||
// prepare the space information of UV atlas
|
||||
@ -1051,9 +1051,9 @@ HRESULT CUVAtlasRepacker::PrepareChartsInfo()
|
||||
|
||||
float minArea = 1e10;
|
||||
|
||||
for (size_t j = 1; j <= (90 / RotateAngle); j++)
|
||||
for (size_t j = 1; float(j) <= (float(90) / RotateAngle); j++)
|
||||
{
|
||||
float angle = j * RotateAngle / 180.0f * XM_PI;
|
||||
float angle = float(j) * RotateAngle / 180.0f * XM_PI;
|
||||
if (angle > XM_PI / 2.0f)
|
||||
angle = XM_PI / 2.0f;
|
||||
XMMATRIX rotateMatrix = XMMatrixRotationZ(angle);
|
||||
@ -1105,7 +1105,7 @@ HRESULT CUVAtlasRepacker::PrepareChartsInfo()
|
||||
// edges and other useful information
|
||||
for (size_t j = 0; j < m_iRotateNum; j++)
|
||||
{
|
||||
float angle = j * XM_PI / m_iRotateNum / 2.0f;
|
||||
float angle = float(j) * XM_PI / float(m_iRotateNum) / 2.0f;
|
||||
XMMATRIX rotateMatrix = XMMatrixRotationZ(angle);
|
||||
|
||||
XMVector2TransformCoordStream(
|
||||
@ -1318,7 +1318,7 @@ void CUVAtlasRepacker::PutChart(uint32_t index)
|
||||
else if (m_currAspectRatio < m_AspectRatio)
|
||||
PutSide = 1;
|
||||
else
|
||||
PutSide = int(floorf(rand() + 0.5f));
|
||||
PutSide = int(floorf(float(rand()) + 0.5f));
|
||||
|
||||
if (PutSide == 0) // put on left or right side
|
||||
{
|
||||
@ -1467,7 +1467,7 @@ void CUVAtlasRepacker::TryPut(int chartPutSide, int PutSide,
|
||||
(ratio > m_triedAspectRatio && (PutSide == UV_LEFTSIDE || PutSide == UV_RIGHTSIDE)) ||
|
||||
((fabsf(ratio - m_triedAspectRatio) < 1e-6f) &&
|
||||
(internalSpace < m_triedInternalSpace ||
|
||||
(abs(internalSpace - m_triedInternalSpace) < m_triedInternalSpace * 0.05f &&
|
||||
(fabsf(float(internalSpace - m_triedInternalSpace)) < float(m_triedInternalSpace) * 0.05f &&
|
||||
m_triedOverlappedLen < minDistant))))
|
||||
{
|
||||
m_triedRotate = size_t(m_currRotate);
|
||||
@ -1507,9 +1507,9 @@ bool CUVAtlasRepacker::CheckAtlasRange()
|
||||
if (m_iNumCharts < CHART_THRESHOLD)
|
||||
{
|
||||
if (tmpX > int(m_dwAtlasWidth))
|
||||
m_adjustFactor = float(m_dwAtlasWidth) / tmpX;
|
||||
m_adjustFactor = float(m_dwAtlasWidth) / float(tmpX);
|
||||
if (tmpY > int(m_dwAtlasHeight))
|
||||
m_adjustFactor = float(m_dwAtlasHeight) / tmpY;
|
||||
m_adjustFactor = float(m_dwAtlasHeight) / float(tmpY);
|
||||
m_adjustFactor *= m_adjustFactor;
|
||||
}
|
||||
|
||||
@ -1585,10 +1585,10 @@ void CUVAtlasRepacker::PutChartInPosition(uint32_t index)
|
||||
auto pPosInfo = reinterpret_cast<_PositionInfo*>(&(m_ChartsInfo[index].PosInfo[m_triedRotate]));
|
||||
|
||||
XMMATRIX matrixRotate;
|
||||
matrixRotate = XMMatrixRotationZ(m_triedPutRotation / 180.0f * XM_PI);
|
||||
matrixRotate = XMMatrixRotationZ(float(m_triedPutRotation) / 180.0f * XM_PI);
|
||||
XMStoreFloat2(&(pPosInfo->basePoint), XMVector2TransformCoord(XMLoadFloat2(&(pPosInfo->basePoint)),
|
||||
matrixRotate));
|
||||
matrixRotate = XMMatrixRotationZ(m_triedPutRotation / 180.0f * XM_PI +
|
||||
matrixRotate = XMMatrixRotationZ(float(m_triedPutRotation) / 180.0f * XM_PI +
|
||||
pPosInfo->angle);
|
||||
|
||||
m_currAspectRatio = m_triedAspectRatio;
|
||||
@ -1602,8 +1602,8 @@ void CUVAtlasRepacker::PutChartInPosition(uint32_t index)
|
||||
m_UVBoard[size_t(i)][size_t(j)] =
|
||||
m_triedUVBoard[size_t(i - m_chartFromY)][size_t(j - m_chartFromX)];
|
||||
transMatrix = XMMatrixTranslation(
|
||||
m_PixelWidth * m_chartFromX - pPosInfo->basePoint.x,
|
||||
m_PixelWidth * m_chartFromY - pPosInfo->basePoint.y, 0.0f);
|
||||
m_PixelWidth * float(m_chartFromX) - pPosInfo->basePoint.x,
|
||||
m_PixelWidth * float(m_chartFromY) - pPosInfo->basePoint.y, 0.0f);
|
||||
break;
|
||||
case 90:
|
||||
for (int i = m_chartFromY; i < m_chartToY; i++)
|
||||
@ -1612,8 +1612,8 @@ void CUVAtlasRepacker::PutChartInPosition(uint32_t index)
|
||||
m_UVBoard[size_t(i)][size_t(j)] =
|
||||
m_triedUVBoard[size_t(m_chartToX - j - 1)][size_t(i - m_chartFromY)];
|
||||
transMatrix = XMMatrixTranslation(
|
||||
m_PixelWidth * m_chartToX - pPosInfo->basePoint.x,
|
||||
m_PixelWidth * m_chartFromY - pPosInfo->basePoint.y, 0.0f);
|
||||
m_PixelWidth * float(m_chartToX) - pPosInfo->basePoint.x,
|
||||
m_PixelWidth * float(m_chartFromY) - pPosInfo->basePoint.y, 0.0f);
|
||||
break;
|
||||
case 180:
|
||||
for (int i = m_chartFromY; i < m_chartToY; i++)
|
||||
@ -1622,8 +1622,8 @@ void CUVAtlasRepacker::PutChartInPosition(uint32_t index)
|
||||
m_UVBoard[size_t(i)][size_t(j)] =
|
||||
m_triedUVBoard[size_t(m_chartToY - i - 1)][size_t(m_chartToX - j - 1)];
|
||||
transMatrix = XMMatrixTranslation(
|
||||
m_PixelWidth * m_chartToX - pPosInfo->basePoint.x,
|
||||
m_PixelWidth * m_chartToY - pPosInfo->basePoint.y, 0.0f);
|
||||
m_PixelWidth * float(m_chartToX) - pPosInfo->basePoint.x,
|
||||
m_PixelWidth * float(m_chartToY) - pPosInfo->basePoint.y, 0.0f);
|
||||
break;
|
||||
case 270:
|
||||
for (int i = m_chartFromY; i < m_chartToY; i++)
|
||||
@ -1632,8 +1632,8 @@ void CUVAtlasRepacker::PutChartInPosition(uint32_t index)
|
||||
m_UVBoard[size_t(i)][size_t(j)] =
|
||||
m_triedUVBoard[size_t(j - m_chartFromX)][size_t(m_chartToY - i - 1)];
|
||||
transMatrix = XMMatrixTranslation(
|
||||
m_PixelWidth * m_chartFromX - pPosInfo->basePoint.x,
|
||||
m_PixelWidth * m_chartToY - pPosInfo->basePoint.y, 0.0f);
|
||||
m_PixelWidth * float(m_chartFromX) - pPosInfo->basePoint.x,
|
||||
m_PixelWidth * float(m_chartToY) - pPosInfo->basePoint.y, 0.0f);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1772,10 +1772,10 @@ void CUVAtlasRepacker::Normalize()
|
||||
{
|
||||
XMMATRIX transMatrix, scalMatrix, matrix;
|
||||
|
||||
transMatrix = XMMatrixTranslation(-m_PixelWidth * (m_fromX + m_iGutter),
|
||||
-m_PixelWidth * (m_fromY + m_iGutter), 0.0f);
|
||||
scalMatrix = XMMatrixScaling(1.0f / m_PixelWidth / m_NormalizeLen,
|
||||
1.0f / m_PixelWidth / m_NormalizeLen, 0.0f);
|
||||
transMatrix = XMMatrixTranslation(-m_PixelWidth * float(m_fromX + m_iGutter),
|
||||
-m_PixelWidth * float(m_fromY + m_iGutter), 0.0f);
|
||||
scalMatrix = XMMatrixScaling(1.0f / m_PixelWidth / float(m_NormalizeLen),
|
||||
1.0f / m_PixelWidth / float(m_NormalizeLen), 0.0f);
|
||||
|
||||
for (size_t i = 0; i < m_iNumCharts; i++)
|
||||
{
|
||||
@ -1977,7 +1977,7 @@ bool CUVAtlasRepacker::DoTessellation(uint32_t ChartIndex, size_t AngleIndex)
|
||||
{
|
||||
for (n = fromX + 1; n < toX; n++)
|
||||
{
|
||||
x = minP.x + n * m_PixelWidth;
|
||||
x = minP.x + float(n) * m_PixelWidth;
|
||||
y = slope * x + b;
|
||||
m = int(floorf((y - minP.y) / m_PixelWidth));
|
||||
|
||||
@ -1990,7 +1990,7 @@ bool CUVAtlasRepacker::DoTessellation(uint32_t ChartIndex, size_t AngleIndex)
|
||||
{
|
||||
for (m = fromY + 1; m < toY; m++)
|
||||
{
|
||||
y = minP.y + m * m_PixelWidth;
|
||||
y = minP.y + float(m) * m_PixelWidth;
|
||||
x = (y - b) / slope;
|
||||
|
||||
n = int(floorf((x - minP.x) / m_PixelWidth));
|
||||
|
@ -130,8 +130,8 @@ namespace Isochart
|
||||
|
||||
inline float CCallbackSchemer::PercentInAllStage()
|
||||
{
|
||||
float fPercent = m_fBase + m_dwWorkDone * m_fPercentScale;
|
||||
return (m_dwDoneStage * 1.0f) / m_dwTotalStage + fPercent / m_dwTotalStage;
|
||||
float fPercent = m_fBase + float(m_dwWorkDone) * m_fPercentScale;
|
||||
return (float(m_dwDoneStage) * 1.0f) / float(m_dwTotalStage) + fPercent / float(m_dwTotalStage);
|
||||
}
|
||||
|
||||
inline void CCallbackSchemer::InitCallBackAdapt(
|
||||
@ -154,7 +154,7 @@ namespace Isochart
|
||||
}
|
||||
// Call callback function per m_dwCallbackDelta steps
|
||||
m_dwCallbackDelta = static_cast<size_t>(
|
||||
m_fCallbackFrequence * dwTaskWork / fPercentOfAllTasks);
|
||||
m_fCallbackFrequence * float(dwTaskWork) / fPercentOfAllTasks);
|
||||
|
||||
if (m_dwCallbackDelta == 0)
|
||||
{
|
||||
@ -164,7 +164,7 @@ namespace Isochart
|
||||
m_dwNextCallback = m_dwCallbackDelta;
|
||||
|
||||
// One step in current sub-task finished how many percent time of main task
|
||||
m_fPercentScale = 1.0f / dwTaskWork * fPercentOfAllTasks;
|
||||
m_fPercentScale = 1.0f / float(dwTaskWork) * fPercentOfAllTasks;
|
||||
|
||||
m_bIsWaitToFinish = false;
|
||||
m_dwWaitPoint = dwTaskWork - m_dwCallbackDelta;
|
||||
@ -184,7 +184,7 @@ namespace Isochart
|
||||
if (fPercent < 0.0f) fPercent = 0.0f;
|
||||
|
||||
float fRealPercent = m_fBase + m_fPercentOfAllTasks * fPercent;
|
||||
fRealPercent = (m_dwDoneStage * 1.0f) / m_dwTotalStage + fRealPercent / m_dwTotalStage;
|
||||
fRealPercent = (float(m_dwDoneStage) * 1.0f) / float(m_dwTotalStage) + fRealPercent / float(m_dwTotalStage);
|
||||
return m_pCallback(fRealPercent);
|
||||
}
|
||||
|
||||
|
@ -160,12 +160,12 @@ namespace
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsInZeroRangeDouble(d3dArea / (uint64_t(1) << (uint64_t(pFace->dwDepth + 1) << 1))))
|
||||
if (IsInZeroRangeDouble(d3dArea / double(uint64_t(1) << (uint64_t(pFace->dwDepth + 1) << 1))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsInZeroRangeDouble(d2dArea / (uint64_t(1) << (uint64_t(pFace->dwDepth + 1) << 1))))
|
||||
if (IsInZeroRangeDouble(d2dArea / double(uint64_t(1) << (uint64_t(pFace->dwDepth + 1) << 1))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -535,7 +535,7 @@ Isochart::IMTFromTextureMap(
|
||||
pfSignal += dwSignalDimension;
|
||||
}
|
||||
|
||||
float fA = static_cast<float>(d2dArea / (uint64_t(1) << (uint64_t(pCurrFace->dwDepth) << 1)));
|
||||
float fA = static_cast<float>(d2dArea / double(uint64_t(1) << (uint64_t(pCurrFace->dwDepth) << 1)));
|
||||
// Compute IMT using standard parameterization coordinates.
|
||||
CalTriangleIMTFromPerVertexSignal(
|
||||
&(vertList[pCurrFace->dwVertIdx[0]]),
|
||||
@ -548,7 +548,7 @@ Isochart::IMTFromTextureMap(
|
||||
dwSignalDimension,
|
||||
&tempIMT);
|
||||
|
||||
double dIntegratedArea = d3dArea / (uint64_t(1) << (uint64_t(pCurrFace->dwDepth) << 1));
|
||||
double dIntegratedArea = d3dArea / double(uint64_t(1) << (uint64_t(pCurrFace->dwDepth) << 1));
|
||||
dTotalIMT[0] += double(tempIMT[0]) * dIntegratedArea;
|
||||
dTotalIMT[1] += double(tempIMT[1]) * dIntegratedArea;
|
||||
dTotalIMT[2] += double(tempIMT[2]) * dIntegratedArea;
|
||||
|
@ -76,7 +76,7 @@ HRESULT CIsoMap::Init(size_t dwDimension, float* pGeodesicMatrix)
|
||||
{
|
||||
pfAverage[i] += m_pfMatrixB[j * m_dwMatrixDimension + i];
|
||||
}
|
||||
pfAverage[i] /= m_dwMatrixDimension;
|
||||
pfAverage[i] /= float(m_dwMatrixDimension);
|
||||
}
|
||||
memcpy(m_pfAvgSquaredDstColumn, pfAverage, m_dwMatrixDimension * sizeof(float));
|
||||
|
||||
@ -99,7 +99,7 @@ HRESULT CIsoMap::Init(size_t dwDimension, float* pGeodesicMatrix)
|
||||
pfAverage[i] += pRow[j];
|
||||
}
|
||||
|
||||
pfAverage[i] /= m_dwMatrixDimension;
|
||||
pfAverage[i] /= float(m_dwMatrixDimension);
|
||||
pRow += m_dwMatrixDimension;
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ HRESULT CIsochartMesh::MergeAdjacentChart(
|
||||
CIsochartMesh* pMergedChart = nullptr;
|
||||
CIsochartMesh* pAddjacentChart = nullptr;
|
||||
size_t dwMaxFaceNumAfterMerging
|
||||
= std::max<size_t>(size_t(dwTotalFaceNumber * MAX_MERGE_RATIO),
|
||||
= std::max<size_t>(size_t(float(dwTotalFaceNumber) * MAX_MERGE_RATIO),
|
||||
size_t(MAX_MERGE_FACE_NUMBER));
|
||||
|
||||
for (size_t i = 0; i < dwAdjacentChartNumber; i++)
|
||||
|
@ -384,8 +384,8 @@ void CIsochartMesh::CombineGeodesicAndSignalDistance(
|
||||
|
||||
float fSignalWeight = SIGNAL_DISTANCE_WEIGHT;
|
||||
|
||||
fAverageSignalDifference /= dwDistanceCount;
|
||||
fAverageGeodesicDifference /= dwDistanceCount;
|
||||
fAverageSignalDifference /= float(dwDistanceCount);
|
||||
fAverageGeodesicDifference /= float(dwDistanceCount);
|
||||
|
||||
if (fAverageSignalDifference > ISOCHART_ZERO_EPS)
|
||||
{
|
||||
|
@ -411,7 +411,7 @@ namespace Isochart
|
||||
//To calculate bounding box, only need to rotate with in PI/2 around the chart's center
|
||||
for (size_t dwRotID = 1; dwRotID < dwRotationCount; dwRotID++)
|
||||
{
|
||||
float fAngle = dwRotID * XM_PI / (dwRotationCount * 2);
|
||||
float fAngle = float(dwRotID) * XM_PI / float(dwRotationCount * 2);
|
||||
|
||||
GetRotatedChartBoundingBox(
|
||||
center, fAngle, tempMinBound, tempMaxBound);
|
||||
|
@ -156,7 +156,7 @@ bool CIsochartMesh::CalculateEdgeAngleDistance(
|
||||
return false;
|
||||
}
|
||||
|
||||
fAverageAngleDistance /= dwEdgeAngleCount;
|
||||
fAverageAngleDistance /= float(dwEdgeAngleCount);
|
||||
if (IsInZeroRange(fAverageAngleDistance))
|
||||
{
|
||||
return false;
|
||||
@ -213,7 +213,7 @@ HRESULT CIsochartMesh::CalculateFuzzyRegion(
|
||||
assert(dwMaxLevel > 0);
|
||||
size_t dwMinLevel =
|
||||
std::min<size_t>(
|
||||
size_t(dwMaxLevel * FUZYY_REGION_PERCENT + 0.5f),
|
||||
size_t(float(dwMaxLevel) * FUZYY_REGION_PERCENT + 0.5f),
|
||||
dwMaxLevel - 1);
|
||||
|
||||
for (size_t i = 0; i < m_dwFaceNumber; i++)
|
||||
@ -779,7 +779,7 @@ HRESULT CIsochartMesh::CalculateLandmarkAndFuzzyRegion(
|
||||
assert(dwMaxLevel > 0);
|
||||
size_t dwMinLevel =
|
||||
std::min<size_t>(
|
||||
size_t(dwMaxLevel * FUZYY_REGION_PERCENT + 0.5f),
|
||||
size_t(float(dwMaxLevel) * FUZYY_REGION_PERCENT + 0.5f),
|
||||
dwMaxLevel - 1);
|
||||
|
||||
bool bSucceed = false;
|
||||
@ -1310,7 +1310,7 @@ OptimizeOneBoundaryByAngle(
|
||||
fabsf(fStretch1 - fStretch2);
|
||||
fAverageStetchDiff += pfFacesStretchDiff[pFatherFace->dwID];
|
||||
}
|
||||
fAverageStetchDiff = 2 * fAverageStetchDiff / dwNodeNumber;
|
||||
fAverageStetchDiff = 2 * fAverageStetchDiff / float(dwNodeNumber);
|
||||
|
||||
// Initialize graph
|
||||
std::unique_ptr<CGraphcut::NODEHANDLE[]> hNodes(new (std::nothrow) CGraphcut::NODEHANDLE[dwNodeNumber]);
|
||||
@ -1540,7 +1540,7 @@ float CIsochartMesh::CalculateFaceGeodesicDistortion(
|
||||
fError += temp * temp;
|
||||
}
|
||||
|
||||
fError /= dwLandmarkNumber;
|
||||
fError /= float(dwLandmarkNumber);
|
||||
|
||||
return fError;
|
||||
}
|
||||
|
@ -1289,7 +1289,7 @@ float CIsochartMesh::CalculateAverageEdgeLength()
|
||||
fAverageEdgeLength += (x * x + y * y);
|
||||
}
|
||||
fAverageEdgeLength =
|
||||
IsochartSqrtf(fAverageEdgeLength / m_edges.size());
|
||||
IsochartSqrtf(fAverageEdgeLength / float(m_edges.size()));
|
||||
|
||||
return fAverageEdgeLength;
|
||||
}
|
||||
@ -1700,8 +1700,8 @@ void CIsochartMesh::PrepareInternalVertOpt(
|
||||
vertInfo.end.x += pVertex1->uv.x;
|
||||
vertInfo.end.y += pVertex1->uv.y;
|
||||
}
|
||||
vertInfo.center.x = vertInfo.end.x / dwAdjacentVertexCount;
|
||||
vertInfo.center.y = vertInfo.end.y / dwAdjacentVertexCount;
|
||||
vertInfo.center.x = vertInfo.end.x / float(dwAdjacentVertexCount);
|
||||
vertInfo.center.y = vertInfo.end.y / float(dwAdjacentVertexCount);
|
||||
vertInfo.end = vertInfo.center;
|
||||
|
||||
TryAdjustVertexParamStretch(
|
||||
@ -1791,7 +1791,7 @@ bool CIsochartMesh::OptimizeVertexStretchAroundCenter(
|
||||
while (iteration < optimizeInfo.dwRandOptOneVertTimes)
|
||||
{
|
||||
// 1. Get a new random position in the optimizing circle range
|
||||
float fAngle = rand() * 2.f * XM_PI / RAND_MAX;
|
||||
float fAngle = float(rand()) * 2.f * XM_PI / RAND_MAX;
|
||||
vertInfo.end.x =
|
||||
vertInfo.center.x + vertInfo.fRadius * cosf(fAngle);
|
||||
vertInfo.end.y =
|
||||
|
@ -1871,7 +1871,7 @@ CaculateDistanceToExtremeVertex(
|
||||
pVertex++;
|
||||
}
|
||||
|
||||
fAverageDistance /= dwBoundaryVertexCount;
|
||||
fAverageDistance /= float(dwBoundaryVertexCount);
|
||||
|
||||
return hr;
|
||||
}
|
||||
@ -2334,7 +2334,7 @@ HRESULT CIsochartMesh::RemoveCloseRepresentiveVertices(
|
||||
size_t i;
|
||||
|
||||
fAvgChartRadius
|
||||
= IsochartSqrtf(m_fChart3DArea / (dwPrimaryEigenDimension + 1));
|
||||
= IsochartSqrtf(m_fChart3DArea / float(dwPrimaryEigenDimension + 1));
|
||||
|
||||
float fMaxDist;
|
||||
uint32_t dwMaxIndex;
|
||||
|
@ -1364,7 +1364,7 @@ namespace
|
||||
float fTangentSize =
|
||||
fNewAtlasTangentExtreme - fAtlasTangentMinExtreme;
|
||||
|
||||
fBetweenArea -= atlasBorder.size() * fMinDistance;
|
||||
fBetweenArea -= float(atlasBorder.size()) * fMinDistance;
|
||||
float fAreaLost = 1 - atlasInfo.fPackedChartArea / (fRadialSize * fTangentSize);
|
||||
|
||||
// Record the minimal area lost
|
||||
@ -1557,8 +1557,8 @@ namespace
|
||||
if (dwTangentLenInPixel > 1)
|
||||
{
|
||||
fTangentDelta =
|
||||
fMinTangentPosition + ((i + dwTangentLenInPixel / 2) % dwTangentLenInPixel)
|
||||
* fTangentRange / (dwTangentLenInPixel - 1);
|
||||
fMinTangentPosition + float((i + dwTangentLenInPixel / 2) % dwTangentLenInPixel)
|
||||
* fTangentRange / float(dwTangentLenInPixel - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2242,12 +2242,12 @@ static float EstimatePixelLength(
|
||||
size_t dwHeight,
|
||||
float gutter)
|
||||
{
|
||||
float fGutter = gutter * STANDARD_UV_SIZE / std::min(dwWidth, dwHeight);
|
||||
float fGutter = gutter * STANDARD_UV_SIZE / float(std::min(dwWidth, dwHeight));
|
||||
float fBaseSpaceArea =
|
||||
fTotalArea * STANDARD_SPACE_RATE / (1 - STANDARD_SPACE_RATE);
|
||||
|
||||
float fBasePixelLength =
|
||||
IsochartSqrtf((fTotalArea + fBaseSpaceArea) / (dwHeight * dwWidth));
|
||||
IsochartSqrtf((fTotalArea + fBaseSpaceArea) / float(dwHeight * dwWidth));
|
||||
|
||||
float fBaseGutter = gutter * fBasePixelLength;
|
||||
|
||||
@ -2270,7 +2270,7 @@ static float EstimatePixelLength(
|
||||
|
||||
float fNewChartRate = fTotalArea / (fTotalArea + fBaseSpaceArea);
|
||||
|
||||
return IsochartSqrtf(fTotalArea / (dwHeight * dwWidth * fNewChartRate));
|
||||
return IsochartSqrtf(fTotalArea / (float(dwHeight * dwWidth) * fNewChartRate));
|
||||
}
|
||||
|
||||
float CIsochartMesh::GuranteeSmallestChartArea(
|
||||
@ -2311,7 +2311,7 @@ HRESULT CIsochartMesh::PreparePacking(
|
||||
// 2. Initialize global sin and cos table needed in packing process.
|
||||
for (size_t ii = 0; ii < CHART_ROTATION_NUMBER; ii++)
|
||||
{
|
||||
float fAngle = ii * 2.f * XM_PI / CHART_ROTATION_NUMBER;
|
||||
float fAngle = float(ii) * 2.f * XM_PI / float(CHART_ROTATION_NUMBER);
|
||||
g_PackingCosTable[ii] = cosf(fAngle);
|
||||
g_PackingSinTable[ii] = sinf(fAngle);
|
||||
}
|
||||
@ -2339,8 +2339,8 @@ HRESULT CIsochartMesh::PreparePacking(
|
||||
|
||||
atlasInfo.fGutter = gutter * atlasInfo.fPixelLength;
|
||||
DPF(2, "Pixel Length is %f", double(atlasInfo.fPixelLength));
|
||||
atlasInfo.fExpectedAtlasWidth = dwWidth * atlasInfo.fPixelLength;
|
||||
atlasInfo.fWidthHeightRatio = (static_cast<float>(dwWidth)) / (dwHeight);
|
||||
atlasInfo.fExpectedAtlasWidth = float(dwWidth) * atlasInfo.fPixelLength;
|
||||
atlasInfo.fWidthHeightRatio = float(dwWidth) / float(dwHeight);
|
||||
atlasInfo.fBoxTop = 0;
|
||||
atlasInfo.fBoxBottom = 0;
|
||||
atlasInfo.fBoxLeft = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user