87 lines
2.3 KiB
C++
87 lines
2.3 KiB
C++
// Copyright (c) 2023 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "display/mesh/Mesh.hpp"
|
|
#include "display/_RenderManager.hpp"
|
|
#include "display/Texture.hpp"
|
|
#include "display/shader/ShaderParameterBuffer.hpp"
|
|
|
|
namespace Dawn {
|
|
template<typename T>
|
|
class IShader {
|
|
public:
|
|
int32_t shaderId = -1;
|
|
int_fast16_t renderId = 0;
|
|
|
|
/**
|
|
* Compile all programs for this shader.
|
|
*/
|
|
virtual void compile() = 0;
|
|
|
|
/**
|
|
* Attaches the supplied shader as the current shader.
|
|
*/
|
|
virtual void bind() = 0;
|
|
|
|
/**
|
|
* Binds a shader buffer to a specific slot.
|
|
*
|
|
* @param slot Slot to bind the buffer to.
|
|
* @param buffer Buffer to bind.
|
|
*/
|
|
template<typename J>
|
|
void setParameterBuffer(shaderbufferslot_t slot, ShaderParameterBuffer<J> *buffer);
|
|
|
|
/**
|
|
* Set's a specific shader parameter to a matrix.
|
|
*
|
|
* @param parameter parameter on the shader to set.
|
|
* @param matrix Matrix to apply.
|
|
*/
|
|
virtual void setMatrix(T parameter, glm::mat4 matrix) = 0;
|
|
|
|
/**
|
|
* Attaches a boolean to a shader.
|
|
*
|
|
* @param parameter parameter to set.
|
|
* @param value Value to set.
|
|
*/
|
|
virtual void setBoolean(T parameter, bool_t value) = 0;
|
|
|
|
/**
|
|
* Set a color on to the shader.
|
|
*
|
|
* @param parameter parameter to set the color to.
|
|
* @param color Color to set.
|
|
*/
|
|
virtual void setColor(T parameter, struct Color color) = 0;
|
|
|
|
/**
|
|
* Set a 3D vector on to the shader.
|
|
*
|
|
* @param parameter parameter to set the vector to.
|
|
* @param vector Vector to set.
|
|
*/
|
|
virtual void setVector3(T parameter, glm::vec3 vector) = 0;
|
|
|
|
/**
|
|
* Attaches a texture to the currently bound shader.
|
|
*
|
|
* @param parameter parameter to set the texture on to.
|
|
* @param texture Texture slot to bind to the parameter.
|
|
*/
|
|
virtual void setTexture(T parameter, textureslot_t texture) = 0;
|
|
|
|
/**
|
|
* Sets a floating point value to the shader.
|
|
*
|
|
* @param parameter Paramater to set the float ont o.
|
|
* @param Float to bind.
|
|
*/
|
|
virtual void setFloat(T parameter, float_t value) = 0;
|
|
|
|
};
|
|
} |