Fix ifs clang-format didn’t get

This commit is contained in:
numzero 2023-10-04 21:10:58 +03:00 committed by sfan5
parent e5b97d440a
commit b01a3ea781
25 changed files with 69 additions and 138 deletions

@ -117,8 +117,7 @@ int main(int argc, char *argv[])
if (device->getTimer()->getTime() >= 1000) {
device->getTimer()->setTime(0);
++n;
if (n == 1) // Tooltip display
{
if (n == 1) { // Tooltip display
bzero(&event, sizeof(SEvent));
event.EventType = irr::EET_MOUSE_INPUT_EVENT;
event.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
@ -127,8 +126,7 @@ int main(int argc, char *argv[])
device->postEventFromUser(event);
} else if (n == 2) // Text input focus
guienv->setFocus(editbox);
else if (n == 3) // Keypress for Text input
{
else if (n == 3) { // Keypress for Text input
bzero(&event, sizeof(SEvent));
event.EventType = irr::EET_KEY_INPUT_EVENT;
event.KeyInput.Char = L'a';

@ -685,8 +685,7 @@ inline void SColorHSL::fromRGB(const SColorf &color)
inline void SColorHSL::toRGB(SColorf &color) const
{
const f32 l = Luminance / 100;
if (core::iszero(Saturation)) // grey
{
if (core::iszero(Saturation)) { // grey
color.set(l, l, l);
return;
}

@ -1518,8 +1518,7 @@ inline CMatrix4<T> &CMatrix4<T>::buildProjectionMatrixPerspectiveFovRH(
// M[14]
M[15] = 0;
if (zClipFromZero) // DirectX version
{
if (zClipFromZero) { // DirectX version
M[10] = (T)(zFar / (zNear - zFar));
M[14] = (T)(zNear * zFar / (zNear - zFar));
} else // OpenGL version
@ -1564,8 +1563,7 @@ inline CMatrix4<T> &CMatrix4<T>::buildProjectionMatrixPerspectiveFovLH(
// M[14]
M[15] = 0;
if (zClipFromZero) // DirectX version
{
if (zClipFromZero) { // DirectX version
M[10] = (T)(zFar / (zFar - zNear));
M[14] = (T)(-zNear * zFar / (zFar - zNear));
} else // OpenGL version
@ -1727,8 +1725,7 @@ inline CMatrix4<T> &CMatrix4<T>::buildProjectionMatrixPerspectiveRH(
// M[14]
M[15] = 0;
if (zClipFromZero) // DirectX version
{
if (zClipFromZero) { // DirectX version
M[10] = (T)(zFar / (zNear - zFar));
M[14] = (T)(zNear * zFar / (zNear - zFar));
} else // OpenGL version
@ -1771,8 +1768,7 @@ inline CMatrix4<T> &CMatrix4<T>::buildProjectionMatrixPerspectiveLH(
// M[14] = (T)(zNear*zFar/(zNear-zFar));
M[15] = 0;
if (zClipFromZero) // DirectX version
{
if (zClipFromZero) { // DirectX version
M[10] = (T)(zFar / (zFar - zNear));
M[14] = (T)(zNear * zFar / (zNear - zFar));
} else // OpenGL version

@ -577,8 +577,7 @@ inline quaternion &quaternion::slerp(quaternion q1, quaternion q2, f32 time, f32
angle *= -1.0f;
}
if (angle <= (1 - threshold)) // spherical interpolation
{
if (angle <= (1 - threshold)) { // spherical interpolation
const f32 theta = acosf(angle);
const f32 invsintheta = reciprocal(sinf(theta));
const f32 scale = sinf(theta * (1.0f - time)) * invsintheta;
@ -692,11 +691,9 @@ inline core::quaternion &quaternion::rotationFromTo(const vector3df &from, const
v1.normalize();
const f32 d = v0.dotProduct(v1);
if (d >= 1.0f) // If dot == 1, vectors are the same
{
if (d >= 1.0f) { // If dot == 1, vectors are the same
return makeIdentity();
} else if (d <= -1.0f) // exactly opposite
{
} else if (d <= -1.0f) { // exactly opposite
core::vector3df axis(1.0f, 0.f, 0.f);
axis = axis.crossProduct(v0);
if (axis.getLength() == 0) {

@ -87,8 +87,7 @@ void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
// We have no interpolation between EndFrame and StartFrame,
// the last frame must be identical to first one with our current solution.
if (FramesPerSecond > 0.f) // forwards...
{
if (FramesPerSecond > 0.f) { // forwards...
if (CurrentFrameNr > EndFrame)
CurrentFrameNr = StartFrame + fmodf(CurrentFrameNr - StartFrame, (f32)(EndFrame - StartFrame));
} else // backwards...
@ -100,8 +99,7 @@ void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
// play animation non looped
CurrentFrameNr += timeMs * FramesPerSecond;
if (FramesPerSecond > 0.f) // forwards...
{
if (FramesPerSecond > 0.f) { // forwards...
if (CurrentFrameNr > (f32)EndFrame) {
CurrentFrameNr = (f32)EndFrame;
if (LoopCallBack)
@ -178,8 +176,7 @@ IMesh *CAnimatedMeshSceneNode::getMeshForCurrentFrame()
// Update the skinned mesh for the current joint transforms.
skinnedMesh->skinMesh();
if (JointMode == EJUOR_READ) // read from mesh
{
if (JointMode == EJUOR_READ) { // read from mesh
skinnedMesh->recoverJointsFromMesh(JointChildSceneNodes);
//---slow---
@ -201,8 +198,7 @@ IMesh *CAnimatedMeshSceneNode::getMeshForCurrentFrame()
//! OnAnimate() is called just before rendering the whole scene.
void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
{
if (LastTimeMs == 0) // first frame
{
if (LastTimeMs == 0) { // first frame
LastTimeMs = timeMs;
}
@ -465,8 +461,7 @@ u32 CAnimatedMeshSceneNode::getJointCount() const
bool CAnimatedMeshSceneNode::removeChild(ISceneNode *child)
{
if (ISceneNode::removeChild(child)) {
if (JointsUsed) // stop weird bugs caused while changing parents as the joints are being created
{
if (JointsUsed) { // stop weird bugs caused while changing parents as the joints are being created
for (u32 i = 0; i < JointChildSceneNodes.size(); ++i) {
if (JointChildSceneNodes[i] == child) {
JointChildSceneNodes[i] = 0; // remove link to child

@ -458,15 +458,13 @@ bool CB3DMeshFileLoader::readChunkTRIS(scene::SSkinMeshBuffer *meshBuffer, u32 m
}
if (AnimatedVertices_VertexID[vertex_id[i]] != -1) {
if (AnimatedVertices_BufferID[vertex_id[i]] != (s32)meshBufferID) // If this vertex is linked in a different meshbuffer
{
if (AnimatedVertices_BufferID[vertex_id[i]] != (s32)meshBufferID) { // If this vertex is linked in a different meshbuffer
AnimatedVertices_VertexID[vertex_id[i]] = -1;
AnimatedVertices_BufferID[vertex_id[i]] = -1;
showVertexWarning = true;
}
}
if (AnimatedVertices_VertexID[vertex_id[i]] == -1) // If this vertex is not in the meshbuffer
{
if (AnimatedVertices_VertexID[vertex_id[i]] == -1) { // If this vertex is not in the meshbuffer
// Check for lightmapping:
if (BaseVertices[vertex_id[i]].TCoords2 != core::vector2df(0.f, 0.f))
meshBuffer->convertTo2TCoords(); // Will only affect the meshbuffer the first time this is called
@ -844,8 +842,7 @@ bool CB3DMeshFileLoader::readChunkBRUS()
// Fixes problems when the lightmap is on the first texture:
if (B3dMaterial.Textures[0] != 0) {
if (B3dMaterial.Textures[0]->Flags & 65536) // 65536 = secondary UV
{
if (B3dMaterial.Textures[0]->Flags & 65536) { // 65536 = secondary UV
SB3dTexture *TmpTexture;
TmpTexture = B3dMaterial.Textures[1];
B3dMaterial.Textures[1] = B3dMaterial.Textures[0];
@ -869,11 +866,9 @@ bool CB3DMeshFileLoader::readChunkBRUS()
if (B3dMaterial.Textures[1]) {
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
B3dMaterial.Material.ZWriteEnable = video::EZW_OFF;
} else if (B3dMaterial.Textures[0]) // One texture:
{
} else if (B3dMaterial.Textures[0]) { // One texture:
// Flags & 0x1 is usual SOLID, 0x8 is mipmap (handled before)
if (B3dMaterial.Textures[0]->Flags & 0x2) //(Alpha mapped)
{
if (B3dMaterial.Textures[0]->Flags & 0x2) { // (Alpha mapped)
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
B3dMaterial.Material.ZWriteEnable = video::EZW_OFF;
} else if (B3dMaterial.Textures[0]->Flags & 0x4) //(Masked)
@ -899,8 +894,7 @@ bool CB3DMeshFileLoader::readChunkBRUS()
//------ Material fx ------
if (B3dMaterial.fx & 1) // full-bright
{
if (B3dMaterial.fx & 1) { // full-bright
B3dMaterial.Material.AmbientColor = video::SColor(255, 255, 255, 255);
B3dMaterial.Material.Lighting = false;
} else
@ -915,8 +909,7 @@ bool CB3DMeshFileLoader::readChunkBRUS()
if (B3dMaterial.fx & 16) // disable backface culling
B3dMaterial.Material.BackfaceCulling = false;
if (B3dMaterial.fx & 32) // force vertex alpha-blending
{
if (B3dMaterial.fx & 32) { // force vertex alpha-blending
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
B3dMaterial.Material.ZWriteEnable = video::EZW_OFF;
}

@ -620,8 +620,7 @@ static void executeBlit_TextureCombineColor_16_to_24(const SBlitJob *job)
const u32 src_x = (u32)(dx * wscale);
u32 color = PixelMul16_2(video::A1R5G5B5toA8R8G8B8(src[src_x]), jobColor);
u8 *writeTo = &dst[dx * 3];
if (video::getAlpha(src[src_x]) > 0) // only overlay if source has visible alpha (alpha == 1)
{
if (video::getAlpha(src[src_x]) > 0) { // only overlay if source has visible alpha (alpha == 1)
*writeTo++ = (color >> 16) & 0xFF;
*writeTo++ = (color >> 8) & 0xFF;
*writeTo++ = color & 0xFF;
@ -634,8 +633,7 @@ static void executeBlit_TextureCombineColor_16_to_24(const SBlitJob *job)
for (u32 dx = 0; dx != w; ++dx) {
u32 color = PixelMul16_2(video::A1R5G5B5toA8R8G8B8(src[dx]), jobColor);
u8 *writeTo = &dst[dx * 3];
if (video::getAlpha(src[dx]) > 0) // only overlay if source has visible alpha (alpha == 1)
{
if (video::getAlpha(src[dx]) > 0) { // only overlay if source has visible alpha (alpha == 1)
*writeTo++ = (color >> 16) & 0xFF;
*writeTo++ = (color >> 8) & 0xFF;
*writeTo++ = color & 0xFF;

@ -29,8 +29,7 @@ void CColorConverter::convert1BitTo16Bit(const u8 *in, s16 *out, s32 width, s32
for (s32 x = 0; x < width; ++x) {
out[x] = *in >> shift & 0x01 ? (s16)0xffff : (s16)0x8000;
if ((--shift) < 0) // 8 pixel done
{
if ((--shift) < 0) { // 8 pixel done
shift = 7;
++in;
}

@ -223,8 +223,7 @@ EGLConfig CEGLManager::chooseConfig(EConfigStyle confStyle)
}
break;
case 4: // alpha
if (Attribs[7]) // Params.WithAlphaChannel
{
if (Attribs[7]) { // Params.WithAlphaChannel
Attribs[7] = 0;
if (Params.AntiAlias) {
@ -236,8 +235,7 @@ EGLConfig CEGLManager::chooseConfig(EConfigStyle confStyle)
--steps;
break;
case 3: // stencil
if (Attribs[15]) // Params.Stencilbuffer
{
if (Attribs[15]) { // Params.Stencilbuffer
Attribs[15] = 0;
if (Params.AntiAlias) {
@ -249,15 +247,13 @@ EGLConfig CEGLManager::chooseConfig(EConfigStyle confStyle)
--steps;
break;
case 2: // depth size
if (Attribs[13] > 16) // Params.ZBufferBits
{
if (Attribs[13] > 16) { // Params.ZBufferBits
Attribs[13] -= 8;
} else
--steps;
break;
case 1: // buffer size
if (Attribs[9] > 16) // Params.Bits
{
if (Attribs[9] > 16) { // Params.Bits
Attribs[9] -= 8;
} else
--steps;

@ -466,8 +466,7 @@ io::path CFileSystem::getAbsolutePath(const io::path &filename) const
p = realpath(filename.c_str(), fpath);
if (!p) {
// content in fpath is unclear at this point
if (!fpath[0]) // seems like fpath wasn't altered, use our best guess
{
if (!fpath[0]) { // seems like fpath wasn't altered, use our best guess
io::path tmp(filename);
return flattenFilename(tmp);
} else

@ -327,8 +327,7 @@ bool CGUIEditBox::processKey(const SEvent &event)
s.append(widep);
s.append(Text.subString(CursorPos, Text.size() - CursorPos));
if (!Max || s.size() <= Max) // thx to Fish FH for fix
{
if (!Max || s.size() <= Max) { // thx to Fish FH for fix
Text = s;
s = widep;
CursorPos += s.size();
@ -340,8 +339,7 @@ bool CGUIEditBox::processKey(const SEvent &event)
s.append(widep);
s.append(Text.subString(realmend, Text.size() - realmend));
if (!Max || s.size() <= Max) // thx to Fish FH for fix
{
if (!Max || s.size() <= Max) { // thx to Fish FH for fix
Text = s;
s = widep;
CursorPos = realmbgn + s.size();
@ -975,8 +973,7 @@ bool CGUIEditBox::processMouse(const SEvent &event)
}
} break;
case EMIE_LMOUSE_PRESSED_DOWN:
if (!Environment->hasFocus(this)) // can happen when events are manually send to the element
{
if (!Environment->hasFocus(this)) { // can happen when events are manually send to the element
BlinkStartTime = os::Timer::getTime();
MouseMarking = true;
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
@ -1106,12 +1103,10 @@ void CGUIEditBox::breakText()
c = Text[i];
bool lineBreak = false;
if (c == L'\r') // Mac or Windows breaks
{
if (c == L'\r') { // Mac or Windows breaks
lineBreak = true;
c = 0;
if (Text[i + 1] == L'\n') // Windows breaks
{
if (Text[i + 1] == L'\n') { // Windows breaks
// TODO: I (Michael) think that we shouldn't change the text given by the user for whatever reason.
// Instead rework the cursor positioning to be able to handle this (but not in stable release
// branch as users might already expect this behavior).
@ -1120,8 +1115,7 @@ void CGUIEditBox::breakText()
if (CursorPos > i)
--CursorPos;
}
} else if (c == L'\n') // Unix breaks
{
} else if (c == L'\n') { // Unix breaks
lineBreak = true;
c = 0;
}

@ -381,8 +381,7 @@ void CGUIEnvironment::OnPostRender(u32 time)
ToolTip.Element->setRelativePosition(pos);
}
if (ToolTip.Element && ToolTip.Element->isVisible()) // (isVisible() check only because we might use visibility for ToolTip one day)
{
if (ToolTip.Element && ToolTip.Element->isVisible()) { // (isVisible() check only because we might use visibility for ToolTip one day)
ToolTip.LastTime = time;
// got invisible or removed in the meantime?

@ -425,13 +425,11 @@ core::dimension2d<u32> CGUIFont::getDimension(const wchar_t *text) const
for (const wchar_t *p = text; *p; ++p) {
bool lineBreak = false;
if (*p == L'\r') // Mac or Windows breaks
{
if (*p == L'\r') { // Mac or Windows breaks
lineBreak = true;
if (p[1] == L'\n') // Windows breaks
++p;
} else if (*p == L'\n') // Unix breaks
{
} else if (*p == L'\n') { // Unix breaks
lineBreak = true;
}
if (lineBreak) {
@ -489,13 +487,11 @@ void CGUIFont::draw(const core::stringw &text, const core::rect<s32> &position,
wchar_t c = text[i];
bool lineBreak = false;
if (c == L'\r') // Mac or Windows breaks
{
if (c == L'\r') { // Mac or Windows breaks
lineBreak = true;
if (text[i + 1] == L'\n') // Windows breaks
c = text[++i];
} else if (c == L'\n') // Unix breaks
{
} else if (c == L'\n') { // Unix breaks
lineBreak = true;
}

@ -306,17 +306,14 @@ void CGUIStaticText::breakText()
c = Text[i];
bool lineBreak = false;
if (c == L'\r') // Mac or Windows breaks
{
if (c == L'\r') { // Mac or Windows breaks
lineBreak = true;
if (Text[i + 1] == L'\n') // Windows breaks
{
if (Text[i + 1] == L'\n') { // Windows breaks
Text.erase(i + 1);
--size;
}
c = '\0';
} else if (c == L'\n') // Unix breaks
{
} else if (c == L'\n') { // Unix breaks
lineBreak = true;
c = '\0';
}
@ -397,17 +394,14 @@ void CGUIStaticText::breakText()
c = Text[i];
bool lineBreak = false;
if (c == L'\r') // Mac or Windows breaks
{
if (c == L'\r') { // Mac or Windows breaks
lineBreak = true;
if ((i > 0) && Text[i - 1] == L'\n') // Windows breaks
{
if ((i > 0) && Text[i - 1] == L'\n') { // Windows breaks
Text.erase(i - 1);
--size;
}
c = '\0';
} else if (c == L'\n') // Unix breaks
{
} else if (c == L'\n') { // Unix breaks
lineBreak = true;
c = '\0';
}

@ -256,8 +256,7 @@ s32 CGUITabControl::insertTab(s32 idx, IGUITab *tab, bool serializationMode)
}
Tabs[idx] = tab;
if (idx == ActiveTabIndex) // in serialization that can happen for any index
{
if (idx == ActiveTabIndex) { // in serialization that can happen for any index
setVisibleTab(ActiveTabIndex);
tab->setVisible(true);
}

@ -268,8 +268,7 @@ IImage *CImageLoaderBMP::loadImage(io::IReadFile *file) const
if (header.Id != 0x4d42)
return 0;
if (header.Compression > 2) // we'll only handle RLE-Compression
{
if (header.Compression > 2) { // we'll only handle RLE-Compression
os::Printer::log("Compression mode not supported.", ELL_ERROR);
return 0;
}

@ -39,8 +39,7 @@ u8 *CImageLoaderTGA::loadCompressedImage(io::IReadFile *file, const STGAHeader &
u8 chunkheader = 0;
file->read(&chunkheader, sizeof(u8)); // Read The Chunk's Header
if (chunkheader < 128) // If The Chunk Is A 'RAW' Chunk
{
if (chunkheader < 128) { // If The Chunk Is A 'RAW' Chunk
chunkheader++; // Add 1 To The Value To Get Total Number Of Raw Pixels
const u32 bytesToRead = bytesPerPixel * chunkheader;
@ -173,8 +172,7 @@ IImage *CImageLoaderTGA::loadImage(io::IReadFile *file) const
switch (header.PixelDepth) {
case 8: {
if (header.ImageType == 3) // grey image
{
if (header.ImageType == 3) { // grey image
image = new CImage(ECF_R8G8B8,
core::dimension2d<u32>(header.ImageWidth, header.ImageHeight));
if (image)

@ -475,8 +475,7 @@ bool CIrrDeviceLinux::createWindow()
if (CreationParams.Fullscreen) {
// Don't try to set window position
} else if (CreationParams.WindowPosition.X >= 0 || CreationParams.WindowPosition.Y >= 0) // default is -1, -1
{
} else if (CreationParams.WindowPosition.X >= 0 || CreationParams.WindowPosition.Y >= 0) { // default is -1, -1
// Window managers are free to ignore positions above, so give it another shot
XMoveWindow(XDisplay, XWindow, x, y);
}
@ -1967,8 +1966,7 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture *tex, con
pixelCol.setData((const void *)data, format);
data += bytesPerPixel;
if (pixelCol.getAlpha() == 0) // transparent
{
if (pixelCol.getAlpha() == 0) { // transparent
XPutPixel(maskImage, x, y, 0);
XPutPixel(sourceImage, x, y, 0);
} else // color

@ -633,8 +633,7 @@ bool CIrrDeviceMacOSX::createWindow()
// TODO: fullscreen
// if (!CreationParams.Fullscreen)
{
if (!CreationParams.WindowId) // create another window when WindowId is null
{
if (!CreationParams.WindowId) { // create another window when WindowId is null
int x = (CreationParams.WindowPosition.X > 0) ? CreationParams.WindowPosition.X : 0;
int y = (CreationParams.WindowPosition.Y > 0) ? CreationParams.WindowPosition.Y : 0;

@ -551,12 +551,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
m += 1;
if (m->group >= 0) {
if (m->group == 0) // down
{
if (m->group == 0) { // down
ClickCount++;
SetCapture(hWnd);
} else if (m->group == 1) // up
{
} else if (m->group == 1) { // up
ClickCount--;
if (ClickCount < 1) {
ClickCount = 0;
@ -1312,8 +1310,7 @@ HCURSOR CIrrDeviceWin32::TextureToCursor(HWND hwnd, irr::video::ITexture *tex, c
pixelCol.setData((const void *)data, format);
data += bytesPerPixel;
if (pixelCol.getAlpha() == 0) // transparent
{
if (pixelCol.getAlpha() == 0) { // transparent
SetPixel(andDc, x, y, RGB(255, 255, 255));
SetPixel(xorDc, x, y, RGB(0, 0, 0));
} else // color

@ -252,8 +252,7 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file)
// Add a triangle
const int a = faceCorners[i + 1];
const int b = faceCorners[i];
if (a != b && a != c && b != c) // ignore degenerated faces. We can get them when we merge vertices above in the VertMap.
{
if (a != b && a != c && b != c) { // ignore degenerated faces. We can get them when we merge vertices above in the VertMap.
currMtl->Meshbuffer->Indices.push_back(a);
currMtl->Meshbuffer->Indices.push_back(b);
currMtl->Meshbuffer->Indices.push_back(c);

@ -167,8 +167,7 @@ void COpenGLSLMaterialRenderer::init(s32 &outMaterialTypeNr,
if (!createShader(GL_GEOMETRY_SHADER_EXT, geometryShaderProgram))
return;
#if defined(GL_ARB_geometry_shader4) || defined(GL_EXT_geometry_shader4) || defined(GL_NV_geometry_shader4)
if (Program2) // Geometry shaders are supported only in OGL2.x+ drivers.
{
if (Program2) { // Geometry shaders are supported only in OGL2.x+ drivers.
Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType));
Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType));
if (verticesOut == 0)

@ -60,8 +60,7 @@ long CReadFile::getPos() const
//! opens the file
void CReadFile::openFile()
{
if (Filename.size() == 0) // bugfix posted by rt
{
if (Filename.size() == 0) { // bugfix posted by rt
File = 0;
return;
}

@ -323,8 +323,7 @@ void CSkinnedMesh::getFrameData(f32 frame, SJoint *joint,
// The hint test failed, do a full scan...
if (foundPositionIndex == -1) {
for (u32 i = 0; i < PositionKeys.size(); ++i) {
if (PositionKeys[i].frame >= frame) // Keys should to be sorted by frame
{
if (PositionKeys[i].frame >= frame) { // Keys should to be sorted by frame
foundPositionIndex = i;
positionHint = i;
break;
@ -370,8 +369,7 @@ void CSkinnedMesh::getFrameData(f32 frame, SJoint *joint,
// The hint test failed, do a full scan...
if (foundScaleIndex == -1) {
for (u32 i = 0; i < ScaleKeys.size(); ++i) {
if (ScaleKeys[i].frame >= frame) // Keys should to be sorted by frame
{
if (ScaleKeys[i].frame >= frame) { // Keys should to be sorted by frame
foundScaleIndex = i;
scaleHint = i;
break;
@ -417,8 +415,7 @@ void CSkinnedMesh::getFrameData(f32 frame, SJoint *joint,
// The hint test failed, do a full scan...
if (foundRotationIndex == -1) {
for (u32 i = 0; i < RotationKeys.size(); ++i) {
if (RotationKeys[i].frame >= frame) // Keys should be sorted by frame
{
if (RotationKeys[i].frame >= frame) { // Keys should be sorted by frame
foundRotationIndex = i;
rotationHint = i;
break;
@ -757,8 +754,7 @@ void CSkinnedMesh::calculateGlobalMatrices(SJoint *joint, SJoint *parentJoint)
joint->LocalAnimatedMatrix = joint->LocalMatrix;
joint->GlobalAnimatedMatrix = joint->GlobalMatrix;
if (joint->GlobalInversedMatrix.isIdentity()) // might be pre calculated
{
if (joint->GlobalInversedMatrix.isIdentity()) { // might be pre calculated
joint->GlobalInversedMatrix = joint->GlobalMatrix;
joint->GlobalInversedMatrix.makeInverse(); // slow
}
@ -1143,8 +1139,7 @@ void CSkinnedMesh::normalizeWeights()
for (i = 0; i < AllJoints.size(); ++i) {
SJoint *joint = AllJoints[i];
for (j = 0; j < joint->Weights.size(); ++j) {
if (joint->Weights[j].strength <= 0) // Check for invalid weights
{
if (joint->Weights[j].strength <= 0) { // Check for invalid weights
joint->Weights.erase(j);
--j;
} else {

@ -891,8 +891,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
u32 *data = new u32[datasize];
for (u32 j = 0; j < datasize; ++j)
data[j] = readInt();
if (dataformat & 0x102) // 2nd uv set
{
if (dataformat & 0x102) { // 2nd uv set
mesh.TCoords2.reallocate(mesh.Vertices.size());
u8 *dataptr = (u8 *)data;
const u32 size = ((dataformat >> 8) & 0xf) * sizeof(core::vector2df);
@ -1073,8 +1072,7 @@ bool CXMeshFileLoader::parseDataObjectMeshNormals(SXMesh &mesh)
// read face normal indices
const u32 nFNormals = readInt();
// if (nFNormals >= mesh.IndexCountPerFace.size())
if (0) // this condition doesn't work for some reason
{
if (0) { // this condition doesn't work for some reason
os::Printer::log("Too many face normals found in x file", ELL_WARNING);
os::Printer::log("Line", core::stringc(Line).c_str(), ELL_WARNING);
SET_ERR_AND_RETURN();
@ -1141,8 +1139,7 @@ bool CXMeshFileLoader::parseDataObjectMeshTextureCoords(SXMesh &mesh)
const u32 nCoords = readInt();
// if (nCoords >= mesh.Vertices.size())
if (0) // this condition doesn't work for some reason
{
if (0) { // this condition doesn't work for some reason
os::Printer::log("Too many texture coords found in x file", ELL_WARNING);
os::Printer::log("Line", core::stringc(Line).c_str(), ELL_WARNING);
SET_ERR_AND_RETURN();
@ -1248,8 +1245,7 @@ bool CXMeshFileLoader::parseDataObjectMeshMaterialList(SXMesh &mesh)
// in version 03.02, the face indices end with two semicolons.
// commented out version check, as version 03.03 exported from blender also has 2 semicolons
if (!BinaryFormat) // && MajorVersion == 3 && MinorVersion <= 2)
{
if (!BinaryFormat) { // && MajorVersion == 3 && MinorVersion <= 2)
if (P[0] == ';')
++P;
}