Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced rendering effects - filters, masks, box-shadows, gradients, and shaders #594

Merged
merged 80 commits into from
Mar 30, 2024

Commits on Jul 23, 2023

  1. Add effect sample

    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    78db66c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    05ec09b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b6f70ff View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    607a8ce View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    679c615 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    76b8556 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1be3e86 View commit details
    Browse the repository at this point in the history
  8. Add Filter class, to be used with the new 'filter' and 'backdrop-filt…

    …er' properties
    
    Filters are implemented partially like decorators.
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    a5e3c7f View commit details
    Browse the repository at this point in the history
  9. Add basic filters

    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    bafca42 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    faae241 View commit details
    Browse the repository at this point in the history
  11. Make elements with 'filter' and 'backdrop-filter' properties create a…

    … local stacking context
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    f6230b2 View commit details
    Browse the repository at this point in the history
  12. Elements with 'filter' and 'backdrop-filter' properties now act as co…

    …ntaining block for absolutely positioned elements
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    a5ddc1a View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    cb64ba4 View commit details
    Browse the repository at this point in the history
  14. Add filters to effect sample

    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    ebc8b65 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    1d7b183 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    edcb854 View commit details
    Browse the repository at this point in the history
  17. Fix backdrop-filter

    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    156d2bd View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    17246f5 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    19281fd View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    a30d3d5 View commit details
    Browse the repository at this point in the history
  21. Add geometry utility for creating background geometry on any target a…

    …rea with border radius support
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    3429285 View commit details
    Browse the repository at this point in the history
  22. Add clip mask to render interface, introduce render manager to keep t…

    …rack of the render state
    
    - The clip mask can be rendered to using normal geometry, then during other render commands the clip mask should hide any contents outside its area.
    - Improved element clipping behavior: Handles more complicated cases, including nested transforms with hidden overflow, and clips to the curved edge of elements with border-radius.
    - Text culling now also considers the viewport and properly handles transforms. Previously, text was not rendered in some situations, or unnecessarily rendered outside the window.
    - Clip mask implemented in GL3 renderer using stencil buffer.
    - Added and modified visual tests for clipping behavior.
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    69ea397 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    4bfc80f View commit details
    Browse the repository at this point in the history
  24. Add support for the 'box-shadow' property

    - Allow textures to be saved from the current layer through render interface.
    - Implement GL3 support for saving textures.
    - Extend bounding box to include ink overflow from box shadows.
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    655cd9a View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    72c816f View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    2dba53e View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    2338f2d View commit details
    Browse the repository at this point in the history
  28. Replace gradient decorator syntax 'gradient(horizontal|vertical ...)'…

    … with 'horizontal-gradient(...)' and 'vertical-gradient(...)' [deprecation]
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    556607d View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    17f1d95 View commit details
    Browse the repository at this point in the history
  30. Improve PropertySpecification::ParsePropertyValues

    - Allow splitting by comma
    - No escaping inside parenthesis
    - Enable quote mode inside parenthesis
    - Add unit tests
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    0507e48 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    1525fd7 View commit details
    Browse the repository at this point in the history
  32. Add 'linear-gradient' and 'repeating-linear-gradient' decorators

    - New property parser for color stop lists.
    - Shorthand parser: Support for repeating, comma-separated patterns.
    - Supports most of CSS syntax:
      - Angle and 'to <direction>' syntax for direction.
      - Multiple color stops, locations in length or percentage units, up to two locations per color.
      - Hints and color interpolation methods are not supported.
    - Uses shader to draw the gradient.
    - GL3 renderer support.
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    b6efab1 View commit details
    Browse the repository at this point in the history
  33. Allow decorators to specify paint area [breaking change]

    Breaking change: 'Decorator::GenerateElementData()' has a new paint area parameter.
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    c3622e6 View commit details
    Browse the repository at this point in the history
  34. Visual tests: Highlight differences when comparing to previous captur…

    …e by holding shift key
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    81ae0c8 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    2f146f4 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    5888497 View commit details
    Browse the repository at this point in the history
  37. Add shader decorator

    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    5d52f71 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    0471ce7 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    c6f550d View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    ecaaefa View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    aec3f2a View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    ae8f2a4 View commit details
    Browse the repository at this point in the history
  43. Configuration menu
    Copy the full SHA
    bdf5608 View commit details
    Browse the repository at this point in the history
  44. Configuration menu
    Copy the full SHA
    9a00f2c View commit details
    Browse the repository at this point in the history
  45. Update clang-format

    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    59146e9 View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    70bcdc7 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    a064612 View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    641f8b5 View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    7ae3bb3 View commit details
    Browse the repository at this point in the history
  50. Use premultiplied alpha for vertex colors

    Introduce a new type for colors with premultiplied alpha.
    mikke89 committed Jul 23, 2023
    Configuration menu
    Copy the full SHA
    c802aeb View commit details
    Browse the repository at this point in the history
  51. Configuration menu
    Copy the full SHA
    2f80bdd View commit details
    Browse the repository at this point in the history
  52. Configuration menu
    Copy the full SHA
    cfd963c View commit details
    Browse the repository at this point in the history
  53. Configuration menu
    Copy the full SHA
    f4414b8 View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2023

  1. Postpone instancing named decorators until other decorators are insta…

    …nced
    
    Previously, they were instanced the moment they were encountered in the style sheet parser. With this change, the render manager is always available at the time of instancing.
    mikke89 committed Aug 5, 2023
    Configuration menu
    Copy the full SHA
    a076be2 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. Refactor Geometry and Texture, introduce unique render resources

    Unique render resources
    - Consist of a unique handle and a pointer to its render manger.
    - Automatically cleans up its underlying resource when out of scope.
    - Ensuring resources are always released in the correct render interface.
    - Geometry, CompiledShader, CompiledFilter and CallbackTexture, are now unique render resources.
      - All of which are constructed through the render manager.
    
    RenderManager
    - Now the owner of all resources constructed through the render interface.
    - Wraps all calls to the render interface, the interface should no longer be called directly.
    - Added back ability to use multiple render interfaces for separate contexts.
      - Each render interface is wrapped by a unique render manager.
    
    Geometry
    - Geometry is now a unique render resource.
    - Geometry is now constructed from a Mesh through the render manager. The mesh cannot be modified after it is submitted. However, it can be released to reuse its buffers, then resubmitted.
      - With this change, we can guarantee pointer stability of submitted vertex and index pointers, until the call to ReleaseCompiledGeometry.
    - Move texture out of Geometry, instead, a texture can be provided during the call to render.
    
    Mesh
    - Simple data structure, contains indices and vertices defining the mesh.
    - Meshes can be constructed directly or using MeshUtilities (previously GeometryUtilities).
    
    Texture
    - The render manager now owns and stores file textures.
      - File textures are released when the render manager is destroyed, during Rml::Shutdown.
      - Each render manager has its own texture database to lookup and reuse textures with the same path.
    - `Texture` is now simply a non-owning view and can be freely copied.
      - The user is responsible for ensuring validity of the underlying resource's lifetime.
    - `CallbackTexture` on the other hand is a unique render resource, automatically released when out of scope.
      - Can make a non-owning reference (Texture).
    - Handlers are available for managing texture sources for unknown or multiple render managers, generating references (Texture) as needed.
       - `TextureSource` for file textures and `CallbackTextureSource` for callback textures.
    
    StableVector
    - New container for stable indices which remain valid after entries are erased.
    
    Breaking changes
    - New procedure for generating geometry and textures (see above for details).
    - GeometryUtilities renamed to MeshUtilities.
    mikke89 committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    a452f26 View commit details
    Browse the repository at this point in the history

