Commit Graph

339 Commits

Author SHA1 Message Date
Alex Szpakowski 74d9bc7faf Add traceback information to the error string generated if a thread causes a Lua error.
--HG--
branch : minor
2017-08-07 20:15:26 -03:00
Alex Szpakowski b129d49a6c Move Color.h from modules/graphics/ to common/
--HG--
branch : minor
2017-08-01 23:53:44 -03:00
Alex Szpakowski 19b4079ecc Merge default into minor
--HG--
branch : minor
2017-07-28 19:14:54 -03:00
Tiago Koji Castro Shibata 3dfe3808c6 Remove playmuted audio configuration 2017-07-18 15:15:04 -03:00
Tiago Koji Castro Shibata 4e9212b152 Add Android support to hasBackgroundMusic 2017-07-13 23:54:37 -03:00
Tiago Koji Castro Shibata 74c35358bb Move setMixMode to love.audio 2017-06-10 00:07:39 -03:00
Tiago Koji Castro Shibata 4c145e8c13 Support audio mix modes 2017-06-02 19:35:58 -03:00
Alex Szpakowski 7694edfd52 Auto-batched draws (except for love.graphics.print, for now) are affected by 3D transforms.
--HG--
branch : minor
2017-05-17 22:03:09 -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 b590edf27d Merge default into minor
--HG--
branch : minor
2017-04-30 00:37:26 -03:00
Alex Szpakowski 621fb24ba1 Require stencil=true to be specified in setCanvas if stenciling is used while a Canvas is active and there is no custom stencil buffer.
--HG--
branch : minor
2017-04-29 21:29:37 -03:00
Alex Szpakowski 70b32c47ce Error if a non-2D/affine matrix is used with auto-batched draws, since they perform CPU-side matrix transforms on 2-component vectors.
--HG--
branch : minor
2017-04-23 00:12:57 -03:00
raidho36 6b7172bd40 Fix Issue #1273
Added Lua index registry clear routine to `destroy` method of classes that use it.
If this is left to GC, the abandoned userdata would stay in memory for one full extra cycle.

