feat: sync WebviewSurface in render systems
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
use crate::prelude::{WebviewMaterial, update_webview_image};
|
use crate::prelude::{WebviewMaterial, WebviewSurface, update_webview_image};
|
||||||
use bevy::app::Plugin;
|
use bevy::app::Plugin;
|
||||||
use bevy::pbr::{ExtendedMaterial, MaterialExtension};
|
use bevy::pbr::{ExtendedMaterial, MaterialExtension};
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
@@ -35,6 +35,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render<E: MaterialExtension>(
|
fn render<E: MaterialExtension>(
|
||||||
|
mut commands: Commands,
|
||||||
mut er: MessageReader<RenderTextureMessage>,
|
mut er: MessageReader<RenderTextureMessage>,
|
||||||
mut images: ResMut<Assets<Image>>,
|
mut images: ResMut<Assets<Image>>,
|
||||||
mut materials: ResMut<Assets<WebviewExtendedMaterial<E>>>,
|
mut materials: ResMut<Assets<WebviewExtendedMaterial<E>>>,
|
||||||
@@ -48,6 +49,9 @@ fn render<E: MaterialExtension>(
|
|||||||
.base
|
.base
|
||||||
.surface
|
.surface
|
||||||
.get_or_insert_with(|| images.add(Image::default()));
|
.get_or_insert_with(|| images.add(Image::default()));
|
||||||
|
commands
|
||||||
|
.entity(texture.webview)
|
||||||
|
.insert(WebviewSurface(handle.clone()));
|
||||||
images.get_mut(handle.id())
|
images.get_mut(handle.id())
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::prelude::{WebviewMaterial, update_webview_image};
|
use crate::prelude::{WebviewMaterial, WebviewSurface, update_webview_image};
|
||||||
use bevy::asset::*;
|
use bevy::asset::*;
|
||||||
use bevy::pbr::{ExtendedMaterial, MaterialExtension};
|
use bevy::pbr::{ExtendedMaterial, MaterialExtension};
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
@@ -31,6 +31,7 @@ impl MaterialExtension for WebviewMaterial {
|
|||||||
pub type WebviewExtendStandardMaterial = ExtendedMaterial<StandardMaterial, WebviewMaterial>;
|
pub type WebviewExtendStandardMaterial = ExtendedMaterial<StandardMaterial, WebviewMaterial>;
|
||||||
|
|
||||||
fn render_standard_materials(
|
fn render_standard_materials(
|
||||||
|
mut commands: Commands,
|
||||||
mut er: MessageReader<RenderTextureMessage>,
|
mut er: MessageReader<RenderTextureMessage>,
|
||||||
mut images: ResMut<Assets<Image>>,
|
mut images: ResMut<Assets<Image>>,
|
||||||
mut materials: ResMut<Assets<WebviewExtendStandardMaterial>>,
|
mut materials: ResMut<Assets<WebviewExtendStandardMaterial>>,
|
||||||
@@ -44,6 +45,9 @@ fn render_standard_materials(
|
|||||||
.extension
|
.extension
|
||||||
.surface
|
.surface
|
||||||
.get_or_insert_with(|| images.add(Image::default()));
|
.get_or_insert_with(|| images.add(Image::default()));
|
||||||
|
commands
|
||||||
|
.entity(texture.webview)
|
||||||
|
.insert(WebviewSurface(handle.clone()));
|
||||||
images.get_mut(handle.id())
|
images.get_mut(handle.id())
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user