From e24d721381567192e98cf56f5498caeda5531714 Mon Sep 17 00:00:00 2001 From: Alexander Szpakowski Date: Wed, 16 Jan 2013 07:21:41 -0400 Subject: [PATCH] Renamed all instances of 'ShaderEffect' (previously 'PixelEffect') to 'Shader'. --- .../macosx/love.xcodeproj/project.pbxproj | 26 +++---- platform/msvc2010/liblove.vcxproj | 8 +-- platform/msvc2010/liblove.vcxproj.filters | 8 +-- src/common/types.h | 4 +- src/modules/graphics/Graphics.cpp | 4 +- src/modules/graphics/Graphics.h | 2 +- src/modules/graphics/opengl/Canvas.h | 2 +- src/modules/graphics/opengl/Graphics.cpp | 14 ++-- src/modules/graphics/opengl/Graphics.h | 4 +- src/modules/graphics/opengl/Image.h | 2 +- .../opengl/{ShaderEffect.cpp => Shader.cpp} | 72 +++++++++---------- .../opengl/{ShaderEffect.h => Shader.h} | 38 +++++----- src/modules/graphics/opengl/wrap_Graphics.cpp | 48 ++++++------- src/modules/graphics/opengl/wrap_Graphics.h | 8 +-- ...{wrap_ShaderEffect.cpp => wrap_Shader.cpp} | 60 ++++++++-------- .../{wrap_ShaderEffect.h => wrap_Shader.h} | 14 ++-- src/scripts/boot.lua | 2 +- src/scripts/boot.lua.h | 2 +- src/scripts/graphics.lua | 34 ++++----- src/scripts/graphics.lua.h | 61 ++++++++-------- 20 files changed, 209 insertions(+), 204 deletions(-) rename src/modules/graphics/opengl/{ShaderEffect.cpp => Shader.cpp} (85%) rename src/modules/graphics/opengl/{ShaderEffect.h => Shader.h} (80%) rename src/modules/graphics/opengl/{wrap_ShaderEffect.cpp => wrap_Shader.cpp} (74%) rename src/modules/graphics/opengl/{wrap_ShaderEffect.h => wrap_Shader.h} (78%) diff --git a/platform/macosx/love.xcodeproj/project.pbxproj b/platform/macosx/love.xcodeproj/project.pbxproj index 1a0787ab8..83901c062 100644 --- a/platform/macosx/love.xcodeproj/project.pbxproj +++ b/platform/macosx/love.xcodeproj/project.pbxproj @@ -236,8 +236,8 @@ A9F2D09114BA85EC0035D2A5 /* Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9F2D09014BA85EC0035D2A5 /* Audio.cpp */; }; A9F6E6AE15A1080D00C86200 /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9F6E6AC15A1080D00C86200 /* love.cpp */; }; A9F6E6B115A1099C00C86200 /* GmeDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9F6E6AF15A1099C00C86200 /* GmeDecoder.cpp */; }; - FADB91451683F5C600D84B22 /* ShaderEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADB91431683F5C600D84B22 /* ShaderEffect.cpp */; }; - FADB91481683F5FA00D84B22 /* wrap_ShaderEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADB91461683F5F900D84B22 /* wrap_ShaderEffect.cpp */; }; + FAE69DC516A6BE7800C1AC79 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE69DC116A6BE7800C1AC79 /* Shader.cpp */; }; + FAE69DC616A6BE7800C1AC79 /* wrap_Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE69DC316A6BE7800C1AC79 /* wrap_Shader.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -532,7 +532,7 @@ A93E6B8C10420ACB007D418B /* wrap_SoundData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_SoundData.h; sourceTree = ""; }; A93E6B8F10420ACC007D418B /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Timer.cpp; sourceTree = ""; }; A93E6B9010420ACC007D418B /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = ""; }; - A93E6B9710420ACC007D418B /* boot.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = boot.lua; sourceTree = ""; }; + A93E6B9710420ACC007D418B /* boot.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; lineEnding = 0; path = boot.lua; sourceTree = ""; }; A93E6B9810420ACC007D418B /* boot.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = boot.lua.h; sourceTree = ""; }; A93E6B9910420ACC007D418B /* graphics.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; lineEnding = 0; path = graphics.lua; sourceTree = ""; }; A93E6B9A10420ACC007D418B /* graphics.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphics.lua.h; sourceTree = ""; }; @@ -737,10 +737,10 @@ A9F6E6B015A1099C00C86200 /* GmeDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GmeDecoder.h; sourceTree = ""; }; A9F8833511163C8C00831E98 /* audio.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = audio.lua; sourceTree = ""; }; A9F8833611163C8C00831E98 /* audio.lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio.lua.h; sourceTree = ""; }; - FADB91431683F5C600D84B22 /* ShaderEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderEffect.cpp; sourceTree = ""; }; - FADB91441683F5C600D84B22 /* ShaderEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShaderEffect.h; sourceTree = ""; }; - FADB91461683F5F900D84B22 /* wrap_ShaderEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_ShaderEffect.cpp; sourceTree = ""; }; - FADB91471683F5FA00D84B22 /* wrap_ShaderEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_ShaderEffect.h; sourceTree = ""; }; + FAE69DC116A6BE7800C1AC79 /* Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Shader.cpp; sourceTree = ""; }; + FAE69DC216A6BE7800C1AC79 /* Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shader.h; sourceTree = ""; }; + FAE69DC316A6BE7800C1AC79 /* wrap_Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_Shader.cpp; sourceTree = ""; }; + FAE69DC416A6BE7800C1AC79 /* wrap_Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Shader.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1148,8 +1148,8 @@ A9B4BA981045937F001DBC80 /* ParticleSystem.h */, A93E6A9310420AC2007D418B /* Quad.cpp */, A93E6A9410420AC2007D418B /* Quad.h */, - FADB91431683F5C600D84B22 /* ShaderEffect.cpp */, - FADB91441683F5C600D84B22 /* ShaderEffect.h */, + FAE69DC116A6BE7800C1AC79 /* Shader.cpp */, + FAE69DC216A6BE7800C1AC79 /* Shader.h */, A93E6A9510420AC2007D418B /* SpriteBatch.cpp */, A93E6A9610420AC2007D418B /* SpriteBatch.h */, A96F41961412BC000067FE9A /* VertexBuffer.cpp */, @@ -1166,8 +1166,8 @@ A9B4BA991045937F001DBC80 /* wrap_ParticleSystem.h */, A93E6AA110420AC3007D418B /* wrap_Quad.cpp */, A93E6AA210420AC3007D418B /* wrap_Quad.h */, - FADB91461683F5F900D84B22 /* wrap_ShaderEffect.cpp */, - FADB91471683F5FA00D84B22 /* wrap_ShaderEffect.h */, + FAE69DC316A6BE7800C1AC79 /* wrap_Shader.cpp */, + FAE69DC416A6BE7800C1AC79 /* wrap_Shader.h */, A93E6AA310420AC3007D418B /* wrap_SpriteBatch.cpp */, A93E6AA410420AC3007D418B /* wrap_SpriteBatch.h */, ); @@ -1955,8 +1955,8 @@ A9F6E6B115A1099C00C86200 /* GmeDecoder.cpp in Sources */, A911D2DB15DFECC8005B7EB8 /* Module.cpp in Sources */, A5474CEF1624903B00C8EEAC /* math.cpp in Sources */, - FADB91451683F5C600D84B22 /* ShaderEffect.cpp in Sources */, - FADB91481683F5FA00D84B22 /* wrap_ShaderEffect.cpp in Sources */, + FAE69DC516A6BE7800C1AC79 /* Shader.cpp in Sources */, + FAE69DC616A6BE7800C1AC79 /* wrap_Shader.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/platform/msvc2010/liblove.vcxproj b/platform/msvc2010/liblove.vcxproj index 875087236..490cb667f 100644 --- a/platform/msvc2010/liblove.vcxproj +++ b/platform/msvc2010/liblove.vcxproj @@ -404,7 +404,7 @@ - + @@ -413,7 +413,7 @@ - + @@ -631,7 +631,7 @@ - + @@ -640,7 +640,7 @@ - + diff --git a/platform/msvc2010/liblove.vcxproj.filters b/platform/msvc2010/liblove.vcxproj.filters index 4ea03a7bb..081f87384 100644 --- a/platform/msvc2010/liblove.vcxproj.filters +++ b/platform/msvc2010/liblove.vcxproj.filters @@ -447,7 +447,7 @@ modules\graphics - + modules\graphics\opengl @@ -474,7 +474,7 @@ modules\graphics\opengl - + modules\graphics\opengl @@ -1129,7 +1129,7 @@ modules\graphics\opengl - + modules\graphics\opengl @@ -1156,7 +1156,7 @@ modules\graphics\opengl - + modules\graphics\opengl diff --git a/src/common/types.h b/src/common/types.h index 4e5216bc2..765d107ab 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -52,7 +52,7 @@ enum Type GRAPHICS_PARTICLE_SYSTEM_ID, GRAPHICS_SPRITE_BATCH_ID, GRAPHICS_CANVAS_ID, - GRAPHICS_SHADEREFFECT_ID, + GRAPHICS_SHADER_ID, // Image IMAGE_IMAGE_DATA_ID, @@ -123,7 +123,7 @@ const bits GRAPHICS_FONT_T = (bits(1) << GRAPHICS_FONT_ID) | OBJECT_T; const bits GRAPHICS_PARTICLE_SYSTEM_T = (bits(1) << GRAPHICS_PARTICLE_SYSTEM_ID) | GRAPHICS_DRAWABLE_T; const bits GRAPHICS_SPRITE_BATCH_T = (bits(1) << GRAPHICS_SPRITE_BATCH_ID) | GRAPHICS_DRAWABLE_T; const bits GRAPHICS_CANVAS_T = (bits(1) << GRAPHICS_CANVAS_ID) | GRAPHICS_DRAWQABLE_T; -const bits GRAPHICS_SHADEREFFECT_T = (bits(1) << GRAPHICS_SHADEREFFECT_ID) | OBJECT_T; +const bits GRAPHICS_SHADER_T = (bits(1) << GRAPHICS_SHADER_ID) | OBJECT_T; // Image. const bits IMAGE_IMAGE_DATA_T = (bits(1) << IMAGE_IMAGE_DATA_ID) | DATA_T; diff --git a/src/modules/graphics/Graphics.cpp b/src/modules/graphics/Graphics.cpp index 9be6102a7..4d154b7e1 100644 --- a/src/modules/graphics/Graphics.cpp +++ b/src/modules/graphics/Graphics.cpp @@ -157,8 +157,8 @@ StringMap::Entry Graphics::suppor { { "canvas", Graphics::SUPPORT_CANVAS }, { "hdrcanvas", Graphics::SUPPORT_HDR_CANVAS }, - { "shadereffect", Graphics::SUPPORT_SHADEREFFECT }, - { "pixeleffect", Graphics::SUPPORT_SHADEREFFECT }, // for compatibility + { "shader", Graphics::SUPPORT_SHADER }, + { "pixeleffect", Graphics::SUPPORT_SHADER }, // for compatibility { "npot", Graphics::SUPPORT_NPOT }, { "subtractive", Graphics::SUPPORT_SUBTRACTIVE }, { "mipmap", Graphics::SUPPORT_MIPMAP }, diff --git a/src/modules/graphics/Graphics.h b/src/modules/graphics/Graphics.h index b61d765d2..ce3da5f14 100644 --- a/src/modules/graphics/Graphics.h +++ b/src/modules/graphics/Graphics.h @@ -86,7 +86,7 @@ public: { SUPPORT_CANVAS = 1, SUPPORT_HDR_CANVAS, - SUPPORT_SHADEREFFECT, + SUPPORT_SHADER, SUPPORT_NPOT, SUPPORT_SUBTRACTIVE, SUPPORT_MIPMAP, diff --git a/src/modules/graphics/opengl/Canvas.h b/src/modules/graphics/opengl/Canvas.h index 17f92bb1d..f874a8bae 100644 --- a/src/modules/graphics/opengl/Canvas.h +++ b/src/modules/graphics/opengl/Canvas.h @@ -95,7 +95,7 @@ public: static void bindDefaultCanvas(); private: - friend class ShaderEffect; + friend class Shader; GLuint getTextureName() const { return img; diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index 2815bd363..ab245af43 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -193,7 +193,7 @@ void Graphics::reset() DisplayState s; discardStencil(); Canvas::bindDefaultCanvas(); - ShaderEffect::detach(); + Shader::detach(); restoreState(s); } @@ -453,21 +453,21 @@ Canvas *Graphics::newCanvas(int width, int height, Canvas::TextureType texture_t return NULL; // never reached } -ShaderEffect *Graphics::newShaderEffect(const ShaderEffect::ShaderSources &shadersources) +Shader *Graphics::newShader(const Shader::ShaderSources &shadersources) { - ShaderEffect *effect = NULL; + Shader *shader = NULL; try { - effect = new ShaderEffect(shadersources); + shader = new Shader(shadersources); } catch(love::Exception &) { - if (effect) - delete effect; + if (shader) + delete shader; throw; } - return effect; + return shader; } void Graphics::setColor(const Color &c) diff --git a/src/modules/graphics/opengl/Graphics.h b/src/modules/graphics/opengl/Graphics.h index 931b62ac6..19d7a1c72 100644 --- a/src/modules/graphics/opengl/Graphics.h +++ b/src/modules/graphics/opengl/Graphics.h @@ -43,7 +43,7 @@ #include "SpriteBatch.h" #include "ParticleSystem.h" #include "Canvas.h" -#include "ShaderEffect.h" +#include "Shader.h" namespace love { @@ -270,7 +270,7 @@ public: Canvas *newCanvas(int width, int height, Canvas::TextureType texture_type = Canvas::TYPE_NORMAL); - ShaderEffect *newShaderEffect(const ShaderEffect::ShaderSources &shadersources); + Shader *newShader(const Shader::ShaderSources &shadersources); /** * Sets the foreground color. diff --git a/src/modules/graphics/opengl/Image.h b/src/modules/graphics/opengl/Image.h index 68c81d8d3..739dea511 100644 --- a/src/modules/graphics/opengl/Image.h +++ b/src/modules/graphics/opengl/Image.h @@ -125,7 +125,7 @@ private: void drawv(const Matrix &t, const vertex *v) const; - friend class ShaderEffect; + friend class Shader; GLuint getTextureName() const { return texture; diff --git a/src/modules/graphics/opengl/ShaderEffect.cpp b/src/modules/graphics/opengl/Shader.cpp similarity index 85% rename from src/modules/graphics/opengl/ShaderEffect.cpp rename to src/modules/graphics/opengl/Shader.cpp index 706f5111c..82480d9af 100644 --- a/src/modules/graphics/opengl/ShaderEffect.cpp +++ b/src/modules/graphics/opengl/Shader.cpp @@ -20,7 +20,7 @@ #include -#include "ShaderEffect.h" +#include "Shader.h" #include "Graphics.h" namespace love @@ -36,38 +36,38 @@ namespace // reattaches the originally active program when destroyed struct TemporaryAttacher { - TemporaryAttacher(ShaderEffect *effect) - : cureffect(effect) - , preveffect(ShaderEffect::current) + TemporaryAttacher(Shader *shader) + : curshader(shader) + , prevshader(Shader::current) { - cureffect->attach(true); + curshader->attach(true); } ~TemporaryAttacher() { - if (preveffect != NULL) - preveffect->attach(); + if (prevshader != NULL) + prevshader->attach(); else - ShaderEffect::detach(); + Shader::detach(); } - ShaderEffect *cureffect; - ShaderEffect *preveffect; + Shader *curshader; + Shader *prevshader; }; } // anonymous namespace -ShaderEffect *ShaderEffect::current = NULL; +Shader *Shader::current = NULL; -GLint ShaderEffect::_maxtextureunits = 0; -std::vector ShaderEffect::_texturecounters; +GLint Shader::_maxtextureunits = 0; +std::vector Shader::_texturecounters; -ShaderEffect::ShaderEffect(const ShaderSources &shadersources) +Shader::Shader(const ShaderSources &shadersources) : _shadersources(shadersources) , _program(0) { if (shadersources.empty()) - throw love::Exception("Cannot create shader effect: no source code!"); + throw love::Exception("Cannot create shader: no source code!"); GLint maxtextureunits; glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxtextureunits); @@ -81,7 +81,7 @@ ShaderEffect::ShaderEffect(const ShaderSources &shadersources) loadVolatile(); } -ShaderEffect::~ShaderEffect() +Shader::~Shader() { if (current == this) detach(); @@ -89,7 +89,7 @@ ShaderEffect::~ShaderEffect() unloadVolatile(); } -GLuint ShaderEffect::createShader(ShaderType type, const std::string &code) +GLuint Shader::compileShaderCode(ShaderType type, const std::string &code) { GLenum glshadertype; const char *shadertypename = NULL; @@ -158,13 +158,13 @@ GLuint ShaderEffect::createShader(ShaderType type, const std::string &code) delete[] errorlog; glDeleteShader(shaderid); - throw love::Exception("Cannot compile %s shader:\n%s", shadertypename, tmp.c_str()); + throw love::Exception("Cannot compile %s shader code:\n%s", shadertypename, tmp.c_str()); } return shaderid; } -void ShaderEffect::createProgram(const std::vector &shaderids) +void Shader::createProgram(const std::vector &shaderids) { _program = glCreateProgram(); if (_program == 0) // should only fail when called between glBegin() and glEnd() @@ -191,7 +191,7 @@ void ShaderEffect::createProgram(const std::vector &shaderids) } } -bool ShaderEffect::loadVolatile() +bool Shader::loadVolatile() { // zero out active texture list _activetextureunits.clear(); @@ -202,12 +202,12 @@ bool ShaderEffect::loadVolatile() ShaderSources::const_iterator source; for (source = _shadersources.begin(); source != _shadersources.end(); ++source) { - GLuint shaderid = createShader(source->first, source->second); + GLuint shaderid = compileShaderCode(source->first, source->second); shaderids.push_back(shaderid); } if (shaderids.empty()) - throw love::Exception("Cannot create shader effect: no valid source code!"); + throw love::Exception("Cannot create shader: no valid source code!"); createProgram(shaderids); @@ -220,7 +220,7 @@ bool ShaderEffect::loadVolatile() return true; } -void ShaderEffect::unloadVolatile() +void Shader::unloadVolatile() { if (current == this) glUseProgram(0); @@ -245,7 +245,7 @@ void ShaderEffect::unloadVolatile() _uniforms.clear(); } -std::string ShaderEffect::getWarnings() const +std::string Shader::getWarnings() const { GLint strlen, nullpos; glGetProgramiv(_program, GL_INFO_LOG_LENGTH, &strlen); @@ -260,7 +260,7 @@ std::string ShaderEffect::getWarnings() const return warnings; } -void ShaderEffect::attach(bool temporary) +void Shader::attach(bool temporary) { if (current != this) glUseProgram(_program); @@ -280,7 +280,7 @@ void ShaderEffect::attach(bool temporary) } } -void ShaderEffect::detach() +void Shader::detach() { if (current != NULL) glUseProgram(0); @@ -288,7 +288,7 @@ void ShaderEffect::detach() current = NULL; } -void ShaderEffect::sendFloat(const std::string &name, int size, const GLfloat *vec, int count) +void Shader::sendFloat(const std::string &name, int size, const GLfloat *vec, int count) { TemporaryAttacher attacher(this); GLint location = getUniformLocation(name); @@ -317,7 +317,7 @@ void ShaderEffect::sendFloat(const std::string &name, int size, const GLfloat *v checkSetUniformError(); } -void ShaderEffect::sendMatrix(const std::string &name, int size, const GLfloat *m, int count) +void Shader::sendMatrix(const std::string &name, int size, const GLfloat *m, int count) { TemporaryAttacher attacher(this); GLint location = getUniformLocation(name); @@ -346,7 +346,7 @@ void ShaderEffect::sendMatrix(const std::string &name, int size, const GLfloat * checkSetUniformError(); } -void ShaderEffect::sendTexture(const std::string &name, GLuint texture) +void Shader::sendTexture(const std::string &name, GLuint texture) { TemporaryAttacher attacher(this); GLint location = getUniformLocation(name); @@ -370,17 +370,17 @@ void ShaderEffect::sendTexture(const std::string &name, GLuint texture) _activetextureunits[textureunit-1] = texture; } -void ShaderEffect::sendImage(const std::string &name, const Image &image) +void Shader::sendImage(const std::string &name, const Image &image) { sendTexture(name, image.getTextureName()); } -void ShaderEffect::sendCanvas(const std::string &name, const Canvas &canvas) +void Shader::sendCanvas(const std::string &name, const Canvas &canvas) { sendTexture(name, canvas.getTextureName()); } -GLint ShaderEffect::getUniformLocation(const std::string &name) +GLint Shader::getUniformLocation(const std::string &name) { std::map::const_iterator it = _uniforms.find(name); if (it != _uniforms.end()) @@ -398,7 +398,7 @@ GLint ShaderEffect::getUniformLocation(const std::string &name) return location; } -int ShaderEffect::getTextureUnit(const std::string &name) +int Shader::getTextureUnit(const std::string &name) { std::map::const_iterator it = _textureunitpool.find(name); @@ -427,7 +427,7 @@ int ShaderEffect::getTextureUnit(const std::string &name) return textureunit; } -void ShaderEffect::checkSetUniformError() +void Shader::checkSetUniformError() { GLenum error_code = glGetError(); if (GL_INVALID_OPERATION == error_code) @@ -440,7 +440,7 @@ void ShaderEffect::checkSetUniformError() } } -std::string ShaderEffect::getGLSLVersion() +std::string Shader::getGLSLVersion() { // GL_SHADING_LANGUAGE_VERSION may not be available in OpenGL < 2.0. const char *tmp = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); @@ -457,7 +457,7 @@ std::string ShaderEffect::getGLSLVersion() return versionString.substr(0, minorEndPos); } -bool ShaderEffect::isSupported() +bool Shader::isSupported() { return GLEE_VERSION_2_0 && getGLSLVersion() >= "1.2"; } diff --git a/src/modules/graphics/opengl/ShaderEffect.h b/src/modules/graphics/opengl/Shader.h similarity index 80% rename from src/modules/graphics/opengl/ShaderEffect.h rename to src/modules/graphics/opengl/Shader.h index d5e01ef9c..50c158e60 100644 --- a/src/modules/graphics/opengl/ShaderEffect.h +++ b/src/modules/graphics/opengl/Shader.h @@ -18,8 +18,8 @@ * 3. This notice may not be removed or altered from any source distribution. **/ -#ifndef LOVE_GRAPHICS_EFFECT_H -#define LOVE_GRAPHICS_EFFECT_H +#ifndef LOVE_GRAPHICS_SHADER_H +#define LOVE_GRAPHICS_SHADER_H #include "common/Object.h" #include @@ -36,14 +36,14 @@ namespace graphics namespace opengl { // A GLSL shader -class ShaderEffect : public Object, public Volatile +class Shader : public Object, public Volatile { public: - // pointer to currently active ShaderEffect. - static ShaderEffect *current; + // pointer to currently active Shader. + static Shader *current; - // Only vertex and fragment shaders have guaranteed support in all ShaderEffects. + // Only vertex and fragment shaders have guaranteed support in all Shaders. enum ShaderType { TYPE_VERTEX, @@ -58,37 +58,37 @@ public: typedef std::map ShaderSources; /** - * Creates a new ShaderEffect using a list of source codes. + * Creates a new Shader using a list of source codes. * Sources must contain at least one vertex or fragment shader. **/ - ShaderEffect(const ShaderSources &shadersources); + Shader(const ShaderSources &shadersources); - virtual ~ShaderEffect(); + virtual ~Shader(); // Implements Volatile virtual bool loadVolatile(); virtual void unloadVolatile(); /** - * Binds this ShaderEffect's program to be used when rendering. + * Binds this Shader's program to be used when rendering. * * @param temporary True if we just want to send values to the shader with no intention of rendering. **/ void attach(bool temporary = false); /** - * Detach the currently bound ShaderEffect. + * Detach the currently bound Shader. * Causes OpenGL to use fixed functionality in place of shader programs. **/ static void detach(); /** - * Returns any warnings this ShaderEffect may have generated. + * Returns any warnings this Shader may have generated. **/ std::string getWarnings() const; /** - * Send at least one float or vector value to this ShaderEffect as a uniform. + * Send at least one float or vector value to this Shader as a uniform. * * @param name The name of the uniform variable in the source code. * @param size Number of elements in each vector to send. @@ -99,7 +99,7 @@ public: void sendFloat(const std::string &name, int size, const GLfloat *vec, int count); /** - * Send at least one matrix to this ShaderEffect as a uniform. + * Send at least one matrix to this Shader as a uniform. * * @param name The name of the uniform variable in the source code. * @param size Number of rows/columns in the matrix. @@ -109,14 +109,14 @@ public: void sendMatrix(const std::string &name, int size, const GLfloat *m, int count); /** - * Send an image to this ShaderEffect as a uniform. + * Send an image to this Shader as a uniform. * * @param name The name of the uniform variable in the source code. **/ void sendImage(const std::string &name, const Image &image); /** - * Send a canvas to this ShaderEffect as a uniform. + * Send a canvas to this Shader as a uniform. * * @param name The name of the uniform variable in the source code. **/ @@ -130,14 +130,14 @@ private: GLint getUniformLocation(const std::string &name); void checkSetUniformError(); - GLuint createShader(ShaderType type, const std::string &code); + GLuint compileShaderCode(ShaderType type, const std::string &code); void createProgram(const std::vector &shaderids); int getTextureUnit(const std::string &name); void sendTexture(const std::string &name, GLuint texture); - // list of all shader code attached to this ShaderEffect + // list of all shader code attached to this Shader ShaderSources _shadersources; GLuint _program; // volatile @@ -160,4 +160,4 @@ private: } // graphics } // love -#endif // LOVE_GRAPHICS_EFFECT_H +#endif // LOVE_GRAPHICS_SHADER_H diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index b274106df..aa58399e0 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -433,10 +433,10 @@ int w_newCanvas(lua_State *L) return 1; } -int w_newShaderEffect(lua_State *L) +int w_newShader(lua_State *L) { - if (!ShaderEffect::isSupported()) - return luaL_error(L, "Sorry, your graphics card does not support shader effects."); + if (!Shader::isSupported()) + return luaL_error(L, "Sorry, your graphics card does not support shaders."); try { @@ -452,28 +452,28 @@ int w_newShaderEffect(lua_State *L) // call effectCodeToGLSL, returned values will be at the top of the stack lua_pcall(L, 2, 2, 0); - ShaderEffect::ShaderSources sources; + Shader::ShaderSources sources; // vertex shader code if (lua_isstring(L, -2)) { std::string vertcode(luaL_checkstring(L, -2)); - sources[ShaderEffect::TYPE_VERTEX] = vertcode; + sources[Shader::TYPE_VERTEX] = vertcode; } // fragment shader code if (lua_isstring(L, -1)) { std::string fragcode(luaL_checkstring(L, -1)); - sources[ShaderEffect::TYPE_FRAGMENT] = fragcode; + sources[Shader::TYPE_FRAGMENT] = fragcode; } - ShaderEffect *effect = instance->newShaderEffect(sources); - luax_newtype(L, "ShaderEffect", GRAPHICS_SHADEREFFECT_T, (void *)effect); + Shader *shader = instance->newShader(sources); + luax_newtype(L, "Shader", GRAPHICS_SHADER_T, (void *)shader); } catch(const love::Exception &e) { - // memory is freed in Graphics::newShaderEffect + // memory is freed in Graphics::newShader luax_getfunction(L, "graphics", "_transformGLSLErrorMessages"); lua_pushstring(L, e.what()); lua_pcall(L, 1, 1, 0); @@ -818,26 +818,26 @@ int w_getCanvas(lua_State *L) return 1; } -int w_setShaderEffect(lua_State *L) +int w_setShader(lua_State *L) { if (lua_isnoneornil(L,1)) { - ShaderEffect::detach(); + Shader::detach(); return 0; } - ShaderEffect *effect = luax_checkshadereffect(L, 1); - effect->attach(); + Shader *shader = luax_checkshader(L, 1); + shader->attach(); return 0; } -int w_getShaderEffect(lua_State *L) +int w_getShader(lua_State *L) { - ShaderEffect *effect = ShaderEffect::current; - if (effect) + Shader *shader = Shader::current; + if (shader) { - effect->retain(); - luax_newtype(L, "ShaderEffect", GRAPHICS_SHADEREFFECT_T, (void *) effect); + shader->retain(); + luax_newtype(L, "Shader", GRAPHICS_SHADER_T, (void *) shader); } else lua_pushnil(L); @@ -865,8 +865,8 @@ int w_isSupported(lua_State *L) if (!Canvas::isHdrSupported()) supported = false; break; - case Graphics::SUPPORT_SHADEREFFECT: - if (!ShaderEffect::isSupported()) + case Graphics::SUPPORT_SHADER: + if (!Shader::isSupported()) supported = false; break; case Graphics::SUPPORT_NPOT: @@ -1285,7 +1285,7 @@ static const luaL_Reg functions[] = { "newSpriteBatch", w_newSpriteBatch }, { "newParticleSystem", w_newParticleSystem }, { "newCanvas", w_newCanvas }, - { "newShaderEffect", w_newShaderEffect }, + { "newShader", w_newShader }, { "setColor", w_setColor }, { "getColor", w_getColor }, @@ -1316,8 +1316,8 @@ static const luaL_Reg functions[] = { "setCanvas", w_setCanvas }, { "getCanvas", w_getCanvas }, - { "setShaderEffect", w_setShaderEffect }, - { "getShaderEffect", w_getShaderEffect }, + { "setShader", w_setShader }, + { "getShader", w_getShader }, { "isSupported", w_isSupported }, @@ -1378,7 +1378,7 @@ static const lua_CFunction types[] = luaopen_spritebatch, luaopen_particlesystem, luaopen_canvas, - luaopen_shadereffect, + luaopen_shader, 0 }; diff --git a/src/modules/graphics/opengl/wrap_Graphics.h b/src/modules/graphics/opengl/wrap_Graphics.h index db201804a..414c4d647 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.h +++ b/src/modules/graphics/opengl/wrap_Graphics.h @@ -28,7 +28,7 @@ #include "wrap_SpriteBatch.h" #include "wrap_ParticleSystem.h" #include "wrap_Canvas.h" -#include "wrap_ShaderEffect.h" +#include "wrap_Shader.h" #include "Graphics.h" namespace love @@ -63,7 +63,7 @@ int w_newImageFont(lua_State *L); int w_newSpriteBatch(lua_State *L); int w_newParticleSystem(lua_State *L); int w_newCanvas(lua_State *L); // comments in function -int w_newShaderEffect(lua_State *L); +int w_newShader(lua_State *L); int w_setColor(lua_State *L); int w_getColor(lua_State *L); int w_setBackgroundColor(lua_State *L); @@ -90,8 +90,8 @@ int w_getMaxPointSize(lua_State *L); int w_newScreenshot(lua_State *L); int w_setCanvas(lua_State *L); int w_getCanvas(lua_State *L); -int w_setShaderEffect(lua_State *L); -int w_getShaderEffect(lua_State *L); +int w_setShader(lua_State *L); +int w_getShader(lua_State *L); int w_isSupported(lua_State *L); int w_draw(lua_State *L); int w_drawq(lua_State *L); diff --git a/src/modules/graphics/opengl/wrap_ShaderEffect.cpp b/src/modules/graphics/opengl/wrap_Shader.cpp similarity index 74% rename from src/modules/graphics/opengl/wrap_ShaderEffect.cpp rename to src/modules/graphics/opengl/wrap_Shader.cpp index 50e8e69f3..2a50b7594 100644 --- a/src/modules/graphics/opengl/wrap_ShaderEffect.cpp +++ b/src/modules/graphics/opengl/wrap_Shader.cpp @@ -18,7 +18,7 @@ * 3. This notice may not be removed or altered from any source distribution. **/ -#include "wrap_ShaderEffect.h" +#include "wrap_Shader.h" #include "wrap_Image.h" #include "wrap_Canvas.h" #include @@ -31,19 +31,19 @@ namespace graphics namespace opengl { -ShaderEffect *luax_checkshadereffect(lua_State *L, int idx) +Shader *luax_checkshader(lua_State *L, int idx) { - return luax_checktype(L, idx, "ShaderEffect", GRAPHICS_SHADEREFFECT_T); + return luax_checktype(L, idx, "Shader", GRAPHICS_SHADER_T); } -int w_ShaderEffect_getWarnings(lua_State *L) +int w_Shader_getWarnings(lua_State *L) { - ShaderEffect *effect = luax_checkshadereffect(L, 1); - lua_pushstring(L, effect->getWarnings().c_str()); + Shader *shader = luax_checkshader(L, 1); + lua_pushstring(L, shader->getWarnings().c_str()); return 1; } -static int _sendScalars(lua_State *L, ShaderEffect *effect, const char *name, int count) +static int _sendScalars(lua_State *L, Shader *shader, const char *name, int count) { float *values = new float[count]; for (int i = 0; i < count; ++i) @@ -62,7 +62,7 @@ static int _sendScalars(lua_State *L, ShaderEffect *effect, const char *name, in try { - effect->sendFloat(name, 1, values, count); + shader->sendFloat(name, 1, values, count); } catch(love::Exception &e) { @@ -74,7 +74,7 @@ static int _sendScalars(lua_State *L, ShaderEffect *effect, const char *name, in return 0; } -static int _sendVectors(lua_State *L, ShaderEffect *effect, const char *name, int count) +static int _sendVectors(lua_State *L, Shader *shader, const char *name, int count) { size_t dimension = lua_objlen(L, 3); float *values = new float[count * dimension]; @@ -106,7 +106,7 @@ static int _sendVectors(lua_State *L, ShaderEffect *effect, const char *name, in try { - effect->sendFloat(name, dimension, values, count); + shader->sendFloat(name, dimension, values, count); } catch(love::Exception &e) { @@ -118,9 +118,9 @@ static int _sendVectors(lua_State *L, ShaderEffect *effect, const char *name, in return 0; } -int w_ShaderEffect_sendFloat(lua_State *L) +int w_Shader_sendFloat(lua_State *L) { - ShaderEffect *effect = luax_checkshadereffect(L, 1); + Shader *shader = luax_checkshader(L, 1); const char *name = luaL_checkstring(L, 2); int count = lua_gettop(L) - 2; @@ -128,17 +128,17 @@ int w_ShaderEffect_sendFloat(lua_State *L) return luaL_error(L, "No variable to send."); if (lua_isnumber(L, 3) || lua_isboolean(L, 3)) - return _sendScalars(L, effect, name, count); + return _sendScalars(L, shader, name, count); else if (lua_istable(L, 3)) - return _sendVectors(L, effect, name, count); + return _sendVectors(L, shader, name, count); return luaL_typerror(L, 3, "number, boolean, or table"); } -int w_ShaderEffect_sendMatrix(lua_State *L) +int w_Shader_sendMatrix(lua_State *L) { int count = lua_gettop(L) - 2; - ShaderEffect *effect = luax_checkshadereffect(L, 1); + Shader *shader = luax_checkshader(L, 1); const char *name = luaL_checkstring(L, 2); if (!lua_istable(L, 3)) @@ -180,7 +180,7 @@ int w_ShaderEffect_sendMatrix(lua_State *L) try { - effect->sendMatrix(name, dimension, values, count); + shader->sendMatrix(name, dimension, values, count); } catch(love::Exception &e) { @@ -192,15 +192,15 @@ int w_ShaderEffect_sendMatrix(lua_State *L) return 0; } -int w_ShaderEffect_sendImage(lua_State *L) +int w_Shader_sendImage(lua_State *L) { - ShaderEffect *effect = luax_checkshadereffect(L, 1); + Shader *shader = luax_checkshader(L, 1); const char *name = luaL_checkstring(L, 2); Image *img = luax_checkimage(L, 3); try { - effect->sendImage(name, *img); + shader->sendImage(name, *img); } catch(love::Exception &e) { @@ -210,15 +210,15 @@ int w_ShaderEffect_sendImage(lua_State *L) return 0; } -int w_ShaderEffect_sendCanvas(lua_State *L) +int w_Shader_sendCanvas(lua_State *L) { - ShaderEffect *effect = luax_checkshadereffect(L, 1); + Shader *shader = luax_checkshader(L, 1); const char *name = luaL_checkstring(L, 2); Canvas *canvas = luax_checkcanvas(L, 3); try { - effect->sendCanvas(name, *canvas); + shader->sendCanvas(name, *canvas); } catch(love::Exception &e) { @@ -231,17 +231,17 @@ int w_ShaderEffect_sendCanvas(lua_State *L) static const luaL_Reg functions[] = { - { "getWarnings", w_ShaderEffect_getWarnings }, - { "sendFloat", w_ShaderEffect_sendFloat }, - { "sendMatrix", w_ShaderEffect_sendMatrix }, - { "sendImage", w_ShaderEffect_sendImage }, - { "sendCanvas", w_ShaderEffect_sendCanvas }, + { "getWarnings", w_Shader_getWarnings }, + { "sendFloat", w_Shader_sendFloat }, + { "sendMatrix", w_Shader_sendMatrix }, + { "sendImage", w_Shader_sendImage }, + { "sendCanvas", w_Shader_sendCanvas }, { 0, 0 } }; -extern "C" int luaopen_shadereffect(lua_State *L) +extern "C" int luaopen_shader(lua_State *L) { - return luax_register_type(L, "ShaderEffect", functions); + return luax_register_type(L, "Shader", functions); } } // opengl diff --git a/src/modules/graphics/opengl/wrap_ShaderEffect.h b/src/modules/graphics/opengl/wrap_Shader.h similarity index 78% rename from src/modules/graphics/opengl/wrap_ShaderEffect.h rename to src/modules/graphics/opengl/wrap_Shader.h index e1a458d42..5ab9a9c8e 100644 --- a/src/modules/graphics/opengl/wrap_ShaderEffect.h +++ b/src/modules/graphics/opengl/wrap_Shader.h @@ -22,7 +22,7 @@ #define LOVE_GRAPHICS_OPENGL_WRAP_PROGRAM_H #include "common/runtime.h" -#include "ShaderEffect.h" +#include "Shader.h" namespace love { @@ -31,12 +31,12 @@ namespace graphics namespace opengl { -ShaderEffect *luax_checkshadereffect(lua_State *L, int idx); -int w_ShaderEffect_getWarnings(lua_State *L); -int w_ShaderEffect_sendFloat(lua_State *L); -int w_ShaderEffect_sendMatrix(lua_State *L); -int w_ShaderEffect_sendImage(lua_State *L); -extern "C" int luaopen_shadereffect(lua_State *L); +Shader *luax_checkshader(lua_State *L, int idx); +int w_Shader_getWarnings(lua_State *L); +int w_Shader_sendFloat(lua_State *L); +int w_Shader_sendMatrix(lua_State *L); +int w_Shader_sendImage(lua_State *L); +extern "C" int luaopen_shader(lua_State *L); } // opengl } // graphics diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index ce6b8619a..7582ae986 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -760,7 +760,7 @@ function love.releaseerrhand(msg) end love.graphics.setCanvas() - love.graphics.setShaderEffect() + love.graphics.setShader() -- Load. if love.audio then love.audio.stop() end diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index 5b3fcbff8..3f4540f4d 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -1783,7 +1783,7 @@ const unsigned char boot_lua[] = 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x43, 0x61, 0x6e, 0x76, 0x61, 0x73, 0x28, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, - 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x29, 0x0a, + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x28, 0x29, 0x0a, 0x09, 0x2d, 0x2d, 0x20, 0x4c, 0x6f, 0x61, 0x64, 0x2e, 0x0a, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x73, 0x74, 0x6f, 0x70, 0x28, diff --git a/src/scripts/graphics.lua b/src/scripts/graphics.lua index 28b3aaabe..6644c6d9b 100644 --- a/src/scripts/graphics.lua +++ b/src/scripts/graphics.lua @@ -1287,7 +1287,7 @@ do end - -- SHADER EFFECTS + -- SHADERS local GLSL_VERSION = "#version 120" @@ -1360,7 +1360,7 @@ void main() { return table_concat(fragcodes, "\n") end - function love.graphics._effectCodeToGLSL(vertcode, fragcode) + function love.graphics._shaderCodeToGLSL(vertcode, fragcode) if vertcode then local s = vertcode:gsub("\r\n\t", " ") s = s:gsub("%w+(%s+)%(", "") @@ -1393,9 +1393,9 @@ void main() { end function love.graphics._transformGLSLErrorMessages(message) - local shadertype = message:match("Cannot compile (%a+) shader") + local shadertype = message:match("Cannot compile (%a+) shader code") if not shadertype then return message end - local lines = {"Cannot compile "..shadertype.." shader:"} + local lines = {"Cannot compile "..shadertype.." shader code:"} for l in message:gmatch("[^\n]+") do -- nvidia compiler message: -- 0() : error/warning [NUMBER]: @@ -1439,7 +1439,7 @@ void main() { end -- automagic uniform setter - local function shadereffect_dispatch_send(self, name, value, ...) + local function shader_dispatch_send(self, name, value, ...) local valuetype = type(value) if valuetype == "number" or valuetype == "boolean" then -- scalar self:sendFloat(name, value, ...) @@ -1462,9 +1462,9 @@ void main() { end end - local newShaderEffect = love.graphics.newShaderEffect - function love.graphics.newShaderEffect(vertcode, fragcode) - love.graphics.newShaderEffect = function(vertcode, fragcode) + local newShader = love.graphics.newShader + function love.graphics.newShader(vertcode, fragcode) + love.graphics.newShader = function(vertcode, fragcode) if love.filesystem then if vertcode and love.filesystem.exists(vertcode) then vertcode = love.filesystem.read(vertcode) @@ -1473,23 +1473,25 @@ void main() { fragcode = love.filesystem.read(fragcode) end end - return newShaderEffect(vertcode, fragcode) + return newShader(vertcode, fragcode) end - local effect = love.graphics.newShaderEffect(vertcode, fragcode) - local meta = getmetatable(effect) - meta.send = shadereffect_dispatch_send + local shader = love.graphics.newShader(vertcode, fragcode) + local meta = getmetatable(shader) + meta.send = shader_dispatch_send meta.sendBoolean = meta.sendFloat - return effect + return shader end -- PixelEffect compatibility functions function love.graphics.newPixelEffect(fragcode) - return love.graphics.newShaderEffect(nil, fragcode) + return love.graphics.newShader(nil, fragcode) end - love.graphics.setPixelEffect = love.graphics.setShaderEffect - love.graphics.getPixelEffect = love.graphics.getShaderEffect + love.graphics.setPixelEffect = love.graphics.setShader + love.graphics.getPixelEffect = love.graphics.getShader + + love.graphics._effectCodeToGLSL = love.graphics._shaderCodeToGLSL end diff --git a/src/scripts/graphics.lua.h b/src/scripts/graphics.lua.h index 6cdce243c..e4718ea03 100644 --- a/src/scripts/graphics.lua.h +++ b/src/scripts/graphics.lua.h @@ -6263,7 +6263,7 @@ const unsigned char graphics_lua[] = 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x66, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, - 0x09, 0x2d, 0x2d, 0x20, 0x53, 0x48, 0x41, 0x44, 0x45, 0x52, 0x20, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x0a, + 0x09, 0x2d, 0x2d, 0x20, 0x53, 0x48, 0x41, 0x44, 0x45, 0x52, 0x53, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x47, 0x4c, 0x53, 0x4c, 0x5f, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x20, 0x3d, 0x20, 0x22, 0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x32, 0x30, 0x22, 0x0a, 0x09, 0x0a, @@ -6385,7 +6385,7 @@ const unsigned char graphics_lua[] = 0x22, 0x29, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, - 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x5f, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x54, + 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x54, 0x6f, 0x47, 0x4c, 0x53, 0x4c, 0x28, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x69, 0x66, 0x20, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, @@ -6454,14 +6454,14 @@ const unsigned char graphics_lua[] = 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x28, 0x22, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x20, 0x28, 0x25, 0x61, - 0x2b, 0x29, 0x20, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x22, 0x29, 0x0a, + 0x2b, 0x29, 0x20, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x29, 0x0a, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x74, 0x79, 0x70, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x7b, 0x22, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x20, 0x22, 0x2e, 0x2e, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x2e, 0x22, 0x20, 0x73, 0x68, 0x61, 0x64, - 0x65, 0x72, 0x3a, 0x22, 0x7d, 0x0a, + 0x65, 0x72, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x3a, 0x22, 0x7d, 0x0a, 0x09, 0x09, 0x66, 0x6f, 0x72, 0x20, 0x6c, 0x20, 0x69, 0x6e, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x67, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x28, 0x22, 0x5b, 0x5e, 0x5c, 0x6e, 0x5d, 0x2b, 0x22, 0x29, 0x20, 0x64, 0x6f, 0x0a, @@ -6554,9 +6554,9 @@ const unsigned char graphics_lua[] = 0x09, 0x2d, 0x2d, 0x20, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x65, 0x74, 0x74, 0x65, 0x72, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x68, - 0x61, 0x64, 0x65, 0x72, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, - 0x68, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x28, 0x73, 0x65, 0x6c, 0x66, 0x2c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2c, - 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x2e, 0x2e, 0x2e, 0x29, 0x0a, + 0x61, 0x64, 0x65, 0x72, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x65, 0x6e, 0x64, + 0x28, 0x73, 0x65, 0x6c, 0x66, 0x2c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x2c, 0x20, 0x2e, 0x2e, 0x2e, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x69, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x3d, 0x20, @@ -6612,17 +6612,16 @@ const unsigned char graphics_lua[] = 0x65, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x2e, 0x22, 0x29, 0x2e, 0x22, 0x29, 0x0a, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, - 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x45, 0x66, - 0x66, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, - 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x0a, + 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x3d, + 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x0a, 0x09, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, - 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x45, 0x66, 0x66, - 0x65, 0x63, 0x74, 0x28, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, - 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, + 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x28, 0x76, 0x65, + 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, - 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x66, - 0x72, 0x61, 0x67, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, + 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x28, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x64, + 0x65, 0x29, 0x0a, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x61, 0x6e, @@ -6643,21 +6642,20 @@ const unsigned char graphics_lua[] = 0x09, 0x09, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, - 0x72, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, - 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, + 0x72, 0x28, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, + 0x64, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a, - 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x6c, + 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x53, 0x68, - 0x61, 0x64, 0x65, 0x72, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, - 0x65, 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, + 0x61, 0x64, 0x65, 0x72, 0x28, 0x76, 0x65, 0x72, 0x74, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x66, 0x72, 0x61, + 0x67, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x20, 0x3d, 0x20, 0x67, 0x65, 0x74, - 0x6d, 0x65, 0x74, 0x61, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x28, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x29, 0x0a, + 0x6d, 0x65, 0x74, 0x61, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x28, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x29, 0x0a, 0x09, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x73, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x73, 0x68, 0x61, 0x64, - 0x65, 0x72, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, - 0x73, 0x65, 0x6e, 0x64, 0x0a, + 0x65, 0x72, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x73, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x20, 0x3d, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x73, 0x65, 0x6e, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x0a, - 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x0a, + 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x2d, 0x2d, 0x20, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, @@ -6666,17 +6664,22 @@ const unsigned char graphics_lua[] = 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, - 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x45, 0x66, 0x66, 0x65, - 0x63, 0x74, 0x28, 0x6e, 0x69, 0x6c, 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, + 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x28, 0x6e, 0x69, 0x6c, + 0x2c, 0x20, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x53, 0x68, 0x61, 0x64, 0x65, - 0x72, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x0a, + 0x72, 0x0a, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x53, 0x68, 0x61, 0x64, 0x65, - 0x72, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x0a, + 0x72, 0x0a, + 0x09, 0x0a, + 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x5f, 0x65, 0x66, + 0x66, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x54, 0x6f, 0x47, 0x4c, 0x53, 0x4c, 0x20, 0x3d, 0x20, 0x6c, + 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x5f, 0x73, 0x68, 0x61, 0x64, + 0x65, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x54, 0x6f, 0x47, 0x4c, 0x53, 0x4c, 0x0a, 0x65, 0x6e, 0x64, 0x0a, }; // [graphics.lua] } // love \ No newline at end of file