engine/include/resources/shader.h

49 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-05-01 12:55:49 +00:00
#ifndef ENGINE_INCLUDE_RESOURCES_SHADER_H_
#define ENGINE_INCLUDE_RESOURCES_SHADER_H_
2022-12-20 23:51:04 +00:00
2023-05-01 13:13:35 +00:00
#include "application.h"
#include "gfx.h"
#include "gfx_device.h"
2022-12-20 23:51:04 +00:00
namespace engine {
2023-05-01 12:55:49 +00:00
namespace resources {
2022-12-20 23:51:04 +00:00
class Shader {
2023-05-01 12:55:49 +00:00
public:
// defines what vertex inputs are defined, position is always vec3
struct VertexParams {
bool has_normal; // vec3
bool has_tangent; // vec3
bool has_color; // vec3
bool has_uv0; // vec2
};
2023-05-24 17:33:55 +00:00
struct ShaderSettings {
VertexParams vertexParams;
bool alpha_blending;
bool cull_backface;
bool write_z;
int render_order;
};
static constexpr int kHighestRenderOrder = 1;
2023-05-01 12:55:49 +00:00
Shader(RenderData* render_data, const char* vert_path, const char* frag_path,
2023-05-24 17:33:55 +00:00
const ShaderSettings& settings);
2023-05-01 12:55:49 +00:00
~Shader();
Shader(const Shader&) = delete;
Shader& operator=(const Shader&) = delete;
const gfx::Pipeline* GetPipeline();
2023-05-24 17:33:55 +00:00
int GetRenderOrder() { return render_order_; }
2023-05-01 12:55:49 +00:00
private:
GFXDevice* const gfx_;
const gfx::Pipeline* pipeline_;
2023-05-24 17:33:55 +00:00
const int render_order_;
2022-12-20 23:51:04 +00:00
};
2023-05-01 12:55:49 +00:00
} // namespace resources
} // namespace engine
#endif