X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Frendertarget.cpp;h=b2dbef2c9f498b35c34e478aa9894bce12b29090;hb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;hp=6a1142857492dce2fc1558f43c017eed6b003015;hpb=6353307898cd397e2bcde13e2448a8a678a60004;p=libs%2Fgl.git diff --git a/source/render/rendertarget.cpp b/source/render/rendertarget.cpp index 6a114285..b2dbef2c 100644 --- a/source/render/rendertarget.cpp +++ b/source/render/rendertarget.cpp @@ -17,23 +17,22 @@ RenderTarget::RenderTarget(unsigned w, unsigned h, const FrameFormat &f): { textures.reserve(f.size()); unsigned samples = f.get_samples(); - for(const UInt16 *i=f.begin(); i!=f.end(); ++i) + for(FrameAttachment a: f) { - FrameAttachment fa = static_cast(*i); - PixelFormat pf = get_attachment_pixelformat(*i); + PixelFormat pf = get_attachment_pixelformat(a); if(samples>1) { Texture2DMultisample *tex2d_ms = new Texture2DMultisample; tex2d_ms->storage(pf, width, height, samples); - fbo.attach(fa, *tex2d_ms); + fbo.attach(a, *tex2d_ms); textures.push_back(tex2d_ms); } else { Texture2D *tex2d = new Texture2D; tex2d->storage(pf, width, height, 1); - fbo.attach(fa, *tex2d); + fbo.attach(a, *tex2d); textures.push_back(tex2d); } } @@ -41,8 +40,8 @@ RenderTarget::RenderTarget(unsigned w, unsigned h, const FrameFormat &f): RenderTarget::~RenderTarget() { - for(vector::iterator i=textures.begin(); i!=textures.end(); ++i) - delete *i; + for(Texture *t: textures) + delete t; } const Texture2D &RenderTarget::get_target_texture(unsigned i) const @@ -68,11 +67,10 @@ void RenderTarget::set_debug_name(const string &name) { #ifdef DEBUG fbo.set_debug_name(name+" [FBO]"); - const FrameFormat &fmt = fbo.get_format(); unsigned i = 0; - for(const UInt16 *j=fmt.begin(); j!=fmt.end(); ++i, ++j) + for(FrameAttachment a: fbo.get_format()) { - unsigned attach_pt = get_attach_point(static_cast(*j)); + unsigned attach_pt = get_attach_point(a); string tex_name; if(attach_pt==get_attach_point(DEPTH_ATTACHMENT)) @@ -82,7 +80,7 @@ void RenderTarget::set_debug_name(const string &name) else tex_name = Msp::format("%s/color%d", name, attach_pt); - textures[i]->set_debug_name(tex_name+".tex2d"); + textures[i++]->set_debug_name(tex_name+".tex2d"); } #else (void)name;