This commit is contained in:
2022-10-19 22:59:48 -07:00
parent acc9d798cb
commit 0033785251
20 changed files with 502 additions and 15 deletions

View File

@ -1,11 +0,0 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
namespace Dawn {
class Shader;
}

View File

@ -5,6 +5,7 @@
#pragma once
#include "RenderTarget.hpp"
#include "display/shader/Shader.hpp"
namespace Dawn {
class DawnGame;
@ -30,8 +31,22 @@ namespace Dawn {
*/
virtual RenderTarget & getBackBuffer() = 0;
/**
* Returns the current render pipeline intended to be used for rendering
* the currently active scene on the game instance.
*
* @return Reference to the currently active main scene render pipeline.
*/
virtual RenderPipeline & getRenderPipeline() = 0;
/**
* Returns the default shader, the default shader will be applied to the
* materials first.
*
* @return Reference to the default shader.
*/
virtual std::shared_ptr<Shader> getDefaultShader() = 0;
/**
* Initialize / Start the Render Manager.
*
@ -43,5 +58,7 @@ namespace Dawn {
* Perform a synchronous frame update on the render manager.
*/
virtual void update() = 0;
};
}

View File

@ -0,0 +1,80 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
namespace Dawn {
class Material;
enum ShaderParameterType {
SHADER_PARAMETER_TYPE_MATRIX,
SHADER_PARAMETER_TYPE_BOOLEAN,
SHADER_PARAMETER_TYPE_COLOR,
SHADER_PARAMETER_TYPE_VECTOR3
};
template<typename T>
class IShader {
public:
/**
* Attaches the supplied shader as the current shader.
*/
virtual void bind() = 0;
// virtual void setCamera(glm::mat4 projection, glm::mat4 view) = 0;
// virtual void setLocalPosition(glm::mat4 position) = 0;
virtual void setDefaultParameters(Material &material) = 0;
virtual void setGlobalParameters(
glm::mat4 projection,
glm::mat4 view
) = 0;
virtual void setMeshParameters(glm::mat4 position) = 0;
/**
* Retreives the list of all parameters that the shader supports. This
* should not include the GLOBAL shader parameters (listed above) since
* those will be modified by the engine directly.
*
* @return Key-Value-Pair of Shader parameters and their type.
*/
virtual std::map<T, enum ShaderParameterType> getParameters() = 0;
/**
* 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;
};
}