Commit Graph

1380 Commits

Author SHA1 Message Date
vrld db86fa4b83 Make love.math.triangulate with any polygon winding order. 2013-03-14 17:21:13 +01:00
Alex Szpakowski d39cfbb4fa Really fixed love.graphics.rectangle 2013-03-13 22:12:35 -03:00
Alex Szpakowski 7229dcae9f Fixed love.graphics.rectangle 2013-03-13 22:03:42 -03:00
Alex Szpakowski 89395d6dfb Updated Visual Studio project for math module changes (thanks Boolsheet) 2013-03-13 20:02:47 -03:00
Alex Szpakowski 4159b15ef2 Updated Xcode project for math module changes 2013-03-13 19:12:48 -03:00
vrld 1a407a6af3 Make non-gcc compilers happy... 2013-03-13 23:09:25 +01:00
vrld ece4ff6472 Make love.math a singleton. Remove code duplication. Add love.math.triangulate.
love::math::Math is now a singleton, so other modules can use it via
love::math::Math::instance.


Removed duplicate implementations of various rng helper functions.
ParticleSystem now uses love::math::Math's RNG.


New function: love.math.triangulate(vertices)

Accepts a table or list of x/y coordinate pairs and returns a table of tables.
The inner tables are the triangles the polygon is composed of.

Works on all *simple* polygons, i.e. a closed chain of vertices that does not
intersect itself. Attempting to triangulate non-simple polygons is undefined
behavior - in the best case it throws an error, in the worst case it returns
an invalid triangulation.

Polygons must be ordered in *clockwise order* with respect to the love
coordinate system. Attempting to triangulate a ccw polygon will throw an
error.

Examples:

  triangles = love.math.triangulate(0,0, 1,1, 2,0, 2,2, 0,2)
  triangles == {
      {1,1, 2,0, 2,2},
      {1,1, 2,2, 0,2},
      {1,1, 0,2, 0,0},
  }

  triangles = love.math.triangulate({0,0, 1,1, 2,0, 2,2, 0,2})
  -- same as above

  triangles = love.math.triangulate(0,2, 2,2, 2,0, 1,1, 0,0)
  -- error - polygons is in counterclockwise order

  triangles = love.math.triangulate(0,0, 1,3, 2,0, 2,2, 0,2)
  -- undefined behavior - polygon intersects itself (because of edge 1,3)
