62 lines
1.1 KiB
C++
62 lines
1.1 KiB
C++
#ifndef SHADERSYSTEM_H
|
|
#define SHADERSYSTEM_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "render/shader.h"
|
|
|
|
enum ShaderUniform_t
|
|
{
|
|
UNIFORM_MODEL_MATRIX,
|
|
UNIFORM_VIEW_MATRIX,
|
|
UNIFORM_PROJ_MATRIX,
|
|
UNIFORM_MVP_MATRIX,
|
|
UNIFORM_CUSTOM_COLOR,
|
|
UNIFORM_SUN_DIRECTION,
|
|
UNIFORM_SUN_COLOR,
|
|
UNIFORM_SUN_AMBIENT,
|
|
|
|
UNIFORM_MAX,
|
|
};
|
|
|
|
enum ShaderSamplers_t
|
|
{
|
|
SAMPLER_ALBEDO,
|
|
SAMPLER_NORMAL,
|
|
SAMPLER_LIGHTMAP,
|
|
|
|
SAMPLER_MAX
|
|
};
|
|
|
|
class ShaderSystem
|
|
{
|
|
public:
|
|
ShaderSystem();
|
|
~ShaderSystem();
|
|
|
|
void Init();
|
|
void Shutdown();
|
|
|
|
Shader* CreateShader(const char* name, const char* vsfilepath, const char* psfilepath, InputLayoutDesc_t* inputLayout = NULL, int inputLayoutCount = 0);
|
|
|
|
void SetShader(const Shader* shader);
|
|
|
|
void SetUniformSampler( const Shader* shader, ShaderSamplers_t sampler, int index );
|
|
void SetUniformFloat4( const Shader* shader, ShaderUniform_t uniform, const void* data );
|
|
void SetUniformMatrix( const Shader* shader, ShaderUniform_t uniform, const void* data );
|
|
|
|
private:
|
|
struct ShaderData
|
|
{
|
|
std::string name;
|
|
Shader* shader;
|
|
};
|
|
|
|
std::vector<ShaderData> m_shaders;
|
|
};
|
|
|
|
extern ShaderSystem* g_shaderSystem;
|
|
|
|
#endif // !SHADERSYSTEM_H
|