Commit graph

285 commits

Author SHA1 Message Date
Vladislav Belov
017aa3b736
Adds splitted shader effects to materials
Some checks failed
checkrefs / lfscheck (push) Has been cancelled
checkrefs / checkrefs (push) Has been cancelled
lint / cppcheck (push) Has been cancelled
lint / copyright (push) Has been cancelled
lint / jenkinsfiles (push) Has been cancelled
pre-commit / build (push) Has been cancelled
2026-05-10 23:57:27 +02:00
Vladislav Belov
59e36be140
Splits shader effects to reuse in material passes 2026-05-10 23:57:23 +02:00
Vladislav Belov
aced56c336
Adds material passes to choose different shaders
All shaders were selected by context (set of defines) which increases
the number of needed permutations. For example: we don't need to know
about shadows when rendering silhouettes.
2026-05-10 23:57:16 +02:00
Vladislav Belov
9aee507e28
Adds wireframe techniques for particle and terrain 2026-05-10 23:57:12 +02:00
Vladislav Belov
75bd640bd8
Removes context of terrain shadows and silhouettes
We were unnecessary passing all combinations of our scene shader context
even if we don't need it as for shadows and silhouettes for terrain
rendering. Since we only need to draw a solid color.
2026-05-10 23:56:57 +02:00
Vladislav Belov
25df2d8a02
Adds resolve PBR compute shader
Also fixes sky shader as it was writing negative values for -Y
direction.
2026-04-29 19:25:12 +02:00
phosit
434a1a1905
Remove Engine.SwitchGuiPage from mod 2026-04-26 12:44:41 +02:00
Vladislav Belov
9b79fb3793
Fixes particle solid axes after aae957ec7b
Some checks are pending
checkrefs / lfscheck (push) Waiting to run
checkrefs / checkrefs (push) Waiting to run
lint / cppcheck (push) Waiting to run
lint / copyright (push) Waiting to run
lint / jenkinsfiles (push) Waiting to run
pre-commit / build (push) Waiting to run
2026-04-25 15:58:25 +02:00
Vantha
8a2a450686 Align text as usual if the scrollbar is invisible
Previously, while `scrollbar` was set to true, the text was always
vertically aligned to the top, no matter what its `text_valign` was, by
the scrolling logic. However, this was done even when the text's caption
was so short that no scrollbar was required in the first place (and not
rendered). Falling back to the specified `text_valign` value in that case
instead seems like the expected behavior.

On a few occasions in the GUI, the text was supposed to be aligned to
the top in either case, but still set `text_valign` to a different value
(for whatever reason), which didn't have any effect previously. But
now since it does, the values have to be corrected to specify what is
actually desired.
2026-04-06 21:39:18 +02:00
Vladislav Belov
b52fbb7c62
Fixes particle shader compilation
The problem was only in case of USE_DESCRIPTOR_INDEXING. Because it adds
additional data for textures to the end of draw uniforms.

Fixes #8780
2026-03-22 00:53:30 +01:00
trompetin17
15076a4504
Relax font alias pattern to allow custom font families
Update the font alias regex pattern from:
    (mono|sans)-(bold-|italic-)?(stroke-)?[0-9]{1,3}
to:
    [a-z]+-(bold-|italic-)?(stroke-)?[0-9]{1,3}

Previously the pattern only allowed the `mono` and `sans` font families.
This change generalizes the pattern to accept any lowercase font family
name, making it compatible with the font alias convention described in:

https://gitea.wildfiregames.com/0ad/0ad/wiki/Adding_font_support

This allows new fonts to be registered through aliases without modifying
the regex each time a new family is introduced.
2026-03-05 11:58:52 -05:00
Vladislav Belov
aae957ec7b
Adds fixed orientation to particles
New features:

* Relative position
* Relative and absolute fixed axis
* Local space
* Axis along velocity vector
2026-02-20 22:46:49 +01:00
Vladislav Belov
145e1c116d
Removes ARB shaders 2026-02-20 22:07:39 +01:00
Vladislav Belov
0432b86de7
Removes ARB (legacy OpenGL) backend
ARB is a legacy backend which uses old assembly shaders. It makes
writing shaders more complex. According to the stats
https://feedback.wildfiregames.com we small amount of players with
ARB.

Fixes #8533
2026-02-20 22:07:38 +01:00
Dunedan
93ce94655d
Use @stylistic/brace-style for eslint
Up to now `eslint-plugin-brace-rules` was used to enforce a common brace
style for JavaScript code. This plugin was however updated the last time
over 9 years ago and will be incompatible with ESLint v10, as that
[removes `context.getSourceCode()`][1], the plugin relies on.

To keep the eslint config working with ESLint v10, this replaces
`eslint-plugin-brace-rules` with the [`@stylistic/brace-style`][2] rule
from `@stylistic/eslint-plugin`, a package we already use.

While `@stylistic/brace-style` doesn't offer an option to format braces
in exactly the same way as before, the "allman" style seems to be the
one closest to the existing code.

