Commit Graph

67 Commits

Author SHA1 Message Date
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 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 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 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 27f36455e8 Fixed ParticleSystem:clone not duplicating position and area spread properly 2013-12-28 01:51:50 -04:00
Alex Szpakowski bccac13432 Added ParticleSystem:clone() 2013-12-25 05:30:07 -04:00
rude 27de844472 Include <algorithm> when std::min/max is used.
It won't build in Visual Studio 2013 unless we do this.
2013-10-23 00:09:12 +02:00
Alex Szpakowski 43b3629e01 Improved performance of Image:refresh 2013-10-13 16:31:29 -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 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 713e050b56 Removed some ParticleSystem methods which existed but did nothing since version 0.5.0 or earlier 2013-08-22 00:30:58 -03:00
Alex Szpakowski dc755ed375 Removed ParticleSystem:getX/getY (resolves issue #633) 2013-08-04 18:27:36 -03:00
Alex Szpakowski 0447d1e7c5 Changed love.math.randomnormal([mean], stddev) to love.math.randomNormal(stddev, [mean]);
Changed love.math.randomseed(seed) to love.math.setRandomState(state) and love.math.setRandomState(low, high). Added low, high = love.math.getRandomState().

love.math.setRandomState(state) can set the random state to an integer of up to 53 bits, love.math.setRandomState(low, high) can set the random state to a 64 bit integer by using the first argument as the lower 32 bits and the second argument as the higher 32 bits.
This allows for reliable setting and saving of the state of a RNG.

--HG--
branch : RandomGenerator-2
2013-08-01 18:32:44 -03:00
Alex Szpakowski d5ef29e015 Removed the optional variation parameter from ParticleSystem:setSpin (issue #634). ParticleSystem:setSpinVariation still exists. 2013-07-09 07:48:42 -03:00
Alex Szpakowski da7bc06976 ParticleSystem:setSizes no longer resets size variation to 0 (issue #640) 2013-07-09 07:38:44 -03: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 35984790e5 Added a way for love's reference-counted objects to be released more safely in some situations (e.g. setters) 2013-06-09 02:42:33 -03:00
Alex Szpakowski 0545138f1e Added ParticleSystem:isStopped (issue #623) 2013-05-24 02:21:47 -03:00
Alex Szpakowski 0c58d5d46a Added ParticleSystem:isPaused (issue #623) and removed ParticleSystem:isEmpty/isFull (issue #621) 2013-05-23 13:42:29 -03:00
Bart van Strien 16e27d95b1 Rename ParticleSystem:setLifetime/setParticleLife and getters to setEmitterLifetime/setParticleLifetime (issue #601) 2013-05-10 16:50:20 +02:00
Alex Szpakowski 4c616e409b Renamed ParticleSystem:count, Channel:count, and all getNum* functions to get*Count (issue #602) 2013-05-03 04:04:44 -03: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 426ca03315 Added ParticleSystem:setLinearAcceleration(xmin, ymin, xmax, ymax) and removed ParticleSystem:setGravity (issue #599) 2013-04-19 15:33:30 -03:00
Alex Szpakowski b6247f9ae1 Added many getters of questionable utility to ParticleSystems.
Storing your own values is blasphemy, clearly.
2013-04-18 04:54:53 -03:00
Alex Szpakowski 6fd3038405 Improved clarity/readability of internal OpenGL state shadowing functions 2013-04-17 01:06:33 -03:00
Alex Szpakowski 2d0b3b5226 ParticleSystems now use their own RNG instead of the global one (prevents ParticleSystems from modifying the global math.random state)
--HG--
branch : math-randobject
2013-04-15 15:11:06 -03:00
Alex Szpakowski d98e2cb40c Renamed randnormal to randomnormal
--HG--
branch : math-randobject
2013-04-15 14:57:20 -03:00
Alex Szpakowski 6a27e1aa2f Ensure the current color is set properly after drawing particlesystems and spritebatches 2013-04-12 15:40:53 -03:00
Alex Szpakowski 7b8884965e Added ParticleSystem:emit(num) (issue #577) 2013-03-27 01:09:53 -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 4704c4e19e Cleaned up some ParticleSystem and Quad code 2013-03-11 17:56:55 -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
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 1945b7975d Cleaned up exception handling code when creating new fonts, spritebatches, and shaders 2013-02-14 21:49:11 -04:00
Alex Szpakowski 96161c66f6 Updated copyright text for the new year 2013-02-05 05:32:49 -04:00
Alexander Szpakowski 8fdd6cbbb2 Merged in from main repository (originally from love-mipmap fork) 2013-01-12 18:07:14 -05: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 6560019829 opengl graphics module files now always include OpenGL.h rather than GLee.h 2013-01-01 17:54:14 -04:00
rude 54498ce378 Apply slime73's ParticleSystem patch. 2012-11-18 11:02:30 +01:00
vrld 4ec7609d37 Fix issue #437: Area-based particle spawn.
New particles are spawned around the particle emitter position according to a
configurabe distribution.

New functionality:

particlesystem:setAreaSpread(distributon, x, y)
distribution, x, y = particlesystem:getAreaSpread()

Where `distribution' is one of "none", "uniform", "normal".
`x' and `y' take different meaning based on the distribution:

  * none:    no area spread - particles spawned at emitter position.
  * uniform: particle spawned at px,py in the rectangle around emitter
             position ex,ey, i.e.:
             ex - x < px < ex + x, ey - y < py < ey + y,
  * normal:  particle position drawn from a normal/gaussian distribution
             with mean ex,ey and standard deviation x,y, i.e.:
             px \in N(ex, x²), py \in N(ey, y²).
2012-09-10 19:58:44 +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
Bill Meltsner 86abc9323b Add ParticleSystem:getPosition (issue #368) 2012-02-04 11:31:07 -05:00
Bill Meltsner be55579a22 Happy New Year, have an enormous diff 2012-01-09 02:41:11 -06:00
vrld a855a01f02 Fix two particle system typos (thanks, Boolsheet!) 2011-12-26 21:29:47 +01:00
Bill Meltsner 969c53e592 make love build on OS X again - there's no need to include gl.h directly, GLee.h does that for us in a cross-platform way 2011-12-19 00:28:45 -06:00