kiss3d | Keep it simple , stupid 3d graphics engine for Rust | Graphics library
kandi X-RAY | kiss3d Summary
kandi X-RAY | kiss3d Summary
Keep It Simple, Stupid 3d graphics engine.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of kiss3d
kiss3d Key Features
kiss3d Examples and Code Snippets
Community Discussions
Trending Discussions on kiss3d
QUESTION
This a specific question about sebcrozet/kiss3d (a graphics package for games written in rust): how do I clear the 'scene'?
I can add objects to the scene by window.add_mesh()
and similar methods, and it seems I can remove specific objects by windows.remove_node()
, but how do I remove all the objects in a scene (e.g. to start a new scene)?
I suppose I could keep a vector of all the objects in the scene, and then iterate over the vector to remove the objects, but that should not be necessary.
Edit: here is some code that reproduces the error, excerpted from my code.
...ANSWER
Answered 2019-Mar-22 at 11:02You can get a scene
from a window
with the Window::scene_mut
function, which will return a SceneNode
.
After you get your mutable scene node you can delete all the objects inside of the scene with the SceneNode::apply_to_scene_nodes
function.
As documented in kiss3d docs page:
fn apply_to_scene_nodes_mut(&mut self, f: &mut F)
Applies a closure to each object contained by this node and its children.
This is the method that takes closure in it and applies it to the all nodes inside to scene. So you don't need to add all the objects to a Vec
.
Note that this method is working recursively to apply the function you provided to all the childrens of the parent and itself.
In your case it is only needed to unlink the parent scene like following:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install kiss3d
Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page