Hello world!
blaind / bevy_text_mesh Goto Github PK
View Code? Open in Web Editor NEWA bevy 3D text mesh generator for displaying text
License: MIT License
A bevy 3D text mesh generator for displaying text
License: MIT License
Hello world!
Currently crate uses its own asset loader for a font.
This may be desired eventually too, but it may overlap with bevy standard loader. It could not be used, since there is no way to expose the font-bytes (needed for ttf2mesh
).
Is there any chance WASM will be supported? Thanks.
The library possibly fails to compile on MacOS:
warning: ttf2mesh/ttf2mesh.c:54:10: fatal error: 'malloc.h' file not found
warning: #include <malloc.h>
warning: ^~~~~~~~~~
warning: 1 error generated.
There's a related stackoverflow question about malloc.h at https://stackoverflow.com/a/56463133/499839
One option would be to transpile ttfmesh.c into rust by https://c2rust.com/. That could also fix #11
bevy_text_mesh/src/mesh_data_generator.rs
Line 95 in 677f8f8
thread 'Compute Task Pool (15)' panicked at C:\Users\Johan\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_text_mesh-0.9.0\src\mesh_data_generator.rs:95:26:
called `Result::unwrap()` on an `Err` value: Glyph2MeshError
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_text_mesh::mesh_system::text_mesh`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
I used the bold version of https://fonts.google.com/specimen/Playpen+Sans/about?preview.text=score%201234
let font = asset_server.load("fonts/playpen_sans_extrabold.ttf#mesh");
commands.spawn((
Name::new("ScoreText"),
TextMeshBundle {
text_mesh: TextMesh {
// text: "0".into(), // does not panic
text: "1".into(), // panics
style: TextMeshStyle {
font: font.clone(),
font_size: SizeUnit::NonStandard(36.),
color: Color::rgb(0.0, 1.0, 0.0),
mesh_quality: Quality::Low,
..default()
},
..default()
},
..default()
},
));
Some fonts produce a Glyph2MeshError
when you attempt to load them. For example, Inter.
Other fonts, like Courier, don't seem to render at all, even though they load properly.
When I add in the TextMeshPlugin then any 2d text ( https://github.com/bevyengine/bevy/blob/main/examples/ui/text.rs ) disappears. I am guessing that it's just that the 2d text is getting upset by a different font loader.
It would be great if I could use your awesome 3d text and also have some 2d ui (like fps and other HUD info). Took me a little while to track this down that this was the cause.
Currently, the size unit is just an arbitrary number (SizeUnit::NonStandard
) - some standardized way should be defined.
My bad... I forgot to load the regular bevy Font while upgrading to 0.12 ๐
The crate uses a global mesh cache.
It is not being cleaned up at all, resulting to polluted cache, when:
See
bevy_text_mesh/src/font_loader.rs
Line 40 in b5174a7
bevy_text_mesh/src/mesh_cache.rs
Line 53 in b5174a7
An example/
file, that would contain multiple different texts displaying the rendering result of various TextMesh
options.
Not sure what type of asset ends up getting loaded in this case, but Res<Assets<TextMeshFont>>::get
yields None
without #mesh
, so of course nothing would be displayed.
This is the result of me misreading the docs/examples but I feel like something should blow up or yell at me for this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.