Commit Graph

3033 Commits

Author SHA1 Message Date
Alex Szpakowski e445c50af8 Fix stenciling…
--HG--
branch : minor
2017-01-05 20:22:50 -04:00
Alex Szpakowski 5243fb5a85 Allow disabling stencil capabilities for the main screen in love.window.setMode.
--HG--
branch : minor
2017-01-05 19:40:18 -04:00
Alex Szpakowski 3adc9b45be Fix captureScreenshot when MSAA is used on iOS
--HG--
branch : minor
2017-01-05 14:50:03 +00:00
Alex Szpakowski a653bfa104 Minor batching fixes and performance improvements
--HG--
branch : minor
2017-01-04 22:57:56 -04:00
Alex Szpakowski 551dc423a2 Improved performance slightly when love.graphics.setColor is used heavily with automatic batching.
--HG--
branch : minor
2017-01-03 23:49:29 -04:00
Alex Szpakowski 8899c03651 Add C++ side support for unsigned int shader uniforms. Note that the shader languages love currently supports (glsl 1.20, glsl es 1.00) don’t support uints at the moment.
--HG--
branch : minor
2017-01-02 20:41:07 -04:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Alex Szpakowski bdd51d547f Minor code cleanup
--HG--
branch : minor
2017-01-02 01:21:22 -04:00
Alex Szpakowski 548293e100 Don’t call unnecessary OpenGL APIs in love.graphics.setColor
--HG--
branch : minor
2017-01-02 01:02:15 -04:00
Alex Szpakowski 66749e874f love.graphics Video code is upwards-compatible with GL3.
--HG--
branch : minor
2017-01-01 21:58:13 -04:00
Alex Szpakowski 75fbc210dc Work around crappy Android NDK
--HG--
branch : minor
2017-01-01 13:06:31 -04:00
Alex Szpakowski a986f5e825 Fix iOS build
--HG--
branch : minor
2017-01-01 12:13:17 -04:00
Alex Szpakowski f12596dd19 More code restructuring.
Move all love.graphics functionality that doesn’t call OpenGL out of the OpenGL backend Graphics class.

--HG--
branch : minor
2016-12-30 18:36:54 -04:00
Alex Szpakowski d94b363b39 Move more love.graphics backend-agnostic module code out of the opengl implementation file.
--HG--
branch : minor
2016-12-30 14:32:11 -04:00
Alex Szpakowski c7419e0e37 Move most graphics Font code out of the opengl subfolder.
--HG--
branch : minor
2016-12-30 14:19:07 -04:00
Alex Szpakowski 1383248876 … typo fix
--HG--
branch : minor
2016-12-29 23:59:42 -04:00
Alex Szpakowski bfd1b86059 Add love.graphics.getPixelDensity, gets the pixel density scale of the screen (matches other APIs).
--HG--
branch : minor
2016-12-29 23:59:25 -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 4a3889ae48 Use automatic batching for love.graphics.print/printf.
This doesn’t actually improve performance at all in most cases, but it does remove some OpenGL-specific code from the Font files, and reduces the amount of duplicated rendering code. This makes it slightly easier to add support for Core Profile OpenGL 3.

--HG--
branch : minor
2016-12-29 00:25:14 -04:00
Alex Szpakowski 52b7b0f80d Unify separate GL/GLES code paths for love’s built in matrices in shaders.
--HG--
branch : minor
2016-12-28 19:32:43 -04:00
Alex Szpakowski 80f269d252 Improve performance of Shader:send when the Shader is not active.
It now defers uploading the uniforms to the program object until the shader becomes active again, instead of activating the shader program and deactivating it each time Shader:send is called.

--HG--
branch : minor
2016-12-28 16:24:57 -04:00
Alex Szpakowski a78fa39113 Added “none” blend mode. This is equivalent to setBlendMode(“replace”, “premultiplied”) (which also effectively disables blending) but doesn’t require explicitly setting the alpha multiplication mode.
--HG--
branch : minor
2016-12-28 12:32:37 -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 5fc076a8fb Fix compilation on iOS
--HG--
branch : minor
2016-12-28 02:36:31 -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 a6a7f03b3a Fix more Windows compilation issues
--HG--
branch : minor
2016-12-27 23:23:57 -04:00
Alex Szpakowski 603c3e43d5 Moved line and shape drawing code out of the opengl folder, since it no longer directly calls any OpenGL functions.
--HG--
branch : minor
2016-12-27 23:21:25 -04:00
Alex Szpakowski 70df473680 Fix compilation in VS2013.
--HG--
branch : minor
2016-12-27 22:48:43 -04:00
Alex Szpakowski 3c1d4304b1 Is MSVC happy with this?
--HG--
branch : minor
2016-12-27 22:03:08 -04:00
Alex Szpakowski 94d169dc85 Add missing files to CMakeLists
--HG--
branch : minor
2016-12-27 21:33:19 -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
Alex Szpakowski f98b7ce1ed Fix ImageData:paste.
--HG--
branch : minor
2016-12-18 00:09:11 -04:00
Alex Szpakowski 2a47a8c9e2 Revert most render pass API changes. The APIs need more work and iteration before they’re better to use than the old setCanvas APIs.
love.graphics.captureScreenshot has not been reverted.

--HG--
branch : minor
2016-12-11 16:33:05 -04:00
Alex Szpakowski 0a8c6f3ee6 Cleaned up some love.graphics code.
--HG--
branch : minor
2016-12-10 23:46:00 -04:00
Alex Szpakowski 1e24a19bea Fix compilation..
--HG--
branch : minor
2016-12-10 16:25:09 -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
Alex Szpakowski b620f32200 Work around SDL issues in Joystick:getGamepadMapping with XInput controllers (issue #1239).
This doesn’t fix the underlying issues in SDL so there may be other aspects of love.joystick which are still affected.

--HG--
branch : minor
2016-12-10 16:14:14 -04:00
Alex Szpakowski 8e2d9c5138 Minor code style cleanup. Fix a couple compiler warnings.
--HG--
branch : minor
2016-12-03 17:23:46 -04:00
Alex Szpakowski 7d68a72d5f Add audio Filter files to the Xcode project
--HG--
branch : minor
2016-12-03 16:35:12 -04:00
Raidho 332ba76e62 Implement audio filters
Use Source:setFilter(type, params...) to set a filter.
Use Source:setFilter() to detach the current filter.
Use Source:getFilter() to get the currently set filter (or nil).

Squashed from pull request 27, and the clean-pr27 branch in love-experiments.

--HG--
branch : minor
2016-12-03 20:54:48 +01:00
Bart van Strien e5aad03f2d Update changelog
--HG--
branch : minor
2016-12-02 23:53:10 +01:00
Bart van Strien cac5a3519a Fix automatically pausing and resuming audio on android (resolves #1237)
--HG--
branch : minor
2016-12-02 13:59:21 +01:00
Bart van Strien 67d3146229 Fix love.audio.play{sources...} so it can resume paused sources
--HG--
branch : minor
2016-12-02 13:57:20 +01:00
Alex Szpakowski 0126f7986a Add missing files to the Xcode project
--HG--
branch : minor
2016-11-30 18:04:10 -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 9aa921ef4c Add new files to cmakelists
--HG--
branch : dynamiccore2
2016-11-30 13:24:11 +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