2015-11-10 02:06:27 +00:00
|
|
|
#ifndef HECLBACKEND_GLSL_HPP
|
|
|
|
#define HECLBACKEND_GLSL_HPP
|
|
|
|
|
2015-11-10 23:17:53 +00:00
|
|
|
#include "ProgrammableCommon.hpp"
|
2015-11-10 02:06:27 +00:00
|
|
|
|
|
|
|
namespace HECL
|
|
|
|
{
|
|
|
|
namespace Backend
|
|
|
|
{
|
|
|
|
|
2015-11-10 23:17:53 +00:00
|
|
|
struct GLSL : ProgrammableCommon
|
2015-11-10 02:06:27 +00:00
|
|
|
{
|
2015-11-10 23:17:53 +00:00
|
|
|
void reset(const IR& ir, Diagnostics& diag);
|
|
|
|
std::string makeVert(const char* glslVer, unsigned col, unsigned uv, unsigned w,
|
|
|
|
unsigned skinSlots, unsigned texMtxs) const;
|
|
|
|
std::string makeFrag(const char* glslVer,
|
2015-11-16 04:30:06 +00:00
|
|
|
const ShaderFunction& lighting=ShaderFunction()) const;
|
2015-11-10 23:17:53 +00:00
|
|
|
std::string makeFrag(const char* glslVer,
|
2015-11-16 04:30:06 +00:00
|
|
|
const ShaderFunction& lighting,
|
|
|
|
const ShaderFunction& post) const;
|
2015-11-10 02:06:27 +00:00
|
|
|
|
2015-11-10 23:17:53 +00:00
|
|
|
private:
|
|
|
|
std::string GenerateVertInStruct(unsigned col, unsigned uv, unsigned w) const;
|
|
|
|
std::string GenerateVertToFragStruct() const;
|
|
|
|
std::string GenerateVertUniformStruct(unsigned skinSlots, unsigned texMtxs) const;
|
2015-11-10 02:06:27 +00:00
|
|
|
|
2015-11-10 23:17:53 +00:00
|
|
|
std::string EmitVec3(const atVec4f& vec) const
|
2015-11-10 02:06:27 +00:00
|
|
|
{
|
2015-11-10 23:17:53 +00:00
|
|
|
return HECL::Format("vec3(%g,%g,%g)", vec.vec[0], vec.vec[1], vec.vec[2]);
|
|
|
|
}
|
2015-11-10 02:06:27 +00:00
|
|
|
|
2015-11-10 23:17:53 +00:00
|
|
|
std::string EmitTexGenSource2(TexGenSrc src, int uvIdx) const;
|
|
|
|
std::string EmitTexGenSource4(TexGenSrc src, int uvIdx) const;
|
2015-11-10 02:06:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // HECLBACKEND_GLSL_HPP
|