Commit graph

19560 commits

Author SHA1 Message Date
Ben Richards
b5f775ee2e Add ParticleEmitter rendering and add lighting support.
Also fix some omitted mixin documentation.
2024-06-17 18:49:08 +12:00
Ben Richards
0243cfaa4d Support tintFill in tinter node input to SubmitterQuad. 2024-06-17 16:40:46 +12:00
Ben Richards
9994bc9270 Add Blitter rendering and extend SubmitterQuad to be more flexible. 2024-06-17 16:25:38 +12:00
Ben Richards
04f927badf Make Lighting more flexible. 2024-06-17 14:22:26 +12:00
Ben Richards
8321866151 Add NineSlice rendering. 2024-06-14 17:23:11 +12:00
Ben Richards
8652532d4a Rename SubmitterImage et al to SubmitterQuad and support elements.
This reflects the fact that game objects may render many quads at once.
2024-06-14 17:22:22 +12:00
Ben Richards
9f27366fb0 Fix WebGL rendering compatibilities with DOMElement and Extern. 2024-06-14 14:42:17 +12:00
Ben Richards
f1d7d24f4d Prevent unintended VAO modifications when modifying global GL state. 2024-06-14 12:46:24 +12:00
Ben Richards
07747d2e18 Use more configurable RenderNodes, and add Lighting component. 2024-06-13 16:26:52 +12:00
Ben Richards
5ad6cc599b Fix tint interpolation in quads.
And anything else that depends upon triangle vertex order.
2024-06-12 21:14:24 +12:00
Ben Richards
0f2d223f1f Use generic vertex buffer. 2024-06-11 19:13:13 +12:00
Ben Richards
ff71ee8419 Associate data and data views with buffers. 2024-05-31 21:20:31 +12:00
Ben Richards
d9c483e684 Update const.js 2024-05-31 13:11:35 +12:00
Ben Richards
28e1008c74 Add documentation and tweaks to Light render nodes.
Override `LightBatchHandler.updateTextureCount` because it inherits a
function which does unnecessary shader recompilation.
Allow LightBatcher to take a config.
2024-05-30 21:16:21 +12:00
Ben Richards
34736ce1f8 Add Light rendering.
Use `gameObject.setRenderNode('LightBatcher')` to assign the render node.
2024-05-29 21:10:13 +12:00
Ben Richards
5c4d978556 Add onRunBegin and onRunEnd to RenderNodes.
Also make `manager` available in `BatchHandler._copyAndCompleteConfig`.
2024-05-29 21:07:04 +12:00
Ben Richards
82738c78f2 Fix BatchHandler affecting unintended VAOs. 2024-05-29 21:01:08 +12:00
Ben Richards
d1a38d55c0 Remove renderer from RenderNode parameters.
It's easy to access via the manager parameter.
2024-05-28 19:36:03 +12:00
Ben Richards
7e16caeed7 Make render nodes customizable.
Game objects can now change their render node, in place of a pipeline.
Render nodes can be created with custom values,
to change their behavior or relationships.
Several nodes are renamed.
Program Wrapper now supports defining layouts with strings instead of
GLenums, to facilitate render node customization.
2024-05-27 18:32:34 +12:00
Ben Richards
9940554eba Optimize Program Wrapper. 2024-05-21 14:49:24 +12:00
Ben Richards
fedf494a4c Fix FillRect.
It wasn't updated to the latest batch paradigm. This fixes camera
fill, flash, and fade.
2024-05-20 17:03:41 +12:00
Ben Richards
261399642e Increase batch size to 16384.
This is the natural limit of 16-bit unsigned integer vertex indexes.
2024-05-17 17:17:49 +12:00
Ben Richards
6bbfde50da Use transformed elements instead of instanced rendering.
There is simply no good way to control instanced rendering with batches,
and there is no efficient way to use hardware transform when using
vertices to render.
2024-05-17 16:34:04 +12:00
Ben Richards
ce6324837e Transfer texture unit index array to WebGLRenderer.
This makes it universally accessible to any shader.
2024-05-16 12:08:20 +12:00
Ben Richards
8c5abcd060 Fix parallel texture unit check.
It was swapping mobile with desktop preferences, whoops.
2024-05-15 16:41:29 +12:00
Ben Richards
c43a45d985 Allow RenderNodeManager to change parallel texture unit count.
The BatchTexturedTintedRawQuads node listens to this, and will
recompile its shader to the indicated performance strategy.
2024-05-14 17:03:00 +12:00
Ben Richards
d120e0a4b5 Fix invalid create and destroy code in Program Wrapper.
There is no `deleteUniformLocation` command. (Thanks, AI hallucinations!)
2024-05-14 16:14:56 +12:00
Ben Richards
e57ed463b2 Reduce accessor use in VAO wrapper. 2024-05-13 15:25:50 +12:00
Ben Richards
c8c170672d Use sub-batches to handle many textures in batches.
This is the way 3.80 handles things, and is useful for performance on
mobile devices where we might only use 1 texture unit per sub-batch.
2024-05-13 15:23:01 +12:00
Richard Davey
2c1ad33e1a Update const.js 2024-05-02 14:41:51 +01:00
Ben Richards
717bd96879 Fix the last missing data from DrawingContext clones.
I hope.
2024-05-02 18:42:42 +12:00
Ben Richards
e7f1269c12 Fix DrawingContext missing critical data. 2024-05-02 18:36:55 +12:00
Ben Richards
f3d1da68a9 Fix and tidy code.
Fix camera background color not working (a call signature changed).
Fix render graph only recording the last camera
(by adding a synthetic root node to the graph).
2024-05-02 16:47:28 +12:00
Ben Richards
65e69a8369 Unify flipped crop handling. 2024-05-02 14:41:01 +12:00
Ben Richards
ee8ebbdd1c Render Video using the new system. 2024-05-01 18:36:29 +12:00
Ben Richards
f86a353a2d Render Text using the new system.
It may be more correct than ever, now that we've standardised it.
2024-05-01 17:34:23 +12:00
Ben Richards
3140edf0c3 Fix Text UV updates.
Previously, Text didn't update the TextureSource dimensions,
so its UVs were identical to resolution.
They should have been normalized to the 0-1 range.
It used `MultiPipeline.batchTexture` to render, which accommodated
these UVs.
These changes update the dimensions when Text changes its canvas size,
and this makes normalized UVs available.
2024-05-01 15:58:45 +12:00
Ben Richards
48d1164c16 Swap order of src and drawingContext parameters.
This makes the standard `renderWebGL` parameters more similar to their
original state: we're just replacing `camera` with `drawingContext`.
2024-04-30 18:09:25 +12:00
Ben Richards
45e89e4574 Make camera part of DrawingContext, and simplify RenderNode calls. 2024-04-30 16:58:45 +12:00
Ben Richards
9bf0276af9 Improve renderer event handling.
Hook batch rendering into resize events.
Fix context restore:
- Restore VAOs
- Fix Program uniform restore.
2024-04-30 12:14:10 +12:00
Ben Richards
061fd21e5f Disable PipelineManager in WebGLRenderer.
This eliminates a lot of unused resources. Some will be recreated later,
but for now it keeps development simple.
I'm not actually removing it, because I want to reference where it is
used for the moment.
2024-04-30 11:45:04 +12:00
Ben Richards
d8a64110f9 Add camera flash and fade effects. 2024-04-29 17:48:27 +12:00
Ben Richards
a7cc7472a6 Add FillRect render node, and camera background fill.
Also use a TextureWrapper instead of a Frame for quad batching,
which makes this possible.
2024-04-29 17:06:21 +12:00
Ben Richards
d43e45d2a4 Handle blend mode in DrawingContext and use it in ListCompositor. 2024-04-29 15:06:43 +12:00
Ben Richards
ef4731c8b1 Avoid Camera generating unchanged DrawingContext. 2024-04-29 10:21:43 +12:00
Ben Richards
45a73c1d2d Complete canvas clear logic. 2024-04-26 20:34:36 +12:00
Ben Richards
af2e4449a0 Add scissor handling and simplify clearing on DrawingContext.
Clearing was just too complex. It was optimized for edge cases,
and made it hard to create DrawingContexts for multiple cameras
drawing to the same framebuffer.
2024-04-26 19:05:32 +12:00
Ben Richards
a007adf05b Document and add textures to main draw method. 2024-04-26 12:14:38 +12:00
Ben Richards
2c2d856b14 Improve batch texture performance. 2024-04-26 11:20:38 +12:00
Ben Richards
dd2bc50628 Fix batch flushing at texture limit instead of over limit. 2024-04-24 17:05:26 +12:00