-
- BrandonReinhart
- Posts: 29
- Joined:
Noesis for Rust & Bevy
I have cleaned up and published an engine-agnostic rust runtime for the Noesis SDK: https://github.com/dead-money/noesis_runtime
No Noesis SDK code is vendored or translated; it's only #include'd at compile time from NOESIS_SDK_DIR.
I suspect this will not be super interesting to the Rust community, who prefer free, MIT-licensed solutions for everything, but anyone who has an interest in Rust and who owns a Noesis license can use this SDK runtime. It has an extremely high degree of SDK coverage.
Rust example:
The second part of this are bridges for the Bevy engine: https://github.com/dead-money/noesis_bevy
Again, I doubt the Bevy community will be enamored by this, but I like using it. Xaml doesn't quite afford itself to an ECS model, so this bridge doesn't do that. Instead, each view is an entity that provides fairly ergonomic access to the Noesis XAML tree from Bevy systems.
The Bevy bindings are mostly complete, a couple things are missing, but the "Scoreboard" demo is about 95% there (just the initial fade-in needs a feature I haven't ported yet). I plan to provide bevy idiomatic versions of other Noesis samples, although you must own the SDK to build and run them since these repos do not contain any SDK assets or code.
Bevy example:
Screenshots aren't super interesting because they look exactly like you'd expect from Noesis!
No Noesis SDK code is vendored or translated; it's only #include'd at compile time from NOESIS_SDK_DIR.
I suspect this will not be super interesting to the Rust community, who prefer free, MIT-licensed solutions for everything, but anyone who has an interest in Rust and who owns a Noesis license can use this SDK runtime. It has an extremely high degree of SDK coverage.
Rust example:
Code: Select all
use noesis_runtime::view::{FrameworkElement, View};
use noesis_runtime::xaml_provider::{set_xaml_provider, XamlProvider};
// Implement a XAML provider against your asset pipeline.
struct MyXaml(std::collections::HashMap<String, Vec<u8>>);
impl XamlProvider for MyXaml {
fn as_any_mut(&mut self) -> &mut dyn std::any::Any { self }
fn load_xaml(&mut self, uri: &str) -> Option<&[u8]> {
self.0.get(uri).map(Vec::as_slice)
}
}
// Once per process.
noesis_runtime::init();
// Install the provider. The returned guard owns the registration;
// drop it to clear the global slot.
let provider = MyXaml(/* ... */);
let _guard = set_xaml_provider(provider);
// Load a scene, create a view, and drive it from your frame loop.
let element = FrameworkElement::load("MainMenu.xaml")
.expect("XAML failed to parse");
let mut view = View::create(element);
view.set_size(1920, 1080);
view.activate();
loop {
// Forward input to view.mouse_*, view.key_*, view.touch_*
let _changed = view.update(time_seconds);
// Your renderer drives view.renderer().
}
noesis_runtime::shutdown();Again, I doubt the Bevy community will be enamored by this, but I like using it. Xaml doesn't quite afford itself to an ECS model, so this bridge doesn't do that. Instead, each view is an entity that provides fairly ergonomic access to the Noesis XAML tree from Bevy systems.
The Bevy bindings are mostly complete, a couple things are missing, but the "Scoreboard" demo is about 95% there (just the initial fade-in needs a feature I haven't ported yet). I plan to provide bevy idiomatic versions of other Noesis samples, although you must own the SDK to build and run them since these repos do not contain any SDK assets or code.
Bevy example:
Code: Select all
use std::sync::Arc;
use bevy::prelude::*;
use noesis_bevy::{NoesisCamera, NoesisPlugin, NoesisView, XamlRegistry};
const MENU_XAML: &str = r#"<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<TextBlock Text="Hello, Noesis!" Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>"#;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(NoesisPlugin::default())
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands, mut xaml: ResMut<XamlRegistry>) {
// Register XAML by URI. For real projects, load .xaml files through the
// asset server instead; the loader feeds the same registry.
xaml.insert("menu.xaml", Arc::new(MENU_XAML.as_bytes().to_vec()));
// A view is a `NoesisView` component on a 2D camera tagged `NoesisCamera`.
// Noesis renders the scene offscreen and composites it onto that camera.
commands.spawn((
Camera2d,
NoesisCamera,
NoesisView {
xaml_uri: "menu.xaml".to_string(),
size: UVec2::new(1920, 1080),
..default()
},
));
}-
- BrandonReinhart
- Posts: 29
- Joined:
Re: Noesis for Rust & Bevy
I also have an excellent implementation of Noesis for Godot that isn't currently in its own repo, but I could extract it and make it a gdExtension (or something? not sure the correct distribution method) if anyone is interested. It's pretty much complete and is actively being used in Architect of Ruin.
The rust stuff is being used in an unannounced prototype Bevy game that is...actually coming along quite nicely and may actually see the light of day.
The rust stuff is being used in an unannounced prototype Bevy game that is...actually coming along quite nicely and may actually see the light of day.
Re: Noesis for Rust & Bevy
Hey Brandon, I'm really impressed with this, thanks a lot for sharing! I've added it to the Unofficial Integrations post.
For Noesis 4.0, we've updated almost all of the samples, removed Blend, added Noesis Studio compatibility, and made many refinements and improvements in addition to the new samples. I'd definitely recommend waiting a bit until the next beta is ready, it should be available later this week.
As for the Godot bindings, this has been requested many times. I'm not sure what the best way to share them would be, perhaps a separate GitHub repository?
THANKS again.
For Noesis 4.0, we've updated almost all of the samples, removed Blend, added Noesis Studio compatibility, and made many refinements and improvements in addition to the new samples. I'd definitely recommend waiting a bit until the next beta is ready, it should be available later this week.
As for the Godot bindings, this has been requested many times. I'm not sure what the best way to share them would be, perhaps a separate GitHub repository?
THANKS again.
-
- BrandonReinhart
- Posts: 29
- Joined:
Re: Noesis for Rust & Bevy
Let me do some research. I'm not sure what the most common way of providing third party plugins to godot is (probably gdextension), so I'll figure that out and make a new repo.
Re: Noesis for Rust & Bevy
Also, now that 4.0 is almost here (it's already in beta), I think it would be great to move directly to that version. Thanks!
Who is online
Users browsing this forum: No registered users and 5 guests