Gems/Atom

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
monroegm-disable-blank-issue-2
Esteban Papp 4 years ago
parent 8cef306efb
commit e6b5342c07

@ -191,7 +191,7 @@ namespace ImageProcessingAtom
}
//for each pixel in dst image, find it's location in src and copy the data from there
float halfSize = rectSize / 2;
float halfSize = static_cast<float>(rectSize / 2);
for (AZ::u32 row = 0; row < rectSize; row++)
{
for (AZ::u32 col = 0; col < rectSize; col++)
@ -201,8 +201,8 @@ namespace ImageProcessingAtom
float dstY = halfSize - row - 0.5f;
float srcX = dstX * mtx[0] + dstY * mtx[1];
float srcY = dstX * mtx[2] + dstY * mtx[3];
AZ::u32 srcCol = srcX + halfSize;
AZ::u32 srcRow = halfSize - srcY;
AZ::u32 srcCol = static_cast<AZ::u32>(srcX + halfSize);
AZ::u32 srcRow = static_cast<AZ::u32>(halfSize - srcY);
memcpy(&dstImageBuf[(row * rectSize + col) * bytePerPixel],
&srcImageBuf[(srcRow * rectSize + srcCol) * bytePerPixel], bytePerPixel);
@ -464,7 +464,7 @@ namespace ImageProcessingAtom
else
{
//transform the image
TransformImage(srcDir, dstDir, buf, tempBuf, sizePerPixel, faceSize);
TransformImage(srcDir, dstDir, buf, tempBuf, static_cast<AZ::u8>(sizePerPixel), faceSize);
dstCubemap->SetFaceData(face, tempBuf, outSize);
}
}
@ -649,7 +649,7 @@ namespace ImageProcessingAtom
preset.m_cubemapSetting->m_mipSlope, //MipAnglePerLevelScale,
(int)preset.m_cubemapSetting->m_filter, //FilterType, CP_FILTER_TYPE_COSINE for diffuse cube
preset.m_cubemapSetting->m_edgeFixup > 0 ? CP_FIXUP_PULL_LINEAR : CP_FIXUP_NONE, //FixupType, CP_FIXUP_PULL_LINEAR if FixupWidth> 0
preset.m_cubemapSetting->m_edgeFixup, //FixupWidth,
static_cast<int32>(preset.m_cubemapSetting->m_edgeFixup), //FixupWidth,
true, //bUseSolidAngle,
16, //GlossScale,
0, //GlossBias

@ -269,11 +269,11 @@ namespace UnitTest
public:
//helper function to save an image object to a file through QtImage
static void SaveImageToFile(const IImageObjectPtr imageObject, const AZStd::string imageName, AZ::u32 maxMipCnt = 100)
static void SaveImageToFile([[maybe_unused]] const IImageObjectPtr imageObject, [[maybe_unused]] const AZStd::string imageName, [[maybe_unused]] AZ::u32 maxMipCnt = 100)
{
#ifndef DEBUG_OUTPUT_IMAGES
return;
#endif
#else
if (imageObject == nullptr)
{
return;
@ -314,6 +314,7 @@ namespace UnitTest
QImage qimage(imageBuf, width, height, pitch, QImage::Format_RGBA8888);
qimage.save(filePath);
}
#endif
}
static bool GetComparisonResult(IImageObjectPtr image1, IImageObjectPtr image2, QString& output)

