Miku AuahDark
b285c2c866
Add love.math.perlinNoise and love.math.simplexNoise.
2022-09-24 23:51:12 +08:00
Alex Szpakowski
7f3538d2ba
Merge branch 'main' into 12.0-development
2022-01-05 21:10:27 -04:00
Alex Szpakowski
8e7fd10b6f
Update copyright year for 2022
2021-12-31 18:33:40 -04:00
Alex Szpakowski
185b53421a
Fix function declaration type mismatch (didn't cause any errors).
2021-12-24 11:41:12 -04:00
megagrump
136c3cd277
use double precision numbers in love.math.noise
2021-11-22 14:57:05 +01:00
Alex Szpakowski
f89aabb0bb
Update copyright year for 2021
2021-04-04 16:14:45 -03:00
Alex Szpakowski
fc4847c69d
Update copyright for the new year
2020-01-03 22:40:36 -04:00
Alex Szpakowski
0752f27bdf
Update copyright year for 2019
2019-01-03 21:09:05 -04:00
Alex Szpakowski
5d5c2f9a96
math and data module instances are now deleted when they have no more Lua references (matches the behaviour of other modules.) Fixes the deprecation system not fully restarting when love.event.quit("restart") is called.
...
Resolves issue #1462 .
2018-12-17 16:44:13 -04:00
Bart van Strien
e80247c191
Happy new year! ✨
2018-01-03 19:47:35 +01:00
Alex Szpakowski
90e86c329d
Add love.data module.
...
- Moved love.math.compress / decompress / decode / encode / hash to love.data.
- Changed love.data.compress/decompress to take the format argument first instead of second.
- Added love.data.newDataView. Returns a read-only subsection of an existing Data object.
- Added love.data.newByteData. Mostly useful in combination with LuaJIT's FFI as it has no extra methods currently.
- Added implementations of Lua 5.3's data packing APIs: love.data.packString / packData / unpack / getPackedSize.
Resolves issue #1336 .
Resolves issue #1331 .
--HG--
branch : minor
2017-09-24 19:25:27 -03:00
Alex Szpakowski
ac697ddb0f
Clean up love’s internal Vector code a bit, and rename it to Vector2 so it’s more obvious what it is.
...
--HG--
branch : minor
2017-05-16 22:07:01 -03:00
Alex Szpakowski
abb72cb813
Happy new year! 🥂
...
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Alex Szpakowski
14aa6965b3
Added Transform objects to love.math (resolves issue #1228 ).
...
- Added love.math.newTransform.
- Added love.graphics.applyTransform and love.graphics.replaceTransform.
- love.graphics.draw/print/printf, Text:add/addf, and SpriteBatch:add can accept a Transform argument.
- love.graphics.push can accept an optional Transform as a second argument, which will apply the Transform after pushing the matrix stack,
- Shader:send can accept Transform objects when sending to a mat4 uniform variable.
--HG--
branch : minor
2016-11-24 21:30:45 -04:00
Alex Szpakowski
ef61573cd3
Merge default into minor
...
--HG--
branch : minor
2016-08-29 22:41:24 -03:00
Alex Szpakowski
677a8d60b8
Use love::Vector (8 bytes) instead of love::Vertex (20 bytes) for love.math.triangulate and love.math.isConvex.
2016-08-24 18:02:27 -03:00
Bart van Strien
3a2e859acd
Add love.math.hash, which supports MD5/SHA-1/SHA-2.
...
--HG--
branch : minor
2016-04-02 18:39:53 +02:00
Alex Szpakowski
cc1b9bc619
Moved most love.math functions out of the Math class, since they're pure functions.
...
--HG--
branch : minor
2016-03-28 19:46:29 -03:00
Alex Szpakowski
734789eb93
Added love.math.encode(format, data | string [, linelength]) and love.math.decode(format, data | string). Current formats are "base64" and "hex". The optional line length only applies to base64 and specifies the maximum number of characters per line in the encoded string.
...
Removed the variant of love.filesystem.newFileData which decoded a base64-encoded string since it's redundant.
--HG--
branch : minor
2016-03-28 19:28:40 -03:00
Alex Szpakowski
46a2e7b85c
Happy new year! 🎉
2016-01-01 00:05:06 -04:00
Alex Szpakowski
20fb7f44df
Cleaned up the code for love.math.random and related functions.
2015-12-10 13:09:54 -04:00
Alex Szpakowski
2e9154283c
Added gzip support to love.math.compress and love.math.decompress.
2015-10-02 03:18:11 -03:00
Alex Szpakowski
c3fd7a25a3
Fixed some misc. compiler warnings.
2015-05-23 12:45:58 -03:00
Alex Szpakowski
97806f87c0
Replaced Simplex noise with Perlin noise for the 3D and 4D variants of love.math.noise, to avoid patent-infringement issues (resolves issue #997.)
2015-04-17 17:01:41 -03:00
Alex Szpakowski
a29b349014
Added love.math.compress(data, format [, level]) and love.math.decompress(compresseddata) / love.math.decompress(compressedstring, format).
...
Renamed the love.image CompressedData type to CompressedImageData.
love.math.compress returns a love.math CompressedData object which holds the newly compressed data. Currently supported formats are "lz4" and "zlib". Note that the formats are not file formats and don't compress filesystem hierarchies.
2015-03-23 11:28:14 -03:00
Alex Szpakowski
c7b45b3505
Updated copyright for the new year
2014-12-31 19:32:43 -04:00
Alex Szpakowski
d52bab4221
Updated the new module changes to use more compile/link-time checking rather than runtime checking.
2014-07-21 15:12:01 -03:00
Alex Szpakowski
d07e31370d
Added RandomGenerator:getState and RandomGenerator:setState (resolves issue #831.)
...
getState returns an implementation-dependent string representing the current state of the RandomGenerator's PRNG. setState sets the PRNG's state to an implementation-dependent string.
2014-02-08 20:28:41 -04:00
Alex Szpakowski
e54d771be4
Added love.math.gammaToLinear and love.math.linearToGamma for converting RGB color values from the sRGB color-space to linear and vice-versa.
2014-02-04 19:45:50 -04:00
Alex Szpakowski
3120a0e650
Goodbye 2013, hello 2014!
2014-01-03 17:28:58 -04:00
Alex Szpakowski
1c8abc74aa
Renamed love.math.g/setRandomState and rng:g/setState to love.math.g/setRandomSeed and rng:g/setSeed.
...
getRandomSeed now always returns the previously set random seed instead of the current (implementation-dependent) random state.
2013-12-01 21:25:27 -04: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
5c0066332f
love.math.noise now returns values in the range of [0, 1] instead of [-1, 1]
2013-08-19 19:57:55 -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
vrld
19eade843c
Add support for Bezier curves of arbitrary degree.
...
New functions:
bezier = love.math.newBezierCurve(control-points)
degree = bezier:getDegree() -- degree = #control-points - 1
x,y = bezier:getControlPoint(pos) -- pos < 0 => string.sub semantics
bezier:setControlPoint(pos, x, y) -- pos < 0 => string.sub semantics
bezier:insertControlPoint(x,y, [pos = -1])
x,y = bezier:eval(t) -- 0 <= t <= 1
polyline = bezier:render([accuracy = 5]) -- returns a table of points
Example:
function love.load()
b = love.math.newBezierCurve(10,10, 80,400, 380,400, 470,10)
end
function love.draw()
if not curve then -- curve rendering is expensive-ish
curve = b:render()
end
love.graphics.line(curve)
end
2013-05-12 21:57:06 +02:00
vrld
d454be7025
Add love.math.isConvex()
...
Checks whether a given polygon is convex or not.
2013-05-12 13:00:08 +02:00
Alex Szpakowski
63404f7097
Added love.graphics.getRendererInfo(infotype). Useful for creating more informative error reports and advanced debugging.
...
Returned string can be highly system-dependent, so don't rely on its output!
infotype can be "name", "version", "vendor", or "device"
2013-05-05 16:47:42 -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
f8c7e2cab8
Code cleanup
2013-05-01 23:18:25 -07:00
Alex Szpakowski
9ccf013570
Added love.math.noise(x, [y, z, w]). Calculates the 1D, 2D, 3D or 4D Simplex noise value at a particular coordinate
2013-05-01 18:26:40 -07:00
Alex Szpakowski
bf6d1c258b
Misc. code cosmetics and improvements
2013-04-18 02:14:35 -03:00
Alex Szpakowski
d98e2cb40c
Renamed randnormal to randomnormal
...
--HG--
branch : math-randobject
2013-04-15 14:57:20 -03:00
Alex Szpakowski
3046981fce
Added love.math.newRandomGenerator. Returns a RNG object with its own seed and random methods.
...
--HG--
branch : math-randobject
2013-04-14 23:02:44 -03:00
vrld
1a407a6af3
Make non-gcc compilers happy...
2013-03-13 23:09:25 +01:00