Commits on Dec 25, 2023

  1. Implement clip masks for the GL2 renderer

    Implement compiled geometry to enable rendering clip masks. Takes advantage of the new guarantee that the pointers to vertices and indices are stable until the call to release.
    mikke89 committed Dec 25, 2023
    Configuration menu
    Copy the full SHA
    ba35525 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    90d2ef2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3176c85 View commit details
    Browse the repository at this point in the history

Commits on Dec 26, 2023

  1. Refactor render interface: Require compiled geometry, use modern and …

    …safer types [breaking change]
    
    All geometry now requires compiling, the immediate geometry rendering call is removed for the following reasons:
    
        1. Compiled geometry is required to use any of the new rendering features, including clip mask and shaders.
        2. It simplifies the render interface, by removing a function that essentially provided a duplicate feature set.
        3. This change enables us to make a clear distinction between required and optional functions. All required functions are now abstract, while optional functions are not.
    
    With recent changes, migrating from the immediate render function to using the compiled geometry functions, should be much less effort. Now the pointers to the geometry data (vertices and indices) are guaranteed to be available and immutable until the same geometry is released. Thus, users can simply store the views to this data, and reuse that during rendering.
    
    The signatures of several functions are changed:
    
        - The Span type is now used to represent contiguous data for improved usability and safety.
        - Texture load and generate now return the texture handle directly, to be consistent with the way geometry is compiled. The value zero is used to represent an empty texture, like before.
        - The scissor region now takes a Rectangle type for improved ergonomics.
    
    This is a breaking change for all users, and requires some minor adaptation in existing render interfaces. The changes to the backend renderers in this commit can be used as a reference for the change.
    mikke89 committed Dec 26, 2023
    Configuration menu
    Copy the full SHA
    5faedc4 View commit details
    Browse the repository at this point in the history
  2. Add a render interface adapter from the old interface to the newly re…

    …factored interface
    
    This adapter is implemented to ease the transition to the new render interface, so that users can quickly adopt the new version of RmlUi. Then, users can iteratively migrate to the new interface as they see fit. There are also some comments that can help guide the migration.
    
    To use the adapter, simply derive from `Rml::RenderInterfaceCompatibility` instead of `Rml::RenderInterface`. Then submit the adapted interface to RmlUi, as demonstrated in the following:
    
    ```
        #include <RmlUi/Core/RenderInterfaceCompatibility.h>
        class MyRenderInterface : public Rml::RenderInterfaceCompatibility { ... };
    
        // During initialization of RmlUi, set the adapted render interface as follows.
        Rml::SetRenderInterface(my_render_interface.GetAdaptedInterface());
    ```
    
    See `Include/RmlUi/Core/RenderInterfaceCompatibility.h` for more details.
    
    This commit further adds the GL2 and GL3 renderers from RmlUi 5, using the compatibility adapter, for demonstrating and testing of the adapter. These can be selected by setting the CMake variable `SAMPLES_BACKEND` to `BackwardCompatible_GLFW_GL2` or `BackwardCompatible_GLFW_GL3`.
    mikke89 committed Dec 26, 2023
    Configuration menu
    Copy the full SHA
    8b292e1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    94fda35 View commit details
    Browse the repository at this point in the history

