Commit Graph

714 Commits

Author SHA1 Message Date
Alex Szpakowski e4dc533bb2 Minor code cleanup 2014-05-01 14:12:21 -03:00
Alex Szpakowski f30a0d72f0 Added Shader:getExternVariable(name).
Returns the base type name ('float', 'image', etc.), the number of components (2 for a vec2), and number of array elements (1 for a non-array variable) for the extern variable with the specified name in the shader.

Returns nil if the variable either doesn't exist or was optimized out by the driver's shader compiler.
2014-04-25 20:32:42 -03:00
Alex Szpakowski af88423285 Fixed an attempted creation of an array with a constant size of 0 2014-04-23 19:43:54 -03:00
Alex Szpakowski 8b90f64440 Don't try to bind the love_PseudoInstanceID vertex shader attribute (it's disabled for now) 2014-04-17 19:48:16 -03:00
Alex Szpakowski f05551a01f Fixed a potential null pointer dereference and a case of undefined behaviour 2014-04-11 03:48:12 -03:00
Alex Szpakowski be8c19911f Fixed love.graphics.isCreated to properly return false if love.window.setMode failed 2014-03-31 04:56:29 -03:00
Alex Szpakowski e7947d9d2e Pulled Mesh:set/getInstanceCount from 0.9.1 for now.
The feature is difficult to use well unless custom vertex attributes are added.
2014-03-29 16:30:48 -03:00
Alex Szpakowski 146b3cff19 Added blend mode "screen". 2014-03-27 23:28:36 -03:00
Alex Szpakowski d5096840ba Fixed Canvas:clear not working properly with antialiased Canvases 2014-03-02 15:49:29 -04:00
Alex Szpakowski 55514720a6 Fixed some minor compiler warnings 2014-03-01 21:16:01 -04:00
Alex Szpakowski ecf37320a9 Changed love.graphics.newMesh, Mesh:setVertex, and Mesh:setVertices to default the u,v arguments to 0,0 instead of requiring them 2014-02-27 05:38:46 -04:00
Alex Szpakowski fe5e7c17e7 Added Body:setUserData and Body:getUserData (resolves issue #853_ 2014-02-26 20:47:05 -04:00
Alex Szpakowski 94aa39116e Fixed stencils used when an antialiased Canvas is active 2014-02-16 14:54:33 -04:00
Alex Szpakowski 6259e38d84 Meshes will now use the smallest integer data type possible for index buffer (vertex map) values, instead of always using 32-bit integer numbers. 2014-02-12 02:22:57 -04:00
Alex Szpakowski 615492540d Added ParticleSystem:setRelativeRotation. If enabled, particle rotations and angles will be relative to their current velocities. 2014-02-06 05:46:47 -04:00
Alex Szpakowski b625bb6624 moved Mesh:setWireframe to love.graphics.setWireframe (affects all draws until it's disabled.)
Wireframe mode should only be used for debugging: the wireframe lines behave differently than regular lines, their widths aren't affected by the graphics scale, and the mode isn't available on OpenGL ES.
2014-02-03 04:59:58 -04:00
Alex Szpakowski ce4fdf4ac9 Added sRGB (gamma-correct) support for Images, Canvases, and the main screen.
love.graphics.newImage(path, “srgb”) creates a new Image whose texels are treated as being in the sRGB color space, so they are linearized when drawing/sampling from the image.

love.graphics.newCanvas(w, h, “srgb”) creates a new Canvas whose texels are treated as being in the sRGB color space, so drawing to the Canvas does a linear->sRGB conversion (but blends linearly), and sampling from it (drawing it or using it in a shader) converts from sRGB to linear space.

The "srgb" window flag does the same as Canvases for the main screen.
2014-02-02 18:31:41 -04:00
Alex Szpakowski 9e746c56fa love.graphics.getBlendMode no longer does several glGetInteger function calls 2014-01-30 21:51:17 -04:00
Alex Szpakowski 40242689b1 Fixed rendering to multiple canvases, removed some redundant OpenGL calls when switching between canvases 2014-01-30 21:09:13 -04:00
Alex Szpakowski 2a4d47e614 Added a missing newline to a print statement 2014-01-29 23:10:57 -04:00
Alex Szpakowski a7ed581204 Reverted ParticleSystem:setPosition’s functionality to 0.9.0’s beheaviour, added ParticleSystem:moveTo which has the new behaviour (new particles spawn in a line between the old position and where the emitter was moved to.) 2014-01-28 03:20:08 -04:00
Alex Szpakowski 6b538b5827 The emission rate for ParticleSystems is no longer restricted to integer numbers. 2014-01-27 23:42:26 -04:00
Alex Szpakowski d70023e350 Enable OpenGL’s debug output when the LOVE_GRAPHICS_DEBUG environment variable is ‘1’. Resolves issue #607. 2014-01-27 23:30:16 -04:00
Alex Szpakowski c5c788e976 Added a built-in variable readable in shaders: ‘love_ScreenSize’. Its x and y components contain the width and height of the current viewport. Resolves issue #841. 2014-01-27 02:58:34 -04:00
Alex Szpakowski 988404e4ca Added love.graphics.getSystemLimit (resolves issue #840). Deprecated love.graphics.getMaxPointSize.
love.graphics.getSystemLimit currently accepts these enum strings: “pointsize”, “texturesize”, “multicanvas”, and “canvasfsaa”.
2014-01-27 02:19:30 -04:00
Alex Szpakowski 7556fde5e6 Added antialiasing (MSAA) support to Canvases via a new optional parameter. Added Canvas:getFSAA. 2014-01-27 01:31:41 -04:00
Alex Szpakowski ba7e69d776 Added Mesh:setDrawRange(min, max) and Mesh:getDrawRange().
If no vertex map is set, this restricts the drawn vertices to those whose indices in the vertex array are between [min, max] inclusive.
If a vertex map is set, this restricts the values used in the vertex map to those whose indices in the vertex map array are between [min, max] inclusive.

Added Mesh constructor variant: love.graphics.newMesh(vertexcount, texture, drawmode). Creates a Mesh with a certain number of vertices with x,y,u,v,r,g,b,a values of (0,0,0,0,255,255,255,255).
2014-01-21 06:16:47 -04:00
Alex Szpakowski 73f1ce0d40 Added instancing support to Meshes via Mesh:setInstanceCount. Added a new built-in variable to vertex shaders: int love_InstanceID.
love.graphics.draw(mesh) will draw the mesh instancecount times, using hardware instancing when available. The only way to draw individual instances differently from each other is to use the love_InstanceID variable in a vertex shader.

Added love.graphics.isSupported(“instancing”). Hardware instancing is supported if true, otherwise a (slower) pseudo-instancing fallback is used internally when drawing instanced meshes.
2014-01-21 06:01:50 -04:00
Alex Szpakowski 0e13975c11 Improved some error message text 2014-01-17 22:28:06 -04:00
Alex Szpakowski 29f47d9a10 Changed particle spawning behaviour in ParticleSystems to spawn at an interpolated position between the location at the previous update and the current one. This results in much smoother behaviour when moving a ParticleSystem constantly via ParticleSystem:setPosition.
Also fixed particle spawning to better fill up the buffer.
2014-01-16 16:20:30 -04:00
Alex Szpakowski dc35db1c7b Fixed tab characters (‘\t’) in text to be drawn properly with love.graphics.print. 2014-01-15 23:38:39 -04:00
Alex Szpakowski 9b9671f5ee Fixed a potential memory leak when a Font object errors 2014-01-15 23:03:39 -04:00
Alex Szpakowski 7f77c2d0b3 Canvas:renderTo now restores the previously active Canvas when done, instead of erroring if another Canvas is already active 2014-01-15 14:56:28 -04:00
Alex Szpakowski 113093e4fc Separated canvas texture creation code from FBO creation code 2014-01-13 01:47:06 -04:00
Alex Szpakowski fda005c5ff love.graphics.getScissor now has a proper C++ module method 2014-01-09 22:49:00 -04:00
Alex Szpakowski c64b3d2527 Renamed love.graphics.getMaxImageSize to love.graphics.getMaxTextureSize (old function is still there, but deprecated.) 2014-01-09 22:18:37 -04:00
Alex Szpakowski 1d3c4e125e Make love.graphics.reset call love.graphics.origin instead of clearing the internal pixel size stack 2014-01-05 15:52:12 -04:00
Alex Szpakowski 510ed6f11e Abstracted lua bindings for general Texture methods into wrap_Texture.cpp 2014-01-04 21:19:03 -04:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski aa69a695d3 Canvases can now be used in SpriteBatches, ParticleSystems, and Meshes (resolves issue #782).
Canvases and Images are now subclasses of the new Texture class.
Added setTexture and getTexture methods for Meshes, ParticleSystems, and SpriteBatches (the old set/getImage methods are deprecated but not removed.)
Canvas texture coordinates are no longer flipped.
2014-01-03 17:07:12 -04:00
Alex Szpakowski ab1cf7fdc5 Really fixed setting the scissor and then changing Canvases 2013-12-31 23:37:04 -04:00
Alex Szpakowski 98b258b75f Fixed font textures in OpenGL returning black RGB values when a shader is active (reverts changeset 69b0b4e) 2013-12-31 22:09:04 -04:00
Alex Szpakowski f3bd944cf5 Reduced the RAM and VRAM space taken up by TrueType font glyphs by 1/2. 2013-12-31 20:15:55 -04:00
Alex Szpakowski a00c006c44 The graphics viewport is now properly restored when switching from an active Canvas to no Canvas (resolves issue #817) 2013-12-30 23:52:46 -04:00
Alex Szpakowski cd303c7c62 Added Mesh:setWireframe and Mesh:isWireframe.
This should *only* be used for debugging: the wireframe lines behave differently from regular love.graphics lines, and the functionality may not work on OpenGL ES.
2013-12-30 01:44:04 -04:00
Alex Szpakowski 27f36455e8 Fixed ParticleSystem:clone not duplicating position and area spread properly 2013-12-28 01:51:50 -04:00
Bart van Strien 90d041ed1b Patch GLee for missing GLXContextID typedef after upstream (mesa) removal from header 2013-12-27 16:50:07 +01:00
Alex Szpakowski bccac13432 Added ParticleSystem:clone() 2013-12-25 05:30:07 -04:00
Alex Szpakowski d0d629a314 Fixed line width after love.graphics.scale with negative numbers (resolves issue #808) 2013-12-18 03:15:44 -04:00
Alex Szpakowski 2ee869b0e8 Fixed some compiler warnings 2013-12-07 05:07:54 -04:00