Commit Graph

251 Commits

Author SHA1 Message Date
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 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 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 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 d9da19d665 Error for misspelled / invalid window attributes in love.window.setMode (resolves issue #736) 2013-10-20 13:17:57 -03:00
Alex Szpakowski b556dde3cb love.graphics.draw(image, quad, x, y, ...) now errors instead of shifting parameters if the quad argument is nil 2013-10-14 03:38:07 -03:00
Alex Szpakowski 206e184cde love.graphics.print's x and y arguments now default to 0 (resolves issue #638) 2013-10-07 23:52:30 -03:00
Alex Szpakowski fb34f5bc9e Auto-padded NPOT images' texture coordinates are now scaled at draw time via the texture matrix (fixes auto-padded images with Meshes.) Also fixed love.graphics.newQuad.
--HG--
branch : Mesh
2013-10-06 23:25:29 -03:00
Alex Szpakowski c426998b04 Fixed Mesh:setVertexMap when the mesh has more than 2^16-1 vertices (still needs more work to make it use smaller data types when available), added Mesh:setVertices
--HG--
branch : Mesh
2013-09-30 04:30:17 -03:00
Alex Szpakowski b59e3d9c35 Meshes now use vertex buffers for more efficient drawing.
--HG--
branch : Mesh
2013-09-29 21:24:19 -03:00
Alex Szpakowski c63e2ec624 Merged default into Mesh
--HG--
branch : Mesh
2013-09-29 04:58:26 -03:00
Alex Szpakowski 1e696c4505 Added Mesh objects and love.graphics.newMesh. Mesh objects are similar to Geometry but they're drawables (the relationship between meshes and images is the opposite of geometry and images.)
Removed Geometry objects and re-added Quads.

example:
local vertices = {{0, 0, 0, 0}, {100, 0, 1, 0}, {100, 100, 1, 1}, {0, 100, 0, 1}}
mesh = love.graphics.newMesh(vertices, image, "fan")
..
love.graphics.draw(mesh, 0, 0)

--HG--
branch : Mesh
2013-09-28 18:26:47 -03:00
Alex Szpakowski bcee9a222b Made some float/int/unsigned char conversions explicit, fixed ParticleSystem:getColors, fixed love.mouse.isDown with x1 and x2 buttons 2013-09-26 00:36:50 -03:00
Alex Szpakowski 5de43a7207 The Vertex struct is now recognized as POD by C++, also fixed the name to be consistent with other love structs 2013-09-24 11:09:18 -03:00
Alex Szpakowski b36d643570 Changed love.graphics.getRendererInfo to return all the info (resolves issue #757) 2013-09-23 18:03:10 -03:00
Alex Szpakowski 21d1e7737c Fixed ParticleSystem:setAreaSpread("none") to not require x/y arguments (resolves issue #738) 2013-09-17 00:54:55 -03:00
Alex Szpakowski f89097ed90 Fixed the error message when only one argument is given to newImageFont (resolves issue #737) 2013-09-16 03:11:38 -03:00
Alex Szpakowski ef9f30d5c4 Fixed a typo preventing compressed textures from being loaded into images 2013-09-06 00:59:19 -03:00
Alex Szpakowski 06f80d5c08 Fixed undefined behaviour when love exceptions are converted into Lua errors (resolves issue #729) 2013-09-05 23:17:29 -03:00
Alex Szpakowski ec9dec6b80 Replaced luax_newtype with luax_pushtype (and added luax_rawnewtype for the old functionality of luax_newtype.)
luax_pushtype keeps the object in a weak table and checks the table before creating a new userdata, so it re-uses the object's existing wrapper userdata if it can, whenever the object is pushed to Lua.

This fixes some subtle issues with love objects, where using them as keys in tables would not always work as expected (https://love2d.org/forums/viewtopic.php?f=4&t=39398&p=112388#p112415). It also decreases the amount of new Lua objects created, saving the garbage collector some work.
2013-08-29 00:40:06 -03:00
Alex Szpakowski 1b5912a461 Really fixed setScissor erroring when scissoring is disabled and x,y,w,h from getScissor is used (see issue #709) 2013-08-21 19:37:26 -03:00
Alex Szpakowski 394888bd13 Fixed love.graphics.setScissor and love.graphics.setColorMask to not error if a single nil argument is given (resolves issue #709) 2013-08-21 18:52:07 -03:00
Alex Szpakowski 96a668ecf3 Renamed CompressedData:getType to CompressedData:getFormat 2013-08-17 14:30:23 -03:00
Alex Szpakowski 72068ba519 love.graphics.isSupported now errors if an invalid string is given (see issue #690) 2013-08-17 00:12:46 -03:00
Alex Szpakowski 73e9f327dc Cleaned up boot.lua a tiny bit 2013-08-08 03:19:54 -03:00
vrld be205544b3 Issue #659: Add line joins.
Added:

love.graphics.setLineJoin(linejoin)
linejoin = love.graphics.getLineJoin()

where linjoin is one of:

- none
- miter
- bevel

Bevel and miter drawing is slightly faster than the 0.8 default (miter), while
the `none` join mode will be slower when overdraw is enabled.
2013-08-07 21:48:21 +02:00
Alex Szpakowski a4ff39e0d4 Improved error checking for some enum strings (resolves issue #690).
Also moved love.audio.newSource from Lua code into C++ code
2013-08-03 21:24:43 -03:00
Alex Szpakowski d7802b053b Removed love.graphics.setAlphaTest: incompatible with OpenGL ES 2+, core OpenGL 3+, and Direct3D 10+. Shaders can accomplish the same things and more. 2013-08-01 12:55:46 -03:00
Alex Szpakowski f41a2ed910 Reverted commit 8c64a0c (love.graphics.setCanvas(nil) erroring) 2013-07-19 19:53:39 -03:00
Alex Szpakowski cb0a974546 Merged love.graphics.setCanvases into love.graphics.setCanvas (resolves issue #684) 2013-07-19 15:45:40 -03:00
Alex Szpakowski 7cf7f3a25f Merged love.graphics.drawg into love.graphics.draw, and SpriteBatch:addg/setg into SpriteBatch:add/set (resolves issue #639) 2013-07-17 18:34:57 -03:00
Alex Szpakowski 57aa632841 Added love.graphics.getMaxImageSize 2013-07-17 00:35:25 -03:00
Alex Szpakowski 267d901cd6 Fixed Geometry:flip when the Geometry was created with newQuad (resolves issue #671) 2013-07-11 16:09:41 -03:00
Alex Szpakowski 454ba9d968 love.graphics.newGeometry now takes an optional draw mode argument ("fan", "strip", or "triangles".) "fan" is the default.
This allows for more diverse and complex Geometries, provided the lover understands how to use each mode. See http://escience.anu.edu.au/lecture/cg/surfaceModeling/image/surfaceModeling015.png

Changed love.graphics.newGeometry to optionally accept vertices as individual arguments instead of just a table of vertices (resolves issue #651).
Changed Geometry:setVertex to optionally accept a table containing x,y,u,v,r,g,b,a instead of just individual arguments.

Added Geometry:set/getDrawMode.

Removed the convex-check in love.graphics.newGeometry (all geometry modes have at least some form of concavity support, lovers can do their own check if needed with love.math.isConvex.)

Added an optional "vertex map" table argument to love.graphics.newGeometry (AKA a vertex index array / element array in graphics programming lingo.)
This allows lovers to change the order in which the vertices are used when drawing, or re-use a single vertex multiple times for different parts of the Geometry.
This is especially useful in the "triangles" Geometry draw mode. The vertex map lets you draw very complex (and concave) shapes / meshes without duplicating vertex data.

Added Geometry:set/getVertexMap.
2013-07-10 15:34:10 -03:00
Bart van Strien f5603b0291 Make love compile against lua5.2 2013-07-10 16:02:52 +02:00
Alex Szpakowski de745aa37c Fixed ParticleSystem drawing order (issue #604) & added ParticleSystem:s/getInsertMode. Thanks @Boolsheet! 2013-07-09 04:17:34 -03:00
Alex Szpakowski abd31ca4e2 Fixed ParticleSystems and Files crashing instead of erroring when given bad sizes (issue #666) 2013-07-04 06:29:02 -03:00
Alex Szpakowski cd97e9ec05 Added Image:getData, returns the original ImageData (or CompressedData) used to create the image 2013-06-17 13:43:40 -03:00
Alex Szpakowski d48d1fd441 Exposed the internal Rasterizer and GlyphData object methods to Lua. Also added Font:hasGlyph. 2013-06-16 07:36:18 -03:00
Alex Szpakowski 15535517d6 love.graphics.setColorMask() with no arguments enabled all color components 2013-06-15 21:52:39 -03:00
Alex Szpakowski 0a1c90f2d7 Removed love.graphics.setLine and love.graphics.setPoint.
Both functions are redundant (setLineStyle+setLineWidth and setPointStyle+setPointSize do the same thing) and have misleading names.
2013-06-14 10:12:09 -03:00
Alex Szpakowski 8718e064e0 Fixed love.graphics.print[f] truncating strings with embedded zeros 2013-06-13 17:37:14 -03:00