From 9147d4ade8d8aef0883a148eea668b66a5ded014 Mon Sep 17 00:00:00 2001 From: cutealien Date: Fri, 7 May 2021 12:41:57 +0000 Subject: [PATCH] COBJMeshFileLoader using a bit more exact color conversion for 0-1 to 0-255 range Same now as SColorf::toSColor git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6214 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 1 + source/Irrlicht/COBJMeshFileLoader.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/changes.txt b/changes.txt index 781b51d..60b88af 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ -------------------------- Changes in 1.9 (not yet released) +- COBJMeshFileLoader using a bit more exact color conversion for 0-1 to 0-255 range (same now as SColorf::toSColor uses). - Speedup for COBJMeshWriter - Add blinkMode parameter to IGUIEnvironment::addModalScreen, so blinking can be suppressed - Speedup: Avoid string copy in CXMLReaderImpl::getAttributeByName diff --git a/source/Irrlicht/COBJMeshFileLoader.cpp b/source/Irrlicht/COBJMeshFileLoader.cpp index 17dcec9..2d9ac9c 100644 --- a/source/Irrlicht/COBJMeshFileLoader.cpp +++ b/source/Irrlicht/COBJMeshFileLoader.cpp @@ -711,11 +711,11 @@ const c8* COBJMeshFileLoader::readColor(const c8* bufPtr, video::SColor& color, c8 colStr[COLOR_BUFFER_LENGTH]; bufPtr = goAndCopyNextWord(colStr, bufPtr, COLOR_BUFFER_LENGTH, bufEnd); - color.setRed((s32)(core::fast_atof(colStr) * 255.0f)); + color.setRed((u32)core::round32(core::fast_atof(colStr)*255.f)); bufPtr = goAndCopyNextWord(colStr, bufPtr, COLOR_BUFFER_LENGTH, bufEnd); - color.setGreen((s32)(core::fast_atof(colStr) * 255.0f)); + color.setGreen((u32)core::round32(core::fast_atof(colStr)*255.f)); bufPtr = goAndCopyNextWord(colStr, bufPtr, COLOR_BUFFER_LENGTH, bufEnd); - color.setBlue((s32)(core::fast_atof(colStr) * 255.0f)); + color.setBlue((u32)core::round32(core::fast_atof(colStr)*255.f)); return bufPtr; }