Struct kiss3d::scene::SceneNode
[−]
[src]
pub struct SceneNode { /* fields omitted */ }
A node of the scene graph.
This may represent a group of other nodes, and/or contain an object that can be rendered.
Methods
impl SceneNode
[src]
fn new(local_scale: Vector3<f32>,
local_transform: Isometry3<f32>,
object: Option<Object>)
-> SceneNode
local_transform: Isometry3<f32>,
object: Option<Object>)
-> SceneNode
Creates a new scene node that is not rooted.
fn new_empty() -> SceneNode
Creates a new empty, not rooted, node with identity transformations.
fn unlink(&mut self)
Removes this node from its parent.
fn data(&self) -> Ref<SceneNodeData>
The data of this scene node.
fn data_mut(&mut self) -> RefMut<SceneNodeData>
The data of this scene node.
fn add_group(&mut self) -> SceneNode
Adds a node without object to this node children.
fn add_child(&mut self, node: SceneNode)
fn add_object(&mut self,
local_scale: Vector3<f32>,
local_transform: Isometry3<f32>,
object: Object)
-> SceneNode
local_scale: Vector3<f32>,
local_transform: Isometry3<f32>,
object: Object)
-> SceneNode
Adds a node containing an object to this node children.
fn add_cube(&mut self, wx: f32, wy: f32, wz: f32) -> SceneNode
Adds a cube as a children of this node. The cube is initially axis-aligned and centered at (0, 0, 0).
Arguments
wx
- the cube extent along the z axiswy
- the cube extent along the y axiswz
- the cube extent along the z axis
fn add_sphere(&mut self, r: f32) -> SceneNode
Adds a sphere as a children of this node. The sphere is initially centered at (0, 0, 0).
Arguments
r
- the sphere radius
fn add_cone(&mut self, r: f32, h: f32) -> SceneNode
Adds a cone to the scene. The cone is initially centered at (0, 0, 0) and points toward the
positive y
axis.
Arguments
h
- the cone heightr
- the cone base radius
fn add_cylinder(&mut self, r: f32, h: f32) -> SceneNode
Adds a cylinder to this node children. The cylinder is initially centered at (0, 0, 0)
and has its principal axis aligned with the y
axis.
Arguments
h
- the cylinder heightr
- the cylinder base radius
fn add_capsule(&mut self, r: f32, h: f32) -> SceneNode
Adds a capsule to this node children. The capsule is initially centered at (0, 0, 0) and
has its principal axis aligned with the y
axis.
Arguments
h
- the capsule heightr
- the capsule caps radius
fn add_quad(&mut self,
w: f32,
h: f32,
usubdivs: usize,
vsubdivs: usize)
-> SceneNode
w: f32,
h: f32,
usubdivs: usize,
vsubdivs: usize)
-> SceneNode
Adds a double-sided quad to this node children. The quad is initially centered at (0, 0, 0). The quad itself is composed of a user-defined number of triangles regularly spaced on a grid. This is the main way to draw height maps.
Arguments
w
- the quad width.h
- the quad height.wsubdivs
- number of horizontal subdivisions. This correspond to the number of squares which will be placed horizontally on each line. Must not be0
.hsubdivs
- number of vertical subdivisions. This correspond to the number of squares which will be placed vertically on each line. Must not be0
. update.
fn add_quad_with_vertices(&mut self,
vertices: &[Point3<f32>],
nhpoints: usize,
nvpoints: usize)
-> SceneNode
vertices: &[Point3<f32>],
nhpoints: usize,
nvpoints: usize)
-> SceneNode
Adds a double-sided quad with the specified vertices.
fn add_geom_with_name(&mut self,
geometry_name: &str,
scale: Vector3<f32>)
-> Option<SceneNode>
geometry_name: &str,
scale: Vector3<f32>)
-> Option<SceneNode>
Creates and adds a new object using the geometry registered as geometry_name
.
fn add_mesh(&mut self,
mesh: Rc<RefCell<Mesh>>,
scale: Vector3<f32>)
-> SceneNode
mesh: Rc<RefCell<Mesh>>,
scale: Vector3<f32>)
-> SceneNode
Creates and adds a new object to this node children using a mesh.
fn add_trimesh(&mut self,
descr: TriMesh3<f32>,
scale: Vector3<f32>)
-> SceneNode
descr: TriMesh3<f32>,
scale: Vector3<f32>)
-> SceneNode
Creates and adds a new object using a mesh descriptor.
fn add_obj(&mut self,
path: &Path,
mtl_dir: &Path,
scale: Vector3<f32>)
-> SceneNode
path: &Path,
mtl_dir: &Path,
scale: Vector3<f32>)
-> SceneNode
Creates and adds multiple nodes created from an obj file.
This will create a new node serving as a root of the scene described by the obj file. This newly created node is added to this node's children.
fn apply_to_scene_nodes_mut<F: FnMut(&mut SceneNode)>(&mut self, f: &mut F)
Applies a closure to each object contained by this node and its children.
fn apply_to_scene_nodes<F: FnMut(&SceneNode)>(&self, f: &mut F)
Applies a closure to each object contained by this node and its children.
fn render(&mut self, pass: usize, camera: &mut Camera, light: &Light)
Render the scene graph rooted by this node.
fn set_material(&mut self, material: Rc<RefCell<Box<Material + 'static>>>)
Sets the material of the objects contained by this node and its children.
fn set_material_with_name(&mut self, name: &str)
Sets the material of the objects contained by this node and its children.
fn set_lines_width(&mut self, width: f32)
Sets the width of the lines drawn for the objects contained by this node and its children.
fn set_points_size(&mut self, size: f32)
Sets the size of the points drawn for the objects contained by this node and its children.
fn set_surface_rendering_activation(&mut self, active: bool)
Activates or deactivates the rendering of the surfaces of the objects contained by this node and its children.
fn enable_backface_culling(&mut self, active: bool)
Activates or deactivates backface culling for the objects contained by this node and its children.
fn modify_vertices<F: FnMut(&mut Vec<Point3<f32>>)>(&mut self, f: &mut F)
Mutably accesses the vertices of the objects contained by this node and its children.
The provided closure is called once per object.
fn read_vertices<F: FnMut(&[Point3<f32>])>(&self, f: &mut F)
Accesses the vertices of the objects contained by this node and its children.
The provided closure is called once per object.
fn recompute_normals(&mut self)
Recomputes the normals of the meshes of the objects contained by this node and its children.
fn modify_normals<F: FnMut(&mut Vec<Vector3<f32>>)>(&mut self, f: &mut F)
Mutably accesses the normals of the objects contained by this node and its children.
The provided closure is called once per object.
fn read_normals<F: FnMut(&[Vector3<f32>])>(&self, f: &mut F)
Accesses the normals of the objects contained by this node and its children.
The provided closure is called once per object.
fn modify_faces<F: FnMut(&mut Vec<Point3<u32>>)>(&mut self, f: &mut F)
Mutably accesses the faces of the objects contained by this node and its children.
The provided closure is called once per object.
fn read_faces<F: FnMut(&[Point3<u32>])>(&self, f: &mut F)
Accesses the faces of the objects contained by this node and its children.
The provided closure is called once per object.
fn modify_uvs<F: FnMut(&mut Vec<Point2<f32>>)>(&mut self, f: &mut F)
Mutably accesses the texture coordinates of the objects contained by this node and its children.
The provided closure is called once per object.
fn read_uvs<F: FnMut(&[Point2<f32>])>(&self, f: &mut F)
Accesses the texture coordinates of the objects contained by this node and its children.
The provided closure is called once per object.
fn is_visible(&self) -> bool
Get the visibility status of node.
fn set_visible(&mut self, visible: bool)
Sets the visibility of this node.
The node and its children are not rendered if it is not visible.
fn set_color(&mut self, r: f32, g: f32, b: f32)
Sets the color of the objects contained by this node and its children.
Colors components must be on the range [0.0, 1.0]
.
fn set_texture_from_file(&mut self, path: &Path, name: &str)
Sets the texture of the objects contained by this node and its children.
The texture is loaded from a file and registered by the global TextureManager
.
Arguments
path
- relative path of the texture on the disk
fn set_texture_with_name(&mut self, name: &str)
Sets the texture of the objects contained by this node and its children.
The texture must already have been registered as name
.
fn set_texture(&mut self, texture: Rc<Texture>)
Sets the texture of the objects contained by this node and its children.
fn set_local_scale(&mut self, sx: f32, sy: f32, sz: f32)
Sets the local scaling factors of the object.
fn reorient(&mut self, eye: &Point3<f32>, at: &Point3<f32>, up: &Vector3<f32>)
Move and orient the object such that it is placed at the point eye
and have its x
axis
oriented toward at
.
fn append_transformation(&mut self, t: &Isometry3<f32>)
Appends a transformation to this node local transformation.
fn prepend_to_local_transformation(&mut self, t: &Isometry3<f32>)
Prepends a transformation to this node local transformation.
fn set_local_transformation(&mut self, t: Isometry3<f32>)
Set this node local transformation.
fn append_translation(&mut self, t: &Translation3<f32>)
Appends a translation to this node local transformation.
fn prepend_to_local_translation(&mut self, t: &Translation3<f32>)
Prepends a translation to this node local transformation.
fn set_local_translation(&mut self, t: Translation3<f32>)
Sets the local translation of this node.
fn append_rotation(&mut self, r: &UnitQuaternion<f32>)
Appends a rotation to this node local transformation.
fn append_rotation_wrt_center(&mut self, r: &UnitQuaternion<f32>)
Appends a rotation to this node local transformation.
fn prepend_to_local_rotation(&mut self, r: &UnitQuaternion<f32>)
Prepends a rotation to this node local transformation.
fn set_local_rotation(&mut self, r: UnitQuaternion<f32>)
Sets the local rotation of this node.
Trait Implementations
impl Clone for SceneNode
[src]
fn clone(&self) -> SceneNode
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more