demotool/programs.hh

68 lines
1.4 KiB
C++

#pragma once
#include "filewatcher.hh"
/*= T_ShaderCode =============================================================*/
struct T_ShaderCode
{
T_ShaderCode( ) = delete;
T_ShaderCode( T_ShaderCode const& ) = delete;
T_ShaderCode( T_ShaderCode&& ) = delete;
explicit T_ShaderCode( __rd__ const int nparts );
~T_ShaderCode( );
void setPart(
__rd__ const int index ,
__rd__ char const* const string );
void setPart(
__rd__ const int index ,
__rd__ void const* const data ,
__rd__ const int size );
bool loadPart(
__rd__ const int index ,
__rd__ std::string const& source ,
__rw__ std::vector< std::string >& errors );
GLuint createProgram(
__rd__ GLenum type ,
__rw__ std::vector< std::string >& errors ) const;
private:
std::vector< char* > code;
};
struct T_ShaderProgram
{
T_ShaderProgram( ) = delete;
T_ShaderProgram( T_ShaderProgram const& ) = delete;
T_ShaderProgram( T_ShaderProgram&& ) = delete;
T_ShaderProgram( __rd__ GLenum programType );
~T_ShaderProgram( );
void addChunk( __rd__ std::string const& string );
void addFile( __rd__ std::string const& source );
void load( );
bool activate( ) const;
GLuint id( ) const { return program_; }
static T_ShaderProgram const& FullscreenQuad( );
private:
T_WatchedFiles files_;
std::vector< bool > chunksOrFiles_;
std::vector< std::string > parts_;
std::vector< std::string > errors_;
GLenum programType_;
GLuint program_;
};