Prettified the code slightly. Clarified some comments. Refactored `Fixture` class `udata` name.
Removed Reference class include from `Shape` (it doesn't use it).
2017-04-14 05:53:36 +03:00
Alex Szpakowski a0ef2ac28b Add Depth compare / shadow sampler support. Officially this is only supported in glsl3 shaders.
- Add Texture:setDepthSampleMode(comparemode). Only works on textures with depth pixel formats. A texture with the depth sample mode set will only work with a depth sampler.
- Add DepthImage, DepthArrayImage, and DepthCubeImage sampler keywords to glsl3.

--HG--
branch : minor
2017-04-12 20:26:06 -03:00
Alex Szpakowski 0001b4695e Add new variants of love.graphics.clear for controlling how the depth and stencil buffers are cleared.
- Add love.graphics.clear(r, g, b, a [, stencilvalue, depthvalue]).
- Add love.graphics.clear(color1, color2, …, [, stencilvalue, depthvalue]).
- Add love.graphics.clear(false, stencilvalue, depthvalue).

stencilvalue and depthvalue are either true, false, or a number. True is the default behaviour and clears that buffer to the default value (0 for stencil, 1 for depth), false prevents clearing.

The third variant listed above only clears the depth and/or stencil buffers and not the color buffer.

--HG--
branch : minor
2017-04-11 22:32:40 -03:00
Alex Szpakowski c36a53fdcb Add new non-readable Canvas formats: depth16, depth24, depth32f, depth24stencil8, and depth32fstencil8.
--HG--
branch : minor
2017-04-11 18:34:04 -03:00
Alex Szpakowski 018a3831cb Add a new “stencil8” pixel format for Canvases (resolves issue #1003).
Also fixed Canvas MSAA (resolves issue #1271).

stencil-formatted Canvases can’t be drawn, and can only be used as the value for a new ‘depthstencil’ field to the table-argument variant of love.graphics.setCanvas.

--HG--
branch : minor
2017-04-11 00:00:22 -03:00
Bart van Strien b205b8a020 Remove references to old LOVE_ENABLE_module_implementation defines
As far as I know they are no longer used, as autotools was the primary (only)
user and it now switches entire modules.
I've also taken the opportunity to clean up the default list in
src/common/config.h.
Oh yeah, and this fixes linux builds not having graphics or audio backends.

--HG--
branch : minor
2017-03-30 19:09:15 +02:00
Alex Szpakowski 43fea45f9f Fix a memory leak when pushing love objects to threads which never load that object’s module (resolves issue #1267).
Also fix Variant assignment operator to call release() on the correct object.

--HG--
branch : minor
2017-03-12 13:20:35 -03:00
Alex Szpakowski 66b299822a Array textures can be easily drawn without a shader (resolves issue #1111).
Added love.graphics.drawLayer(texture, layerindex, …). ‘texture’ must be an array texture.
Added SpriteBatch:add/setLayer.

Added Quad:get/setLayer. This applies to array textures that are drawn without specifying an explicit layer index in the draw call.

Added love.graphics.newQuad variants which have layer arguments.

--HG--
branch : minor
2017-02-26 17:11:22 -04:00
Alex Szpakowski 73fd45558b Implement Array, Cubemap, and Volume texture types (issue #1111).
- Add love.graphics.newArrayImage, newCubeImage, and newVolumeImage.
- Add love.graphics.newCanvas(w, h, layers) and newCanvas(w, h, layers, settings). Add ‘type’ field to the settings table of newCanvas.

- Add new love.graphics.setCanvas variants: setCanvas(canvas, slice), and setCanvas(canvastable) where canvastable is in the format: {{canvas1, layer=2}, {canvas2, face=5}}

- Add Texture:getTextureType, getDepth, getLayerCount, getMipmapCount, and getFormat.

- Remove Image:getData and Image:refresh.
- Add Image:replacePixels(imagedata [, slice] [, mipmap]).

- Update Canvas:newImageData to accept a slice argument.

- Add love.image.newCubeFaces(imagedata).

--HG--
branch : minor
2017-02-20 14:58:13 -04:00
Bart van Strien 03b863d788 Simplify love.audio's Pool class
Move most logic back to Source. Pool now simply contains a list of playing
sources and a mutex. Also gets rid of the pause/pauseAtomic duplication in
Source, since it can now request a lock from Pool itself.

--HG--
branch : minor
2017-02-11 21:41:22 +01:00
Raidho 6ea1ebde9c Data:clone ported to minor
minor tweaks

--HG--
branch : minor
2017-02-10 06:19:53 +03:00
Alex Szpakowski a6669a8bb2 Merge default into minor
--HG--
branch : minor
2017-01-21 12:06:35 -04:00
Bart van Strien 2aff0b1199 Remove executable bit from source files 2017-01-15 20:21:38 +01:00
Alex Szpakowski c5b7a07064 Merge default into minor.
--HG--
branch : minor
2017-01-12 22:52:24 -04:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Alex Szpakowski a986f5e825 Fix iOS build
--HG--
branch : minor
2017-01-01 12:13:17 -04:00
Alex Szpakowski d26002f5cc Revamped and streamlined retina / high-DPI support (resolves issue #1122).
With the highdpi window flag enabled on a retina-capable display and OS, content should now appear to the user at the same size and in the same positions as with the flag disabled.

As a result, mouse and touch coordinates, Texture and graphics dimensions, and the graphics coordinate system now use pixel density-scaled units instead of pixels. Raw pixel units should generally only be used for things such as shader algorithms which execute per-pixel and rely on accurate pixel dimensions. love.window.fromPixels and friends typically don’t need to be used anymore.

Images, Canvases, and Fonts can have an optional explicit ‘pixel density’ set when creating them. This allows for easily loading high pixel density content which displays at the same size as regular or low pixel density content.

API changes:

- Added Texture:getPixelWidth/getPixelHeight/getPixelDimensions and Texture:getPixelDensity. Texture:getWidth/getHeight return the pixel density-scaled width and height (as it will appear on the screen when drawn) rather than the number of pixels on each texture dimension.

- Added love.graphics.getPixelWidth/getPixelHeight/getPixelDimensions.

- Added optional ‘pixeldensity’ field to the settings table parameter of love.graphics.newImage. It defaults to 1, or if the file the Image was loaded from has “@2x”, “@3x”, etc. at the end of its name, it uses that number as the pixel density scale by default.

- love.graphics.newCanvas now takes a table as its third parameter, with fields “format”, “msaa”, and “pixeldensity”. pixeldensity defaults to the main screen’s pixel density. The width and height parameters specify the visual size that the Canvas will be drawn at / can be drawn to (pixel density-scaled units).

- love.graphics.newVideo accepts a table as its second parameter, with optional fields “audio” and “pixeldensity”. pixeldensity defaults to 1.

- love.graphics.newFont variants have an optional pixeldensity parameter at the end of the argument list. For TrueType fonts this defaults to the current pixel density scale of the screen, and for BMFonts and ImageFonts this defaults to 1.

- Added Font:getPixelDensity.

- Renamed love.window.getPixelScale to love.window.getPixelDensity.

--HG--
branch : minor
2016-12-29 23:55:51 -04:00
Alex Szpakowski 8aa6725039 Cleaned up some duplicated pixel format-related code in Font files.
--HG--
branch : minor
2016-12-29 02:45:27 -04:00
Alex Szpakowski 4ef91ed79f Use SIMD SSE functionality when available for 4x4 matrix multiplies. Slightly improves performance of large numbers of love.graphics.draw(texture) calls.
--HG--
branch : minor
2016-12-28 04:05:52 -04:00
Alex Szpakowski 19aee7e75c Minor optimizations to love.graphics.draw(texture).
--HG--
branch : minor
2016-12-28 01:24:21 -04:00
Alex Szpakowski 0d2e08baff Implement automatic batching for points, lines, shapes, and images/quads.
The above are batched together into a single draw call when called without other drawing calls in between, as long as the following criteria are met:

- The texture is the same.
- The primitive type is the same (points cannot be batched with non-points).
- The love.graphics state is the same (aside from the current color - i.e. setColor - and the transform state).
- The active shader’s uniform values are the same.

You can examine the ‘drawcalls’ field of love.graphics.getStats() to help determine if your code is allowing for optimum batching.

--HG--
branch : minor
2016-12-27 21:02:58 -04:00
Bart van Strien 77949030e2 Fix various spelling mistakes (mostly in luasocket)
Thanks to Alexandre Detiste for reporting them
2016-12-21 09:54:37 +01:00
Alex Szpakowski 0a8c6f3ee6 Cleaned up some love.graphics code.
--HG--
branch : minor
2016-12-10 23:46:00 -04:00
Alex Szpakowski d7feb20df9 Remove love.timer SDL implementation files, since they don’t do anything.
--HG--
branch : minor
2016-12-10 16:21:48 -04:00
Bart van Strien 7bd3581a52 Merge dynamiccore2 into minor
Instead of a global type enum and bitfield, all types now have their own
love::Type static member. This means they automatically assign their ids, build
their bitsets, etc. As a bonus, it simplifies wrapper code since most functions
already know which type they're pushing to or getting from lua, so they can
directly get the static member (if it's called 'type').

--HG--
branch : minor
2016-11-30 22:38:30 +01:00
Bart van Strien 06f4d6363e Move all love::Type initialisation to their respective (new) files
Previously Data, Stream, Drawable and Image (and for some reason Filesystem) had types in types.cpp

--HG--
branch : dynamiccore2
2016-11-30 12:55:08 +01:00
Alex Szpakowski cc1ea70272 Fix indentation
--HG--
branch : minor
2016-11-27 22:57:23 -04:00
Alex Szpakowski 0a3adc0839 Unify pixel format enums for ImageData, CompressedImageData, and Canvas into a single PixelFormat enum.
Replace love.graphics.getRawImageFormats and love.graphics.getCompressedImageFormats with love.graphics.getImageFormats.

--HG--
branch : minor
2016-11-27 22:53:23 -04:00
Bart van Strien 24a7a3d367 Merge minor into dynamiccore2
--HG--
branch : dynamiccore2
2016-11-26 22:19:12 +01:00
Alex Szpakowski 92774b759b Fix line and shape segment counts and smooth line antialiasing when love.graphics.applyTransform and replaceTransform are used.
--HG--
branch : minor
2016-11-25 19:59:48 -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 99a3653d10 Merged in rcoaxil/love-patches/minor-mic-input (pull request #68)
Microphone input implemented.

--HG--
branch : minor
2016-11-20 13:51:49 +00:00
Bart van Strien de29986d38 Minor performance tweaks for love::Type
On my system these tweaks restore performance to "enum" levels

--HG--
branch : dynamiccore2
2016-11-16 14:45:06 +01:00
Bart van Strien 9f6aa716fa Pass Type to luax_register_type by pointer instead of reference
Since the type is passed to va_start, and apparently that's undefined behaviour if it's a reference.

<Textmode> the best kind of behavior

--HG--
branch : dynamiccore2
2016-11-14 21:51:47 +01:00
Bart van Strien d967a755e5 Make love::Type handle type names
TODO: Fix undefined behaviour in luax_register_type, you can't use a va_list after a reference type

--HG--
branch : dynamiccore2
2016-11-14 21:06:53 +01:00
Bart van Strien 5d43c9601a Automatically deduce the type in luax_pushtype, if possible
--HG--
branch : dynamiccore2
2016-11-13 17:38:42 +01:00
Bart van Strien 7dd960619d Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype
--HG--
branch : dynamiccore2
2016-11-13 17:13:40 +01:00
Bart van Strien 4a0a90e511 Include int.h to fix windows build
--HG--
branch : dynamiccore2
2016-11-13 16:51:27 +01:00