API ReferenceGE Extensionseditorterraform
Terraform - Fetch Sources
Collects terraforming sources (roads, splines) from the scene within a polygon or selection, converting them to a standardized format for the terraform engine.
Collects terraforming sources (roads, splines) from the scene within a polygon or selection, converting them to a standardized format for the terraform engine.
Public API
| Function | Signature | Description |
|---|---|---|
M.getAllSourcesInPolygon | (polygon) → sources | Gets all supported sources within a polygon |
M.getAllSourcesInSelection | () → sources | Gets all supported sources in current editor selection |
Source Types Collected
| Source Type | Module Used | Description |
|---|---|---|
| MeshRoad | scenetree.findClassObjects("MeshRoad") | Scene tree mesh roads |
| RAT Roads | editor/tech/roadArchitect/roads | Road Architect roads |
| Mesh Splines | editor/meshSpline/splineMgr | Mesh spline tools |
| Assembly Splines | editor/assemblySpline/splineMgr | Assembly spline tools |
| Master Splines | editor/masterSpline/splineMgr | Master spline tools |
Code Example
local fetchSources = require('editor/terraform/fetchSources')
-- Get all sources within a drawn polygon
local polygon = { vec3(0,0,0), vec3(100,0,0), vec3(100,100,0), vec3(0,100,0) }
local sources = fetchSources.getAllSourcesInPolygon(polygon)
-- Get sources from editor selection (MeshRoads only)
local sources = fetchSources.getAllSourcesInSelection()
-- Each source is an array of ordered polyline points:
-- { pos = vec3, width = number, binormal = vec3 }
-- For mesh roads, a Catmull-Rom spline is fitted to nodes
-- with Frenet frame computation (tangent, normal, binormal)
-- For RAT roads, render data is used directly with lane extents
-- Polygon clipping: roads partially inside are split,
-- only segments inside the polygon are included as separate sources
-- AABB pre-filtering: sources outside polygon AABB are skipped
-- Node spans computed via geom.getNodeSpansInsidePolygon()Dependencies
| Module | Purpose |
|---|---|
editor/meshSpline/splineMgr | Mesh spline data access |
editor/assemblySpline/splineMgr | Assembly spline data access |
editor/tech/roadArchitect/roads | RAT road data access |
editor/masterSpline/splineMgr | Master spline data access |
editor/toolUtilities/geom | Polygon/AABB/span geometry utilities |
See Also
- Terraform - Core Engine - Related reference
- World Editor Guide - Guide
Sensor Configuration - Utilities
Provides coordinate frame conversions between vehicle-space and sensor-local frames, plus debug visualization for sensor boxes, beams, and local frames.
Terraform - Core Engine
Core terraforming engine that modifies terrain heightmaps based on source geometry (roads, splines) using SDF-based falloff, optional noise, and blur smoothing.