Skip to main content

Module tree

Module tree 

Source
Expand description

Procedural trees. A Tree grows a trunk with branches (tapered tubes) and clusters of leaf cards at the twigs. Bark and leaves are two Transient child meshes drawn with the built-in builtin:bark and builtin:foliage shaders: leaves are cut out in the shader and sway in the wind on the GPU, so the meshes are built only when a parameter changes.

use kvas_engine::tree::{Tree, build};
let (bark, leaves) = build(&Tree::default());
assert!(!bark.indices.is_empty() && !leaves.indices.is_empty());

Structs§

Tree
A seeded procedural tree. Change any field in the Inspector and the tree regrows.
TreePart
Marks a child mesh created for a tree (bark or leaves).

Enums§

TreeStyle
Overall shape of a tree: Broadleaf (oak), Conifer (pine), Palm, or Bush.

Functions§

build
Builds the bark and leaf meshes of a tree (in the tree’s local space, root at the origin).
update
Rebuilds changed trees and their transient bark and leaf meshes.