1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef LUA_SHADERS_H
#define LUA_SHADERS_H
#include <string>
#include <vector>
using std::string;
using std::vector;
#include "Rendering/GL/myGL.h"
struct lua_State;
class LuaShaders {
public:
static bool PushEntries(lua_State* L);
LuaShaders();
~LuaShaders();
string errorLog;
GLuint GetProgramName(unsigned int progID) const;
private:
struct Object {
Object(GLuint _id, GLenum _type) : id(_id), type(_type) {}
GLuint id;
GLenum type;
};
struct Program {
GLuint id;
std::vector<Object> objects;
};
std::vector<Program> programs;
vector<unsigned int> unused; // references slots in programs
private:
unsigned int AddProgram(const Program& p);
void RemoveProgram(unsigned int progID);
GLuint GetProgramName(lua_State* L, int index) const;
private:
static void DeleteProgram(Program& p);
private:
// the call-outs
static int CreateShader(lua_State* L);
static int DeleteShader(lua_State* L);
static int UseShader(lua_State* L);
static int ActiveShader(lua_State* L);
static int GetActiveUniforms(lua_State* L);
static int GetUniformLocation(lua_State* L);
static int Uniform(lua_State* L);
static int UniformInt(lua_State* L);
static int UniformMatrix(lua_State* L);
static int SetShaderParameter(lua_State* );
static int GetShaderLog(lua_State* L);
private:
static int activeShaderDepth;
};
#endif /* LUA_SHADERS_H */
|