Skip to main content

Scene

Struct Scene 

Source
pub struct Scene {
    pub shadows: Vec<Shadow>,
    pub quads: Vec<Quad>,
    pub paths: Vec<PaintedPath>,
    pub underlines: Vec<Underline>,
    pub monochrome_sprites: Vec<MonochromeSprite>,
    pub subpixel_sprites: Vec<SubpixelSprite>,
    pub polychrome_sprites: Vec<PolychromeSprite>,
    pub surfaces: Vec<PaintSurface>,
    /* private fields */
}
Expand description

重导出场景系统相关类型 渲染场景 — 收集所有绘制图元(四边形、文本、阴影等),供 GPU 批量渲染。

Fields§

§shadows: Vec<Shadow>

阴影图元列表。

§quads: Vec<Quad>

四边形图元列表。

§paths: Vec<PaintedPath>

矢量路径图元列表。

§underlines: Vec<Underline>

下划线图元列表。

§monochrome_sprites: Vec<MonochromeSprite>

单色精灵图元列表。

§subpixel_sprites: Vec<SubpixelSprite>

亚像素精灵图元列表。

§polychrome_sprites: Vec<PolychromeSprite>

多色精灵图元列表。

§surfaces: Vec<PaintSurface>

平台原生绘制表面列表。

Implementations§

Source§

impl Scene

渲染场景的构建和管理方法。

Source

pub fn clear(&mut self)

清空场景中的所有绘制操作。

Source

pub fn len(&self) -> usize

返回场景中的绘制操作数量。

Source

pub fn push_layer(&mut self)

推入一个新的绘制图层,后续图元将在此图层内绘制。

图层不立刻占用绘制顺序:关闭时以「图层内图元的并集边界」插入排序树, 按与其他图元相同的规则共享或新建绘制顺序;图层内所有图元共用该顺序。

Source

pub fn pop_layer(&mut self)

弹出当前绘制图层,返回上一层。

最外层图层关闭时,挂起队列里的所有图层(含嵌套)统一插入排序树。

Source

pub fn insert_primitive(&mut self, primitive: impl Into<Primitive>)

插入一个渲染图元到场景中。

不在图层内时立即插入排序树分配绘制顺序;在图层内则并入图层, 关闭时统一落地。

Source

pub fn replay(&mut self, range: Range<usize>, prev_scene: &Scene)

重放指定范围内的绘制操作,从另一个场景复制图元。

Source

pub fn finish(&mut self)

完成场景构建,按绘制顺序排序所有图元。

Source

pub fn batches(&self) -> impl Iterator<Item = PrimitiveBatch> + '_

返回按绘制顺序分批的图元迭代器。

Trait Implementations§

Source§

impl Default for Scene

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Send for Scene

§

impl !Sync for Scene

§

impl Forget for Scene

§

impl Freeze for Scene

§

impl Move for Scene

§

impl RefUnwindSafe for Scene

§

impl Unpin for Scene

§

impl UnsafeUnpin for Scene

§

impl UnwindSafe for Scene

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more