Added: Remove ambiance ans shininess to SE shapes. Add seasons texture set

fix_opengl_on_mac
Ulukyn 5 years ago
parent 1143ecaae0
commit 3da2f45363

@ -3269,77 +3269,79 @@ CRGBAF CBitmap::getColor (float x, float y) const
uint32 i;
bool isValid = true;
for (i = 0; i < 4; ++i)
{
nlassert (nX[i] >= 0);
nlassert (nY[i] >= 0 );
nlassert (nX[i] < nWidth);
nlassert (nY[i] < nHeight);
if (nX[i] < 0 || nY[i] < 0 || nX[i] >= nWidth || nY[i] >= nHeight)
isValid = false;
}
// Decimal part of (x,y)
x = x - (float)nX[0];
y = y - (float)nY[0];
switch (this->PixelFormat)
if (isValid)
{
case RGBA:
case DXTC1:
case DXTC1Alpha:
case DXTC3:
case DXTC5:
{
CRGBAF finalVal;
CRGBA val[4];
// Decimal part of (x,y)
x = x - (float)nX[0];
y = y - (float)nY[0];
if (this->PixelFormat == RGBA)
switch (this->PixelFormat)
{
case RGBA:
case DXTC1:
case DXTC1Alpha:
case DXTC3:
case DXTC5:
{
for (i = 0; i < 4; ++i)
CRGBAF finalVal;
CRGBA val[4];
if (this->PixelFormat == RGBA)
{
val[i] = CRGBA (rBitmap[(nX[i]+nY[i]*nWidth)*4+0],
rBitmap[(nX[i]+nY[i]*nWidth)*4+1],
rBitmap[(nX[i]+nY[i]*nWidth)*4+2],
rBitmap[(nX[i]+nY[i]*nWidth)*4+3]);
for (i = 0; i < 4; ++i)
{
val[i] = CRGBA (rBitmap[(nX[i]+nY[i]*nWidth)*4+0],
rBitmap[(nX[i]+nY[i]*nWidth)*4+1],
rBitmap[(nX[i]+nY[i]*nWidth)*4+2],
rBitmap[(nX[i]+nY[i]*nWidth)*4+3]);
}
}
}
else
{
// slower version : get from DXT
for (i = 0; i < 4; ++i)
else
{
val[i] = getPixelColor(nX[i], nY[i]);
// slower version : get from DXT
for (i = 0; i < 4; ++i)
{
val[i] = getPixelColor(nX[i], nY[i]);
}
}
}
finalVal.R = getColorInterp (x, y, val[0].R, val[1].R, val[2].R, val[3].R);
finalVal.G = getColorInterp (x, y, val[0].G, val[1].G, val[2].G, val[3].G);
finalVal.B = getColorInterp (x, y, val[0].B, val[1].B, val[2].B, val[3].B);
finalVal.A = getColorInterp (x, y, val[0].A, val[1].A, val[2].A, val[3].A);
finalVal /= 255.f;
finalVal.R = getColorInterp (x, y, val[0].R, val[1].R, val[2].R, val[3].R);
finalVal.G = getColorInterp (x, y, val[0].G, val[1].G, val[2].G, val[3].G);
finalVal.B = getColorInterp (x, y, val[0].B, val[1].B, val[2].B, val[3].B);
finalVal.A = getColorInterp (x, y, val[0].A, val[1].A, val[2].A, val[3].A);
finalVal /= 255.f;
return finalVal;
}
break;
case Alpha:
case Luminance:
{
return finalVal;
}
break;
case Alpha:
case Luminance:
{
float finalVal;
float val[4];
float finalVal;
float val[4];
for (i = 0; i < 4; ++i)
val[i] = rBitmap[(nX[i]+nY[i]*nWidth)];
for (i = 0; i < 4; ++i)
val[i] = rBitmap[(nX[i]+nY[i]*nWidth)];
finalVal = getColorInterp (x, y, val[0], val[1], val[2], val[3]);
finalVal /= 255.f;
finalVal = getColorInterp (x, y, val[0], val[1], val[2], val[3]);
finalVal /= 255.f;
if (this->PixelFormat == Alpha)
return CRGBAF (1.f, 1.f, 1.f, finalVal);
else // Luminance
return CRGBAF (finalVal, finalVal, finalVal, 1.f);
if (this->PixelFormat == Alpha)
return CRGBAF (1.f, 1.f, 1.f, finalVal);
else // Luminance
return CRGBAF (finalVal, finalVal, finalVal, 1.f);
}
break;
default: break;
}
break;
default: break;
}
return CRGBAF (0.0f, 0.0f, 0.0f, 0.0f);

@ -2298,13 +2298,28 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
if(!instance.empty())
{
if (texture == "#season#" || texture.empty())
{
uint8 selectedTextureSet = (uint8)::computeCurrSeason();
instance.selectTextureSet(selectedTextureSet);
texture = "";
}
else if (texture[0] == '#')
{
uint8 selectedTextureSet;
fromString(texture.substr(1), selectedTextureSet);
instance.selectTextureSet(selectedTextureSet);
texture = "";
}
for(uint j=0;j<instance.getNumMaterials();j++)
{
if (!highlight)
{
instance.getMaterial(j).setAmbient(CRGBA(0,0,0,255));
/*instance.getMaterial(j).setAmbient(CRGBA(0,0,0,255));
instance.getMaterial(j).setEmissive(CRGBA(255,255,255,255));
instance.getMaterial(j).setShininess(10.0f);
instance.getMaterial(j).setShininess(10.0f);*/
}
else
{

Loading…
Cancel
Save