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

Implementation of EnsoGL predefined Rectangle shape. #6033

Merged
merged 6 commits into from
Mar 23, 2023

Conversation

wdanilo
Copy link
Member

@wdanilo wdanilo commented Mar 22, 2023

Pull Request Description

This PR implements a "super-shape", Rectangle. This shape has been specifically designed to be utilized across various sections of the GUI. Its numerous parameters enable a highly adaptable approach to drawing a diverse range of shapes, such as circles, rings, or ring segments. The advantage of having a singular shape for these cases is that a single draw call can be used to render multiple GUI elements, which ultimately enhances performance.

Screen.Recording.2023-03-22.at.07.26.31.mov

Important Notes

  1. This shape is defined in a debug scene for now. It is basis for future work and it should be refactored to some EnsoGL module in the future.
  2. This PR enhances EnsoGL with a new shape unification mode, unify_exclusive, allowing blending their colors based on the foreground shape's SDF value. This means that even if these shapes overlap and the foreground is semi-transparent, it will blend with the background only in the anti-aliased areas. This allows us to render both rectangle and its border without artifacts between them, no matter the scene zoom level or camera transformation.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@wdanilo wdanilo added the CI: No changelog needed Do not require a changelog entry for this PR. label Mar 22, 2023
@wdanilo wdanilo marked this pull request as ready for review March 22, 2023 06:19
Comment on lines +40 to +43
let canvas_clip_height_diff = &canvas_height * (clip.y() * 2.0);
let canvas_clip_width_diff = &canvas_width * (clip.x() * 2.0);
let canvas_height = canvas_height + &canvas_clip_height_diff;
let canvas_width = canvas_width + &canvas_clip_width_diff;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not clear variable names

let canvas_width = canvas_width + &canvas_clip_width_diff;

// === Body ===
let inset2 = (&inset * 2.0).px();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe padding is better than inset?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave inset here, as we discussed, as this is term used in CSS and Swift. Padding is used in display objects and it will get confusing if we will use it here as well, especially, as this shape implements display object.

@wdanilo wdanilo merged commit ca0779c into develop Mar 23, 2023
@wdanilo wdanilo deleted the wip/wdanilo/predefined-shapes branch March 23, 2023 05:47
Procrat added a commit that referenced this pull request Mar 27, 2023
* develop:
  Layout fixes (#6066)
  Use new Enso Hash Codes and Comparable (#6060)
  Search suggestions by static attribute (#6036)
  Use .node-version for pinning Node.js version (#6057)
  Fix code generation for suggestion preview (#6054)
  Implementation of EnsoGL predefined Rectangle shape. (#6033)
  Tidy up the public module level statics (#6032)
  Cursor aware Component Browser (#5770)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants