ICustomMaterial



Describes minimum required functionality from CustomMaterial control.

You can find more information in comments below. Overrided methods can be found in corresponding base interface.

class ICustomMaterial :public virtual IMaterialControl
{
public:
    enum OPTION_TYPE // Shader option types 
    {
        otNone, // Option is not found 
        otInteger,
        otFloat,
        otVec2,
        otVec3,
        otVec4,
        otVec2i,
        otVec3i,
        otVec4i,
        otMat4
    };
public:
    void(*OnActivateMaterial)(ICustomMaterial *sender); // Event called at material activation after setting default shader uniform. In this event custom options could be set/updated 

    virtual ITexture *getTexture() = 0; // Return associated texture 
    virtual AnsiString getVertexShader() = 0; // Return vertex shader code 
    virtual AnsiString getFragmentShader() = 0; // Return fragment shader code 
    virtual int getOptionCount() = 0; // Return option count 
    virtual String getOptionName(const int index) = 0; // Return specified option name. Return empty string if not found 
    virtual OPTION_TYPE getOptionType(const int index) = 0; // Return specified option type. Return otNone if not found 
    virtual int getIntegerOptionValue(const int index) = 0; // Return specified option integer value. Return 0 if not found 
    virtual float getFloatOptionValue(const int index) = 0; // Return specified option float value. Return 0 if not found 
    virtual Vec2 getVec2OptionValue(const int index) = 0; // Return specified option Vec2 value. Return zero vector if not found 
    virtual Vec3 getVec3OptionValue(const int index) = 0; // Return specified option Vec3 value. Return zero vector if not found 
    virtual Vec4 getVec4OptionValue(const int index) = 0; // Return specified option Vec4 value. Return zero vector if not found 
    virtual Vec2i getVec2iOptionValue(const int index) = 0; // Return specified option Vec2i value. Return zero vector if not found 
    virtual Vec3i getVec3iOptionValue(const int index) = 0; // Return specified option Vec3i value. Return zero vector if not found 
    virtual Vec4i getVec4iOptionValue(const int index) = 0; // Return specified option Vec4i value. Return zero vector if not found 
    virtual Mat4 getMat4OptionValue(const int index) = 0; // Return specified option matrix value. Return identity matrix if not found 
    virtual AnsiString getVertexShaderErrors() = 0; // Return vertex shader compilation errors 
    virtual AnsiString getFragmentShaderErrors() = 0; // Return fragment shader compilation errors 
    virtual AnsiString getProgramErrors() = 0; // Return shader program linking errors 

    virtual bool setTexture(ITexture *value) = 0; // Associate texture 
    virtual bool setVertexShader(const AnsiString &value) = 0; // Set vertex shader code 
    virtual bool setFragmentShader(const AnsiString &value) = 0; // Set fragment shader code 
    virtual bool setShaders(const AnsiString &vertex, const AnsiString &fragment) = 0; // Set both vertex and fragment shader codes 
    virtual bool setOption(const String &name, const int value) = 0; // Set integer option value 
    virtual bool setOption(const String &name, const float value) = 0; // Set float option value 
    virtual bool setOption(const String &name, const Vec2 &value) = 0; // Set Vec2 option value 
    virtual bool setOption(const String &name, const Vec3 &value) = 0; // Set Vec3 option value 
    virtual bool setOption(const String &name, const Vec4 &value) = 0; // Set Vec4 option value 
    virtual bool setOption(const String &name, const Vec2i &value) = 0; // Set Vec2i option value 
    virtual bool setOption(const String &name, const Vec3i &value) = 0; // Set Vec3i option value 
    virtual bool setOption(const String &name, const Vec4i &value) = 0; // Set Vec4i option value 
    virtual bool setOption(const String &name, const Mat4 &value) = 0; // Set matrix option value 

    virtual bool LoadVertexShader(const String &filename) = 0; // Load vertex shader code from specified file 
    virtual bool LoadFragmentShader(const String &filename) = 0; // Load fragment shader code from specified file 
    virtual bool LoadShaders(const String &vertex_filename, const String &fragment_filename) = 0; // Load vertex and fragment shader code from specified files 

    virtual void LockUpdate() = 0; // Prevent shaders recompilation untill final unlock 
    virtual void UnlockUpdate() = 0; // Allow shader recompilation on changes. Should be called the same time the previous method was called 
};
Namespace: nitisa::opengl
Include: OpenGL/Controls/ICustomMaterial.h