mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-20 23:23:47 +00:00
Implementation of sRGB image support. Overhauls the linearization setup to utilize the sRGB image types, as well as refactors the use of ColorF and ColorI to be properly internally consistent. ColorIs are used only for front-facing/editing/UI settings, and ColorFs, now renamed to LinearColorF to reduce confusion of purpose, are used for color info in the engine itself. This avoids confusing and expensive conversions back and forth between types and avoids botches with linearity. Majority work done by @rextimmy
This commit is contained in:
parent
8780f83262
commit
25686ed4be
294 changed files with 3894 additions and 2813 deletions
|
|
@ -307,22 +307,22 @@ void GuiBitmapButtonCtrl::setBitmap( const String& name )
|
|||
if( mUseModifiers )
|
||||
baseName += modifiers[ i ];
|
||||
|
||||
mTextures[ i ].mTextureNormal = GFXTexHandle( baseName, &GFXDefaultPersistentProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__));
|
||||
mTextures[ i ].mTextureNormal = GFXTexHandle( baseName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__));
|
||||
|
||||
if( mUseStates )
|
||||
{
|
||||
if( !mTextures[ i ].mTextureNormal )
|
||||
mTextures[ i ].mTextureNormal = GFXTexHandle( baseName + s_n, &GFXDefaultPersistentProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__));
|
||||
mTextures[ i ].mTextureNormal = GFXTexHandle( baseName + s_n, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__));
|
||||
|
||||
mTextures[ i ].mTextureHilight = GFXTexHandle( baseName + s_h, &GFXDefaultPersistentProfile, avar("%s() - mTextureHighlight (line %d)", __FUNCTION__, __LINE__));
|
||||
mTextures[ i ].mTextureHilight = GFXTexHandle( baseName + s_h, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureHighlight (line %d)", __FUNCTION__, __LINE__));
|
||||
if( !mTextures[ i ].mTextureHilight )
|
||||
mTextures[ i ].mTextureHilight = mTextures[ i ].mTextureNormal;
|
||||
|
||||
mTextures[ i ].mTextureDepressed = GFXTexHandle( baseName + s_d, &GFXDefaultPersistentProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__));
|
||||
mTextures[ i ].mTextureDepressed = GFXTexHandle( baseName + s_d, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__));
|
||||
if( !mTextures[ i ].mTextureDepressed )
|
||||
mTextures[ i ].mTextureDepressed = mTextures[ i ].mTextureHilight;
|
||||
|
||||
mTextures[ i ].mTextureInactive = GFXTexHandle( baseName + s_i, &GFXDefaultPersistentProfile, avar("%s() - mTextureInactive (line %d)", __FUNCTION__, __LINE__));
|
||||
mTextures[ i ].mTextureInactive = GFXTexHandle( baseName + s_i, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureInactive (line %d)", __FUNCTION__, __LINE__));
|
||||
if( !mTextures[ i ].mTextureInactive )
|
||||
mTextures[ i ].mTextureInactive = mTextures[ i ].mTextureNormal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ void GuiIconButtonCtrl::setBitmap(const char *name)
|
|||
|
||||
if (*mBitmapName)
|
||||
{
|
||||
mTextureNormal = GFXTexHandle( name, &GFXDefaultPersistentProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) );
|
||||
mTextureNormal = GFXTexHandle( name, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ ConsoleDocClass( GuiSwatchButtonCtrl,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
GuiSwatchButtonCtrl::GuiSwatchButtonCtrl()
|
||||
: mSwatchColor(1, 1, 1, 1), mUseSRGB(false)
|
||||
: mSwatchColor(1, 1, 1, 1)
|
||||
{
|
||||
mButtonText = StringTable->insert( "" );
|
||||
setExtent(140, 30);
|
||||
|
|
@ -72,8 +72,6 @@ GuiSwatchButtonCtrl::GuiSwatchButtonCtrl()
|
|||
void GuiSwatchButtonCtrl::initPersistFields()
|
||||
{
|
||||
addField("color", TypeColorF, Offset(mSwatchColor, GuiSwatchButtonCtrl), "The foreground color of GuiSwatchButtonCtrl");
|
||||
addField( "useSRGB", TypeBool, Offset( mUseSRGB, GuiSwatchButtonCtrl ), "Render using sRGB scale" );
|
||||
|
||||
addField( "gridBitmap", TypeString, Offset( mGridBitmap, GuiSwatchButtonCtrl ), "The bitmap used for the transparent grid" );
|
||||
|
||||
Parent::initPersistFields();
|
||||
|
|
@ -108,10 +106,7 @@ void GuiSwatchButtonCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
drawer->drawBitmapStretch( mGrid, renderRect );
|
||||
|
||||
// Draw swatch color as fill...
|
||||
if (!mUseSRGB)
|
||||
drawer->drawRectFill( renderRect, mSwatchColor.toGamma() );
|
||||
else
|
||||
drawer->drawRectFill(renderRect, mSwatchColor);
|
||||
drawer->drawRectFill(renderRect, mSwatchColor.toColorI());
|
||||
|
||||
// Draw any borders...
|
||||
drawer->drawRect( renderRect, borderColor );
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ class GuiSwatchButtonCtrl : public GuiButtonBaseCtrl
|
|||
protected:
|
||||
|
||||
/// The color to display on the button.
|
||||
ColorF mSwatchColor;
|
||||
bool mUseSRGB; ///< use sRGB color scale
|
||||
LinearColorF mSwatchColor;
|
||||
/// Bitmap used for mGrid
|
||||
String mGridBitmap;
|
||||
|
||||
|
|
@ -52,10 +51,10 @@ class GuiSwatchButtonCtrl : public GuiButtonBaseCtrl
|
|||
GuiSwatchButtonCtrl();
|
||||
|
||||
/// Return the color displayed in the swatch.
|
||||
ColorF getColor() { return mSwatchColor; }
|
||||
LinearColorF getColor() { return mSwatchColor; }
|
||||
|
||||
/// Set the color to display in the swatch.
|
||||
void setColor( const ColorF &color ) { mSwatchColor = color; }
|
||||
void setColor( const LinearColorF &color ) { mSwatchColor = color; }
|
||||
|
||||
// GuiButtonBaseCtrl
|
||||
virtual bool onWake();
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ void GuiToolboxButtonCtrl::setNormalBitmap( StringTableEntry bitmapName )
|
|||
return;
|
||||
|
||||
if ( *mNormalBitmapName )
|
||||
mTextureNormal = GFXTexHandle( mNormalBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) );
|
||||
mTextureNormal = GFXTexHandle( mNormalBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) );
|
||||
else
|
||||
mTextureNormal = NULL;
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ void GuiToolboxButtonCtrl::setLoweredBitmap( StringTableEntry bitmapName )
|
|||
return;
|
||||
|
||||
if ( *mLoweredBitmapName )
|
||||
mTextureLowered = GFXTexHandle( mLoweredBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureLowered (line %d)", __FUNCTION__, __LINE__) );
|
||||
mTextureLowered = GFXTexHandle( mLoweredBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureLowered (line %d)", __FUNCTION__, __LINE__) );
|
||||
else
|
||||
mTextureLowered = NULL;
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ void GuiToolboxButtonCtrl::setHoverBitmap( StringTableEntry bitmapName )
|
|||
return;
|
||||
|
||||
if ( *mHoverBitmapName )
|
||||
mTextureHover = GFXTexHandle( mHoverBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureHover (line %d)", __FUNCTION__, __LINE__) );
|
||||
mTextureHover = GFXTexHandle( mHoverBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureHover (line %d)", __FUNCTION__, __LINE__) );
|
||||
else
|
||||
mTextureHover = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@
|
|||
|
||||
/// @name Common colors we use
|
||||
/// @{
|
||||
ColorF colorWhite(1.,1.,1.);
|
||||
ColorF colorWhiteBlend(1.,1.,1.,.75);
|
||||
ColorF colorBlack(.0,.0,.0);
|
||||
ColorF colorAlpha(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
ColorF colorAlphaW(1.0f, 1.0f, 1.0f, 0.0f);
|
||||
LinearColorF colorWhite(1.,1.,1.);
|
||||
LinearColorF colorWhiteBlend(1.,1.,1.,.75);
|
||||
LinearColorF colorBlack(.0,.0,.0);
|
||||
LinearColorF colorAlpha(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
LinearColorF colorAlphaW(1.0f, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
ColorI GuiColorPickerCtrl::mColorRange[7] = {
|
||||
ColorI(255,0,0), // Red
|
||||
|
|
@ -52,7 +52,7 @@ ColorI GuiColorPickerCtrl::mColorRange[7] = {
|
|||
IMPLEMENT_CONOBJECT(GuiColorPickerCtrl);
|
||||
|
||||
ConsoleDocClass( GuiColorPickerCtrl,
|
||||
"@brief Editor GUI used for picking a ColorF from a palette.\n\n"
|
||||
"@brief Editor GUI used for picking a LinearColorF from a palette.\n\n"
|
||||
"@note Editor use only.\n\n"
|
||||
"@internal"
|
||||
);
|
||||
|
|
@ -61,8 +61,8 @@ GuiColorPickerCtrl::GuiColorPickerCtrl()
|
|||
{
|
||||
setExtent(140, 30);
|
||||
mDisplayMode = pPallet;
|
||||
mBaseColor = ColorF(1.,.0,1.);
|
||||
mPickColor = ColorF(.0,.0,.0);
|
||||
mBaseColor = LinearColorF(1.,.0,1.);
|
||||
mPickColor = LinearColorF(.0,.0,.0);
|
||||
mSelectorPos = Point2I(0,0);
|
||||
mMouseDown = mMouseOver = false;
|
||||
mActive = true;
|
||||
|
|
@ -73,7 +73,6 @@ GuiColorPickerCtrl::GuiColorPickerCtrl()
|
|||
mSelectColor = false;
|
||||
mSetColor = mSetColor.BLACK;
|
||||
mBitmap = NULL;
|
||||
mUseSRGB = false;
|
||||
}
|
||||
|
||||
GuiColorPickerCtrl::~GuiColorPickerCtrl()
|
||||
|
|
@ -105,7 +104,6 @@ void GuiColorPickerCtrl::initPersistFields()
|
|||
addGroup("ColorPicker");
|
||||
addField("baseColor", TypeColorF, Offset(mBaseColor, GuiColorPickerCtrl));
|
||||
addField("pickColor", TypeColorF, Offset(mPickColor, GuiColorPickerCtrl));
|
||||
addField("useSRGB", TypeBool, Offset(mUseSRGB, GuiColorPickerCtrl), "Render using sRGB scale");
|
||||
addField("selectorGap", TypeS32, Offset(mSelectorGap, GuiColorPickerCtrl));
|
||||
addField("displayMode", TYPEID< PickMode >(), Offset(mDisplayMode, GuiColorPickerCtrl) );
|
||||
addField("actionOnMove", TypeBool,Offset(mActionOnMove, GuiColorPickerCtrl));
|
||||
|
|
@ -116,25 +114,19 @@ void GuiColorPickerCtrl::initPersistFields()
|
|||
}
|
||||
|
||||
// Function to draw a box which can have 4 different colors in each corner blended together
|
||||
void GuiColorPickerCtrl::drawBlendBox(RectI &bounds, ColorF &c1, ColorF &c2, ColorF &c3, ColorF &c4)
|
||||
void GuiColorPickerCtrl::drawBlendBox(RectI &bounds, LinearColorF &c1, LinearColorF &c2, LinearColorF &c3, LinearColorF &c4)
|
||||
{
|
||||
GFX->setStateBlock(mStateBlock);
|
||||
|
||||
S32 l = bounds.point.x, r = bounds.point.x + bounds.extent.x;
|
||||
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y;
|
||||
|
||||
ColorF col[4];
|
||||
LinearColorF col[4];
|
||||
col[0] = c1;
|
||||
col[1] = c2;
|
||||
col[2] = c3;
|
||||
col[3] = c4;
|
||||
if (!mUseSRGB)
|
||||
{
|
||||
for (U32 i = 0; i < 4; i++)
|
||||
col[i] = col[i].toGamma();
|
||||
}
|
||||
|
||||
//A couple of checks to determine if color blend
|
||||
//A couple of checks to determine if color blend
|
||||
if (c1 == colorWhite && c3 == colorAlpha && c4 == colorBlack)
|
||||
{
|
||||
|
|
@ -224,17 +216,8 @@ void GuiColorPickerCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, U8 numC
|
|||
|
||||
ColorI *col = new ColorI[numColors];
|
||||
dMemcpy(col, colors, numColors * sizeof(ColorI));
|
||||
if (mUseSRGB)
|
||||
{
|
||||
for (U16 i = 0; i < numColors - 1; i++)
|
||||
for (U16 i = 0; i < numColors - 1; i++)
|
||||
col[i] = colors[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (U16 i = 0; i < numColors - 1; i++)
|
||||
col[i] = colors[i].toGamma();
|
||||
}
|
||||
|
||||
|
||||
for (U16 i = 0; i < numColors - 1; i++)
|
||||
{
|
||||
|
|
@ -273,6 +256,8 @@ void GuiColorPickerCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, U8 numC
|
|||
}
|
||||
PrimBuild::end();
|
||||
}
|
||||
|
||||
SAFE_DELETE_ARRAY(col);
|
||||
}
|
||||
|
||||
void GuiColorPickerCtrl::drawSelector(RectI &bounds, Point2I &selectorPos, SelectorMode mode)
|
||||
|
|
@ -281,23 +266,24 @@ void GuiColorPickerCtrl::drawSelector(RectI &bounds, Point2I &selectorPos, Selec
|
|||
return;
|
||||
|
||||
U16 sMax = mSelectorGap*2;
|
||||
const ColorI color = colorWhiteBlend.toColorI();
|
||||
switch (mode)
|
||||
{
|
||||
case sVertical:
|
||||
// Now draw the vertical selector Up -> Pos
|
||||
if (selectorPos.y != bounds.point.y+1)
|
||||
GFX->getDrawUtil()->drawLine(selectorPos.x, bounds.point.y, selectorPos.x, selectorPos.y-sMax-1, colorWhiteBlend);
|
||||
GFX->getDrawUtil()->drawLine(selectorPos.x, bounds.point.y, selectorPos.x, selectorPos.y-sMax-1, color);
|
||||
// Down -> Pos
|
||||
if (selectorPos.y != bounds.point.y+bounds.extent.y)
|
||||
GFX->getDrawUtil()->drawLine(selectorPos.x, selectorPos.y + sMax, selectorPos.x, bounds.point.y + bounds.extent.y, colorWhiteBlend);
|
||||
GFX->getDrawUtil()->drawLine(selectorPos.x, selectorPos.y + sMax, selectorPos.x, bounds.point.y + bounds.extent.y, color);
|
||||
break;
|
||||
case sHorizontal:
|
||||
// Now draw the horizontal selector Left -> Pos
|
||||
if (selectorPos.x != bounds.point.x)
|
||||
GFX->getDrawUtil()->drawLine(bounds.point.x, selectorPos.y-1, selectorPos.x-sMax, selectorPos.y-1, colorWhiteBlend);
|
||||
GFX->getDrawUtil()->drawLine(bounds.point.x, selectorPos.y-1, selectorPos.x-sMax, selectorPos.y-1, color);
|
||||
// Right -> Pos
|
||||
if (selectorPos.x != bounds.point.x)
|
||||
GFX->getDrawUtil()->drawLine(bounds.point.x+mSelectorPos.x+sMax, selectorPos.y-1, bounds.point.x + bounds.extent.x, selectorPos.y-1, colorWhiteBlend);
|
||||
GFX->getDrawUtil()->drawLine(bounds.point.x+mSelectorPos.x+sMax, selectorPos.y-1, bounds.point.x + bounds.extent.x, selectorPos.y-1, color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -339,7 +325,7 @@ void GuiColorPickerCtrl::renderColorBox(RectI &bounds)
|
|||
drawBlendBox( blendRect, colorAlpha, colorAlpha, colorBlack, colorBlack );
|
||||
blendRect.point.y += blendRect.extent.y - 1;
|
||||
blendRect.extent.y = 2;
|
||||
GFX->getDrawUtil()->drawRect( blendRect, colorBlack);
|
||||
GFX->getDrawUtil()->drawRect( blendRect, colorBlack.toColorI());
|
||||
drawSelector( pickerBounds, selectorPos, sHorizontal );
|
||||
drawSelector( pickerBounds, selectorPos, sVertical );
|
||||
break;
|
||||
|
|
@ -366,7 +352,7 @@ void GuiColorPickerCtrl::renderColorBox(RectI &bounds)
|
|||
break;
|
||||
case pPallet:
|
||||
default:
|
||||
GFX->getDrawUtil()->drawRectFill( pickerBounds, mBaseColor );
|
||||
GFX->getDrawUtil()->drawRectFill( pickerBounds, mBaseColor.toColorI());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -404,7 +390,7 @@ void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
|
|||
U32 buf_x = offset.x + mSelectorPos.x + 1;
|
||||
U32 buf_y = resolution.y - (extent.y - (offset.y + mSelectorPos.y + 1));
|
||||
|
||||
GFXTexHandle bb( resolution.x, resolution.y, GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );
|
||||
GFXTexHandle bb(resolution.x, resolution.y, GFXFormatR8G8B8A8_SRGB, &GFXRenderTargetSRGBProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__));
|
||||
|
||||
Point2I tmpPt(buf_x, buf_y);
|
||||
|
||||
|
|
@ -417,7 +403,7 @@ void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
|
|||
mBitmap = NULL;
|
||||
}
|
||||
|
||||
mBitmap = new GBitmap(bb.getWidth(), bb.getHeight());
|
||||
mBitmap = new GBitmap(bb.getWidth(), bb.getHeight(),false,GFXFormatR8G8B8A8);
|
||||
|
||||
bb.copyToBmp(mBitmap);
|
||||
|
||||
|
|
@ -435,7 +421,7 @@ void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
|
|||
ColorI tmp;
|
||||
mBitmap->getColor(buf_x, buf_y, tmp);
|
||||
|
||||
mPickColor = (ColorF)tmp;
|
||||
mPickColor = (LinearColorF)tmp;
|
||||
|
||||
// Now do onAction() if we are allowed
|
||||
if (mActionOnMove)
|
||||
|
|
@ -449,7 +435,7 @@ void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
|
|||
renderChildControls(offset, updateRect);
|
||||
}
|
||||
|
||||
void GuiColorPickerCtrl::setSelectorPos(const ColorF & color)
|
||||
void GuiColorPickerCtrl::setSelectorPos(const LinearColorF & color)
|
||||
{
|
||||
if (mBitmap && !mPositionChanged)
|
||||
{
|
||||
|
|
@ -469,7 +455,7 @@ void GuiColorPickerCtrl::setSelectorPos(const ColorF & color)
|
|||
}
|
||||
}
|
||||
|
||||
Point2I GuiColorPickerCtrl::findColor(const ColorF & color, const Point2I& offset, const Point2I& resolution, GBitmap& bmp)
|
||||
Point2I GuiColorPickerCtrl::findColor(const LinearColorF & color, const Point2I& offset, const Point2I& resolution, GBitmap& bmp)
|
||||
{
|
||||
RectI rect;
|
||||
Point2I ext = getExtent();
|
||||
|
|
@ -506,7 +492,7 @@ Point2I GuiColorPickerCtrl::findColor(const ColorF & color, const Point2I& offse
|
|||
ColorI tmp;
|
||||
U32 buf_x;
|
||||
U32 buf_y;
|
||||
ColorF curColor;
|
||||
LinearColorF curColor;
|
||||
F32 val(10000.0f);
|
||||
F32 closestVal(10000.0f);
|
||||
bool closestSet = false;
|
||||
|
|
@ -521,7 +507,7 @@ Point2I GuiColorPickerCtrl::findColor(const ColorF & color, const Point2I& offse
|
|||
|
||||
//Get the color at that position
|
||||
bmp.getColor(buf_x, buf_y, tmp);
|
||||
curColor = (ColorF)tmp;
|
||||
curColor = (LinearColorF)tmp;
|
||||
|
||||
//Evaluate how close the color is to our desired color
|
||||
val = mFabs(color.red - curColor.red) + mFabs(color.green - curColor.green) + mFabs(color.blue - curColor.blue);
|
||||
|
|
@ -660,14 +646,14 @@ void GuiColorPickerCtrl::onMouseUp(const GuiEvent &)
|
|||
const char *GuiColorPickerCtrl::getScriptValue()
|
||||
{
|
||||
static char temp[256];
|
||||
ColorF color = getValue();
|
||||
LinearColorF color = getValue();
|
||||
dSprintf( temp, 256, "%f %f %f %f", color.red, color.green, color.blue, color.alpha );
|
||||
return temp;
|
||||
}
|
||||
|
||||
void GuiColorPickerCtrl::setScriptValue(const char *value)
|
||||
{
|
||||
ColorF newValue;
|
||||
LinearColorF newValue;
|
||||
dSscanf(value, "%f %f %f %f", &newValue.red, &newValue.green, &newValue.blue, &newValue.alpha);
|
||||
setValue(newValue);
|
||||
}
|
||||
|
|
@ -687,7 +673,7 @@ DefineConsoleMethod(GuiColorPickerCtrl, updateColor, void, (), , "Forces update
|
|||
object->updateColor();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectorColor, void, (ColorF color), ,
|
||||
DefineEngineMethod(GuiColorPickerCtrl, setSelectorColor, void, (LinearColorF color), ,
|
||||
"Sets the current position of the selector based on a color.n"
|
||||
"@param color Color to look for.n")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -81,16 +81,15 @@ class GuiColorPickerCtrl : public GuiControl
|
|||
/// @{
|
||||
void renderColorBox(RectI &bounds); ///< Function that draws the actual color box
|
||||
void drawSelector(RectI &bounds, Point2I &selectorPos, SelectorMode mode); /// < Function that draws the selection indicator
|
||||
void drawBlendBox(RectI &bounds, ColorF &c1, ColorF &c2, ColorF &c3, ColorF &c4);
|
||||
void drawBlendBox(RectI &bounds, LinearColorF &c1, LinearColorF &c2, LinearColorF &c3, LinearColorF &c4);
|
||||
void drawBlendRangeBox(RectI &bounds, bool vertical, U8 numColors, ColorI *colors);
|
||||
/// @}
|
||||
|
||||
/// @name Core Variables
|
||||
/// @{
|
||||
ColorF mPickColor; ///< Color that has been picked from control
|
||||
ColorF mBaseColor; ///< Colour we display (in case of pallet and blend mode)
|
||||
LinearColorF mPickColor; ///< Color that has been picked from control
|
||||
LinearColorF mBaseColor; ///< Colour we display (in case of pallet and blend mode)
|
||||
PickMode mDisplayMode; ///< Current color display mode of the selector
|
||||
bool mUseSRGB; ///< use sRGB color scale
|
||||
|
||||
Point2I mSelectorPos; ///< Current position of the selector
|
||||
bool mPositionChanged; ///< Current position has changed since last render?
|
||||
|
|
@ -99,10 +98,10 @@ class GuiColorPickerCtrl : public GuiControl
|
|||
bool mActionOnMove; ///< Perform onAction() when position has changed?
|
||||
|
||||
bool mSelectColor;
|
||||
ColorF mSetColor;
|
||||
LinearColorF mSetColor;
|
||||
GBitmap* mBitmap;
|
||||
|
||||
Point2I findColor(const ColorF & color, const Point2I& offset, const Point2I& resolution, GBitmap& bmp);
|
||||
Point2I findColor(const LinearColorF & color, const Point2I& offset, const Point2I& resolution, GBitmap& bmp);
|
||||
|
||||
S32 mSelectorGap; ///< The half-way "gap" between the selector pos and where the selector is allowed to draw.
|
||||
|
||||
|
|
@ -125,9 +124,9 @@ class GuiColorPickerCtrl : public GuiControl
|
|||
/// @name Color Value Functions
|
||||
/// @{
|
||||
/// NOTE: setValue only sets baseColor, since setting pickColor wouldn't be useful
|
||||
void setValue(ColorF &value) {mBaseColor = value;}
|
||||
void setValue(LinearColorF &value) {mBaseColor = value;}
|
||||
/// NOTE: getValue() returns baseColor if pallet (since pallet controls can't "pick" colours themselves)
|
||||
ColorF getValue() { return mDisplayMode == pPallet ? mBaseColor : mPickColor; }
|
||||
LinearColorF getValue() { return mDisplayMode == pPallet ? mBaseColor : mPickColor; }
|
||||
const char *getScriptValue();
|
||||
void setScriptValue(const char *value);
|
||||
void updateColor() {mPositionChanged = true;}
|
||||
|
|
@ -136,7 +135,7 @@ class GuiColorPickerCtrl : public GuiControl
|
|||
/// @name Selector Functions
|
||||
/// @{
|
||||
void setSelectorPos(const Point2I &pos); ///< Set new pos (in local coords)
|
||||
void setSelectorPos(const ColorF & color);
|
||||
void setSelectorPos(const LinearColorF & color);
|
||||
Point2I getSelectorPos() {return mSelectorPos;}
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ void GuiGradientSwatchCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
drawer->drawBitmapStretch( mGrid, renderRect );
|
||||
|
||||
// Draw swatch color as fill...
|
||||
drawer->drawRectFill( renderRect, mSwatchColor );
|
||||
drawer->drawRectFill( renderRect, mSwatchColor.toColorI());
|
||||
|
||||
// Draw any borders...
|
||||
drawer->drawRect( renderRect, borderColor );
|
||||
|
|
@ -218,14 +218,14 @@ GuiGradientCtrl::GuiGradientCtrl()
|
|||
setExtent(140, 30);
|
||||
mDisplayMode = pHorizColorRange;
|
||||
mSaveDisplayMode = pHorizColorRange;
|
||||
mBaseColor = ColorF(1.,.0,1.);
|
||||
mPickColor = ColorF(.0,.0,.0);
|
||||
mBaseColor = LinearColorF(1.,.0,1.);
|
||||
mPickColor = LinearColorF(.0,.0,.0);
|
||||
mMouseDown = mMouseOver = false;
|
||||
mActive = true;
|
||||
mPositionChanged = false;
|
||||
mActionOnMove = false;
|
||||
mShowReticle = true;
|
||||
colorWhiteBlend = ColorF(1.,1.,1.,.75);
|
||||
colorWhiteBlend = LinearColorF(1.,1.,1.,.75);
|
||||
mSwatchFactor = 7;
|
||||
}
|
||||
|
||||
|
|
@ -410,7 +410,7 @@ void GuiGradientCtrl::onMouseDown(const GuiEvent &event)
|
|||
Point2I resolution = getRoot()->getExtent();
|
||||
GFXTexHandle bb( resolution.x,
|
||||
resolution.y,
|
||||
GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );
|
||||
GFXFormatR8G8B8A8, &GFXRenderTargetSRGBProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );
|
||||
|
||||
Point2I tmpPt( event.mousePoint.x, event.mousePoint.y );
|
||||
GFXTarget *targ = GFX->getActiveRenderTarget();
|
||||
|
|
@ -420,7 +420,7 @@ void GuiGradientCtrl::onMouseDown(const GuiEvent &event)
|
|||
ColorI tmp;
|
||||
bmp.getColor( event.mousePoint.x, event.mousePoint.y, tmp );
|
||||
|
||||
addColorRange( globalToLocalCoord(event.mousePoint), ColorF(tmp) );
|
||||
addColorRange( globalToLocalCoord(event.mousePoint), LinearColorF(tmp) );
|
||||
|
||||
mMouseDown = true;
|
||||
}
|
||||
|
|
@ -506,7 +506,7 @@ void GuiGradientCtrl::reInitSwatches( GuiGradientCtrl::PickMode )
|
|||
mColorRange[i].swatch->registerObject();
|
||||
addObject(mColorRange[i].swatch);
|
||||
mColorRange[i].swatch->setPosition( Point2I( mColorRange[i].pos, b ) );// needs to be adjusted
|
||||
mColorRange[i].swatch->setColor(ColorF(mColorRange[i].color));
|
||||
mColorRange[i].swatch->setColor(LinearColorF(mColorRange[i].color));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -518,12 +518,12 @@ void GuiGradientCtrl::reInitSwatches( GuiGradientCtrl::PickMode )
|
|||
mAlphaRange[i].swatch->registerObject();
|
||||
addObject(mAlphaRange[i].swatch);
|
||||
mAlphaRange[i].swatch->setPosition( Point2I( mAlphaRange[i].pos, b ) );// needs to be adjusted
|
||||
mAlphaRange[i].swatch->setColor(ColorF(mAlphaRange[i].color));
|
||||
mAlphaRange[i].swatch->setColor(LinearColorF(mAlphaRange[i].color));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GuiGradientCtrl::addColorRange(Point2I pos, const ColorF& color)
|
||||
void GuiGradientCtrl::addColorRange(Point2I pos, const LinearColorF& color)
|
||||
{
|
||||
if( pos.x + mSwatchFactor < mBlendRangeBox.point.x &&
|
||||
pos.x + mSwatchFactor > mBlendRangeBox.extent.x )
|
||||
|
|
@ -611,7 +611,7 @@ DefineConsoleMethod(GuiGradientCtrl, getColorCount, S32, (), , "Get color count"
|
|||
return 0;
|
||||
}
|
||||
|
||||
DefineConsoleMethod(GuiGradientCtrl, getColor, ColorF, (S32 idx), , "Get color value")
|
||||
DefineConsoleMethod(GuiGradientCtrl, getColor, LinearColorF, (S32 idx), , "Get color value")
|
||||
{
|
||||
|
||||
if( object->getDisplayMode() == GuiGradientCtrl::pHorizColorRange )
|
||||
|
|
@ -631,5 +631,5 @@ DefineConsoleMethod(GuiGradientCtrl, getColor, ColorF, (S32 idx), , "Get color v
|
|||
}
|
||||
}
|
||||
|
||||
return ColorF::ONE;
|
||||
return LinearColorF::ONE;
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ public:
|
|||
{
|
||||
GuiGradientSwatchCtrl* swatch;
|
||||
S32 pos;
|
||||
ColorF color;
|
||||
LinearColorF color;
|
||||
};
|
||||
|
||||
Vector<ColorRange> mColorRange;
|
||||
|
|
@ -93,8 +93,8 @@ private:
|
|||
|
||||
/// @name Core Variables
|
||||
/// @{
|
||||
ColorF mPickColor; ///< Color that has been picked from control
|
||||
ColorF mBaseColor; ///< Colour we display (in case of pallet and blend mode)
|
||||
LinearColorF mPickColor; ///< Color that has been picked from control
|
||||
LinearColorF mBaseColor; ///< Colour we display (in case of pallet and blend mode)
|
||||
PickMode mDisplayMode; ///< Current color display mode of the selector
|
||||
PickMode mSaveDisplayMode;
|
||||
|
||||
|
|
@ -105,11 +105,11 @@ private:
|
|||
|
||||
GFXStateBlockRef mStateBlock;
|
||||
|
||||
ColorF colorWhite;
|
||||
ColorF colorWhiteBlend;
|
||||
ColorF colorBlack;
|
||||
ColorF colorAlpha;
|
||||
ColorF colorAlphaW;
|
||||
LinearColorF colorWhite;
|
||||
LinearColorF colorWhiteBlend;
|
||||
LinearColorF colorBlack;
|
||||
LinearColorF colorAlpha;
|
||||
LinearColorF colorAlphaW;
|
||||
/// @}
|
||||
String mColorFunction;
|
||||
|
||||
|
|
@ -126,9 +126,9 @@ public:
|
|||
/// @name Color Value Functions
|
||||
/// @{
|
||||
/// NOTE: setValue only sets baseColor, since setting pickColor wouldn't be useful
|
||||
void setValue(ColorF &value) {mBaseColor = value;}
|
||||
void setValue(LinearColorF &value) {mBaseColor = value;}
|
||||
/// NOTE: getValue() returns baseColor if pallet (since pallet controls can't "pick" colours themselves)
|
||||
ColorF getValue() {return mPickColor;}
|
||||
LinearColorF getValue() {return mPickColor;}
|
||||
void updateColor() {mPositionChanged = true;}
|
||||
/// @}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ public:
|
|||
void inspectPreApply();
|
||||
void inspectPostApply();
|
||||
void reInitSwatches( GuiGradientCtrl::PickMode );
|
||||
void addColorRange(Point2I pos, const ColorF& color);
|
||||
void addColorRange(Point2I pos, const LinearColorF& color);
|
||||
void removeColorRange( GuiGradientSwatchCtrl* swatch );
|
||||
void sortColorRange();
|
||||
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ DefineEngineMethod( GuiListBoxCtrl, addItem, S32, (const char* newItem, const ch
|
|||
green = dAtof(GuiListBoxCtrl::getStringElement( color, 1 ));
|
||||
blue = dAtof(GuiListBoxCtrl::getStringElement( color, 2 ));
|
||||
|
||||
return object->addItemWithColor( newItem, ColorF(red, green, blue) );
|
||||
return object->addItemWithColor( newItem, LinearColorF(red, green, blue) );
|
||||
}
|
||||
else if(elementCount == 1)
|
||||
{
|
||||
|
|
@ -654,13 +654,13 @@ S32 GuiListBoxCtrl::addItem( StringTableEntry text, void *itemData )
|
|||
return insertItem( mItems.size(), text, itemData );
|
||||
}
|
||||
|
||||
S32 GuiListBoxCtrl::addItemWithColor( StringTableEntry text, ColorF color, void *itemData )
|
||||
S32 GuiListBoxCtrl::addItemWithColor( StringTableEntry text, LinearColorF color, void *itemData )
|
||||
{
|
||||
// This just calls insert item at the end of the list
|
||||
return insertItemWithColor( mItems.size(), text, color, itemData );
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiListBoxCtrl, setItemColor, void, (S32 index, ColorF color),,
|
||||
DefineEngineMethod( GuiListBoxCtrl, setItemColor, void, (S32 index, LinearColorF color),,
|
||||
"@brief Sets the color of a single list entry at the specified index id.\n\n"
|
||||
"@param index Index id to modify the color of in the list.\n"
|
||||
"@param color Color value to set the list entry to.\n"
|
||||
|
|
@ -677,7 +677,7 @@ DefineEngineMethod( GuiListBoxCtrl, setItemColor, void, (S32 index, ColorF color
|
|||
object->setItemColor( index, color );
|
||||
}
|
||||
|
||||
void GuiListBoxCtrl::setItemColor(S32 index, const ColorF& color)
|
||||
void GuiListBoxCtrl::setItemColor(S32 index, const LinearColorF& color)
|
||||
{
|
||||
if ((index >= mItems.size()) || index < 0)
|
||||
{
|
||||
|
|
@ -767,7 +767,7 @@ S32 GuiListBoxCtrl::insertItem( S32 index, StringTableEntry text, void *itemData
|
|||
|
||||
}
|
||||
|
||||
S32 GuiListBoxCtrl::insertItemWithColor( S32 index, StringTableEntry text, ColorF color, void *itemData )
|
||||
S32 GuiListBoxCtrl::insertItemWithColor( S32 index, StringTableEntry text, LinearColorF color, void *itemData )
|
||||
{
|
||||
// If the index is greater than our list size, insert it at the end
|
||||
if( index >= mItems.size() )
|
||||
|
|
@ -780,7 +780,7 @@ S32 GuiListBoxCtrl::insertItemWithColor( S32 index, StringTableEntry text, Color
|
|||
return -1;
|
||||
}
|
||||
|
||||
if( color == ColorF(-1, -1, -1) )
|
||||
if( color == LinearColorF(-1, -1, -1) )
|
||||
{
|
||||
Con::warnf("GuiListBoxCtrl::insertItem - cannot add NULL color" );
|
||||
return -1;
|
||||
|
|
@ -1065,7 +1065,7 @@ void GuiListBoxCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
{
|
||||
// Set the size of the color box to be drawn next to the item text
|
||||
colorBoxSize = 3;
|
||||
boxColor = ColorI(mItems[i]->color);
|
||||
boxColor = ColorI(mItems[i]->color.toColorI());
|
||||
// Draw the box first
|
||||
ColorI black = ColorI(0, 0, 0);
|
||||
drawBox( Point2I(offset.x + mProfile->mTextOffset.x + colorBoxSize, offset.y + ( i * mItemSize.y ) + 8), colorBoxSize, black, boxColor );
|
||||
|
|
@ -1085,7 +1085,7 @@ void GuiListBoxCtrl::onRenderItem(const RectI& itemRect, LBItem *item)
|
|||
if( item->isSelected )
|
||||
GFX->getDrawUtil()->drawRectFill( itemRect, mProfile->mFillColorSEL );
|
||||
|
||||
GFX->getDrawUtil()->setBitmapModulation( item->hasColor ? (ColorI)item->color : mProfile->mFontColor);
|
||||
GFX->getDrawUtil()->setBitmapModulation( item->hasColor ? item->color.toColorI() : mProfile->mFontColor);
|
||||
renderJustifiedText(itemRect.point + Point2I( 2, 0 ), itemRect.extent, item->itemText);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public:
|
|||
String itemTooltip;
|
||||
bool isSelected;
|
||||
void* itemData;
|
||||
ColorF color;
|
||||
LinearColorF color;
|
||||
bool hasColor;
|
||||
};
|
||||
|
||||
|
|
@ -102,12 +102,12 @@ public:
|
|||
void setItemText( S32 index, StringTableEntry text );
|
||||
|
||||
S32 addItem( StringTableEntry text, void *itemData = NULL );
|
||||
S32 addItemWithColor( StringTableEntry text, ColorF color = ColorF(-1, -1, -1), void *itemData = NULL);
|
||||
S32 addItemWithColor( StringTableEntry text, LinearColorF color = LinearColorF(-1, -1, -1), void *itemData = NULL);
|
||||
S32 insertItem( S32 index, StringTableEntry text, void *itemData = NULL );
|
||||
S32 insertItemWithColor( S32 index, StringTableEntry text, ColorF color = ColorF(-1, -1, -1), void *itemData = NULL);
|
||||
S32 insertItemWithColor( S32 index, StringTableEntry text, LinearColorF color = LinearColorF(-1, -1, -1), void *itemData = NULL);
|
||||
S32 findItemText( StringTableEntry text, bool caseSensitive = false );
|
||||
|
||||
void setItemColor(S32 index, const ColorF& color);
|
||||
void setItemColor(S32 index, const LinearColorF& color);
|
||||
void clearItemColor(S32 index);
|
||||
|
||||
void deleteItem( S32 index );
|
||||
|
|
|
|||
|
|
@ -1871,7 +1871,7 @@ bool GuiTreeViewCtrl::buildIconTable(const char * icons)
|
|||
dStrncpy( buf, start, getMin( sizeof( buf ) / sizeof( buf[ 0 ] ) - 1, len ) );
|
||||
buf[ len ] = '\0';
|
||||
|
||||
mIconTable[ numIcons ] = GFXTexHandle( buf, &GFXDefaultPersistentProfile, avar( "%s() - mIconTable[%d] (line %d)", __FUNCTION__, numIcons, __LINE__ ) );
|
||||
mIconTable[ numIcons ] = GFXTexHandle( buf, &GFXTexturePersistentProfile, avar( "%s() - mIconTable[%d] (line %d)", __FUNCTION__, numIcons, __LINE__ ) );
|
||||
}
|
||||
else
|
||||
mIconTable[ numIcons ] = GFXTexHandle();
|
||||
|
|
@ -3942,7 +3942,7 @@ void GuiTreeViewCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
if (mDragMidPoint == NomDragMidPoint || !mSupportMouseDragging )
|
||||
return;
|
||||
|
||||
ColorF greyLine(0.5,0.5,0.5,1);
|
||||
ColorI greyLine(128,128,128);
|
||||
Point2F squarePt;
|
||||
|
||||
// CodeReview: LineWidth is not supported in Direct3D. This is lame. [5/10/2007 Pat]
|
||||
|
|
@ -4257,7 +4257,6 @@ bool GuiTreeViewCtrl::renderTooltip( const Point2I &hoverPos, const Point2I& cur
|
|||
{
|
||||
Item* item;
|
||||
BitSet32 flags = 0;
|
||||
char buf[ 2048 ];
|
||||
if( _hitTest( cursorPos, item, flags ) && (!item->mTooltip.isEmpty() || mUseInspectorTooltips) )
|
||||
{
|
||||
bool render = true;
|
||||
|
|
@ -4302,6 +4301,7 @@ bool GuiTreeViewCtrl::renderTooltip( const Point2I &hoverPos, const Point2I& cur
|
|||
{
|
||||
if( mUseInspectorTooltips )
|
||||
{
|
||||
char buf[2048];
|
||||
item->getTooltipText( sizeof( buf ), buf );
|
||||
tipText = buf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,13 +89,13 @@ void GuiOffscreenCanvas::_setupTargets()
|
|||
// Update color
|
||||
if (!mTargetTexture.isValid() || mTargetSize != mTargetTexture.getWidthHeight())
|
||||
{
|
||||
mTargetTexture.set( mTargetSize.x, mTargetSize.y, mTargetFormat, &GFXDefaultRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, 0 );
|
||||
mTargetTexture.set( mTargetSize.x, mTargetSize.y, mTargetFormat, &GFXRenderTargetSRGBProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, 0 );
|
||||
}
|
||||
|
||||
// Update depth if needed
|
||||
if (mUseDepth && (!mTargetDepth.isValid() || mTargetSize != mTargetDepth.getWidthHeight()))
|
||||
{
|
||||
mTargetDepth.set( mTargetSize.x, mTargetSize.y, GFXFormatD24S8, &GFXDefaultZTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, 0 );
|
||||
mTargetDepth.set( mTargetSize.x, mTargetSize.y, GFXFormatD24S8, &GFXRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, 0 );
|
||||
mTarget->attachTexture( GFXTextureTarget::RenderSlot(GFXTextureTarget::DepthStencil), mTargetDepth );
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ void GuiOffscreenCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = tr
|
|||
|
||||
// Clear the current viewport area
|
||||
GFX->setViewport( screenRect );
|
||||
GFX->clear( GFXClearTarget, ColorF(0,0,0,0), 1.0f, 0 );
|
||||
GFX->clear( GFXClearTarget, LinearColorF(0,0,0,0), 1.0f, 0 );
|
||||
|
||||
resetUpdateRegions();
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ void GuiOffscreenCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = tr
|
|||
|
||||
// Fill Blue if no Dialogs
|
||||
if(this->size() == 0)
|
||||
GFX->clear( GFXClearTarget, ColorF(0,0,0,1), 1.0f, 0 );
|
||||
GFX->clear( GFXClearTarget, LinearColorF(0,0,0,1), 1.0f, 0 );
|
||||
|
||||
GFX->setClipRect( contentRect );
|
||||
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ ConsoleDocClass( GuiCursor,
|
|||
GFX_ImplementTextureProfile(GFXGuiCursorProfile,
|
||||
GFXTextureProfile::DiffuseMap,
|
||||
GFXTextureProfile::PreserveSize |
|
||||
GFXTextureProfile::Static,
|
||||
GFXTextureProfile::Static | GFXTextureProfile::SRGB,
|
||||
GFXTextureProfile::NONE);
|
||||
GFX_ImplementTextureProfile(GFXDefaultGUIProfile,
|
||||
GFXTextureProfile::DiffuseMap,
|
||||
GFXTextureProfile::PreserveSize |
|
||||
GFXTextureProfile::Static |
|
||||
GFXTextureProfile::Static | GFXTextureProfile::SRGB |
|
||||
GFXTextureProfile::NoPadding,
|
||||
GFXTextureProfile::NONE);
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ bool GuiControlProfile::protectedSetBitmap( void *object, const char *index, con
|
|||
|
||||
//verify the bitmap
|
||||
if (profile->mBitmapName && profile->mBitmapName[0] && dStricmp(profile->mBitmapName, "texhandle") != 0 &&
|
||||
!profile->mTextureObject.set( profile->mBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
|
||||
!profile->mTextureObject.set( profile->mBitmapName, &GFXTexturePersistentProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
|
||||
Con::errorf("Failed to load profile bitmap (%s)",profile->mBitmapName);
|
||||
|
||||
// If we've got a special border, make sure it's usable.
|
||||
|
|
@ -566,7 +566,7 @@ S32 GuiControlProfile::constructBitmapArray()
|
|||
|
||||
if( mTextureObject.isNull() )
|
||||
{
|
||||
if ( !mBitmapName || !mBitmapName[0] || !mTextureObject.set( mBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
|
||||
if ( !mBitmapName || !mBitmapName[0] || !mTextureObject.set( mBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -655,7 +655,7 @@ void GuiControlProfile::incLoadCount()
|
|||
//
|
||||
|
||||
if (mBitmapName && mBitmapName[0] && dStricmp(mBitmapName, "texhandle") != 0 &&
|
||||
!mTextureObject.set( mBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
|
||||
!mTextureObject.set( mBitmapName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) ))
|
||||
Con::errorf("Failed to load profile bitmap (%s)",mBitmapName);
|
||||
|
||||
constructBitmapArray();
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ void GuiEaseViewCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// Draw axis.
|
||||
|
||||
GFX->getDrawUtil()->drawLine( zeroX, zeroY + 0.0f, zeroX, zeroY + plotH, mAxisColor );
|
||||
GFX->getDrawUtil()->drawLine( zeroX, zeroY + plotH, zeroX + plotW, zeroY + plotH, mAxisColor );
|
||||
GFX->getDrawUtil()->drawLine( zeroX, zeroY + 0.0f, zeroX, zeroY + plotH, mAxisColor.toColorI());
|
||||
GFX->getDrawUtil()->drawLine( zeroX, zeroY + plotH, zeroX + plotW, zeroY + plotH, mAxisColor.toColorI());
|
||||
|
||||
F32 numPoints = W;
|
||||
F32 lastX = zeroX;
|
||||
|
|
@ -105,7 +105,7 @@ void GuiEaseViewCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
x = zeroX + x * plotW;
|
||||
y = zeroY + plotH - y * plotH;
|
||||
|
||||
GFX->getDrawUtil()->drawLine( lastX, lastY, x, y, mEaseColor );
|
||||
GFX->getDrawUtil()->drawLine( lastX, lastY, x, y, mEaseColor.toColorI());
|
||||
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ class GuiEaseViewCtrl : public GuiControl
|
|||
protected:
|
||||
|
||||
EaseF mEase; // ease we are visualizing
|
||||
ColorF mAxisColor; // color to draw axis in
|
||||
ColorF mEaseColor; // color to draw ease in
|
||||
LinearColorF mAxisColor; // color to draw axis in
|
||||
LinearColorF mEaseColor; // color to draw ease in
|
||||
F32 mEaseWidth; // width of lines
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -848,7 +848,7 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
if( mSnapTargets[ axis ] )
|
||||
{
|
||||
RectI bounds = mSnapTargets[ axis ]->getGlobalBounds();
|
||||
drawer->drawRect( bounds, ColorF( .5, .5, .5, .5 ) );
|
||||
drawer->drawRect( bounds, ColorI( 128, 128, 128, 128 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -868,8 +868,8 @@ void GuiEditCtrl::drawNuts(RectI &box, ColorI &outlineColor, ColorI &nutColor)
|
|||
|
||||
if( mDrawBorderLines )
|
||||
{
|
||||
ColorF lineColor( 0.7f, 0.7f, 0.7f, 0.25f );
|
||||
ColorF lightLineColor( 0.5f, 0.5f, 0.5f, 0.1f );
|
||||
ColorI lineColor( 179, 179, 179, 64 );
|
||||
ColorI lightLineColor( 128, 128, 128, 26);
|
||||
|
||||
if(lx > 0 && ty > 0)
|
||||
{
|
||||
|
|
@ -2860,7 +2860,7 @@ class GuiEditorRuler : public GuiControl
|
|||
|
||||
void onRender(Point2I offset, const RectI &updateRect)
|
||||
{
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, ColorF(1,1,1,1));
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, ColorI::WHITE);
|
||||
|
||||
Point2I choffset(0,0);
|
||||
if( mRefCtrl != NULL )
|
||||
|
|
@ -2880,7 +2880,7 @@ class GuiEditorRuler : public GuiControl
|
|||
start = 4;
|
||||
if(!(pos % 100))
|
||||
start = 1;
|
||||
GFX->getDrawUtil()->drawLine(x, offset.y + start, x, offset.y + 10, ColorF(0,0,0,1));
|
||||
GFX->getDrawUtil()->drawLine(x, offset.y + start, x, offset.y + 10, ColorI::BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2898,7 +2898,7 @@ class GuiEditorRuler : public GuiControl
|
|||
start = 4;
|
||||
if(!(pos % 100))
|
||||
start = 1;
|
||||
GFX->getDrawUtil()->drawLine(offset.x + start, y, offset.x + 10, y, ColorF(0,0,0,1));
|
||||
GFX->getDrawUtil()->drawLine(offset.x + start, y, offset.x + 10, y, ColorI::BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
{
|
||||
GFX->getDrawUtil()->drawLine( pos.x, pos.y + ( ext.y * ( 1.0f - mIdentity.x ) ),
|
||||
pos.x + ext.x, pos.y + ( ext.y * ( 1.0f - mIdentity.y ) ),
|
||||
ColorF( 0.9f, 0.9f, 0.9f ) );
|
||||
ColorI( 230, 230, 230 ) );
|
||||
}
|
||||
|
||||
// draw the curv
|
||||
|
|
@ -207,7 +207,7 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
S32 y = (S32)(ext.y*(1.0f-mFilter.getValue(index)));
|
||||
|
||||
verts[i].point.set( (F32)(pos.x + i), (F32)(pos.y + y), 0.0f );
|
||||
verts[i].color = GFXVertexColor( ColorF( 0.4f, 0.4f, 0.4f ) );
|
||||
verts[i].color = ColorI( 103, 103, 103 );
|
||||
}
|
||||
|
||||
verts.unlock();
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ GuiGraphCtrl::GuiGraphCtrl()
|
|||
|
||||
AssertWarn( MaxPlots == 6, "Only 6 plot colors initialized. Update following code if you change MaxPlots." );
|
||||
|
||||
mGraphColor[ 0 ] = ColorF( 1.0, 1.0, 1.0 );
|
||||
mGraphColor[ 1 ] = ColorF( 1.0, 0.0, 0.0 );
|
||||
mGraphColor[ 2 ] = ColorF( 0.0, 1.0, 0.0 );
|
||||
mGraphColor[ 3 ] = ColorF( 0.0, 0.0, 1.0 );
|
||||
mGraphColor[ 4 ] = ColorF( 0.0, 1.0, 1.0 );
|
||||
mGraphColor[ 5 ] = ColorF( 0.0, 0.0, 0.0 );
|
||||
mGraphColor[ 0 ] = LinearColorF( 1.0, 1.0, 1.0 );
|
||||
mGraphColor[ 1 ] = LinearColorF( 1.0, 0.0, 0.0 );
|
||||
mGraphColor[ 2 ] = LinearColorF( 0.0, 1.0, 0.0 );
|
||||
mGraphColor[ 3 ] = LinearColorF( 0.0, 0.0, 1.0 );
|
||||
mGraphColor[ 4 ] = LinearColorF( 0.0, 1.0, 1.0 );
|
||||
mGraphColor[ 5 ] = LinearColorF( 0.0, 0.0, 0.0 );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class GuiGraphCtrl : public GuiControl
|
|||
StringTableEntry mAutoPlot[ MaxPlots ];
|
||||
U32 mAutoPlotDelay[ MaxPlots ];
|
||||
SimTime mAutoPlotLastDisplay[ MaxPlots ];
|
||||
ColorF mGraphColor[ MaxPlots ];
|
||||
LinearColorF mGraphColor[ MaxPlots ];
|
||||
Vector< F32 > mGraphData[ MaxPlots ];
|
||||
F32 mGraphMax[ MaxPlots ];
|
||||
GraphType mGraphType[ MaxPlots ];
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ bool GuiInspectorTypeImageFileName::renderTooltip( const Point2I &hoverPos, cons
|
|||
if ( !filename || !filename[0] )
|
||||
return false;
|
||||
|
||||
GFXTexHandle texture( filename, &GFXDefaultStaticDiffuseProfile, avar("%s() - tooltip texture (line %d)", __FUNCTION__, __LINE__) );
|
||||
GFXTexHandle texture( filename, &GFXStaticTextureSRGBProfile, avar("%s() - tooltip texture (line %d)", __FUNCTION__, __LINE__) );
|
||||
if ( texture.isNull() )
|
||||
return false;
|
||||
|
||||
|
|
@ -1058,7 +1058,7 @@ bool GuiInspectorTypeEaseF::updateRects()
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// GuiInspectorTypeColor (Base for ColorI/ColorF)
|
||||
// GuiInspectorTypeColor (Base for ColorI/LinearColorF)
|
||||
//-----------------------------------------------------------------------------
|
||||
GuiInspectorTypeColor::GuiInspectorTypeColor()
|
||||
: mBrowseButton( NULL )
|
||||
|
|
@ -1209,7 +1209,7 @@ void GuiInspectorTypeColorI::setValue( StringTableEntry newValue )
|
|||
IMPLEMENT_CONOBJECT(GuiInspectorTypeColorF);
|
||||
|
||||
ConsoleDocClass( GuiInspectorTypeColorF,
|
||||
"@brief Inspector field type for ColorF\n\n"
|
||||
"@brief Inspector field type for LinearColorF\n\n"
|
||||
"Editor use only.\n\n"
|
||||
"@internal"
|
||||
);
|
||||
|
|
@ -1234,7 +1234,7 @@ void GuiInspectorTypeColorF::setValue( StringTableEntry newValue )
|
|||
// Now we also set our color swatch button to the new color value.
|
||||
if ( mBrowseButton )
|
||||
{
|
||||
ColorF color(1,0,1,1);
|
||||
LinearColorF color(1,0,1,1);
|
||||
dSscanf( newValue, "%f %f %f %f", &color.red, &color.green, &color.blue, &color.alpha );
|
||||
mBrowseButton->setColor( color );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ public:
|
|||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// TypeColor GuiInspectorField Class (Base for ColorI/ColorF)
|
||||
// TypeColor GuiInspectorField Class (Base for ColorI/LinearColorF)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class GuiSwatchButtonCtrl;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ GuiParticleGraphCtrl::GuiParticleGraphCtrl()
|
|||
|
||||
for(S32 i = 0; i < MaxPlots; i++)
|
||||
{
|
||||
mPlots[i].mGraphColor = ColorF(1.0, 1.0, 1.0);
|
||||
mPlots[i].mGraphColor = LinearColorF(1.0, 1.0, 1.0);
|
||||
VECTOR_SET_ASSOCIATION(mPlots[i].mGraphData);
|
||||
mPlots[i].mGraphMax.x = 1;
|
||||
mPlots[i].mGraphMax.y = 50;
|
||||
|
|
@ -55,38 +55,38 @@ GuiParticleGraphCtrl::GuiParticleGraphCtrl()
|
|||
mPlots[i].mGraphScale = 0.05f;
|
||||
}
|
||||
|
||||
mPlots[0].mGraphColor = ColorF(1.0f, 0.2f, 0.2f);
|
||||
mPlots[1].mGraphColor = ColorF(1.0f, 0.5f, 0.5f);
|
||||
mPlots[2].mGraphColor = ColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[3].mGraphColor = ColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[4].mGraphColor = ColorF(0.0f, 1.0f, 1.0f);
|
||||
mPlots[5].mGraphColor = ColorF(0.0f, 0.0f, 0.0f);
|
||||
mPlots[6].mGraphColor = ColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[7].mGraphColor = ColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[8].mGraphColor = ColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[9].mGraphColor = ColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[10].mGraphColor = ColorF(0.0f, 0.5f, 0.5f);
|
||||
mPlots[11].mGraphColor = ColorF(0.25f, 0.25f, 0.25f);
|
||||
mPlots[12].mGraphColor = ColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[13].mGraphColor = ColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[14].mGraphColor = ColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[15].mGraphColor = ColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[16].mGraphColor = ColorF(0.0f, 0.5f, 0.5f);
|
||||
mPlots[17].mGraphColor = ColorF(0.25f, 0.25f, 0.25f);
|
||||
mPlots[18].mGraphColor = ColorF(1.0f, 0.2f, 0.2f);
|
||||
mPlots[19].mGraphColor = ColorF(1.0f, 0.5f, 0.5f);
|
||||
mPlots[20].mGraphColor = ColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[21].mGraphColor = ColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[22].mGraphColor = ColorF(0.0f, 1.0f, 1.0f);
|
||||
mPlots[23].mGraphColor = ColorF(0.0f, 0.0f, 0.0f);
|
||||
mPlots[24].mGraphColor = ColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[25].mGraphColor = ColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[26].mGraphColor = ColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[27].mGraphColor = ColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[28].mGraphColor = ColorF(1.0f, 0.0f, 0.0f);
|
||||
mPlots[29].mGraphColor = ColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[30].mGraphColor = ColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[31].mGraphColor = ColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[0].mGraphColor = LinearColorF(1.0f, 0.2f, 0.2f);
|
||||
mPlots[1].mGraphColor = LinearColorF(1.0f, 0.5f, 0.5f);
|
||||
mPlots[2].mGraphColor = LinearColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[3].mGraphColor = LinearColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[4].mGraphColor = LinearColorF(0.0f, 1.0f, 1.0f);
|
||||
mPlots[5].mGraphColor = LinearColorF(0.0f, 0.0f, 0.0f);
|
||||
mPlots[6].mGraphColor = LinearColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[7].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[8].mGraphColor = LinearColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[9].mGraphColor = LinearColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[10].mGraphColor = LinearColorF(0.0f, 0.5f, 0.5f);
|
||||
mPlots[11].mGraphColor = LinearColorF(0.25f, 0.25f, 0.25f);
|
||||
mPlots[12].mGraphColor = LinearColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[13].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[14].mGraphColor = LinearColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[15].mGraphColor = LinearColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[16].mGraphColor = LinearColorF(0.0f, 0.5f, 0.5f);
|
||||
mPlots[17].mGraphColor = LinearColorF(0.25f, 0.25f, 0.25f);
|
||||
mPlots[18].mGraphColor = LinearColorF(1.0f, 0.2f, 0.2f);
|
||||
mPlots[19].mGraphColor = LinearColorF(1.0f, 0.5f, 0.5f);
|
||||
mPlots[20].mGraphColor = LinearColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[21].mGraphColor = LinearColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[22].mGraphColor = LinearColorF(0.0f, 1.0f, 1.0f);
|
||||
mPlots[23].mGraphColor = LinearColorF(0.0f, 0.0f, 0.0f);
|
||||
mPlots[24].mGraphColor = LinearColorF(0.5f, 0.5f, 0.5f);
|
||||
mPlots[25].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f);
|
||||
mPlots[26].mGraphColor = LinearColorF(0.0f, 0.5f, 0.0f);
|
||||
mPlots[27].mGraphColor = LinearColorF(0.0f, 0.0f, 0.5f);
|
||||
mPlots[28].mGraphColor = LinearColorF(1.0f, 0.0f, 0.0f);
|
||||
mPlots[29].mGraphColor = LinearColorF(0.0f, 1.0f, 0.0f);
|
||||
mPlots[30].mGraphColor = LinearColorF(0.0f, 0.0f, 1.0f);
|
||||
mPlots[31].mGraphColor = LinearColorF(0.5f, 0.0f, 0.0f);
|
||||
|
||||
mVertexClickSize = 6;
|
||||
mSelectedPlot = 0;
|
||||
|
|
@ -134,11 +134,11 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
pDrawUtil->drawRect(rect, mProfile->mBorderColor);
|
||||
}
|
||||
|
||||
GuiControlProfile* profile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiDefaultProfile"));
|
||||
Resource<GFont> font = profile->mFont;
|
||||
GuiControlProfile* profile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiDefaultProfile"));
|
||||
Resource<GFont> font = profile->mFont;
|
||||
GFXVideoMode videoMode = GFXInit::getDesktopResolution();
|
||||
|
||||
ColorF color(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
ColorI color(255, 255, 255, 128);
|
||||
pDrawUtil->drawRectFill(updateRect, color);
|
||||
|
||||
for (S32 k = 0; k < MaxPlots; k++)
|
||||
|
|
@ -184,7 +184,7 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
// check if this isn't our first loop through, if it is we won't have starting points
|
||||
if(sample > 0)
|
||||
{
|
||||
pDrawUtil->drawLine( lastPosX, lastPosY , posX, posY , mPlots[k].mGraphColor );
|
||||
pDrawUtil->drawLine( lastPosX, lastPosY , posX, posY , mPlots[k].mGraphColor.toColorI() );
|
||||
} else
|
||||
{
|
||||
mPlots[k].mNutList.clear();
|
||||
|
|
@ -205,7 +205,7 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
mLastSelectedPoint = mSelectedPoint;
|
||||
}
|
||||
|
||||
ColorI nutColor (mPlots[k].mGraphColor);
|
||||
ColorI nutColor (mPlots[k].mGraphColor.toColorI());
|
||||
|
||||
if(k == mSelectedPlot && sample == mLastSelectedPoint)
|
||||
{
|
||||
|
|
@ -220,7 +220,7 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
blue = 1.0 - blue;
|
||||
// nut color
|
||||
|
||||
nutColor = ColorI(ColorF(red, green, blue));
|
||||
nutColor = LinearColorF(red, green, blue).toColorI();
|
||||
}
|
||||
|
||||
// draw the seleciton nut
|
||||
|
|
@ -660,7 +660,7 @@ Point2F GuiParticleGraphCtrl::getGraphExtent(S32 plotID)
|
|||
return resultV;
|
||||
}
|
||||
|
||||
ColorF GuiParticleGraphCtrl::getGraphColor(S32 plotID)
|
||||
LinearColorF GuiParticleGraphCtrl::getGraphColor(S32 plotID)
|
||||
{
|
||||
return mPlots[plotID].mGraphColor;
|
||||
}
|
||||
|
|
@ -1151,7 +1151,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (S32 plotID, F32 x,
|
|||
return object->getPlotIndex(plotID, x, y);
|
||||
}
|
||||
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, ColorF, (S32 plotID), , "(int plotID)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, LinearColorF, (S32 plotID), , "(int plotID)"
|
||||
"Get the color of the graph passed."
|
||||
"@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
struct PlotInfo
|
||||
{
|
||||
ColorF mGraphColor;
|
||||
LinearColorF mGraphColor;
|
||||
Vector<Point2F> mGraphData;
|
||||
Vector<Point2F> mNutList;
|
||||
Point2F mGraphMax;
|
||||
|
|
@ -136,7 +136,7 @@ public:
|
|||
|
||||
// Get Functions
|
||||
Point2F getGraphExtent(S32 plotID);
|
||||
ColorF getGraphColor(S32 plotID);
|
||||
LinearColorF getGraphColor(S32 plotID);
|
||||
S32 getSelectedPlot();
|
||||
S32 getSelectedPoint();
|
||||
Point2F getPlotPoint(S32 plotID, S32 samples);
|
||||
|
|
|
|||
|
|
@ -1433,7 +1433,7 @@ void GuiShapeEdPreview::renderWorld(const RectI &updateRect)
|
|||
|
||||
GFXStateBlockDesc desc;
|
||||
desc.fillMode = GFXFillWireframe;
|
||||
GFX->getDrawUtil()->drawCube( desc, boxSize, mModel->getShape()->center, ColorF::WHITE );
|
||||
GFX->getDrawUtil()->drawCube( desc, boxSize, mModel->getShape()->center, ColorI::WHITE );
|
||||
}
|
||||
|
||||
// Render the selected object bounding box
|
||||
|
|
@ -1450,7 +1450,7 @@ void GuiShapeEdPreview::renderWorld(const RectI &updateRect)
|
|||
const Box3F& bounds = mesh->getBounds();
|
||||
GFXStateBlockDesc desc;
|
||||
desc.fillMode = GFXFillWireframe;
|
||||
GFX->getDrawUtil()->drawCube( desc, bounds.getExtents(), bounds.getCenter(), ColorF::RED );
|
||||
GFX->getDrawUtil()->drawCube( desc, bounds.getExtents(), bounds.getCenter(), ColorI::RED );
|
||||
|
||||
GFX->popWorldMatrix();
|
||||
}
|
||||
|
|
@ -1490,9 +1490,9 @@ void GuiShapeEdPreview::renderGui(Point2I offset, const RectI& updateRect)
|
|||
if ( mModel )
|
||||
{
|
||||
if ( mRenderNodes && mHoverNode != -1 )
|
||||
renderNodeName( mHoverNode, ColorF::WHITE );
|
||||
renderNodeName( mHoverNode, LinearColorF::WHITE );
|
||||
if ( mSelectedNode != -1 )
|
||||
renderNodeName( mSelectedNode, ColorF::WHITE );
|
||||
renderNodeName( mSelectedNode, LinearColorF::WHITE );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1530,7 +1530,7 @@ void GuiShapeEdPreview::renderSunDirection() const
|
|||
if ( mEditingSun )
|
||||
{
|
||||
// Render four arrows aiming in the direction of the sun's light
|
||||
ColorI color( mFakeSun->getColor() );
|
||||
ColorI color = LinearColorF( mFakeSun->getColor()).toColorI();
|
||||
F32 length = mModel->getShape()->bounds.len() * 0.8f;
|
||||
|
||||
// Get the sun's vectors
|
||||
|
|
@ -1587,18 +1587,18 @@ void GuiShapeEdPreview::renderNodes() const
|
|||
if ( ( i == mSelectedNode ) || ( i == mHoverNode ) )
|
||||
continue;
|
||||
|
||||
renderNodeAxes( i, ColorF::WHITE );
|
||||
renderNodeAxes( i, LinearColorF::WHITE );
|
||||
}
|
||||
|
||||
// Render the hovered node
|
||||
if ( mHoverNode != -1 )
|
||||
renderNodeAxes( mHoverNode, ColorF::GREEN );
|
||||
renderNodeAxes( mHoverNode, LinearColorF::GREEN );
|
||||
}
|
||||
|
||||
// Render the selected node (even if mRenderNodes is false)
|
||||
if ( mSelectedNode != -1 )
|
||||
{
|
||||
renderNodeAxes( mSelectedNode, ColorF::GREEN );
|
||||
renderNodeAxes( mSelectedNode, LinearColorF::GREEN );
|
||||
|
||||
const MatrixF& nodeMat = mModel->mNodeTransforms[mSelectedNode];
|
||||
mGizmo->set( nodeMat, nodeMat.getPosition(), Point3F::One);
|
||||
|
|
@ -1606,7 +1606,7 @@ void GuiShapeEdPreview::renderNodes() const
|
|||
}
|
||||
}
|
||||
|
||||
void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const
|
||||
void GuiShapeEdPreview::renderNodeAxes(S32 index, const LinearColorF& nodeColor) const
|
||||
{
|
||||
if(mModel->mNodeTransforms.size() <= index || index < 0)
|
||||
return;
|
||||
|
|
@ -1623,15 +1623,15 @@ void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const
|
|||
|
||||
GFX->pushWorldMatrix();
|
||||
GFX->multWorld( mModel->mNodeTransforms[index] );
|
||||
|
||||
GFX->getDrawUtil()->drawCube( desc, xAxis * scale, Point3F::Zero, nodeColor );
|
||||
GFX->getDrawUtil()->drawCube( desc, yAxis * scale, Point3F::Zero, nodeColor );
|
||||
GFX->getDrawUtil()->drawCube( desc, zAxis * scale, Point3F::Zero, nodeColor );
|
||||
const ColorI color = LinearColorF(nodeColor).toColorI();
|
||||
GFX->getDrawUtil()->drawCube( desc, xAxis * scale, Point3F::Zero, color );
|
||||
GFX->getDrawUtil()->drawCube( desc, yAxis * scale, Point3F::Zero, color );
|
||||
GFX->getDrawUtil()->drawCube( desc, zAxis * scale, Point3F::Zero, color );
|
||||
|
||||
GFX->popWorldMatrix();
|
||||
}
|
||||
|
||||
void GuiShapeEdPreview::renderNodeName(S32 index, const ColorF& textColor) const
|
||||
void GuiShapeEdPreview::renderNodeName(S32 index, const LinearColorF& textColor) const
|
||||
{
|
||||
if(index < 0 || index >= mModel->getShape()->nodes.size() || index >= mProjectedNodes.size())
|
||||
return;
|
||||
|
|
@ -1640,7 +1640,7 @@ void GuiShapeEdPreview::renderNodeName(S32 index, const ColorF& textColor) const
|
|||
|
||||
Point2I pos( mProjectedNodes[index].x, mProjectedNodes[index].y + sNodeRectSize + 6 );
|
||||
|
||||
GFX->getDrawUtil()->setBitmapModulation( textColor );
|
||||
GFX->getDrawUtil()->setBitmapModulation( LinearColorF(textColor).toColorI());
|
||||
GFX->getDrawUtil()->drawText( mProfile->mFont, pos, nodeName.c_str() );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,8 +164,8 @@ protected:
|
|||
// Rendering
|
||||
void renderGrid();
|
||||
void renderNodes() const;
|
||||
void renderNodeAxes(S32 index, const ColorF& nodeColor) const;
|
||||
void renderNodeName(S32 index, const ColorF& textColor) const;
|
||||
void renderNodeAxes(S32 index, const LinearColorF& nodeColor) const;
|
||||
void renderNodeName(S32 index, const LinearColorF& textColor) const;
|
||||
void renderSunDirection() const;
|
||||
void renderCollisionMeshes() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ void GuiChunkedBitmapCtrl::renderRegion(const Point2I &offset, const Point2I &ex
|
|||
|
||||
F32 widthScale = F32(extent.x) / F32(mTexHandle.getWidth());
|
||||
F32 heightScale = F32(extent.y) / F32(mTexHandle.getHeight());
|
||||
GFX->setBitmapModulation(ColorF(1,1,1));
|
||||
GFX->setBitmapModulation(LinearColorF(1,1,1));
|
||||
for(U32 i = 0; i < widthCount; i++)
|
||||
{
|
||||
for(U32 j = 0; j < heightCount; j++)
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ void GuiFadeinBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// Render overlay on top of bitmap.
|
||||
|
||||
ColorI color = mFadeColor;
|
||||
ColorI color = mFadeColor.toColorI();
|
||||
color.alpha = alpha;
|
||||
|
||||
GFX->getDrawUtil()->drawRectFill( offset, getExtent() + offset, color );
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class GuiFadeinBitmapCtrl : public GuiBitmapCtrl
|
|||
protected:
|
||||
|
||||
/// Color we fade in from and fade out to.
|
||||
ColorF mFadeColor;
|
||||
LinearColorF mFadeColor;
|
||||
|
||||
/// Reference time on which to base all fade timings.
|
||||
U32 mStartTime;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void EditorIconRegistry::loadFromPath( const String &path, bool overwrite )
|
|||
String defaultIconFile = path + "default";
|
||||
|
||||
mDefaultIcon.set( defaultIconFile,
|
||||
&GFXDefaultPersistentProfile,
|
||||
&GFXTexturePersistentSRGBProfile,
|
||||
avar("%s() - mIcons[] (line %d)",
|
||||
__FUNCTION__, __LINE__) );
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ void EditorIconRegistry::loadFromPath( const String &path, bool overwrite )
|
|||
void EditorIconRegistry::add( const String &className, const String &imageFile, bool overwrite )
|
||||
{
|
||||
// First see if we can load the image.
|
||||
GFXTexHandle icon( imageFile, &GFXDefaultPersistentProfile,
|
||||
GFXTexHandle icon( imageFile, &GFXTexturePersistentSRGBProfile,
|
||||
avar("%s() - mIcons[] (line %d)", __FUNCTION__, __LINE__) );
|
||||
if ( icon.isNull() )
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1035,7 +1035,7 @@ void GuiConvexEditorCtrl::drawFacePlane( ConvexShape *shape, S32 faceId )
|
|||
|
||||
GFX->setVertexBuffer( vb );
|
||||
|
||||
GFXTexHandle tex( "core/art/grids/512_transp", &GFXDefaultStaticDiffuseProfile, "ConvexEditor_grid" );
|
||||
GFXTexHandle tex( "core/art/grids/512_transp", &GFXStaticTextureSRGBProfile, "ConvexEditor_grid" );
|
||||
GFX->setTexture( 0, tex );
|
||||
GFX->setupGenericShaders();
|
||||
GFX->drawPrimitive( GFXTriangleList, 0, points.size() / 3 );
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ bool GuiMissionAreaCtrl::onAdd()
|
|||
|
||||
if (*mHandleBitmap)
|
||||
{
|
||||
mHandleTexture = GFXTexHandle( mHandleBitmap, &GFXDefaultPersistentProfile, avar("%s() - mHandleTexture (line %d)", __FUNCTION__, __LINE__) );
|
||||
mHandleTexture = GFXTexHandle( mHandleBitmap, &GFXTexturePersistentSRGBProfile, avar("%s() - mHandleTexture (line %d)", __FUNCTION__, __LINE__) );
|
||||
mHandleTextureSize = Point2I( mHandleTexture->getWidth(), mHandleTexture->getHeight() );
|
||||
mHandleTextureHalfSize = Point2F(mHandleTextureSize.x, mHandleTextureSize.y) * 0.5f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -658,7 +658,7 @@ void SelectionBrush::rebuild()
|
|||
//... move the selection
|
||||
}
|
||||
|
||||
void SelectionBrush::render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const
|
||||
void SelectionBrush::render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone) const
|
||||
{
|
||||
//... render the selection
|
||||
}
|
||||
|
|
@ -1296,10 +1296,10 @@ void TerrainEditor::renderScene(const RectI &)
|
|||
return;
|
||||
|
||||
if(!mSelectionHidden)
|
||||
renderSelection(mDefaultSel, ColorF::RED, ColorF::GREEN, ColorF::BLUE, ColorF::BLUE, true, false);
|
||||
renderSelection(mDefaultSel, LinearColorF::RED, LinearColorF::GREEN, LinearColorF::BLUE, LinearColorF::BLUE, true, false);
|
||||
|
||||
if(mRenderBrush && mMouseBrush->size())
|
||||
renderBrush(*mMouseBrush, ColorF::GREEN, ColorF::RED, ColorF::BLUE, ColorF::BLUE, false, true);
|
||||
renderBrush(*mMouseBrush, LinearColorF::GREEN, LinearColorF::RED, LinearColorF::BLUE, LinearColorF::BLUE, false, true);
|
||||
|
||||
if(mRenderBorder)
|
||||
renderBorder();
|
||||
|
|
@ -1386,7 +1386,7 @@ void TerrainEditor::renderPoints( const Vector<GFXVertexPCT> &pointList )
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone, bool renderFill, bool renderFrame )
|
||||
void TerrainEditor::renderSelection( const Selection & sel, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone, bool renderFill, bool renderFrame )
|
||||
{
|
||||
PROFILE_SCOPE( TerrainEditor_RenderSelection );
|
||||
|
||||
|
|
@ -1395,7 +1395,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
return;
|
||||
|
||||
Vector<GFXVertexPCT> vertexBuffer;
|
||||
ColorF color;
|
||||
LinearColorF color;
|
||||
ColorI iColor;
|
||||
|
||||
vertexBuffer.setSize(sel.size() * 5);
|
||||
|
|
@ -1428,7 +1428,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
color.interpolate( outColorFull, outColorNone, weight );
|
||||
}
|
||||
//
|
||||
iColor = color;
|
||||
iColor = color.toColorI();
|
||||
|
||||
GFXVertexPCT *verts = &(vertexBuffer[i * 5]);
|
||||
|
||||
|
|
@ -1479,17 +1479,17 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
color.interpolate(outColorFull, outColorNone, weight );
|
||||
}
|
||||
|
||||
iColor = color;
|
||||
iColor = color.toColorI();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( center )
|
||||
{
|
||||
iColor = inColorNone;
|
||||
iColor = LinearColorF(inColorNone).toColorI();
|
||||
}
|
||||
else
|
||||
{
|
||||
iColor = outColorFull;
|
||||
iColor = LinearColorF(outColorFull).toColorI();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1525,7 +1525,7 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
GFX->drawPrimitive( GFXLineStrip , i*5, 4);
|
||||
}
|
||||
|
||||
void TerrainEditor::renderBrush( const Brush & brush, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone, bool renderFill, bool renderFrame )
|
||||
void TerrainEditor::renderBrush( const Brush & brush, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone, bool renderFill, bool renderFrame )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ public:
|
|||
|
||||
const char *getType() const { return "selection"; }
|
||||
void rebuild();
|
||||
void render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone) const;
|
||||
void render(Vector<GFXVertexPCT> & vertexBuffer, S32 & verts, S32 & elems, S32 & prims, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone) const;
|
||||
void setSize(const Point2I &){}
|
||||
|
||||
protected:
|
||||
|
|
@ -416,8 +416,8 @@ class TerrainEditor : public EditTSCtrl
|
|||
void updateBrush(Brush & brush, const Point2I & gPos);
|
||||
|
||||
//
|
||||
void renderSelection(const Selection & sel, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone, bool renderFill, bool renderFrame);
|
||||
void renderBrush(const Brush & brush, const ColorF & inColorFull, const ColorF & inColorNone, const ColorF & outColorFull, const ColorF & outColorNone, bool renderFill, bool renderFrame);
|
||||
void renderSelection(const Selection & sel, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone, bool renderFill, bool renderFrame);
|
||||
void renderBrush(const Brush & brush, const LinearColorF & inColorFull, const LinearColorF & inColorNone, const LinearColorF & outColorFull, const LinearColorF & outColorNone, bool renderFill, bool renderFrame);
|
||||
void renderBorder();
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1839,9 +1839,9 @@ bool WorldEditor::onAdd()
|
|||
// create the default class entry
|
||||
mDefaultClassEntry.mName = 0;
|
||||
mDefaultClassEntry.mIgnoreCollision = false;
|
||||
mDefaultClassEntry.mDefaultHandle = GFXTexHandle(mDefaultHandle, &GFXDefaultStaticDiffuseProfile, avar("%s() - mDefaultClassEntry.mDefaultHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
mDefaultClassEntry.mSelectHandle = GFXTexHandle(mSelectHandle, &GFXDefaultStaticDiffuseProfile, avar("%s() - mDefaultClassEntry.mSelectHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
mDefaultClassEntry.mLockedHandle = GFXTexHandle(mLockedHandle, &GFXDefaultStaticDiffuseProfile, avar("%s() - mDefaultClassEntry.mLockedHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
mDefaultClassEntry.mDefaultHandle = GFXTexHandle(mDefaultHandle, &GFXStaticTextureSRGBProfile, avar("%s() - mDefaultClassEntry.mDefaultHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
mDefaultClassEntry.mSelectHandle = GFXTexHandle(mSelectHandle, &GFXStaticTextureSRGBProfile, avar("%s() - mDefaultClassEntry.mSelectHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
mDefaultClassEntry.mLockedHandle = GFXTexHandle(mLockedHandle, &GFXStaticTextureSRGBProfile, avar("%s() - mDefaultClassEntry.mLockedHandle (line %d)", __FUNCTION__, __LINE__));
|
||||
|
||||
if(!(mDefaultClassEntry.mDefaultHandle && mDefaultClassEntry.mSelectHandle && mDefaultClassEntry.mLockedHandle))
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue