demotool/ui-rendertarget.hh
2017-11-23 23:31:24 +01:00

84 lines
1.6 KiB
C++

#pragma once
#ifndef REAL_BUILD
# include "externals.hh"
#endif
#include <ebcl/Arrays.hh>
struct T_Texture;
struct T_Rendertarget;
struct T_RendertargetSetup
{
T_RendertargetSetup( );
T_RendertargetSetup& add(
T_Texture& texture ,
const uint32_t level = 0 );
T_RendertargetSetup& depth(
T_Texture& texture );
T_Rendertarget create( );
private:
struct T_Attachment_ {
T_Texture* texture;
uint32_t level;
T_Attachment_(
T_Texture& texture ,
const uint32_t level )
: texture( &texture ) , level( level )
{}
};
using T_Attachments_ = ebcl::T_AutoArray< T_Attachment_ , 8 >;
void checkAttachment(
T_Texture const& texture ,
const uint32_t level );
bool hasAttachments_;
uint32_t width_ , height_;
T_Attachments_ colorAttachments_;
ebcl::T_Optional< T_Attachment_ > depthAttachment_;
};
struct T_Rendertarget
{
T_Rendertarget( T_Rendertarget const& ) = delete;
T_Rendertarget( );
T_Rendertarget(
const GLuint id ,
const uint32_t nCats ,
const uint32_t width ,
const uint32_t height );
T_Rendertarget( T_Rendertarget&& other ) noexcept;
T_Rendertarget& operator =(
T_Rendertarget&& ) noexcept;
~T_Rendertarget( );
void attach( T_Texture const& texture ,
uint32_t lod ,
uint32_t id );
void toggle( uint32_t id , bool active );
bool activate( );
GLuint id( ) const { return id_; }
uint32_t width( ) const { return width_; }
uint32_t height( ) const { return height_; }
static void MainOutput( );
private:
GLuint id_;
uint32_t nCats_ , width_ , height_;
ebcl::T_AutoArray< GLenum , 8 > buffers_;
};