Spline Mesh Demo
App: apps/spline_mesh_demo/
Demonstrates spline mesh extrusion (engine PLM-245 / ADR 0084), part of Block SPL
(splines / geometry / scatter): MeshGen.ribbon
sweeps a flat ribbon along a Spline and conforms it onto a heightfield
terrain — each ribbon station snaps onto the ground so the “river” hugs the hills — while
MeshGen.tube sweeps a capped tube
along a second spline to arch a pipe over the valley.
Run from root
Section titled “Run from root”% ./plume3d spline_mesh_demoA raised three-quarter camera looks over the valley. The demo captures a screenshot at frame 60 and exits at frame 80.
What it does
Section titled “What it does”-
Builds a heightfield terrain twice — once as a visual
MeshGen.heightmapmesh, and once as a matchingPhysics.addStaticHeightfieldcollider from the same heights, so the surface the ribbon conforms to lines up with the surface you see. (The collider extends+X/+Z, so its node sits at the-halfcorner to align with the centered visual mesh.)_terrain = MeshGen.heightmap(_heights, _n, _n, _cell, _cell, 1.0)var tnode = _scene.addNode("terrain")tnode.setPosition(-_half, 0, -_half)Physics.addStaticHeightfield(_scene, tnode, _heights, _n, _cell) // same heights → aligned -
Builds an S-curve river spline from five control points and sweeps a ribbon along it, passing the scene so each station conforms to the terrain:
var path = Spline.new()path.addPoint(-15, 0, -12)path.addPoint(-6, 0, -3)// … more points …_river = MeshGen.ribbon(path, 2.4, 64, _scene) // conformScene = _scene → snap to the ground_river.setColor(0.24, 0.44, 0.78, 1.0)Passing
nullinstead of_scenewould leave the ribbon flat at the spline’s own height. -
Sweeps a decorative tube along a second spline whose middle control points rise, so the pipe arches over the scene (no conform — it keeps the spline’s own heights):
var arch = Spline.new()arch.addPoint(-10, 0.2, 6)arch.addPoint(-4, 4.0, 6)arch.addPoint(4, 4.0, 6)arch.addPoint(10, 0.2, 6)_pipe = MeshGen.tube(arch, 0.35, 12, 48) -
Draws the terrain, river, and pipe immediate-mode with a lit shader.
- MeshGen —
ribbon(flat swept ribbon, terrain-conformed via the scene) andtube(capped closed tube), plusheightmapfor the terrain. - Spline —
Spline.new/addPoint; the curve both sweeps follow. - Physics —
addStaticHeightfield(the collider the ribbon conforms onto) and the surface queriesribbon’s conform uses under the hood.
- Conform is invisible without a collider.
ribbon(spline, width, samples, scene)snaps each station via a physics ray-down, which only hits registered colliders. The visualMeshGen.heightmapalone would not conform anything — the matchingaddStaticHeightfieldis what the ray sees. Build both from the same heights and they align. - The ribbon’s surface normal is the spline frame’s normal (exact), and the tube’s cross-section
is seam-welded, so both shade correctly under a lit shader. Both follow the standard
centered / Y-up / CCW-outward
MeshGenconventions.
See MeshGen — Spline extrusion for the full ribbon / tube
surface and the Spline primitive that drives them.