pub struct Scene {
pub meshes: Arena<Mesh>,
pub textures: Arena<Texture>,
pub objects: Arena<RenderObject>,
pub light: DirectionalLight,
}Expand description
Fields§
§meshes: Arena<Mesh>Mesh storage. 网格存储。
textures: Arena<Texture>Texture storage. 纹理存储。
objects: Arena<RenderObject>Render-object storage. 渲染对象存储。
light: DirectionalLightThe single directional light of the scene. 场景中唯一的方向光。
Implementations§
Source§impl Scene
impl Scene
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty scene. 创建一个空场景。
§Examples
示例
use he3d_core::{Material, Mesh, RenderObject, Rgb, Scene, Transform};
let mut scene = Scene::new();
let mesh = scene.meshes.insert(Mesh::triangle(1.0, 1.0)?);
let object = scene.spawn(RenderObject {
mesh,
texture: None,
transform: Transform::default(),
material: Material::new(Rgb::WHITE),
visible: true,
});
assert!(scene.objects.contains(object));Sourcepub fn spawn(&mut self, object: RenderObject) -> ObjectId
pub fn spawn(&mut self, object: RenderObject) -> ObjectId
Insert a render object and return its handle. 插入一个渲染对象并返回其句柄。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scene
impl RefUnwindSafe for Scene
impl Send for Scene
impl Sync for Scene
impl Unpin for Scene
impl UnsafeUnpin for Scene
impl UnwindSafe for Scene
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more