// Copyright (c) 2023 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "display/shader/ShaderProgram.hpp" #include "display/mesh/Mesh.hpp" #include "display/_RenderManager.hpp" namespace Dawn { class Material; class MeshRenderer; class Camera; struct ShaderPassItem { ShaderProgram *shaderProgram = nullptr; int32_t priority = 0; Mesh *mesh; int32_t start = 0; int32_t count = -1; float_t w = 0; renderflag_t renderFlags = RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST; enum MeshDrawMode drawMode = MESH_DRAW_MODE_TRIANGLES; // Parameters std::map colorValues; std::map boolValues; std::map matrixValues; std::map vec3Values; std::map textureValues; std::map floatValues; // Textures std::map textureSlots; }; class Shader { public: int32_t shaderId = -1; int_fast16_t renderId = 0; /** * Compile all programs for this shader. This amy not remain forever as I * may decide to allow shaders to share programs somehow. For now though * this is clean enough. */ virtual void compile() = 0; /** * Returns the list of pass items to render for the given scene item. * * @param mesh Mesh Renderer for the scene item. * @param material Material for the scene item. * @param camera Camera for the scene. * @return List of passes to render. */ virtual std::vector getPassItems( Mesh *mesh, Material *material, Camera *camera ) = 0; }; }