Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
jop::Shader Class Reference

#include <Shader.hpp>

Inheritance diagram for jop::Shader:
jop::Resource jop::SafeReferenceable< Resource > jop::SerializeInfo

Public Types

enum  Type { Type::Vertex, Type::Geometry, Type::Fragment }
 

Public Member Functions

 Shader (const std::string &name)
 Constructor. More...
 
 ~Shader () override
 Destructor. More...
 
void destroy ()
 Destroy this shader. More...
 
void addSource (const char *source)
 Add shader source. More...
 
bool compile (const Type type, const bool preprocess=true)
 Compile shader. More...
 
bool load (const std::string &path, Type type, const bool preprocess=true)
 Load shader. More...
 
Type getType () const
 Get the shader type. More...
 
unsigned int getHandle () const
 Get the OpenGL handle. More...
 
- Public Member Functions inherited from jop::Resource
 Resource (const std::string &name)
 Constructor. More...
 
virtual ~Resource ()=0
 Virtual destructor. More...
 
const std::string & getName () const
 Get the name of this resource. More...
 
void setPersistence (const unsigned short level)
 Set the persistence level. More...
 
unsigned short getPersistence () const
 Get the persistence level. More...
 
- Public Member Functions inherited from jop::SafeReferenceable< Resource >
WeakReference< ResourcegetReference () const
 Get a weak reference to the bound object. More...
 
- Public Member Functions inherited from jop::SerializeInfo
 SerializeInfo ()
 
void setSerializePackage (const uint16 package)
 
uint16 getSerializePackage () const
 
void setShouldSerialize (const bool set)
 
bool shouldSerialize () const
 
void setLightSerializeable (const bool set)
 
bool isLightSerializeable () const
 

Static Public Member Functions

static const std::string & getVersionString ()
 Get the version definition string. More...
 
static const std::string & getExtensionString ()
 Get the extension definition string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from jop::Resource
 Resource (const Resource &other, const std::string &newName)
 Copy constructor. More...
 
- Protected Member Functions inherited from jop::SafeReferenceable< Resource >
 SafeReferenceable (Resource *ref)
 Constructor. More...
 
 SafeReferenceable (SafeReferenceable< Resource > &&other)
 Move constructor. More...
 
SafeReferenceableoperator= (SafeReferenceable< Resource > &&other)
 Move assignment operator. More...
 
 ~SafeReferenceable ()
 Protected destructor. More...
 

Detailed Description

Definition at line 35 of file Shader.hpp.

Member Enumeration Documentation

enum jop::Shader::Type
strong

Shader type

Enumerator
Vertex 
Geometry 
Fragment 

Definition at line 41 of file Shader.hpp.

Constructor & Destructor Documentation

jop::Shader::Shader ( const std::string &  name)
explicit

Constructor.

Parameters
nameName of the resource
jop::Shader::~Shader ( )
override

Destructor.

Member Function Documentation

void jop::Shader::addSource ( const char *  source)

Add shader source.

The string must stay in existence until after compile() is called.

Parameters
sourceThe shader source
bool jop::Shader::compile ( const Type  type,
const bool  preprocess = true 
)

Compile shader.

Parameters
typeShader type
preprocessShould shader be preprocessed?
Returns
True if successful
void jop::Shader::destroy ( )

Destroy this shader.

static const std::string& jop::Shader::getExtensionString ( )
static

Get the extension definition string.

Returns
The extension string
unsigned int jop::Shader::getHandle ( ) const

Get the OpenGL handle.

Returns
The shader handle
Type jop::Shader::getType ( ) const

Get the shader type.

Returns
The shader type
static const std::string& jop::Shader::getVersionString ( )
static

Get the version definition string.

Returns
The version string
bool jop::Shader::load ( const std::string &  path,
Type  type,
const bool  preprocess = true 
)

Load shader.

Parameters
pathPath to file containing shader or shaders source code
typeShader type
preprocessShould shader be preprocessed?
Returns
True if successful

The documentation for this class was generated from the following file: