class EE::Graphics::Shader

Overview

The basic shader class. More…

#include <shader.hpp>

class Shader {
public:
    // construction

    Shader(const Uint32& Type);
    Shader(const Uint32& Type, const std::string& Filename);
    Shader(const Uint32& Type, const char* Data, const Uint32& DataSize);
    Shader(const Uint32& Type, Pack* Pack, const std::string& Filename);
    Shader(const Uint32& Type, const char** Data, const Uint32& NumLines);
    virtual ~Shader();

    // methods

    static void ensure(bool ensure);
    static bool ensure();
    void setSource(const std::string& Source);
    void setSource(const std::vector<Uint8>& Source);
    void setSource(const char* Data, const Uint32& DataSize);
    void setSource(const char** Data, const Uint32& NumLines);
    bool compile();
    bool isValid() const;
    bool isCompiled() const;
    std::string compileLog() const;
    Uint32 getType() const;
    Uint32 getId() const;
    void reload();
};

Detailed Documentation

The basic shader class.

Construction

Shader(const Uint32& Type)

Constructor with type of shader, next you’ll need to set the source and compile it.

Shader(const Uint32& Type, const std::string& Filename)

Create a type of shader and load the shader from a file, and compile it.

Shader(const Uint32& Type, const char* Data, const Uint32& DataSize)

Create a type of shader from memory, and compile it.

Shader(const Uint32& Type, Pack* Pack, const std::string& Filename)

Create a type of shader loaded from a pack file

Shader(const Uint32& Type, const char** Data, const Uint32& NumLines)

Create a type of shader from memory, and compile it.

Methods

static void ensure(bool ensure)

Activates/Deactivates shader convertion from fixed pipeline to programmable pipeline ( activated by default )

static bool ensure()

Returns:

If automatic Shader conversion is activated

void setSource(const std::string& Source)

Set the shader source

void setSource(const std::vector<Uint8>& Source)

Set the shader source

void setSource(const char* Data, const Uint32& DataSize)

Set the shader source

void setSource(const char** Data, const Uint32& NumLines)

Set the shader source

bool compile()

Compile the shader

bool isValid() const

Returns:

If the shader is valid

bool isCompiled() const

Returns:

If the shader is compiled

std::string compileLog() const

Returns:

The log of the compilation

Uint32 getType() const

Returns:

The Shader Type

Uint32 getId() const

Returns:

The Shader Id

void reload()

Reloads the Shader.