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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef LUA_GL_H
#define LUA_GL_H
#include <string>
#include <set>
#include "Lua/LuaHandle.h"
struct lua_State;
class LuaOpenGL {
public:
enum DrawMode {
DRAW_NONE = 0,
DRAW_GENESIS = 1,
DRAW_WORLD = 2,
DRAW_WORLD_SHADOW = 3,
DRAW_WORLD_REFLECTION = 4,
DRAW_WORLD_REFRACTION = 5,
DRAW_SCREEN = 6,
DRAW_MINIMAP = 7,
DRAW_LAST_MODE = DRAW_MINIMAP
};
public:
static void Init();
static void Free();
static bool PushEntries(lua_State* L);
static bool IsDrawingEnabled() { return CLuaHandle::GetStaticLuaContextData().drawingEnabled; }
static void SetDrawingEnabled(bool value) { CLuaHandle::GetStaticLuaContextData().drawingEnabled = value; }
static bool CanUseShaders() { return canUseShaders; }
static bool GetSafeMode() { return safeMode; }
static void SetSafeMode(bool value) { safeMode = value; }
static void EnableCommon(DrawMode);
static void ResetCommon(DrawMode);
static void DisableCommon(DrawMode);
static void EnableDrawGenesis();
static void ResetDrawGenesis();
static void DisableDrawGenesis();
static void EnableDrawWorld();
static void ResetDrawWorld();
static void DisableDrawWorld();
static void EnableDrawWorldPreUnit();
static void ResetDrawWorldPreUnit();
static void DisableDrawWorldPreUnit();
static void EnableDrawWorldShadow();
static void ResetDrawWorldShadow();
static void DisableDrawWorldShadow();
static void EnableDrawWorldReflection();
static void ResetDrawWorldReflection();
static void DisableDrawWorldReflection();
static void EnableDrawWorldRefraction();
static void ResetDrawWorldRefraction();
static void DisableDrawWorldRefraction();
static void EnableDrawScreenEffects();
static void ResetDrawScreenEffects();
static void DisableDrawScreenEffects();
static void EnableDrawScreen();
static void ResetDrawScreen();
static void DisableDrawScreen();
static void EnableDrawInMiniMap();
static void ResetDrawInMiniMap();
static void DisableDrawInMiniMap();
protected:
static void ResetGLState();
static void ClearMatrixStack(int);
static void ResetGenesisMatrices();
static void ResetWorldMatrices();
static void ResetWorldShadowMatrices();
static void ResetScreenMatrices();
static void ResetMiniMapMatrices();
static void SetupScreenMatrices();
static void RevertScreenMatrices();
static void SetupScreenLighting();
static void RevertScreenLighting();
static void SetupWorldLighting();
static void RevertWorldLighting();
private:
static DrawMode drawMode;
static DrawMode prevDrawMode; // for minimap (when drawn in Screen mode)
static bool safeMode;
static bool canUseShaders;
static float screenWidth;
static float screenDistance;
static void (*resetMatrixFunc)(void);
static unsigned int resetStateList;
static std::set<unsigned int> occlusionQueries;
private:
static void CheckDrawingEnabled(lua_State* L, const char* caller);
private:
static int HasExtension(lua_State* L);
static int GetNumber(lua_State* L);
static int GetString(lua_State* L);
static int ConfigScreen(lua_State* L);
static int GetViewSizes(lua_State* L);
static int DrawMiniMap(lua_State* L);
static int SlaveMiniMap(lua_State* L);
static int ConfigMiniMap(lua_State* L);
static int ResetState(lua_State* L);
static int ResetMatrices(lua_State* L);
static int Clear(lua_State* L);
static int Lighting(lua_State* L);
static int ShadeModel(lua_State* L);
static int Scissor(lua_State* L);
static int Viewport(lua_State* L);
static int ColorMask(lua_State* L);
static int DepthMask(lua_State* L);
static int DepthTest(lua_State* L);
static int DepthClamp(lua_State* L);
static int Culling(lua_State* L);
static int LogicOp(lua_State* L);
static int Fog(lua_State* L);
static int Smoothing(lua_State* L);
static int AlphaTest(lua_State* L);
static int LineStipple(lua_State* L);
static int Blending(lua_State* L);
static int BlendEquation(lua_State* L);
static int BlendFunc(lua_State* L);
static int BlendEquationSeparate(lua_State* L);
static int BlendFuncSeparate(lua_State* L);
static int Material(lua_State* L);
static int Color(lua_State* L);
static int PolygonMode(lua_State* L);
static int PolygonOffset(lua_State* L);
static int StencilTest(lua_State* L);
static int StencilMask(lua_State* L);
static int StencilFunc(lua_State* L);
static int StencilOp(lua_State* L);
static int StencilMaskSeparate(lua_State* L);
static int StencilFuncSeparate(lua_State* L);
static int StencilOpSeparate(lua_State* L);
static int LineWidth(lua_State* L);
static int PointSize(lua_State* L);
static int PointSprite(lua_State* L);
static int PointParameter(lua_State* L);
static int Texture(lua_State* L);
static int CreateTexture(lua_State* L);
static int DeleteTexture(lua_State* L);
static int DeleteTextureFBO(lua_State* L);
static int TextureInfo(lua_State* L);
static int CopyToTexture(lua_State* L);
static int RenderToTexture(lua_State* L);
static int GenerateMipmap(lua_State* L);
static int ActiveTexture(lua_State* L);
static int TexEnv(lua_State* L);
static int TexGen(lua_State* L);
static int MultiTexEnv(lua_State* L);
static int MultiTexGen(lua_State* L);
static int Shape(lua_State* L);
static int BeginEnd(lua_State* L);
static int Vertex(lua_State* L);
static int Normal(lua_State* L);
static int TexCoord(lua_State* L);
static int MultiTexCoord(lua_State* L);
static int SecondaryColor(lua_State* L);
static int FogCoord(lua_State* L);
static int EdgeFlag(lua_State* L);
static int Rect(lua_State* L);
static int TexRect(lua_State* L);
static int BeginText(lua_State* L);
static int Text(lua_State* L);
static int EndText(lua_State* L);
static int GetTextWidth(lua_State* L);
static int GetTextHeight(lua_State* L);
static int Unit(lua_State* L);
static int UnitRaw(lua_State* L);
static int UnitShape(lua_State* L);
static int UnitMultMatrix(lua_State* L);
static int UnitPiece(lua_State* L);
static int UnitPieceMatrix(lua_State* L);
static int UnitPieceMultMatrix(lua_State* L);
static int Feature(lua_State* L);
static int FeatureShape(lua_State* L);
static int DrawListAtUnit(lua_State* L);
static int DrawFuncAtUnit(lua_State* L);
static int DrawGroundCircle(lua_State* L);
static int DrawGroundQuad(lua_State* L);
static int Light(lua_State* L);
static int ClipPlane(lua_State* L);
static int MatrixMode(lua_State* L);
static int LoadIdentity(lua_State* L);
static int LoadMatrix(lua_State* L);
static int MultMatrix(lua_State* L);
static int Translate(lua_State* L);
static int Scale(lua_State* L);
static int Rotate(lua_State* L);
static int Ortho(lua_State* L);
static int Frustum(lua_State* L);
static int Billboard(lua_State* L);
static int PushMatrix(lua_State* L);
static int PopMatrix(lua_State* L);
static int PushPopMatrix(lua_State* L);
static int GetMatrixData(lua_State* L);
static int PushAttrib(lua_State* L);
static int PopAttrib(lua_State* L);
static int UnsafeState(lua_State* L);
static int CreateList(lua_State* L);
static int CallList(lua_State* L);
static int DeleteList(lua_State* L);
static int Flush(lua_State* L);
static int Finish(lua_State* L);
static int ReadPixels(lua_State* L);
static int SaveImage(lua_State* L);
static int CreateQuery(lua_State* L);
static int DeleteQuery(lua_State* L);
static int RunQuery(lua_State* L);
static int GetQuery(lua_State* L);
static int GetGlobalTexNames(lua_State* L);
static int GetGlobalTexCoords(lua_State* L);
static int GetShadowMapParams(lua_State* L);
static int GetSun(lua_State* L);
static int RenderMode(lua_State* L);
static int SelectBuffer(lua_State* L);
static int SelectBufferData(lua_State* L);
static int InitNames(lua_State* L);
static int LoadName(lua_State* L);
static int PushName(lua_State* L);
static int PopName(lua_State* L);
};
#endif /* LUA_UNITDEFS_H */
|