2013-03-13 20:48:39 +01:00
Alex Szpakowski d383434edf ParticleSystem:setColors now accepts multiple color arrays (issue #440) 2013-03-13 14:38:58 -03:00
Alex Szpakowski b8ec6633ab Fixed love.graphics.printf wrapping when the wrap limit is the same as the text width (issue #558) 2013-03-13 00:08:09 -03:00
Alex Szpakowski 1172d5b836 love.graphics.newScreenshot now uses the size of the current canvas (if applicable), instead of adding transparency or clipping to match the screen size 2013-03-12 20:52:24 -03:00
Alex Szpakowski d39bb315af love.graphics.newScreenshot replaces alpha with full opacity by default (issue #374, thanks Boolsheet)
Some additional overhead was added to newScreenshot because it doesn't use glPixelTransfer (not supported in ES2 / core GL3+, and like all GL functions has the slight potential to be buggy on some drivers). This choice might be revisited in the future.
2013-03-12 20:48:40 -03:00
Alex Szpakowski e869b71c43 Fixed crash in ImageData:paste 2013-03-12 17:16:39 -03:00
Alex Szpakowski 94f140454f More Quad code cleanup 2013-03-11 22:46:25 -03:00
Alex Szpakowski 17bcab4f32 Added love.graphics.getDimensions and Image/Canvas/ImageData:getDimensions (issue #566) 2013-03-11 19:03:37 -03:00
Alex Szpakowski 4704c4e19e Cleaned up some ParticleSystem and Quad code 2013-03-11 17:56:55 -03:00
Alex Szpakowski ce71bc0847 Fixed love.timer.step / dt 2013-03-11 02:00:25 -03:00
Alex Szpakowski 6a83eba5f2 Merged love-experiments/particlesystem-quads into default 2013-03-11 01:53:49 -03:00
Alex Szpakowski 318f335c7c ParticleSystem:setQuads can now accept a table argument, cleaned up the ParticleSystem quad code
--HG--
branch : particlesystem-quads
2013-03-11 01:44:43 -03:00
Bart van Strien 7efe11b11f Add centered flag to setMode, optionally centers the window (on by default, as before) (issue #463) 2013-03-10 23:00:31 +01:00
Bart van Strien 63c57ba3f8 Make love.timer.getFPS and love.timer.getAverageDelta microsecond-accurate 2013-03-10 22:16:23 +01:00
Bart van Strien 28af989a00 Add love.timer.getAverageDelta (issue #570) and constify love.timer.sleep 2013-03-10 22:07:24 +01:00
Alex Szpakowski d30809ebff Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
--HG--
branch : particlesystem-quads
2013-03-10 03:40:25 -03:00
Alex Szpakowski 738f471978 Fixed shader creation 2013-03-07 17:47:40 -04:00
Alex Szpakowski 6f67fbdfa7 Fixed a typo in joystick event code 2013-03-06 11:17:39 -04:00
Alex Szpakowski be648a82f7 Updated Visual Studio project for new thread module files and version changes (thanks Boolsheet) 2013-03-06 09:43:55 -04:00
Alex Szpakowski 3c8bc9ee9f Merged bartbes/love-experiments/joystickevents into default 2013-03-05 13:59:45 -04:00
Alex Szpakowski 6b1222366d Removed 'moved' suffix from new joystick callbacks
--HG--
branch : joystickevents
2013-03-05 12:31:11 -04:00
Alex Szpakowski cd21eaaf33 Re-enable GME support in OS X 2013-03-04 22:16:54 -04:00
Alex Szpakowski 974d63124e Removed redundant code in the event module 2013-03-04 19:05:57 -04:00
Alex Szpakowski a844ac2389 Added love.joystickaxismoved, love.joystickballmoved, and love.joystickhatmoved callbacks
--HG--
branch : joystickevents
2013-03-04 18:49:25 -04:00
Alex Szpakowski 75c3262d49 Update changelog 2013-03-04 14:31:33 -04:00
Alex Szpakowski 65a3206ae4 Fixed another case of issue #538 (check for non power of two support does not cover all possibilities) 2013-03-04 14:02:35 -04:00
Alex Szpakowski 2d7dd87eb5 Removed PixelEffect compatibility functions (love.graphics.newPixelEffect is now love.graphics.newShader, etc)
Also removed love.graphics.isSupported("pixeleffect") in favor of love.graphics.isSupported("shader")
2013-03-04 14:01:04 -04:00
Alex Szpakowski 524368331d Removed love.graphics.setColorMode
- The "replace" color mode can easily be duplicated with love.graphics.setColor(255, 255, 255)
- The current color mode has no effect when a shader is active
- Color mode functionality can easily be replicated with shaders
- OpenGL ES 2 (iOS, Android, etc) does not have the functions used by love.graphics.setColorMode
2013-03-04 13:58:14 -04:00
Alex Szpakowski 4ae126ac44 Fixed some potential instability or crash issues 2013-03-03 20:23:40 -04:00
Alex Szpakowski d5245483ef Updated version to 0.9.0 (codename TBD) 2013-03-03 19:55:37 -04:00
Alex Szpakowski 22c514e53a Fixed a compiler warning 2013-03-03 18:55:57 -04:00
Alex Szpakowski f0ca4f6c97 Removed internal code for love.graphics.triangle and love.graphics.quad 2013-03-03 18:49:56 -04:00
Alex Szpakowski 0efdc732e0 Updated Xcode project for new thread module files 2013-03-03 14:58:59 -04:00
Bart van Strien a9244da013 Merge minor into default, next release shall be 0.9.0 2013-03-03 19:53:57 +01:00
Bart van Strien 3d0c5761ce Merge in default, update changelog
--HG--
branch : minor
2013-03-03 19:51:04 +01:00
Alex Szpakowski d3cdb7d609 Added SpriteBatch:isEmpty() and SpriteBatch:isFull() 2013-03-01 17:32:38 -04:00
Alex Szpakowski 34f291f26e Updated UTF-8 library to the latest version 2013-03-01 10:01:37 -04:00
Alex Szpakowski 706ed3e8ce Added math module files to Visual Studio project (thanks Boolsheet) 2013-02-26 22:15:48 -04:00
Alex Szpakowski 395a1dbced The "alpha" blend mode now outputs more useful/intuitive alpha values (thanks Boolsheet)
See https://love2d.org/forums/viewtopic.php?f=4&t=16223 and http://www.opengl.org/discussion_boards/showthread.php/167554-FBO-and-blending
2013-02-26 21:44:01 -04:00
Alex Szpakowski e5670e69b3 Added love.graphics.setColorMask(r, g, b, a) and love.graphics.getColorMask()
setColorMask enables or disables specific color components when rendering and clearing the screen.
For example, setColorMask(true, false, true, true) will prevent the green component of the color of all rendered objects from being written to the current frame buffer.
setColorMask is a wrapper for http://www.opengl.org/sdk/docs/man2/xhtml/glColorMask.xml

--HG--
branch : love.graphics.setColorMask
2013-02-26 11:24:30 -04:00
Alex Szpakowski 0be26b7678 Added new math module files to the Xcode project 2013-02-26 06:35:50 -04:00
vrld 4b8c6d236d Rename Math.{cpp,h} to ModMath.{cpp,h}.
Compilers can get confused and include Math.h and math.h (included by cmath).
2013-02-26 10:43:03 +01:00
vrld d842c5d28d Fix box muller transform in common/math.cpp.
Random numbers have to be in (0:1], not in [0:1).
2013-02-26 10:37:42 +01:00
vrld 03518d51ac Merge something (?) 2013-02-25 18:34:23 +01:00