Commit graph

198 commits

Author SHA1 Message Date
clayjohn
cfd5fe0f29 Avoid crash when CanvasTexture used with light decal atlas
The decal atlas is used for Light2Ds, decals, and Light3Ds
2023-01-30 20:59:53 -08:00
Rémi Verschelde
fca400450c
Merge pull request #72291 from clayjohn/GL-item-cap
Remove cap on number of items drawn in frame in 2D gl_compatibility renderer
2023-01-29 14:12:38 +01:00
clayjohn
0b28c1f8ed Remove cap on number of items drawn in frame in 2D gl_compatibility render
Also clean up some names to make the overall organization more clear

Also remove cap on items per batch
2023-01-28 20:36:17 -08:00
clayjohn
eb9c2b878a Automatically transform Skeleton2D calculations so pivots are not needed 2023-01-27 14:55:22 -08:00
bruvzg
653799bb38
Fix LCD font AA on OpenGL renderer. 2023-01-26 18:45:18 +02:00
clayjohn
d3c3fa32af Stop incrementing light_count once max number of lights are reached in 2D canvas renderer 2023-01-20 17:04:00 -08:00
clayjohn
faea9f5c10 Remove SCREEN_TEXTURE, DEPTH_TEXTURE, and NORMAL_ROUGHNESS_TEXTURE
in favour of texture hints
2023-01-18 19:52:47 -08:00
jainl28patel
390f83bf5a fix normal map not flipping in sprite2D 2023-01-14 11:51:56 +05:30
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde
676f60b0cc
Merge pull request #70132 from clayjohn/RT-update
Implement render_target_was_used API so that Viewports can properly check if they have been used.
2022-12-17 12:26:51 +01:00
clayjohn
99a159cd9b Transform sdf xfrom by particle emission transform when particles are in global space 2022-12-16 11:55:11 -08:00
clayjohn
1b330820bf Implement render_target_was_used API so that Viewports can properly check if they have been used.
For the RD renderer, this does not work for Viewports used in scene shaders yet
2022-12-16 09:50:45 -08:00
clayjohn
b6a1aa15b1 Use instanced array buffer instead of UBO for canvas item batching
This simplifies the generated shader code which increases both performance and compile time on low end devices
2022-12-15 08:25:44 -08:00
clayjohn
bdd4001ef0 Various fixes and documentation for CanvasGroup
Properly apply custom materials with CanvasGroups in the GLES3 backend

Properly blur backbuffer when using a partial rect in forward_plus and
gl_compatibility renderers

Properly set fit_margin when clear_margin is set

Fix shader error during backbuffer clear in mobile renderer
2022-12-13 10:22:18 -08:00
clayjohn
0a88c68d0a Detect and report if 2D particles use the screen SDF
This ensures that the SDF is updated even if not used in a canvas_item shader
2022-12-07 10:03:08 -08:00
Rémi Verschelde
7ef9947d0e
Merge pull request #68870 from dsnopek/master-webxr-input
Get WebXR fully working in Godot 4!
2022-12-02 12:24:40 +01:00
David Snopek
310bf39cd3 Get WebXR fully working in Godot 4! 2022-12-01 21:46:30 -06:00
clayjohn
f33ffd9ab4 Add Skeletons and Blend Shapes to the OpenGL renderer
This uses a similar multipass approach to blend shapes
as Godot 3.x, the major difference here is that we
need to convert the normals and tangents to octahedral
for rendering.

Skeletons work the same as the Vulkan renderer except the bones
are stored in a texture as they were in 3.x.
2022-11-29 09:45:03 -08:00
clayjohn
535f1adc8d Fix drawing of Mesh2D
The batch was being discarded if no instance buffer was present, but an instance buffer is only needed for MultiMesh and particles.
2022-11-24 13:00:42 -08:00
clayjohn
9ce57050a5 Add GPUParticles to the OpenGL3 renderer.
This includes collision (2D SDF, Box, Sphere, Heightmap),
attraction (Box, Sphere), and all sorting modes.

This does not include 3D SDF collisions, trails, or
manual emission.
2022-11-14 23:28:25 -08:00
Rémi Verschelde
1691a33eb9
Merge pull request #67374 from MrBlockers/fix-draw-primitive
Fix draw_primitive ignoring texture argument
2022-11-11 10:43:18 +01:00
clayjohn
3c1e5003ab Fix pathological corner case in drawing tileset editor
Interleaving draw_rect calls with and without a texture forces every rect to
have its own draw call. In this case it meant that there is a draw call for every single
tile in the atlas. This change makes it so the renderer can batch draw calls
which reduced the draw call count by a factor of 512
2022-11-04 13:04:20 -07:00
Rémi Verschelde
cb1931b271
Merge pull request #67639 from clayjohn/GLES3-2d-shadows
Add 2D shadows and canvas SDF to OpenGL3 renderer
2022-11-02 17:12:20 +01:00
clayjohn
eb07056e70 Add texture reading code to OpenGL3 renderer for web and mobile
This allows using texture_2d_get on all platforms which is needed for the get_image function