Commits on Dec 30, 2023

  1. Configuration menu
    Copy the full SHA
    cbeea43 View commit details
    Browse the repository at this point in the history

Commits on Dec 31, 2023

  1. Use default log output also when there is no system interface installed

    This ensures that log messages are submitted to the same stream output before and after installing the default provided system interface. In particular, the output from MSVC is given in its debug output.
    mikke89 committed Dec 31, 2023
    Configuration menu
    Copy the full SHA
    ac8e1f2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5a27590 View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2024

  1. Configuration menu
    Copy the full SHA
    6e1d487 View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2024

  1. Configuration menu
    Copy the full SHA
    ff65107 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7335eed View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7b359d5 View commit details
    Browse the repository at this point in the history
  4. Fix defender decorator from being rendered in invader samples

    Add warning message when decorators generate invalid data handles
    mikke89 committed Feb 5, 2024
    Configuration menu
    Copy the full SHA
    144212b View commit details
    Browse the repository at this point in the history
  5. Update CMake minimum to 3.5

    mikke89 committed Feb 5, 2024
    Configuration menu
    Copy the full SHA
    b301702 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    13b60d1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7b9d865 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8dfba05 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    742bbba View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    c42d729 View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2024

  1. Configuration menu
    Copy the full SHA
    011b3c1 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2024

  1. Configuration menu
    Copy the full SHA
    b470b2b View commit details
    Browse the repository at this point in the history
  2. Render interface: Make layer compositing a separate function instead …

    …of being a part of layer pop
    
    The purpose of each function should now be more clear. With this change, we can now composite two arbitrary layers which simplifies some use cases of compositing.
    
    This commit also uses the changed interface to fix some artifacts when rendering back-drop filter blur combined with plain filter blur.
    mikke89 committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    e96b950 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2024

  1. Configuration menu
    Copy the full SHA
    c93dbc0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    37cf4d3 View commit details
    Browse the repository at this point in the history