[1]: https://eslint.org/blog/2025/11/eslint-v10.0.0-alpha.0-released/#removed-deprecated-rule-context-members
[2]: https://eslint.style/rules/brace-style
2026-01-12 21:33:52 +01:00
phosit
b67faf35c3
Switch main branch to Release 29 2025-12-18 18:16:11 +01:00
Vladislav Belov
3ffb5ec5a0
Removes USE_FOG define and switches to a shader parameter.
Refs #8385
2025-10-11 08:11:35 +02:00
Vladislav Belov
13b988cecb
Removes shader effect duplications. 2025-09-29 12:04:53 +02:00
phosit
b1196fc94f Use promises to update the colormixer
Callbacks introduce indirections which are harder to understand.
2025-08-05 19:15:01 +02:00
phosit
17338daaaa Groupe a chanels in the collor-mixer
It's easyier to construct and iterate chanel by chanel instead of
iterating three arrays at once.
2025-08-05 19:15:01 +02:00
phosit
6c481d4811 Make the colormixer a module
Modules don't expose global symbols. Because of that not all functions
have to be cramed in to one class. The functions can now be split in a
more readable way.

Ref: #8081
2025-08-05 19:15:01 +02:00
phosit
07309450fc Make also dap respect 'no-useless-assignment'
Forgotten in #8163 due to rebase.
2025-08-01 15:57:27 +02:00
trompetin17
20b7c3f9b8
Implement Debug Adapter Protocol (DAP) Interface in debugger.js
Adds initial support for the Debug Adapter Protocol (DAP) to
SpiderMonkey via debugger.js. This JavaScript-based implementation
enables external debuggers (e.g., VS Code) to interact with the JS
runtime using the DAP interface.

Implemented DAP requests and events:

- attach
- initialize (capabilities)
- stopped event
- threads
- scopes
- variables (globalThis pending)
- continue
- stepIn
- stepOut
- setBreakpoints
- Handling of debugger statements

This forms the foundation for interactive debugging of in-game scripts,
providing smoother integration with developer tools.
2025-07-11 11:06:05 -05:00
trompetin17
b42a2b9adb
Apply correct use of TextSize APIs in GUI
Updates GUI code to apply the correct usage of `guiObject.getTextSize()`
and `guiObject.GetPreferedTextSize()`.

- `guiObject.getPreferedTextSize()` is now used when the goal is to compute the
  bounding box of a text string to dynamically resize or layout a GUI
  object accordingly. It simulates how the text would be rendered,
  accounting for markup and layout rules.

- `guiObject.getTextSize()` remains in use when text is being measured
  within a fixed-size GUI element (e.g., a button or label). It respects
  internal constraints like buffer zone and maxWidth, and is typically
  used to align other elements based on its visual appearance.

These changes ensure more accurate text sizing and consistent layout
behavior across GUI components.
2025-06-26 17:11:24 -05:00
Stan
dc04f3f432
Fix autofixable eslint warnings for eqeqeq
Ref: #7812
Pull Request: #8129
2025-06-26 11:03:19 +02:00
phosit
77b1addb45 Enable modules in the GUI
Doesn't actually change a GUI-page to use modules. Adopting a GUI-page
now only requires JS and XML changes.

Ref: #8081
2025-06-26 10:50:21 +02:00
Vantha
fd847c2a23
Refactor GUI object resizing JS code passages
It is possible to modify sizes by setting the properties directly.
(Without having to create a copy of it)
This allows to shorten those passages quite a bit without any functional change.
2025-06-17 12:57:37 -05:00
Ralph Sennhauser
14bb7730fe
Enable eslint rule 'no-useless-escape'
Enable recommended rule 'no-useless-escape' [1] and manually fix violations.

[1] https://eslint.org/docs/latest/rules/no-useless-escape

Ref: #8068
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-17 15:20:06 +02:00
Ralph Sennhauser
58219b974c
Fix trailing whitespace and add pre-commit hook
Some have their editor configured to remove trailing whitespace and
editing such a file would "fix" it, adding an unrelated change.

Fix whitespace violations excluding third party libs and generated files
like glad or patches.

Enable pre-commit hook trailing-whitespace to enforce it in the future.

Fixes: #8016
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-15 20:08:48 +02:00
Ralph Sennhauser
8b98a7a27c
Enable eslint rule 'no-extra-boolean-cast'
Enable https://eslint.org/docs/latest/rules/no-extra-boolean-cast

Ref: #8068
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-14 12:03:06 +02:00
trompetin17
b1123ff259
Revert "Fix element positions after new font rendering"
This reverts commit 52ee6ad470.

The original commit addressed incorrect UI alignment caused by improper
handling of font height and linespacing after FreeType integration
(introduced in 734386ce9f).

However, commit c2d529b975 corrected the root issue by standardizing
font metrics:
- Proper use of FreeType's height
- Removal of lineSpace
- Introduction of getCapHeight and Descender for accurate vertical
  alignment

