blah/public/blah/graphics/shader.h

53 lines
890 B
C
Raw Normal View History

2020-08-26 15:38:01 +08:00
#pragma once
#include <blah/containers/stackvector.h>
#include <blah/containers/str.h>
2020-08-26 15:38:01 +08:00
#include <memory>
namespace Blah
{
enum class UniformType
{
None,
Float,
Float2,
Float3,
Float4,
Mat3x2,
Mat4x4,
Texture
};
struct UniformInfo
{
String name;
UniformType type;
int array_length;
};
struct ShaderData
{
const char* vertex;
const char* fragment;
};
2020-08-26 15:38:01 +08:00
2020-12-27 06:44:48 +08:00
class Shader;
typedef std::shared_ptr<Shader> ShaderRef;
2020-08-26 15:38:01 +08:00
class Shader
{
public:
2020-12-27 06:44:48 +08:00
// Creates a Shader with the given Shader Data.
// If the Shader creation fails, it will return an invalid ShaderRef.
static ShaderRef create(const ShaderData* data);
2020-08-26 15:38:01 +08:00
virtual ~Shader() = default;
// Gets a list of Shader Uniforms from Shader
virtual Vector<UniformInfo>& uniforms() = 0;
2020-08-26 15:38:01 +08:00
// Gets a list of Shader Uniforms from Shader
virtual const Vector<UniformInfo>& uniforms() const = 0;
2020-08-26 15:38:01 +08:00
};
}