added partial support for RGB565 data format.

This commit is contained in:
rachytski 2012-02-14 16:52:07 +04:00 committed by Alex Zolotarev
parent f3a5567816
commit a02650b0e6
2 changed files with 13 additions and 2 deletions

View file

@ -30,6 +30,8 @@ namespace yg
return 4;
case yg::Data4Bpp:
return 2;
case yg::Data565Bpp:
return 2;
default:
return 0;
}
@ -47,8 +49,11 @@ namespace yg
case yg::Data4Bpp:
return shared_ptr<gl::BaseTexture>(new gl::Texture<yg::RGBA4Traits, true>(m_w, m_h));
case yg::Data8Bpp:
default:
return shared_ptr<gl::BaseTexture>(new gl::Texture<yg::RGBA8Traits, true>(m_w, m_h));
case yg::Data565Bpp:
return shared_ptr<gl::BaseTexture>(new gl::Texture<yg::RGB565Traits, true>(m_w, m_h));
default:
return shared_ptr<gl::BaseTexture>();
}
}
@ -241,6 +246,9 @@ namespace yg
case yg::Data8Bpp:
pixelSize = 4;
break;
case yg::Data565Bpp:
pixelSize = 2;
break;
}
return m_texWidth * m_texHeight * pixelSize * m_texCount;
@ -693,6 +701,8 @@ namespace yg
return make_shared_ptr(new gl::Texture<RGBA8Traits, false>(w, h));
case Data4Bpp:
return make_shared_ptr(new gl::Texture<RGBA4Traits, false>(w, h));
case Data565Bpp:
return make_shared_ptr(new gl::Texture<RGB565Traits, false>(w, h));
default:
MYTHROW(ResourceManagerException, ("unknown render target format"));
};

View file

@ -27,7 +27,8 @@ namespace yg
enum DataFormat
{
Data8Bpp,
Data4Bpp
Data4Bpp,
Data565Bpp
};
struct TTextureFactory : BasePoolElemFactory