mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-09 20:31:29 +11:00
add function to render directly from an encoding
This commit is contained in:
parent
520f6d0d41
commit
ec956d859b
|
@ -3,6 +3,7 @@
|
|||
use bytemuck::{Pod, Zeroable};
|
||||
|
||||
use crate::{
|
||||
encoding::Encoding,
|
||||
engine::{BufProxy, ImageFormat, ImageProxy, Recording, ResourceProxy},
|
||||
shaders::{self, FullShaders, Shaders},
|
||||
Scene,
|
||||
|
@ -134,12 +135,20 @@ pub fn render_full(
|
|||
shaders: &FullShaders,
|
||||
width: u32,
|
||||
height: u32,
|
||||
) -> (Recording, ResourceProxy) {
|
||||
render_encoding_full(&scene.data(), shaders, width, height)
|
||||
}
|
||||
|
||||
pub fn render_encoding_full(
|
||||
data: &Encoding,
|
||||
shaders: &FullShaders,
|
||||
width: u32,
|
||||
height: u32,
|
||||
) -> (Recording, ResourceProxy) {
|
||||
use crate::encoding::{resource::ResourceCache, PackedEncoding};
|
||||
let mut recording = Recording::default();
|
||||
let mut resources = ResourceCache::new();
|
||||
let mut packed_scene = PackedEncoding::default();
|
||||
let data = scene.data();
|
||||
packed_scene.pack(&data, &mut resources);
|
||||
let (ramp_data, ramps_width, ramps_height) = resources.ramps(packed_scene.resources).unwrap();
|
||||
let gradient_image = if data.patches.is_empty() {
|
||||
|
|
Loading…
Reference in a new issue