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

SVG deserialization support #37

Merged
merged 4 commits into from
Sep 2, 2024
Merged

SVG deserialization support #37

merged 4 commits into from
Sep 2, 2024

Conversation

themkat
Copy link
Contributor

@themkat themkat commented Sep 1, 2024

Information

My attempt at supporting SVG loading as part of the resource pipeline. Works with both desktop/native build and wasm. Needs only the resvg crate to do so.

Read in the linked issue in #4 that users wanted SVGs automatically rendered to a texture. That is what I have tried (and in my view succeeded) to accomplish here 🙂

The code in Deserialize for Texture2D might be refactored, but found no prettier way to do it right now.

Fixes #4

Testing

Simply modified the logo example in three-d to only show the colors of the image. (that examples fragment shader does some minor processing I did not look into, but simply removed when testing).

Loaded the following image from wikimedia for testing wasm build, as it doesn't seem like the local resources were included.
https://upload.wikimedia.org/wikipedia/commons/5/54/Bot%C3%B3n_Me_gusta.svg

wasm:
image

native on Mac OS X (with the test.svg image included here):
image

Image is probably stretched a tiny bit in both cases, but mostly so on the native version.

Copy link
Owner

@asny asny left a comment

Choose a reason for hiding this comment

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

Super nice, only very minor comments. Thanks for the contribution 🙏

src/io.rs Outdated Show resolved Hide resolved
src/io.rs Outdated Show resolved Hide resolved
@asny asny merged commit 319c6f0 into asny:main Sep 2, 2024
4 checks passed
@themkat themkat deleted the feature/svg branch September 2, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SVG format (deserialize)
2 participants