Commit Graph

55 Commits

Author SHA1 Message Date
Sasha Szpakowski 64a30f177f Merge branch 'main' into 12.0-development 2024-02-10 12:24:48 -04:00
Sasha Szpakowski 94d5864144 update year for copyright notice 2024-02-10 12:13:22 -04:00
Sasha Szpakowski 8872497561 graphics: handle default textures in high level code.
Previously each backend had to set up default textures with its own code, which needs some care for it to be robust.
2023-12-27 21:28:02 +01:00
Sasha Szpakowski f6cdbdc868 Merge branch 'main' into 12.0-development 2022-12-31 22:46:34 -04:00
Sasha Szpakowski c823dbca96 Update copyright year for 2023 2022-12-31 22:25:49 -04: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 c8038f22df Merge branch 'main' into 12.0-development 2021-12-24 11:35:35 -04:00
Alex Szpakowski bd741a8c78 Fix incorrect particle offsets when Quads are used without setOffset.
Fixes #1741.
2021-11-19 21:44:04 -04:00
Alex Szpakowski 21f5ba86d3 Merge branch 'master' into 12.0-development 2021-04-07 20:33:44 -03:00
Alex Szpakowski f89aabb0bb Update copyright year for 2021 2021-04-04 16:14:45 -03:00
Alex Szpakowski 694d448e83 Vertex shaders can write to gl_PointSize (fixes #1603).
If a shader uses gl_PointSize then it can only be used when drawing points. If a shader doesn't use gl_PointSize then it can't be used when drawing points.

Added 'ConstantPointSize' and 'CurrentDPIScale' built-in shader uniforms.

ConstantPointSize is in DPI-scaled points, whereas gl_PointSize is in pixels, so to get the correct default behaviour a shader needs to do gl_PointSize = ConstantPointSize * CurrentDPIScale
2021-01-23 13:47:12 -04:00
Alex Szpakowski deff795908 Rename some internal buffer enums to better match what they do 2021-01-17 20:59:16 -04:00
Alex Szpakowski 1f9d98263d Refactor Buffer internals.
Allows buffers created with love.graphics.newBuffer to only allocate VRAM data. Previously they had a copy of their contents in RAM.
Also makes it easier to implement Buffers in other graphics APIs and to implement more types of Buffers in the future.
2020-12-22 19:23:02 -04:00
Alex Szpakowski 7fbb68e90e Merge branch '12.0-development' into GraphicsBuffer 2020-02-28 23:10:21 -04:00
Alex Szpakowski 9425c9224b Rename internal batched draw code to be more clear 2020-02-27 20:08:50 -04:00
Alex Szpakowski 1ddfcd4cc8 Always use explicitly typed buffers, even in internal code 2020-02-23 16:30:55 -04:00
Alex Szpakowski 2572f0c7a1 Meshes expose GraphicsBuffers, part 2 2020-02-01 15:39:59 -04:00
Alex Szpakowski ee5304ba53 Remove vertex namespace 2020-01-13 20:41:05 -04:00
Alex Szpakowski b0232a4a6b Initial work on unified graphics buffers representing different types of data. 2020-01-12 16:41:23 -04:00
Alex Szpakowski fc4847c69d Update copyright for the new year 2020-01-03 22:40:36 -04:00
Alex Szpakowski 9ab2a94037 Rename internal C++ Color struct to Color32 to help differentiate it from Colorf. 2019-09-14 23:13:40 -03:00
Alex Szpakowski 55d4dc0f9e Restructure some internal vertex buffer binding code to be closer to how graphics APIs actually behave. 2019-08-25 16:50:15 -03:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Alex Szpakowski ac52666c6f Rename ParticleSystem:setAreaSpread to setEmissionArea, and move the functionality from setAreaSpreadAngle/setAreSpreadIsRelativeDirection into setEmissionArea. Resolves issue #1311. 2018-01-13 21:11:07 -04:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Alex Szpakowski f7b2598490 Remove unnecessary internal constructor arguments. 2017-12-24 22:08:57 -04:00
Alex Szpakowski a31b500b03 Simplify quad drawing code, and use glDrawElementsBaseVertex when available. 2017-12-24 22:05:10 -04:00
Alex Szpakowski 3fb621af95 Always use a 16 bit index array for quad indices, with multiple draws when necessary. See issue #1356. 2017-12-24 15:54:03 -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 e3fd489373 Abstracted lower level drawing code, moved all type-specific drawing code out of opengl backend, deleted obsolete files
--HG--
branch : minor
2017-10-26 20:58:19 -03:00
Alex Szpakowski 15cc540e4c Make internal vertex attribute code less OpenGL-specific.
--HG--
branch : minor
2017-10-25 23:12:39 -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
Bart van Strien 7dae80f552 Fix return type of ParticleSystem:getAreaSpreadIsRelativeDirection, remove optional parameters from ParticleSystem:setAreaSpread (resolves #1340)
I opted to remove the optional parameters altogether since they seemed oddly
out-of-place. They used to reset the values to defaults when not supplied, and
they also weren't returned by getAreaSpread(), so
setAreaSpread(getAreaSpread()) actually changed spread parameters.

The other option was to remove the separate getters/setters for
AreaSpreadIsRelativeDirection and AreaSpreadAngle, and fully rely on
setAreaSpread for these parameters, but the rest of the ParticleSystem API
tends to keep parameters separate.

--HG--
branch : minor
2017-09-12 12:40:21 +02:00
Alex Szpakowski 864147c38c love.graphics: move more platform-independent code out of the opengl backend
--HG--
branch : minor
2017-07-22 23:34:39 -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 955fb9b60c Fixed love.graphics.draw(particlesystem, …) to actually use the transformation parameters.
--HG--
branch : minor
2017-05-17 18:51:42 -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 7fdea9a5d1 Merged in lognz/love-minor2/particle system new features (pull request #85)
Particle System New Features

--HG--
branch : minor
2017-03-11 14:52:01 +00:00
lognz 9f2ac304e3 Corrected angle not factoring setDirection() into spawn angle
--HG--
branch : particle system new features
2017-03-11 08:13:12 +00:00
lognz 0f99f261e0 Particle System new features
2 new Particle System Distribution types:

borderellipse - spawns new particles around the border of an elllipse shape defined by dx,dy
borderrectangle - spawns new particles around the border of a rectangle shape defined by dx, dy

New functions:

getAreaSpreadAngle()
getAreaSpreadIsRelativeDirection()
setAreaSpreadAngle(angle in radians)
setAreaSpreadIsRelativeDirection(boolean)

setAreaSpread(distribution, x, y, (optional)angle, (optional)isRelativeDirection)

- angle - defaults 0. In radians the angle to rotate the entire area spread distribution
- isRelativeDirection - defaults false. When false, particles will travel in the direction defined by setDirection(). When true, particles will travel away from the center of the area spread shape

Demo: http://i.imgur.com/sBQ9Xhr.png

The new angle parameter should address: https://bitbucket.org/rude/love/issues/1172

--HG--
branch : particle system new features
2017-03-11 01:54:26 -06:00
lognz 09b757f018 2 new area particle distributions: borderellipse and borderrectangle
--HG--
branch : particle system new features
2017-03-10 06:42:52 -06:00
Alex Szpakowski a8e4db8e1e Clamp color arguments to [0, 1] in cases where we don’t support values outside of that range internally.
--HG--
branch : minor
2017-03-09 21:15:56 -04: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 d990044288 love.graphics internal Buffer objects are no longer OpenGL-specific.
--HG--
branch : minor
2017-01-28 19:26:57 -04:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04: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 c761202486 Build type information on first use (load-time), instead of using a hardcoded list
--HG--
branch : dynamiccore2
2016-11-13 16:38:57 +01:00
Alex Szpakowski 60d90ca4a8 Merge default into minor
--HG--
branch : minor
2016-10-30 01:07:39 -03:00
Nathan Korth 53c528aa44 Add 'ellipse' distribution to ParticleSystem 2016-10-28 16:26:28 -04:00