As a result, the UI offset workaround is now obsolete and must be
reverted to reflect the correct baseline behavior.
2025-06-11 08:10:57 -05:00
Vantha
eb2f59eeaa Allow actors to override the entity's anchor type
Optionally let actor templates define their own anchor types.
These override the default value defined in the template.
Useful for actors without their own entity template.

Reviewed-By: Itms
Reviewed-On: https://gitea.wildfiregames.com/0ad/0ad/pulls/7542
2025-06-10 23:01:09 +02:00
Ralph Sennhauser
f3ac9e9669
Fix eslint rule 'default-case'
Manual fixes needed for:
eslint --no-config-lookup --rule '"default-case": 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-28 19:24:50 +02:00
trompetin17
2781d9a6a3
Add Fallback Font support
In previous fontbuilder.py we have the capacity to specified chain fonts
when a glyph is missed from one font.

This commit enable that behavior.
2025-05-28 01:01:03 -05:00
Dunedan
99b9a0cb86
Add support for new font handling for checkrefs.py
As the fonts specified in the GUI templates don't exist as files on disk
anymore after 734386ce9f we can't check if they're specified correctly
the same way as before anymore. Instead, this commit adds validation
of font names to the GUI Relax NG schema and adds a check whether all
fonts referenced in default.cfg exist in the proper location.
2025-05-25 11:21:51 +02:00
trompetin17
8c85f32327 Remove fontbuilder & files
After 734386ce9f (that introduce freetype as a core of text rendering
engine), we dont need fontbuilder.py, neither files generated by that
tool.
2025-05-22 19:06:53 +02:00
trompetin17
a1d13c1cf8
Add CJK fonts for Text Engine
This PR removes the need for separate mods that previously provided CJK
support, and reduce the step for release process as mentioned here:
https://gitea.wildfiregames.com/0ad/0ad/wiki/ReleaseProcess
2025-05-21 16:16:36 +02:00
Ralph Sennhauser
4e5cdc87b9
Fix eslint rule 'spaced-comment'
Manual fixes needed for:
eslint --no-config-lookup --rule '"spaced-comment": ["warn", "always"]'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-17 12:08:47 +02:00
Dunedan
52ee6ad470
Fix element positions after new font rendering
This fixes the positions of elements which changed as part of
734386ce9f.
2025-05-17 10:02:25 +02:00
trompetin17
734386ce9f
Use freetype for font rendering
Replace premade bitmap fonts with FreeType2 and dynamic texture atlas.

Switched from static, premade bitmap fonts to runtime-generated glyphs using FreeType2.
Glyphs are rendered on demand into a dynamic texture atlas, improving scalability,
font quality, and support for internationalization.

Currently using RGBA format for compatibility across all render
paths while initial support for R8_UNORM is being added.
This prepares for future optimizations in VRAM and performance

Includes groundwork for gamma-corrected blending and future swizzling support.
2025-05-16 14:57:59 -05:00
Ralph Sennhauser
3a2d75af65
Fix eslint rule 'no-irregular-whitespace'
Manual fixes needed for:
eslint --no-config-lookup --rule '"no-irregular-whitespace": 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-14 13:52:12 +02:00
Ralph Sennhauser
7684e12717
Fix eslint rule 'prefer-const' in modmod
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
    binaries/data/mods/mod

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-06 13:49:13 +02:00
Ralph Sennhauser
3916fab66f
Fix eslint rule 'no-undef-init'
Manual fix needed, remove all assignments to undefined and rely on the
default state.

eslint --no-config-lookup --rule '""no-undef-init: 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-04 20:34:40 +02:00
Ralph Sennhauser
1da93a6d2f
Fix eslint rule 'object-curly-spacing'
eslint --no-config-lookup --fix --rule '"object-curly-spacing": ["warn", "always"]'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-03 17:17:35 +02:00
phosit
40762c257d Quit Engine by closing the root page
When the root page gets closed the engine quits instead or crashing.
The root pages are changed to use that mechanism to quit the engine.
This removes the need of `Engine.Exit` for the GUI.
2025-03-12 12:07:37 +01:00
phosit
df5fee6103 Rename PushGuiPage to OpenChildPage
There is no `PopGuiPage` anymore. For symmetry there should also be no
`PushGuiPage`.
2025-03-09 10:39:20 +01:00
phosit
094a7c2268 Return a promise from most page-inits
Adopt the new interface by all pages which close themself. (Not thous
using `Engine.SwitchGuiPage`.)
2025-03-09 10:39:20 +01:00
phosit
d3bc5bc802 Enable page-inits to return a Promise
Allows to return the page-completion-value instead of passing it to an
`Engine` function.

Closes: #7000
2025-03-09 10:39:20 +01:00
Itms
dc830ccf55
Switch main branch to Release 28 2025-01-12 01:27:02 +01:00
Dunedan
5f086a7851
Improve colormixer layout 2025-01-11 17:45:55 +01:00