This commit also fixes some OpenGL warnings on the Web platform that came from attempting to map a buffer with zero length
2022-11-01 13:42:53 -07:00
clayjohn
2ec234ff67 Add 2D shadows and canvas SDF to OpenGL3 renderer
This is an initial implementation based on the current RD implementation

Performance will improve later
2022-10-28 11:33:23 -07:00
Clay John
e1caa8797b
Merge pull request #67043 from clayjohn/clip_children
Improve behaviour of clip_children by clipping to parent alpha value but still retaining parent color
2022-10-27 09:59:27 -07:00
MrBlockers
0c4fd03f40 Fix draw_primitive ignoring texture argument 2022-10-21 21:35:13 -04:00
Rémi Verschelde
6feded171b Merge pull request #67416 from clayjohn/GLES3-primitive
Fix drawing of 2D primitives in OpenGL3 renderer
2022-10-15 12:56:38 +02:00
clayjohn
6d048af42f Fix drawing of 2D primitives in OpenGL3 renderer
Previously the wrong vertices were used when assembling the second triangle
of a quad
2022-10-14 16:55:14 -07:00
clayjohn
978aa05a99 Fix error in Web builds that resulting in 2D
objects not drawing in the GLES3 backend.

Issue came from not binding a light UBO when using the DISABLE_LIGHTING
code path
2022-10-14 11:18:27 -07:00
clayjohn
b6f44859d7 Implement multiple clip_children modes for CanvasItems 2022-10-14 08:02:28 -07:00
clayjohn
09b1a6f85f Improve behaviour of clip_children by clipping
to parent alpha value, but still retaining
parent color
2022-10-13 18:35:12 -07:00
Rémi Verschelde
367a9b8056 Merge pull request #67335 from clayjohn/GLES3-2d-lights
Add 2D lights to OpenGL3 canvas renderer
2022-10-13 09:05:36 +02:00
clayjohn
e600fb93a5 Add 2D lights to OpenGL3 canvas renderer
This is an initial implementation using the same single-pass approach as the RenderingDevice.
2022-10-12 17:55:01 -07:00
clayjohn
4765e5fa64 Allow clearing backbuffer after finishing CanvasGroup
This avoids an issue where having multiple CanvasGroups overlap
would create a weird artifact
2022-10-07 14:13:40 -07:00
clayjohn
154b9c1c91 Use a giant UBO to optimize performance in 2D
This removes the countless small UBO writes we had before
and replaces them with a single large write per render pass.

This results in much faster rendering on low-end devices
but improves speed on all devices.
2022-10-06 11:24:45 -07:00
Hendrik Brucker
e235bca995 Fix/restore BackBufferCopy 2022-09-15 02:36:39 +02:00
clayjohn
fea48cdfc6 Fix rendering when using WebGL2.
Fixes include using proper depth buffer format in 3D (this had previously been fixed already but the changes were lost in a rebase), Remove unused lighting and shadowing code in 2D, and update 2D UBOs using glBufferSubData so that they remain the appropriate size.
2022-09-06 14:42:08 -07:00
Yuri Rubinsky
8191b3c110 Rename uniform to parameter across the engine 2022-09-01 11:42:57 +03:00
Fabio Alessandrelli
d20b32186f [Web] Rename JavaScript platform to Web.
Also rename export name from "HTML5" to "Web".
2022-08-29 11:52:00 +02:00
bruvzg
bcc3643989
Add font LCD sub-pixel anti-aliasing support. 2022-08-23 08:47:21 +03:00
Max Hilbrunner
019d6584ee
Merge pull request #64167 from clayjohn/screen-texture-hint
Add shader uniform hints for screen textures
2022-08-19 21:51:39 +02:00
clayjohn
028ef2edc8 Add shader uniform hints for screen textures so users can specify custom filter and repeat modes.
At this time, it works best in the Vulkan Renderers as they support using multiple samplers with the same texture.

In GLES3 this feature really only allows you to use the screen texture without mipmaps if you want to save the cost of generating them.
2022-08-09 12:29:49 -04:00
Rafał Mikrut
49632bf993 Check also GLES3 in CI 2022-08-06 19:12:09 +02:00
LinuxUserGD
6e6569aa78 fix 'Comparison result is always the same' warnings 2022-07-29 19:45:22 +02:00
Hugo Locurcio
4b42379c8f
Rename RenderingServer global shader uniform methods to be more explicit
The `global_shader_uniform` name is longer, but it makes it much
easier to find the methods when searching in the class reference.
2022-07-28 18:46:59 +02:00
Rémi Verschelde
199ea349f5
Merge pull request #57698 from bluenote10/feature/rename_translated_to_translated_local 2022-07-28 10:03:07 +02:00
reduz
455c06ecd4 Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.

* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.

These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.

**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00
Fabian Keller
2bf9e6090c rename translate(d) to translate(d)_local in Transform 2D/3D 2022-07-16 11:47:54 +02:00
Bastiaan Olij
ecfcfd97fa Split dependency logic
Split FOG
Split visibility notifier
Final cleanup of storage classes
2022-06-28 00:10:29 +10:00