Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Swoosh 2 alpha release  (Read 2416 times)

0 Members and 1 Guest are viewing this topic.

foo

  • Newbie
  • *
  • Posts: 20
    • View Profile
Swoosh 2 alpha release
« on: December 02, 2022, 11:35:33 pm »
Swoosh 2 is ready for use but not yet merged into master. Use branch feature/swoosh2 for the latest changes.



What is Swoosh?
See More:
(click to show/hide)

Swoosh 2 changes the way we render graphics. Traditionally, SFML sprites are drawn directly to the target surface or window. With Swoosh 2, we submit render events with data in them and let the user-defined renderer decide how to draw. It's convenient to think of render events for sfml drawables as "tags". By tagging the drawables, we can tell the renderer how we'd like to draw them.

Swoosh 2 comes with a simple composite renderer, SimpleRenderer, and a few event types to begin migrating from the previous version:
  • struct Immediate → used by swoosh internals to draw directly to the final output buffer
  • Clone(...) → a utility function that makes a copy of your sfml primitive before submitting. Useful for migration.
  • renderer.submit(sf::drawable*, sf::RenderStates) → overload to replace the previous draw calls will wrap sfml primitives into RenderSource events.
Swoosh 2 can let you define multiple renderers and switch between them on the fly. I think a video speaks for itself. In the following video, I switch between the simple renderer that comes with Swoosh and a deferred renderer for 3D lighting effects. The deferred render is available for your own use in the Example Project that comes with the fork.

Click the image to go to the YouTube video



Having multiple render options for SFML projects is powerful and brings a lot of utility.

One render option can be used to increase performance on embedded machines by discarding some events entirely, especially since SFML 2 is still very behind on modern graphics support on PC and mobile.

Another renderer can be used for debugging your application. Or you can get creative and make the renderer an in-game effect that changes how your player sees the world around them.

The most powerful aspect about Swoosh 2's new renderer pipeline is that you do not need to change what you submit to draw so all of your scene's code stays the same.

See the Example Project draw step source code to see this fact in action.
« Last Edit: December 03, 2022, 06:40:56 pm by foo »