Commit Graph

60 Commits

Author SHA1 Message Date
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 113093e4fc Separated canvas texture creation code from FBO creation code 2014-01-13 01:47:06 -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 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 c8f5494900 Images, Canvases, Quads, and Fonts now have the same vertex winding order 2013-11-10 19:57:13 -04: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 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 9834897372 Fixed Canvas:clear on GL3+ systems 2013-08-13 16:05:20 -03:00
Alex Szpakowski 5a3055dd3b Replaced internal calls to luaL_register (deprecated in Lua 5.2) with an alternative 2013-07-16 23:23:58 -03:00
Alex Szpakowski 3725b4122f Fixed lazy-loading of stencil buffers in Canvases sometimes failing due to uninitialized variables 2013-07-16 20:04:10 -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
Alex Szpakowski 9da1af1e99 Canvas:clear() when multiple canvases are active is now more efficient when GL3+ is supported 2013-07-06 07:02:48 -03:00
Alex Szpakowski 80122d67e6 Slightly improved performance of love.graphics.setCanvases 2013-06-27 01:43:32 -03:00
Alex Szpakowski f25efcc8af Improved performance and reduced temporary memory usage of love.graphics.newScreenshot and Canvas:getImageData 2013-06-15 22:07:16 -03:00
Alex Szpakowski d286f78ec7 Improved error messages when canvas/image creation fails because the size is too big for the system 2013-06-09 18:24:19 -03:00
Alex Szpakowski c0998cd996 Fixed love.graphics.setScissor when love.graphics.setCanvas is called directly after a setScissor call 2013-06-07 03:31:30 -03:00
Alex Szpakowski 6c6cb270de Fixed Canvas:clear 2013-05-30 04:31:32 -03:00
Alex Szpakowski 0e9d73503c Stencil buffers are now created and attached to canvases on-demand, instead of always on canvas creation.
saves VRAM when stencils aren't used in canvases.
2013-05-22 23:08:21 -03:00
vrld e9d0204cdc Disallow concave shapes as geometry. 2013-05-12 13:01:05 +02:00
Alex Szpakowski 7ab3809165 Fixed Object:typeOf for love.physics objects new to 0.8.0, removed vestigial ColorMode code 2013-05-07 15:23:26 -03:00
Alex Szpakowski 3bf43dadd8 Renamed CompressedData:getNumMipmaps to CompressedData:getMipmapCount; Improved type-checking error messages for some functions which expect function arguments 2013-05-02 17:26:50 -04:00
Alex Szpakowski 1edfbb766f Misc. fixes 2013-05-01 16:17:42 -07:00
Alex Szpakowski 3b05ec0635 Geometries now automatically use per-vertex colors when drawing if any vertex has a custom color set, otherwise the constant color is used.
Still not a perfect solution, but it works better than before
2013-04-23 23:25:45 -07:00
Alex Szpakowski 38b7e19914 Fixed Geometry:flip 2013-04-21 19:54:05 -07:00
vrld 71317c4359 Add Geometries (replaces Quads).
A Geometry is a collection of vertices describing a non self-intersecting
(simple) polygon. In addition to screen coordinates, the vertices have
attributes for texture coordinates (s,t) and color (r,g,b,a).

It can be used as a quad, to display distorted images, or anything in between.

Added:
^^^^^^

-- geometry from table, where table has the format:
-- info = {
-- {x,y, s,t, [r = 255, g = 255, b = 255, a = 255]}
-- {x,y, s,t, [r = 255, g = 255, b = 255, a = 255]}
-- ...
-- }
geom = love.graphics.newGeometry(info)

-- convenience wrapper for quads (same as before)
geom = love.graphics.newQuad(x,y, w,h, sw,sh)

-- retrieve vertex i (1-indexed)
x,y,s,t,r,g,b,a = geom:getVertex(i)

-- set vertex i (1-indexed)
geom:setVertex(i, x,y, s,t, [r,g,b,a])

-- flip geometry
geom:flip(x, y)


Renamed:
^^^^^^^^

love.graphics.drawq() -> love.graphics.drawg()


Removed:
^^^^^^^^

quad:setViewport()
quad:getViewport()
2013-04-21 18:53:13 +02:00
Alex Szpakowski 6fd3038405 Improved clarity/readability of internal OpenGL state shadowing functions 2013-04-17 01:06:33 -03:00
Alex Szpakowski b59b967f6b Fixed a memory leak in Canvas:getImageData() (issue #590) 2013-04-09 14:08:05 -03:00
Alex Szpakowski d5aa807747 More internal code cleanup 2013-03-31 19:02:27 -03:00
Alex Szpakowski a55c7e871e fixed canvas:clear() when multi-canvas rendering is active, changed some names and wording
--HG--
branch : MRTs
2013-03-26 04:58:43 -03:00
Alex Szpakowski 6c5daab312 Fixed up the API: setCanvas (singular) now only takes one canvas, setCanvases must be used for multi-canvas rendering
--HG--
branch : MRTs
2013-03-25 21:23:09 -03:00
Alex Szpakowski 2ea065c68b Added MRT support to canvases via love.graphics.setCanvases(c1, c2, ...), and an 'effects' callback function in shaders.
- Simultanious rendering to multiple canvases requires all canvases to be the same size (limitation of pre-GL3.0 framebuffers)
- love.graphics.isSupported("mrtcanvas") was added
- love_Canvases[n] (0-based array of active canvases) can be written to in pixel shaders in the 'effects' callback function
- everything drawn to multiple canvases at once will be duplicated to all canvases if no shader is active or the standard 'effect' shader function is used

--HG--
branch : MRTs
2013-03-24 02:20:15 -03:00
Alex Szpakowski 2009124cf9 Reworked internal anisotropic filtering code to be more concise and intuitive 2013-03-21 12:21:13 -03:00
Alex Szpakowski 25d6700361 Moved anisotropic filtering to Image:setFilter(min, mag, anisotropy), added anisotropic filtering support to canvases and fonts 2013-03-20 23:23:26 -03:00
Alex Szpakowski 96161c66f6 Updated copyright text for the new year 2013-02-05 05:32:49 -04:00
rude ba4cf6204d Added Canvas:getPixel(x, y). (pull request #17) 2012-10-17 21:33:10 -04:00
Alexander Szpakowski e5388ff73b Removed more unnecessary tabs in blank lines 2013-01-07 07:11:40 -04:00
Alexander Szpakowski eb98e8cc48 Removed unnecessary tabs in empty lines, fixed texture filtering when the minification and mipmap filter are the same 2013-01-07 06:56:59 -04:00
Alexander Szpakowski 1678252b7a Applied patch from issue #542 (texture filtering inconsistencies) in main LÖVE repository 2013-01-01 21:29:38 -04:00
vrld 31f98ebf52 Fix #234 again. Of course this means the texture coordinates are flipped
again...
2012-10-18 13:29:13 +02:00
vrld ccdf6e1c00 Fix Issue #476: Add HDR Canvas (thanks, Alexander Szpakowski!).
* Add `love.graphics.isSupported("hdrcanvas")' to query whether the hardware
  actually supports HDR canvases.

* Add optional third argument to `love.graphics.newCanvas(w,h, type)', where
  `type' is one of "normal" or "hdr" and defaults to "normal". HDR canvases
  use floating point that can have values > 1 to store pixels, allowing for
  HDR rendering and other higher level lighting techniques when combined with
  pixel effects.

* Add `canvas:getType()'.
2012-10-11 22:22:10 +02:00
vrld a39ddc9f1a Close issue #480: Extending Canvas support to cards without packed depth stencil. 2012-10-01 22:06:56 +02:00
vrld 87c6646705 Fix #435 (for real this time). Unfixes #324.
Add a extern vec2 love_ScreenSize to the pixel effects that will
be (re)set upon PixelEffect::loadVolatile() and is used to flip
the fragment coordinate.

Unfixes #324 because canvases can have different dimensions than
the screen.
2012-08-05 16:08:22 +02:00
Bart van Strien 7793e7f02f CRLF to LF 2012-07-04 14:40:24 +02:00
rude 81c38e22d0 Applied the new style guidelines.
Well, sort of. Lot's more to be done, but this is a start.
2012-06-28 23:52:33 +02:00
Bart van Strien 2ac4a9e6d0 Manually keep track of bound textures, so we don't have to poll each frame
Patch submitted by slime73.
2012-01-10 15:36:18 +01:00
Bill Meltsner be55579a22 Happy New Year, have an enormous diff 2012-01-09 02:41:11 -06:00
Bart van Strien 0aae9684b3 Automated formatting fix 2011-11-16 11:32:41 +01:00
vrld 983b00c510 Revert Canvas flipping (commits 9cb824e2fa84, e0234edd0026) in order to fix issue #324. 2011-11-12 22:09:56 +01:00