Dawn/archive/UIShader.hpp

43 lines
1.0 KiB
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "display/shader/Shader.hpp"
namespace Dawn {
#define UI_SHADER_QUAD_COUNT 1024
#define UI_SHADER_TEXTURE_COUNT 16
enum class UIShaderQuadStyle {
TEXTURED = 0,
FONT = 1
};
struct UIShaderQuad {
glm::vec4 quad;
glm::vec4 uv;
struct Color color;
glm::vec4 style;
};
struct UIShaderData {
glm::mat4 projection;
glm::mat4 view;
glm::mat4 model;
shadertexturebinding_t textures[UI_SHADER_TEXTURE_COUNT];
struct UIShaderQuad quads[UI_SHADER_QUAD_COUNT];
};
class UIShader : public Shader<UIShaderData> {
protected:
void getStages(
const enum ShaderOpenGLVariant variant,
const struct UIShaderData *rel,
std::vector<std::shared_ptr<ShaderStage>> &stages,
std::vector<struct ShaderParameter> &parameters,
std::vector<struct IShaderStructure> &structures
) override;
};
}