Minor fixes
This commit is contained in:
@@ -91,7 +91,7 @@ namespace Nz
|
||||
std::shared_ptr<Image> image = std::make_shared<Image>(type, format, width, height, depth, levelCount);
|
||||
|
||||
// Read all mipmap levels
|
||||
for (unsigned int i = 0; i < image->GetLevelCount(); i++)
|
||||
for (UInt8 i = 0; i < image->GetLevelCount(); i++)
|
||||
{
|
||||
std::size_t byteCount = PixelFormatInfo::ComputeSize(format, width, height, depth);
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Nz
|
||||
{
|
||||
if (header.format.flags & (DDPF_RGB | DDPF_ALPHA | DDPF_ALPHAPIXELS | DDPF_LUMINANCE))
|
||||
{
|
||||
PixelFormatDescription info(PixelFormatContent::ColorRGBA, header.format.bpp, PixelFormatSubType::Unsigned);
|
||||
PixelFormatDescription info(PixelFormatContent::ColorRGBA, SafeCast<UInt8>(header.format.bpp), PixelFormatSubType::Unsigned);
|
||||
|
||||
if (header.format.flags & DDPF_RGB)
|
||||
{
|
||||
|
||||
@@ -39,10 +39,10 @@ namespace Nz
|
||||
}
|
||||
|
||||
const MD5AnimParser::Frame* frames = parser.GetFrames();
|
||||
std::size_t frameCount = parser.GetFrameCount();
|
||||
std::size_t frameRate = parser.GetFrameRate();
|
||||
UInt32 frameCount = parser.GetFrameCount();
|
||||
UInt32 frameRate = parser.GetFrameRate();
|
||||
const MD5AnimParser::Joint* joints = parser.GetJoints();
|
||||
std::size_t jointCount = parser.GetJointCount();
|
||||
UInt32 jointCount = parser.GetJointCount();
|
||||
|
||||
// À ce stade, nous sommes censés avoir assez d'informations pour créer l'animation
|
||||
std::shared_ptr<Animation> animation = std::make_shared<Animation>();
|
||||
@@ -62,10 +62,10 @@ namespace Nz
|
||||
Quaternionf rotationQuat = Quaternionf::RotationBetween(Vector3f::UnitX(), Vector3f::Forward()) *
|
||||
Quaternionf::RotationBetween(Vector3f::UnitZ(), Vector3f::Up());
|
||||
|
||||
for (std::size_t i = 0; i < jointCount; ++i)
|
||||
for (UInt32 i = 0; i < jointCount; ++i)
|
||||
{
|
||||
int parent = joints[i].parent;
|
||||
for (std::size_t j = 0; j < frameCount; ++j)
|
||||
for (UInt32 j = 0; j < frameCount; ++j)
|
||||
{
|
||||
SequenceJoint& sequenceJoint = sequenceJoints[j*jointCount + i];
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@ namespace Nz
|
||||
|
||||
UInt8* pixels = image->GetPixels();
|
||||
|
||||
int rle_value = 0;
|
||||
unsigned int rle_count = 0;
|
||||
UInt8 rleValue = 0;
|
||||
UInt8 rleCount = 0;
|
||||
|
||||
switch (bitCount)
|
||||
{
|
||||
@@ -115,20 +115,20 @@ namespace Nz
|
||||
/* decode line number y */
|
||||
while (bytes--)
|
||||
{
|
||||
if (rle_count == 0)
|
||||
if (rleCount == 0)
|
||||
{
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (rle_value < 0xc0)
|
||||
rle_count = 1;
|
||||
if (rleValue < 0xc0)
|
||||
rleCount = 1;
|
||||
else
|
||||
{
|
||||
rle_count = rle_value - 0xc0;
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
@@ -136,11 +136,11 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
rle_count--;
|
||||
rleCount--;
|
||||
|
||||
for (int i = 7; i >= 0; --i)
|
||||
{
|
||||
int colorIndex = ((rle_value & (1 << i)) > 0);
|
||||
int colorIndex = ((rleValue & (1 << i)) > 0);
|
||||
|
||||
*ptr++ = header.palette[colorIndex * 3 + 0];
|
||||
*ptr++ = header.palette[colorIndex * 3 + 1];
|
||||
@@ -170,20 +170,20 @@ namespace Nz
|
||||
/* decode line number y */
|
||||
while (bytes--)
|
||||
{
|
||||
if (rle_count == 0)
|
||||
if (rleCount == 0)
|
||||
{
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (rle_value < 0xc0)
|
||||
rle_count = 1;
|
||||
if (rleValue < 0xc0)
|
||||
rleCount = 1;
|
||||
else
|
||||
{
|
||||
rle_count = rle_value - 0xc0;
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
@@ -191,8 +191,8 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
rle_count--;
|
||||
*(pLine++) = rle_value;
|
||||
rleCount--;
|
||||
*(pLine++) = rleValue;
|
||||
}
|
||||
|
||||
/* compute line's color indexes */
|
||||
@@ -254,20 +254,20 @@ namespace Nz
|
||||
/* decode line number y */
|
||||
while (bytes--)
|
||||
{
|
||||
if (rle_count == 0)
|
||||
if (rleCount == 0)
|
||||
{
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (rle_value < 0xc0)
|
||||
rle_count = 1;
|
||||
if (rleValue < 0xc0)
|
||||
rleCount = 1;
|
||||
else
|
||||
{
|
||||
rle_count = rle_value - 0xc0;
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
@@ -275,11 +275,11 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
rle_count--;
|
||||
rleCount--;
|
||||
|
||||
*ptr++ = palette[rle_value * 3 + 0];
|
||||
*ptr++ = palette[rle_value * 3 + 1];
|
||||
*ptr++ = palette[rle_value * 3 + 2];
|
||||
*ptr++ = palette[rleValue * 3 + 0];
|
||||
*ptr++ = palette[rleValue * 3 + 1];
|
||||
*ptr++ = palette[rleValue * 3 + 2];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -298,20 +298,20 @@ namespace Nz
|
||||
/* decode line number y */
|
||||
while (bytes--)
|
||||
{
|
||||
if (rle_count == 0)
|
||||
if (rleCount == 0)
|
||||
{
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (rle_value < 0xc0)
|
||||
rle_count = 1;
|
||||
if (rleValue < 0xc0)
|
||||
rleCount = 1;
|
||||
else
|
||||
{
|
||||
rle_count = rle_value - 0xc0;
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
@@ -319,8 +319,8 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
rle_count--;
|
||||
ptr[c] = static_cast<UInt8>(rle_value);
|
||||
rleCount--;
|
||||
ptr[c] = static_cast<UInt8>(rleValue);
|
||||
ptr += 3;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user