@ -8,7 +8,7 @@
#include <AzCore/std/bind/bind.h>
#include <AzCore/std/string/string.h>
#define CP_PI 3.14159265358979323846
#define CP_PI 3.14159265358979323846f
namespace ImageProcessingAtom
@ -259,10 +259,10 @@ namespace ImageProcessingAtom
//get face idx and u, v texel coordinate in face
VectToTexelCoord(a_XYZ, a_Surface[0].m_Width, &faceIdx, &u, &v );
u = VM_MIN((int32)u, a_Surface[0].m_Width - 1);
v = VM_MIN((int32)v, a_Surface[0].m_Width - 1);
u = static_cast<float>(VM_MIN((int32)u, a_Surface[0].m_Width - 1));
v = static_cast<float>(VM_MIN((int32)v, a_Surface[0].m_Width - 1));
return( a_Surface[faceIdx].GetSurfaceTexelPtr(u, v) );
return( a_Surface[faceIdx].GetSurfaceTexelPtr(static_cast<int32>(u), static_cast<int32>(v)) );
}
//--------------------------------------------------------------------------------------
@ -357,7 +357,7 @@ namespace ImageProcessingAtom
VM_XPROD3_UNTYPED(xProdVect, edgeVect0, edgeVect1 );
texelArea += 0.5f * sqrt( VM_DOTPROD3_UNTYPED(xProdVect, xProdVect ) );
return texelArea;
return static_cast<float>(texelArea);
}
@ -1130,7 +1130,7 @@ namespace ImageProcessingAtom
// if p0 = 0 and p1 = 1, and d0 and d1 = 0, the interpolation reduces to
//
// p(t) = - 2t^3 + 3t^2
fixupWeight = ((-2.0 * fixupFrac + 3.0) * fixupFrac * fixupFrac);
fixupWeight = ((-2.0f * fixupFrac + 3.0f) * fixupFrac * fixupFrac);
}
break;
case CP_FIXUP_AVERAGE_LINEAR:
@ -1147,7 +1147,7 @@ namespace ImageProcessingAtom
break;
case CP_FIXUP_AVERAGE_HERMITE:
{
fixupWeight = ((-2.0 * fixupFrac + 3.0) * fixupFrac * fixupFrac);
fixupWeight = ((-2.0f * fixupFrac + 3.0f) * fixupFrac * fixupFrac);
//perform weighted average of edge tap value and current tap
// fade off weight using hermite spline with distance from edge
@ -1538,7 +1538,7 @@ namespace ImageProcessingAtom
// Find angle for which: cos(a) ^ cosinePower = epsilon
const float epsilon = 0.000001f;
float angle = acosf(powf(epsilon, 1.0f / cosinePower));
angle *= 180.0f / (float)CP_PI;
angle *= 180.0f / CP_PI;
angle *= 2.0f;
return angle;
@ -1555,7 +1555,7 @@ namespace ImageProcessingAtom
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
return float(bits) * 2.3283064365386963e-10; // float(bits) * 2^-32
return float(bits) * 2.3283064365386963e-10f; // float(bits) * 2^-32
}
inline void HammersleySequence(uint32 sampleIndex, uint32 sampleCount, float* vXi)
@ -1668,7 +1668,7 @@ namespace ImageProcessingAtom
float mip = 0.5f * log2f(solidAngleSample / solidAngleTexel) + 1.0f;
//determine surrounding mip levels
uint32 mipA = floor(mip);
uint32 mipA = static_cast<uint32>(floor(mip));
uint32 mipB = mipA + 1;
float lerp = 0.0f;
VM_CLAMP(lerp, mip - mipA, 0.0f, 1.0f);
@ -1819,7 +1819,7 @@ namespace ImageProcessingAtom
float filterAngle;
//min angle a src texel can cover (in degrees)
srcTexelAngle = (180.0f / (float)CP_PI) * atan2f(1.0f, (float)a_SrcCubeMapWidth);
srcTexelAngle = (180.0f / CP_PI) * atan2f(1.0f, (float)a_SrcCubeMapWidth);
//filter angle is 1/2 the cone angle
filterAngle = a_FilterConeAngle / 2.0f;
@ -1870,7 +1870,7 @@ namespace ImageProcessingAtom
const int32 dstSize = a_DstCubeMap[0].m_Width;
//min angle a src texel can cover (in degrees)
const float srcTexelAngle = (180.0f / (float)CP_PI) * atan2f(1.0f, (float)srcSize);
const float srcTexelAngle = (180.0f / CP_PI) * atan2f(1.0f, (float)srcSize);
//angle about center tap to define filter cone
float filterAngle;
@ -1897,7 +1897,7 @@ namespace ImageProcessingAtom
//dotProdThresh threshold based on cone angle to determine whether or not taps
// reside within the cone angle
const float dotProdThresh = cosf( ((float)CP_PI / 180.0f) * filterAngle );
const float dotProdThresh = cosf( (CP_PI / 180.0f) * filterAngle );
//thread progress
m_ThreadProgress[a_ThreadIdx].m_StartFace = a_FaceIdxStart;
@ -2004,8 +2004,8 @@ namespace ImageProcessingAtom
else if( a_FilterType == CP_FILTER_TYPE_ANGULAR_GAUSSIAN )
{
//fit 3 standard deviations within angular extent of filter
CP_ITYPE stdDev = (a_FilterAngle * CP_PI / 180.0) / 3.0;
CP_ITYPE inv2Variance = 1.0 / (2.0 * stdDev * stdDev);
CP_ITYPE stdDev = (a_FilterAngle * CP_PI / 180.0f) / 3.0f;
CP_ITYPE inv2Variance = 1.0f / (2.0f * stdDev * stdDev);
for(iLUTEntry=0; iLUTEntry<m_NumFilterLUTEntries; iLUTEntry++ )
{

@ -135,7 +135,7 @@ namespace ImageProcessingAtom
mantissa >>= (23 - 10);
//assemble s10e5 number using logical operations
rawf16Data = (signVal << 15) | (exponent << 10) | mantissa;
rawf16Data = static_cast<uint16>((signVal << 15) | (exponent << 10) | mantissa);
//return re-assembled raw data as a 32 bit float
return rawf16Data;

@ -125,7 +125,7 @@
//normalize vectors
#define VM_NORM3_UNTYPED(d, s) {double __idsq; __idsq=1.0/sqrt(VM_DOTPROD3_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; }
#define VM_NORM3_UNTYPED_F32(d, s) {float __idsq; __idsq=1.0/sqrt(VM_DOTPROD3_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; }
#define VM_NORM3_UNTYPED_F32(d, s) {float __idsq; __idsq=1.0f/sqrt(VM_DOTPROD3_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; }
#define VM_NORM3(d, s) VM_NORM3_UNTYPED_F32(((float *)(d)), ((float *)(s)))
#define VM_NORM4_UNTYPED(d, s) {double __idsq; __idsq=1.0/sqrt(VM_DOTPROD4_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; d[3]=s[3]*__idsq; }

@ -933,9 +933,10 @@ namespace AZ
uint16_t DirectionalLightFeatureProcessor::GetCascadeCount(LightHandle handle) const
{
for (const auto& segmentIt : m_shadowProperties.GetData(handle.GetIndex()).m_segments)
const auto& segments = m_shadowProperties.GetData(handle.GetIndex()).m_segments;
if (!segments.empty())
{
return aznumeric_cast<uint16_t>(segmentIt.second.size());
return aznumeric_cast<uint16_t>(segments.begin()->second.size());
}
return 0;
}

@ -539,9 +539,10 @@ namespace AZ::Render
{
esmPass->QueueForBuildAndInitialization();
}
for (ProjectedShadowmapsPass* shadowPass : m_projectedShadowmapsPasses)
if (!m_projectedShadowmapsPasses.empty())
{
const ProjectedShadowmapsPass* shadowPass = m_projectedShadowmapsPasses.front();
for (const auto& shadowProperty : shadowProperties)
{
const int16_t shadowIndexInSrg = shadowProperty.m_shadowId.GetIndex();
@ -553,7 +554,6 @@ namespace AZ::Render
filterData.m_shadowmapOriginInSlice = origin.m_originInSlice;
m_deviceBufferNeedsUpdate = true;
}
break;
}
m_shadowmapPassNeedsUpdate = false;
@ -571,8 +571,9 @@ namespace AZ::Render
void ProjectedShadowFeatureProcessor::PrepareViews(const PrepareViewsPacket&, AZStd::vector<AZStd::pair<RPI::PipelineViewTag, RPI::ViewPtr>>& outViews)
{
for (ProjectedShadowmapsPass* pass : m_projectedShadowmapsPasses)
if (!m_projectedShadowmapsPasses.empty())
{
ProjectedShadowmapsPass* pass = m_projectedShadowmapsPasses.front();
RPI::RenderPipeline* renderPipeline = pass->GetRenderPipeline();
if (renderPipeline)
{
@ -598,7 +599,6 @@ namespace AZ::Render
outViews.emplace_back(AZStd::make_pair(viewTag, shadowProperty.m_shadowmapView));
}
}
break;
}
}
@ -606,8 +606,9 @@ namespace AZ::Render
{
AZ_ATOM_PROFILE_FUNCTION("RPI", "ProjectedShadowFeatureProcessor: Render");
for (const ProjectedShadowmapsPass* pass : m_projectedShadowmapsPasses)
if (!m_projectedShadowmapsPasses.empty())
{
const ProjectedShadowmapsPass* pass = m_projectedShadowmapsPasses.front();
for (const RPI::ViewPtr& view : packet.m_views)
{
if (view->GetUsageFlags() & RPI::View::UsageFlags::UsageCamera)
@ -622,7 +623,6 @@ namespace AZ::Render
m_filterParamBufferHandler.UpdateSrg(srg);
}
}
break;
}
}

