demotool/rendertarget.hh

75 lines
1.4 KiB
C++

#pragma once
#ifndef REAL_BUILD
# include "externals.hh"
#endif
#include "texture.hh"
struct T_Rendertarget;
struct T_RendertargetSetup
{
T_RendertargetSetup( );
T_RendertargetSetup& add(
__rw__ T_Texture& texture ,
__rd__ const uint32_t level = 0 );
T_RendertargetSetup& depth(
__rw__ T_Texture& texture );
T_Rendertarget create( );
private:
struct T_Attachment_ {
T_Texture* texture;
uint32_t level;
T_Attachment_(
__rw__ T_Texture& texture ,
__rd__ const uint32_t level )
: texture( &texture ) , level( level )
{}
};
void checkAttachment(
__rw__ T_Texture const& texture ,
__rd__ const uint32_t level );
bool hasAttachments_;
uint32_t width_ , height_;
std::vector< T_Attachment_ > colorAttachments_;
std::unique_ptr< T_Attachment_ > depthAttachment_;
};
struct T_Rendertarget
{
T_Rendertarget( ) = delete;
T_Rendertarget( T_Rendertarget const& ) = delete;
T_Rendertarget(
__rd__ const GLuint id ,
__rd__ const uint32_t nCats ,
__rd__ const uint32_t width ,
__rd__ const uint32_t height );
T_Rendertarget( __rw__ T_Rendertarget&& other ) noexcept;
T_Rendertarget& operator =(
__rw__ T_Rendertarget&& ) noexcept;
~T_Rendertarget( );
bool activate( );
uint32_t width( ) const { return width_; }
uint32_t height( ) const { return height_; }
static void MainOutput( );
private:
GLuint id_;
uint32_t nCats_ , width_ , height_;
std::vector< GLenum > buffers_;
};