Skip to content

Commit

Permalink
InternalUtilities: slightly simplify using upstream code
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Sep 22, 2024
1 parent 81552ff commit 25e428d
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions main/src/InternalUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "CaelumExceptions.h"
#include "InternalUtilities.h"
#include "PrivatePtr.h"
#include <OgreString.h>
#include <cstddef>

namespace Caelum
Expand Down Expand Up @@ -40,28 +41,20 @@ namespace Caelum
}

// Calculate the interpolated pixel
Ogre::ColourValue c1, c2, cf;
Ogre::ColourValue c1, c2;
c1 = img->getColourAt (px1, py, 0);
c2 = img->getColourAt (px2, py, 0);

// Blend the two pixels together.
// diff is the weight between pixel 1 and pixel 2.
float diff = px - px1;
cf = c1 * (1 - diff) + c2 * diff;

return cf;
return Ogre::Math::lerp(c1, c2, diff);
}

const Ogre::String InternalUtilities::pointerToString (void* pointer)
{
std::stringstream stream;
stream.width(2 * sizeof(void *));
stream.fill('0');
stream.unsetf(std::ios::dec);
stream.setf(std::ios::hex);
stream.setf(std::ios::uppercase);
stream << reinterpret_cast<ptrdiff_t>(pointer);
return stream.str();
return Ogre::StringUtil::format("%p", pointer);
}

Ogre::MaterialPtr InternalUtilities::checkLoadMaterialClone (
Expand Down

0 comments on commit 25e428d

Please sign in to comment.