RamSpline
A class in Root.Township, the global namespace.
Third-party NatureManufacture river spline: builds a river mesh along Catmull-Rom control points, with width, flow map and vertex colours. Used for forest river paths (RiverPath.Mesh).
- Listed in Global namespace: Q to R
- Inherits or implements
MonoBehaviour - Attributes
RequireComponent
Constructors
| Member | What it is |
|---|---|
RamSpline() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
List<RamSpline> beginnigChildSplines | Splines that connect to the start of this one; rebuilt after this one. |
int beginningConnectionID | Index of the point on beginningSpline this spline starts from (its last point). |
float beginningMaxWidth | Where across the parent's width (0 to 1) this spline's start ends. |
float beginningMinWidth | Where across the parent's width (0 to 1) this spline's start begins. |
RamSpline beginningSpline | Spline whose end this spline's start joins onto. |
Color[] colors | Vertex colours. Reset to black when the vertex count changes. |
List<Vector2> colorsFlowMap | Per-vertex flow map written to uv4. Kept when overrideFlowMap is set. |
List<Vector4> controlPoints | Control points: XYZ is the local position, W the width there. |
List<Vector3> controlPointsDown | Left edge points at each control point. |
List<AnimationCurve> controlPointsMeshCurves | Per control point curve that lifts vertices across the width. |
List<Quaternion> controlPointsOrientation | Orientation at each control point. |
List<Quaternion> controlPointsRotations | Extra rotation per control point. |
List<float> controlPointsSnap | Per control point amount (0 to 1) that edge vertices snap to the ground. |
List<Vector3> controlPointsUp | Right edge points at each control point. |
SplineProfile currentProfile | Spline profile asset in use. Probably read by the editor tool only. |
bool debug | Editor tool setting. Not read in the game code. |
int detailTerrain | Editor tool setting for terrain carving. Not read in the game code. |
int detailTerrainForward | Editor tool setting for terrain carving. Not read in the game code. |
Color drawColor | Editor vertex painting colour. Not read in the game code. |
bool drawOnMesh | Editor vertex painting toggle. Not read in the game code. |
bool drawOnMeshFlowMap | Editor flow map painting toggle. Not read in the game code. |
bool drawOnMultiple | Editor painting toggle for several splines. Not read in the game code. |
float drawSize | Editor painting brush size. Not read in the game code. |
List<RamSpline> endingChildSplines | Splines that connect to the end of this one; rebuilt after this one. |
int endingConnectionID | Index of the point on endingSpline this spline ends at (always 0). |
float endingMaxWidth | Where across the next spline's width (0 to 1) this spline's end stops. |
float endingMinWidth | Where across the next spline's width (0 to 1) this spline's end starts. |
RamSpline endingSpline | Spline whose start this spline's end joins onto. |
float flowDirection | Editor flow painting setting. Not read in the game code. |
AnimationCurve flowFlat | Flow speed across the width on level ground. |
float flowSpeed | Speed written into the flow map. |
AnimationCurve flowWaterfall | Flow speed across the width on steep ground. |
float fulllength | Total UV length of the spline, worked out in GenerateMesh. |
bool generateMeshParts | Whether the mesh is split into several child parts. |
bool invertUVDirection | Flips the UV direction along the river. |
float length | Running UV length along the spline, carried on from beginningSpline. |
List<float> lerpValues | Per sample position along the control points (segment index plus t). |
float maxVal | Shapes how vertices spread across the right half of the width. |
AnimationCurve meshCurve | Default lift curve across the width. Not read in this class. |
List<Transform> meshesPartTransforms | Child objects made when the mesh is split into parts. Destroyed on each rebuild. |
MeshFilter meshfilter | Mesh filter that gets the generated mesh. |
int meshPartsCount | How many parts the mesh is split into. |
float minMaxWidth | Share of the joined spline's width this spline covers, for UVs. |
float minVal | Shapes how vertices spread across the left half of the width. |
bool normalFromRaycast | When true, normals come from a raycast to the ground instead of the spline orientation. |
List<Vector3> normalsBeginning | Normals of the first row, used by splines that join onto this one. |
List<Vector3> normalsEnding | Normals of the last row, used by splines that join onto this one. |
List<Vector3> normalsList | Per sample normal. |
Material oldMaterial | Editor tool setting. Not read in the game code. |
SplineProfile oldProfile | Previous spline profile. Probably used by the editor tool only. |
float opacity | Editor painting opacity. Not read in the game code. |
List<Quaternion> orientations | Per sample orientation. |
bool overrideFlowMap | When true, a hand painted flow map is kept instead of recomputed. |
List<Vector3> points | Sampled centre line points. |
List<Vector3> points2 | Unused point list. |
List<Vector3> pointsDown | Sampled left edge points. |
List<Vector3> pointsUp | Sampled right edge points. |
float raycastHeightOffset | Height above a vertex that ground snap raycasts start from. |
bool showFlowMap | Editor display toggle. Not read in the game code. |
bool showVertexColors | Editor display toggle. Not read in the game code. |
float simulatedRiverLength | Editor river simulation setting. Not read in the game code. |
int simulatedRiverPoints | Editor river simulation setting. Not read in the game code. |
float simulationMinStepSize | Editor river simulation setting. Not read in the game code. |
LayerMask snapMask | Layers the edge vertices snap and raycast onto. |
List<float> snaps | Per sample ground snap amount. |
bool snapToTerrain | Whether generated vertices are raycast down onto snapMask colliders. |
List<Vector3> tangents | Per sample tangent. |
float terrainAdditionalWidth | Editor terrain carving setting. Not read in the game code. |
AnimationCurve terrainCurve | Editor terrain carving curve. Not read in the game code. |
float terrainDepthHeight | Editor terrain carving setting. Not read in the game code. |
float terrainDepthMultiplier | Editor terrain carving setting. Not read in the game code. |
float terrainSmoothMultiplier | Editor terrain carving setting. Not read in the game code. |
int toolbarInt | Selected tab in the editor tool. Not read in the game code. |
float triangleDensity | How densely the spline is sampled along its length. |
float uvBeginning | UV offset across the width, from where this spline joins its parent. |
bool uvRotation | When true, the along-river UV goes in u instead of v. |
float uvScale | UV tiling along the river. |
bool uvScaleOverride | When true, keeps this spline's own uvScale instead of copying the parent's. |
float uvWidth | UV width across the river, scaled by the share of the parent it covers. |
List<Vector3> verticesBeginning | Vertices of the first row, used by splines that join onto this one. |
List<Vector3> verticesEnding | Vertices of the last row, used by splines that join onto this one. |
int vertsInShape | Vertices across the river's width. |
float width | Default width for new control points. |
List<float> widths | Per sample river width. |
1 private and internal field
Methods
| Member | What it is |
|---|---|
void AddPoint(Vector4 position) | Adds a control point at the end. A w of 0 copies the last point's width, or width for the first. |
void AddPoint(Vector4 position, AnimationCurve curve) | Adds a control point at the end. A w of 0 copies the last point's width, or width for the first. |
void AddPointAfter(int i) | Inserts a control point after index i, halfway to the next point or extended past the last one. |
void ChangePointPosition(int i, Vector3 position) | Moves a control point. A w of 0 keeps its current width. |
void ChangePointPosition(int i, Vector4 position) | Moves a control point. A w of 0 keeps its current width. |
void ControlledGenerate() | Builds the mesh now and stops Start from building it again. |
static RamSpline CreateSpline(Material splineMaterial = null, List<Vector4> positions = null) | Creates a new game object with a spline and an unshadowed mesh renderer, optionally with a material and points. |
void GenerateBeginningParentBased() | Snaps the first control point onto the end of beginningSpline, between its min and max width. |
void GenerateEndingParentBased() | Snaps the last control point onto the start of endingSpline, between its min and max width. |
void GenerateMeshParts(Mesh baseMesh) | Splits a built mesh into meshPartsCount child mesh objects and hides the main renderer. |
void GenerateSpline(List<RamSpline> generatedSplines = null) | Rebuilds the river mesh from the control points, then regenerates connected child splines. The list argument is ignored. |
void RemovePoint(int i) | Removes a control point and its rotation, snap and curve entries. |
void RemovePoints(int fromID = -1) | Removes every control point after index fromID (all of them by default). |
void Start() | Builds the mesh unless ControlledGenerate already did. |
13 private and internal methods
Used in
Members of other types that take, return or hold a RamSpline: