Commit Graph

62 Commits

Author SHA1 Message Date
Alex Szpakowski 6c447ab4f6 Clean up some common Image and Canvas code. 2020-02-01 23:54:51 -04:00
Alex Szpakowski 23bc1a7aae Add new mesh data formats: int32, uint32, [u]int8, [u]int16, snorm8, and snorm16.
Integer formats for vertex attributes are only supported in glsl3 shaders. They use ivec/uvec types in glsl.

--HG--
branch : minor
2020-01-11 22:24:38 -04:00
Alex Szpakowski 5f9b5a21d0 Merge default into minor
--HG--
branch : minor
2020-01-03 22:45:36 -04:00
Alex Szpakowski fc4847c69d Update copyright for the new year 2020-01-03 22:40:36 -04:00
Alex Szpakowski b41f1316fa Add love.graphics.setBlendState, which sets the lower level blend operation and factor values which higher level blend modes are based on.
--HG--
branch : minor
2019-12-27 09:57:42 -05:00
Alex Szpakowski efa2bd7837 Consolidate some internal graphics state definitions into a new renderstate file.
--HG--
branch : minor
2019-12-26 23:07:51 -05:00
Alex Szpakowski 5c01289300 Fix love.graphics.getTextureTypes to return a table with boolean values instead of number values. 2019-07-13 21:58:01 -03:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Alex Szpakowski dc5e43adf3 Split wrap_Graphics.lua into two files to work around VS2013's 16kB limit for raw string literals. 2018-12-13 22:34:30 -04:00
Bart van Strien 7253118100 Make and use a vector variant of luax_convobj
Which also prevents accessing the zeroeth element of an empty vector
2018-12-03 18:19:28 +01:00
Josh Grams cca5af66e8 setCanvas: rephrase confusing error message. 2018-09-21 08:32:27 -04:00
bjornbytes 1916c2a5fa Fix getCanvas for cube canvases; 2018-02-11 22:09:14 -08:00
Alex Szpakowski d37c53584e Fixed the mipmaps flag in love.graphics.newImage; cleaned up a bit of vector code in love.math.isConvex. 2018-01-28 22:32:40 -04:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Alex Szpakowski dd59803ad3 Error when invalid setting names are used in the tables passed to love.graphics.newCanvas and newImage. See issue #1312. 2017-12-28 23:16:51 -04:00
Alex Szpakowski 7ff428b64f Fix love.graphics.newImage(compressedimagedata, settings) to respect the mipmaps boolean flag instead of always using the compressed texture's mipmaps if it has any. 2017-12-27 11:03:32 -04:00
Alex Szpakowski 7354de2059 Add (low level) functionality to allow rendering 3D Meshes.
- Add love.graphics.setDepthMode(testcomparison, enablewrites).
- Add love.graphics.setMeshCullMode.
- Add love.graphics.setFrontFaceWinding.

Depth testing and depth writes require a depth buffer to work. The mesh cull mode controls whether front/back faces of a mesh are culled. The front face winding determines whether a clockwise or counterclockwise-oriented face in a mesh is considered front facing.

--HG--
branch : minor
2017-12-09 23:34:08 -04:00
Alex Szpakowski cbcb1a8606 Allow a depth/stencil canvas to be active without a color canvas.
--HG--
branch : minor
2017-12-03 19:33:48 -04:00
Alex Szpakowski 82553d793d Clamp colors in love.graphics.newMesh. I missed this one in my previous commit.
--HG--
branch : minor
2017-11-25 10:23:29 -04:00
Alex Szpakowski 6dea2ab714 Clamp all color arguments to [0, 1] in cases where values outside that range don't make sense (fixed-point color values & sRGB colors). Closes issue #1315.
--HG--
branch : minor
2017-11-21 19:49:52 -04:00
Alex Szpakowski 7a2e52b12d Cleaned up some vertex data-related code.
--HG--
branch : minor
2017-10-22 12:33:47 -03:00
Alex Szpakowski e5b0d96b27 Restructured some Shader code. Added runtime temporary caching and sharing of shader stages. Resolves issue #1235.
--HG--
branch : minor
2017-10-21 03:08:18 -03:00
Bart van Strien 9e4374935d Show (short) list of possible enum values when an invalid value is encountered (resolves #1318)
All enum errors have (hopefully) been changed to a luax_enumerror, which has a
fixed error message. If additionally a list of valid options is passed, it
lists that in the error message. For every enum error with few options I've
implemented this using a getConstants call.

This solution has been designed specifically to reduce the number of template
instantiations (as I've been told that was a concern). All new template code
happens in places where there already was an instantiation of the relevant
StringMap. Of course there is still std::vector<std::string>...

--HG--
branch : minor
2017-10-02 17:11:53 +02:00
Alex Szpakowski b838d0de54 Simplified an internal Variant constructor to be more intuitive to use.
--HG--
branch : minor
2017-09-30 10:39:24 -03:00
Alex Szpakowski 8068b0f1d4 Add variant of love.graphics.captureScreenshot which takes a Channel argument.
--HG--
branch : minor
2017-09-30 10:25:14 -03:00
Alex Szpakowski bdf961e174 Improve the error message when bad values are given to love.graphics.line. Resolves issue #1345.
--HG--
branch : minor
2017-09-24 16:19:39 -03:00
Alex Szpakowski 844900db39 Rename all cases of 'pixel density' to 'DPI scale' in love's APIs.
--HG--
branch : minor
2017-09-24 16:09:05 -03:00
Bart van Strien 77663ed847 Replace love.graphics.pop("all") with love.graphics.getStackDepth (resolves #1248 again)
The pop("all") api was a bit awkward, especially considering there's a
push("all") that does something else. I think any use case that benefited from
pop("all") benefits from getStackDepth just as much if not more. There is also
additional functionality, like being able to find the source of a mismatched
push/pop.

--HG--
branch : minor
2017-09-23 10:56:54 +02:00
Alex Szpakowski 4ee85e1793 love get* APIs which return tables with fields can optionally accept a table argument to fill in, instead of creating a new table.
--HG--
branch : minor
2017-09-22 19:47:55 -03:00
Bart van Strien a2ad1b462f Add love.graphics.pop("all"), which pops the entire stack (resolves #1248)
--HG--
branch : minor
2017-09-18 14:31:51 +02:00
Alex Szpakowski 8a77ea1007 Improve the error message when a type other than a table is given as the 3rd arg to newCanvas.
--HG--
branch : minor
2017-09-16 20:01:48 -03:00
Muh Muhten dda0200ffe Use proper type checking for coordinate arguments in love.graphics.points/line/polygon. Resolves issue #1325.
--HG--
branch : minor
2017-08-27 21:31:41 -03:00
Alex Szpakowski 9d0e984c3d Add love.filesystem.getInfo. Deprecate love.filesystem.exists/isDirectory/isFile/isSymlink/getLastModified/getSize. Resolves issue #641.
--HG--
branch : minor
2017-08-27 18:14:54 -03:00
Alex Szpakowski fee157b6b9 Functions that take a boolean argument now properly type-check for it.
--HG--
branch : minor
2017-08-14 22:56:20 -03:00
Alex Szpakowski 01c091882a Fix love.graphics.newImage(ImageData). Thanks Santos!
--HG--
branch : minor
2017-08-07 18:53:40 -03:00
Alex Szpakowski 2dd6408d00 Images/[Compressed]ImageData can be created using any Data, instead of just files or FileData.
--HG--
branch : minor
2017-08-05 23:55:20 -03:00
Alex Szpakowski 84d5d8b636 Move decoder-agnostic love.image code out of the magpie backend folder.
--HG--
branch : minor
2017-08-01 23:22:24 -03:00
Alex Szpakowski 217552b5ff love.graphics.newShader can accept File and FileData arguments (resolves issue #1308).
--HG--
branch : minor
2017-08-01 18:35:35 -03:00
Alex Szpakowski 17cf7bba83 Cleaned up love.graphics.newShader's wrapper code a bit.
--HG--
branch : minor
2017-07-29 23:09:45 -03:00
Alex Szpakowski 5ef6730497 Added a variant of love.graphics.captureScreenshot which takes a single filename parameter. Resolves issue #1293.
--HG--
branch : minor
2017-07-29 12:54:53 -03:00
Alex Szpakowski b3d4443f9d Added 'drawcallsbatched' field to the table returned by love.graphics.getStats.
It has the number of draw calls that were saved by auto-batching.

--HG--
branch : minor
2017-07-23 01:58:25 -03:00
Alex Szpakowski c37e9ed6bf Use vector2 arrays instead of raw float arrays for graphics primitives. Simplifies the code a bit.
--HG--
branch : minor
2017-07-23 01:49:27 -03:00
Alex Szpakowski 34ebe18f14 Use luaL_check/optinteger instead of luaL_check/optnumber when getting integer arguments to functions. Resolves issue #1251.
--HG--
branch : minor
2017-07-16 12:17:50 -03:00
Alex Szpakowski 54a049e206 Restructured internal code for graphics capabilities. Added love.graphics.getTextureTypes which returns a table of Texture Type to boolean supported fields.
--HG--
branch : minor
2017-06-27 22:26:30 -03:00
Alex Szpakowski 45de7cebb6 Cleaned up some graphics code.
--HG--
branch : minor
2017-06-10 15:09:33 -03:00
Alex Szpakowski 9fe81ad922 Allow a temporary/internal depth buffer to be used when a Canvas is active, similar to how temporary stencil buffers are allowed.
Syntax is setCanvas{canvas [, depth=true, stencil=true]} or setCanvas{canvas, depthstencil=true}.

--HG--
branch : minor
2017-06-10 14:25:22 -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 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
Alex Szpakowski 7161d600b7 Add mipmapping support to Canvases.
- Added an optional mipmap index argument to the non-table variant of love.graphics.setCanvas, and an optional ‘mipmap’ field to the table variant.
- Canvas:setMipmapFilter now works.
- Added Canvas:generateMipmaps.
- Added Canvas:getMipmapMode.
- Added a new ‘mipmaps’ enum field to the table passed into love.graphics.newCanvas. Accepted values are “none” (default), “manual”, and “auto”.

If a Canvas has the manual mipmap mode, you will either need to render to a mipmap level or call Canvas:generateMipmaps. If it has the auto mode, mipmaps will be automatically generated after rendering to that Canvas. Generating mipmaps is not free.

--HG--
branch : minor
2017-04-15 01:58:03 -03:00