@ -61,7 +61,7 @@ namespace MaterialEditor
auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset);
if (presetItr != m_presets.end())
{
setCurrentIndex(AZStd::distance(m_presets.begin(), presetItr));
setCurrentIndex(static_cast<int>(AZStd::distance(m_presets.begin(), presetItr)));
}
}
@ -80,7 +80,7 @@ namespace MaterialEditor
auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset);
if (presetItr != m_presets.end())
{
setItemText(AZStd::distance(m_presets.begin(), presetItr), preset->m_displayName.c_str());
setItemText(static_cast<int>(AZStd::distance(m_presets.begin(), presetItr)), preset->m_displayName.c_str());
}
else
{

@ -61,7 +61,7 @@ namespace MaterialEditor
auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset);
if (presetItr != m_presets.end())
{
setCurrentIndex(AZStd::distance(m_presets.begin(), presetItr));
setCurrentIndex(static_cast<int>(AZStd::distance(m_presets.begin(), presetItr)));
}
}
@ -80,7 +80,7 @@ namespace MaterialEditor
auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset);
if (presetItr != m_presets.end())
{
setItemText(AZStd::distance(m_presets.begin(), presetItr), preset->m_displayName.c_str());
setItemText(static_cast<int>(AZStd::distance(m_presets.begin(), presetItr)), preset->m_displayName.c_str());
}
else
{

Loading…
Cancel
Save