void nSurface::SetAlphaKey( const IColor &color ) { IColor keyColor(color.GetRed(), color.GetGreen(), color.GetBlue(), (u32)255); IColor newColor; if (color.GetAlpha()>0) newColor.Set(color.GetRed(), color.GetGreen(), color.GetBlue(), color.GetAlpha()); else newColor.Set(0, 0, 0, color.GetAlpha()); switch (m_ColorFormat) { case ECF_A8R8G8B8: // 32 bit { for (u32 y=0; y<m_Dimension.Height; y++) for (u32 x=0; x<m_Dimension.Width; x++) { if (((u32 *)m_pData)[y * m_Dimension.Width + x] == keyColor.Color) ((u32 *)m_pData)[y * m_Dimension.Width + x] = newColor.Color; } } } }
IString IProperty::GetString() { if (m_pVar) { switch (m_iType) { case IPT_BOOL: return *((bool*)m_pVar)==true?"true":"false"; break; case IPT_INTEGER: return IString(*((int*)m_pVar)); break; case IPT_FLOAT: return TrimZeroFloat(IString(*((float*)m_pVar))); break; case IPT_VEC2: { IString str; IVector2D *vect = ((IVector2D*)m_pVar); str.Printf("%f;%f",vect->GetU(),vect->GetV()); return str; } break; case IPT_VEC3: { IString str; IVector3D *vect = ((IVector3D*)m_pVar); str.Printf("%f;%f;%f",vect->GetX(),vect->GetY(),vect->GetZ()); return str; } break; case IPT_COLOR: { IString str; IColor *color = ((IColor*)m_pVar); str.Printf("%f;%f;%f;%f",color->GetRed(),color->GetGreen(),color->GetBlue(),color->GetAlpha()); return str; } break; case IPT_STRING: case IPT_LONG_STRING: return *((IString*)m_pVar); break; case IPT_CHOICE: return *((int*)m_pVar); //return IString(*((int*)m_pVar)); break; case IPT_RESSOURCE_ITX: // Texture //if (((ISmartPtr<ITexture>*)m_pVar)) //return (*(ISmartPtr<ITexture>*)m_pVar)->GetFilename(); //return ""; //return *((IString*)m_pVar); return Core::RelativeToPath(Core::AppPath(),*((IString*)m_pVar)); break; case IPT_RESSOURCE_IMA: // Material break; case IPT_RESSOURCE_IEM: // Animated mesh break; } } return ""; }