Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

R3F23c: the engine's load empties its render images before its rows spawn, not after (runtime/plugins apply_rows reset them once the rows were in, so a three:uniforms row naming a render image made a second, blank image under the same name and every ShaderMaterial reading a target read black)

shinyobjectz53b5da60b330
diff --git a/engine/render/src/engine/load.rs b/engine/render/src/engine/load.rs
index f7fea211..ab81ce64 100644
--- a/engine/render/src/engine/load.rs
+++ b/engine/render/src/engine/load.rs
@@ -32,6 +32,7 @@ impl Engine {
}
// the rows go through the store; what else the last load spawned (overlay, tag, raea's leftovers) goes too
store::clear(world);
+ world.insert_resource(raea_sys_frame::RenderImages::default()); // its render images: this load's are made as its rows spawn
world.despawn_all::<With<Mirror>>();
let ents = store::load(world, inserted);
#[cfg(feature = "native")]
diff --git a/runtime/plugins/src/fields.rs b/runtime/plugins/src/fields.rs
index a41eca22..e5824acb 100644
--- a/runtime/plugins/src/fields.rs
+++ b/runtime/plugins/src/fields.rs
@@ -33,7 +33,7 @@ pub fn row_names(world: &mut World, v: &Value) -> Result<Option<Entity>, String>
/// A picture as a Handle<Image> field gives it (a path in the edit, an inline {width, height, pixels}, "render:NAME"),
/// for a material built outside the component rows (raea-sys-material's shader_ext.rs: a surface shader's textures).
-/// Called once the rows are applied (apply_rows), so a "render:NAME" meets the camera that draws into it.
+/// A "render:NAME" is the image every row of the load naming it shares (the engine's load empties them before its rows spawn).
pub fn image(world: &mut World, v: &Value) -> Result<Handle<Image>, String> {
let refs = world.remove_resource::<Refs>().unwrap_or_default();
let reg = world.resource::<AppTypeRegistry>().clone();
diff --git a/runtime/plugins/src/lib.rs b/runtime/plugins/src/lib.rs
index a236c3fb..1de45e55 100644
--- a/runtime/plugins/src/lib.rs
+++ b/runtime/plugins/src/lib.rs
@@ -310,7 +310,6 @@ pub fn apply_rows(world: &mut World, inserted: &[Tup], ents: &[Entity], dir: &Pa
world.insert_resource(Refs { dir: dir.to_path_buf(), names: by_name, media });
world.insert_resource(raea_bevy_world::EntityNames(row_names));
world.insert_resource(Loading::default());
- world.insert_resource(RenderImages::default());
if active(world) {
let mut c = world.resource_mut::<PluginClock>();
c.stepped = 0;