37 minBoundDefaultColour(overridedMinDefaultColour),
38 maxBoundDefaultColour(overridedMaxDefaultColour)
49 float gradientPosition = gradientPos;
50 if(gradientPos < 0.0f)
51 gradientPosition = 0.0f;
52 if(gradientPos > 1.0f)
53 gradientPosition = 1.0f;
56 if (colourFrames.empty())
59 return Ogre::ColourValue::Black;
61 return Interpolate(
ColourFrame(0.0f, minBoundDefaultColour),
ColourFrame(1.0f, maxBoundDefaultColour), gradientPosition);
65 ColourFrames::const_iterator iSearchedColourFrame = colourFrames.find(gradientPosition);
66 if(iSearchedColourFrame != colourFrames.end())
67 return iSearchedColourFrame->second;
70 if (colourFrames.size() == 1)
75 return colourFrames.begin()->second;
79 if(gradientPosition < colourFrames.begin()->first)
82 return Interpolate(
ColourFrame(0.0f, minBoundDefaultColour), *colourFrames.begin(), gradientPosition);
87 return Interpolate(*colourFrames.begin(),
ColourFrame(1.0f, maxBoundDefaultColour), gradientPosition);
93 ColourFrames::const_iterator iMinBound = colourFrames.lower_bound(gradientPosition);
94 if(iMinBound != colourFrames.begin())
98 ColourFrames::const_iterator iMaxBound = colourFrames.upper_bound(gradientPosition);
101 if(gradientPosition < iMinBound->first)
106 return iMinBound->second;
111 return Interpolate(
ColourFrame(0.0f, minBoundDefaultColour), *iMinBound, gradientPosition);
116 if(iMaxBound == colourFrames.end())
122 return iMaxBound->second;
127 return Interpolate(*iMaxBound,
ColourFrame(1.0f, maxBoundDefaultColour), gradientPosition);
132 return Interpolate(*iMinBound, *iMaxBound, gradientPosition);
135 Ogre::ColourValue SColourGradient::Interpolate(
const ColourFrame& minColourFrame,
const ColourFrame& maxColourFrame,
const float& mediumRangeValue)
const