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

[Feature Suggestion] Vector Graphic Tesselation #1107

Open
Fancy2209 opened this issue Jan 16, 2024 · 5 comments
Open

[Feature Suggestion] Vector Graphic Tesselation #1107

Fancy2209 opened this issue Jan 16, 2024 · 5 comments
Labels

Comments

@Fancy2209
Copy link

Starling is the main way to use Hardware Acceleration on Flash, but currently, it does not natively support using Vector Art, who is Flash's main art form
My suggestion is adding tesselation support (converting it to triangles and feeding to the gpu), who is how all flash emulators (Scaleform, AwayFL, Ruffle) handle it, that way supporting using Vectors in hardware too.

@PrimaryFeather
Copy link
Contributor

PrimaryFeather commented Jan 19, 2024

Hi there,
You're absolutely right, the lack of native vector shapes is the main drawback of Starling, and what you're suggesting would be the way to go to make this possible.

However, to be honest - as you can see from the lack of recent updates - I don't have much time to develop Starling at the moment, so I'm afraid it's unlikely to happen any time soon.

(I've always loved working on Starling, but since the financial support from Adobe and others stopped, I had to move on to other projects and reduced my development efforts for Starling mostly to fixing urgent bugs and keeping it compatible with the latest AIR versions. It's totally possible to add a small feature here or there when requested, but what you're asking would be a major effort.)

@Fancy2209
Copy link
Author

Fancy2209 commented Jan 19, 2024

Hi there, You're absolutely right, the lack of native vector shapes is the main drawback of Starling, and what you're suggesting would be the way to go to make this possible.

However, to be honest - as you can see from the lack of recent updates - I don't have much time to develop Starling at the moment, so I'm afraid it's unlikely to happen any time soon.

(I've always loved working on Starling, but since the financial support from Adobe and others stopped, I had to move on to other projects and reduced my development efforts for Starling mostly to fixing urgent bugs and keeping it compatible with the latest AIR versions. It's totally possible to add a small feature here or there when requested, but what you're asking would be a major effort.)

I completely understand, it's still impressive you have maintained Starling support for so long! Away3D basically died the year Adobe cut funds, so it is appreciated you at least made sure to keep Starling working after all this time.
It really just striked me off this was missing you know? I am surprised no one suggested this sooner

@Fancy2209
Copy link
Author

Fancy2209 commented May 13, 2024

https://github.com/Fancy2209/Starling-Dynamite
I got a POC working but the starling graphics extension forks out there all have issues displaying flash shapes as they weren't tested to render such things
The built in Canvas has no LineTo/MoveTo/CurveTo right?
I might try to port NanoVG to AS3 if it doesn't.

@PrimaryFeather
Copy link
Contributor

PrimaryFeather commented May 16, 2024

Mhm, Flash shapes had some very specific properties, right? I was always impressed how drawing in Flash / Adobe Animate felt almost like working with a pixel-based app. I can imagine it's hard to replicate that 100%.

The built in Canvas of Starling doesn't have those methods; the closest that's there is the drawPolygon method, which triangulates a simple list of points, but doesn't support any curves. All rather bare-bones, I'm afraid. 😳

@Fancy2209
Copy link
Author

Fancy2209 commented Jun 7, 2024

Mhm, Flash shapes had some very specific properties, right? I was always impressed how drawing in Flash / Adobe Animate felt almost like working with a pixel-based app. I can imagine it's hard to replicate that 100%.

The built in Canvas of Starling doesn't have those methods; the closest that's there is the drawPolygon method, which triangulates a simple list of points, but doesn't support any curves. All rather bare-bones, I'm afraid. 😳

I undesrtand, I've decided for a new version of my project that takes these limitations into account, by making a class extending Canvas, that

  1. Takes the Vector. in it's constructor
  2. Uses the Canvas implementatoion for Fills
  3. Basing code out off this function from AwayJS' GraphicsPath Implementation (who is pretty accurate, partly because Away uses it in their Flash Emulator) to make countours out of the GraphicsPath Data
  4. Pass the contours through a Worker running LibTess2 to Tesselate them (AwayJS does this, so I thought I should do it too)
  5. Draw the Path Contour with Canvas as a Polygon made out of the output

Still haven't finished doing this new version but wanted to share my current idea on implementing this.
Will share the code when I get this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants