dymokomi/luce-geocore
Source of release 0.7.7
0.7.7 / src / code / stubs.lucb
# The API a snippet is checked against: `luce_geocore/code.lucb` in the snippet root. The
# bodies never run; what each member does is in `bindings.lucb`.
let stub_text: str = """from luce_kernel.lib import Mat4
## The geometry a Code node's snippet runs against (luce-geocore). Positions, normals
## and colors are f32[4] with lane 3 zero; uv is f32[2]. Accessors take the attribute's
## name as a literal and read or write it in its stored type; reading an attribute the
## geometry lacks gives 0, and writing one creates it.
## The point a snippet runs for (Run Over Points).
pub struct Point:
## This point's array attribute `name` (Houdini's f[]@, i[]@, v[]@), empty without
## one; more than 64 items faults. Setting one queues a write applied after the run
## (the attribute becomes an array attribute of that kind).
pub func f32_array(name: str) -> const FloatArray*:
_ = name
return (const FloatArray*)(void*)4096
pub func set_f32_array(name: str, value: const FloatArray*):
_ = name
_ = value
pub func i32_array(name: str) -> const IntArray*:
_ = name
return (const IntArray*)(void*)4096
pub func set_i32_array(name: str, value: const IntArray*):
_ = name
_ = value
pub func vec3_array(name: str) -> const VectorArray*:
_ = name
return (const VectorArray*)(void*)4096
pub func set_vec3_array(name: str, value: const VectorArray*):
_ = name
_ = value
## This point's text attribute `name` ("" without one), and setting it (applied
## after the run, as `k.set_point_text`).
pub func text(name: str) -> const Text*:
_ = name
return (const Text*)(void*)4096
pub func set_text(name: str, value: const Text*):
_ = name
_ = value
## Position, in world space.
pub var P: f32[4]
## Normal, 0 when the geometry has none; writing creates it.
pub var N: f32[4]
## Color; writing creates it.
pub var Cd: f32[4]
## Texture coordinates on points.
pub var uv: f32[2]
## This point's number and how many points there are.
pub let ptnum: i32
pub let numpt: i32
## A Gaussian splat's rotation, x, y, z, w (Houdini's `orient`); the identity (0, 0, 0, 1) without one.
pub var orient: f32[4]
## A splat's size along its own axes (σ, Houdini's `scale`), lane 3 zero.
pub var scale: f32[4]
## A splat's linear opacity, 0 to 1 (3DGS's sigmoid of the file's logit).
pub var opacity: f32
var written: bool
## SH coefficient `i` of a splat (0 to `sh_count() - 1`: bands 1 to 3 in order,
## m = -l..l), RGB in lanes 0 to 2; an `i` out of range faults.
pub func sh(i: i32) -> f32[4]:
_ = i
return [0.0, 0.0, 0.0, 0.0]
## Set SH coefficient `i` (lanes 0 to 2); the cloud's `sh` changes after the run.
pub func set_sh(i: i32, value: f32[4]):
_ = i
_ = value
self.written = true
## How many SH coefficients a splat has: 0, 3, 8 or 15 (degree 0 to 3).
pub func sh_count() -> i32:
return 0
## Point attribute `name`, of its stored type.
pub func f32(name: str) -> f32:
_ = name
return 0.0
pub func f64(name: str) -> f64:
_ = name
return 0.0
pub func i32(name: str) -> i32:
_ = name
return 0
pub func i64(name: str) -> i64:
_ = name
return 0
pub func vec2(name: str) -> f32[2]:
_ = name
return [0.0, 0.0]
pub func vec3(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
pub func vec4(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
## Set point attribute `name`, creating it with the setter's type.
pub func set_f32(name: str, value: f32):
_ = name
_ = value
self.written = true
pub func set_f64(name: str, value: f64):
_ = name
_ = value
self.written = true
pub func set_i32(name: str, value: i32):
_ = name
_ = value
self.written = true
pub func set_i64(name: str, value: i64):
_ = name
_ = value
self.written = true
pub func set_vec2(name: str, value: f32[2]):
_ = name
_ = value
self.written = true
pub func set_vec3(name: str, value: f32[4]):
_ = name
_ = value
self.written = true
pub func set_vec4(name: str, value: f32[4]):
_ = name
_ = value
self.written = true
## Whether the point is in point group `name`; put it in or take it out.
pub func in_group(name: str) -> bool:
_ = name
return false
pub func set_group(name: str, member: bool):
_ = name
_ = member
self.written = true
## The primitive (face) a snippet runs for (Run Over Primitives).
pub struct Prim:
## This primitive's array attribute `name` (Houdini's f[]@, i[]@, v[]@), empty without
## one; more than 64 items faults. Setting one queues a write applied after the run
## (the attribute becomes an array attribute of that kind).
pub func f32_array(name: str) -> const FloatArray*:
_ = name
return (const FloatArray*)(void*)4096
pub func set_f32_array(name: str, value: const FloatArray*):
_ = name
_ = value
pub func i32_array(name: str) -> const IntArray*:
_ = name
return (const IntArray*)(void*)4096
pub func set_i32_array(name: str, value: const IntArray*):
_ = name
_ = value
pub func vec3_array(name: str) -> const VectorArray*:
_ = name
return (const VectorArray*)(void*)4096
pub func set_vec3_array(name: str, value: const VectorArray*):
_ = name
_ = value
## This primitive's text attribute `name` ("" without one), and setting it (applied
## after the run, as `k.set_prim_text`).
pub func text(name: str) -> const Text*:
_ = name
return (const Text*)(void*)4096
pub func set_text(name: str, value: const Text*):
_ = name
_ = value
## Color; writing creates it.
pub var Cd: f32[4]
## This primitive's number and how many there are.
pub let primnum: i32
pub let numprim: i32
var written: bool
## The face's area, center and unit normal.
pub func area() -> f32:
return 0.0
pub func center() -> f32[4]:
return [0.0, 0.0, 0.0, 0.0]
pub func normal() -> f32[4]:
return [0.0, 0.0, 0.0, 0.0]
## Primitive attribute `name`, of its stored type.
pub func f32(name: str) -> f32:
_ = name
return 0.0
pub func f64(name: str) -> f64:
_ = name
return 0.0
pub func i32(name: str) -> i32:
_ = name
return 0
pub func i64(name: str) -> i64:
_ = name
return 0
pub func vec2(name: str) -> f32[2]:
_ = name
return [0.0, 0.0]
pub func vec3(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
pub func vec4(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
## Set primitive attribute `name`, creating it with the setter's type.
pub func set_f32(name: str, value: f32):
_ = name
_ = value
self.written = true
pub func set_f64(name: str, value: f64):
_ = name
_ = value
self.written = true
pub func set_i32(name: str, value: i32):
_ = name
_ = value
self.written = true
pub func set_i64(name: str, value: i64):
_ = name
_ = value
self.written = true
pub func set_vec2(name: str, value: f32[2]):
_ = name
_ = value
self.written = true
pub func set_vec3(name: str, value: f32[4]):
_ = name
_ = value
self.written = true
pub func set_vec4(name: str, value: f32[4]):
_ = name
_ = value
self.written = true
## Whether the primitive is in primitive group `name`; put it in or take it out.
pub func in_group(name: str) -> bool:
_ = name
return false
pub func set_group(name: str, member: bool):
_ = name
_ = member
self.written = true
## The vertex (a face's corner) a snippet runs for (Run Over Vertices).
pub struct Vertex:
## This vertex's array attribute `name` (Houdini's f[]@, i[]@, v[]@), empty without
## one; more than 64 items faults. Setting one queues a write applied after the run
## (the attribute becomes an array attribute of that kind).
pub func f32_array(name: str) -> const FloatArray*:
_ = name
return (const FloatArray*)(void*)4096
pub func set_f32_array(name: str, value: const FloatArray*):
_ = name
_ = value
pub func i32_array(name: str) -> const IntArray*:
_ = name
return (const IntArray*)(void*)4096
pub func set_i32_array(name: str, value: const IntArray*):
_ = name
_ = value
pub func vec3_array(name: str) -> const VectorArray*:
_ = name
return (const VectorArray*)(void*)4096
pub func set_vec3_array(name: str, value: const VectorArray*):
_ = name
_ = value
## Texture coordinates and normal on the vertex.
pub var uv: f32[2]
pub var N: f32[4]
## This vertex's number, how many there are, and the point it uses.
pub let vtxnum: i32
pub let numvtx: i32
pub let ptnum: i32
var written: bool
## Vertex attribute `name`, of its stored type.
pub func f32(name: str) -> f32:
_ = name
return 0.0
pub func f64(name: str) -> f64:
_ = name
return 0.0
pub func i32(name: str) -> i32:
_ = name
return 0
pub func i64(name: str) -> i64:
_ = name
return 0
pub func vec2(name: str) -> f32[2]:
_ = name
return [0.0, 0.0]
pub func vec3(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
pub func vec4(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
## Set vertex attribute `name`, creating it with the setter's type.
pub func set_f32(name: str, value: f32):
_ = name
_ = value
self.written = true
pub func set_f64(name: str, value: f64):
_ = name
_ = value
self.written = true
pub func set_i32(name: str, value: i32):
_ = name
_ = value
self.written = true
pub func set_i64(name: str, value: i64):
_ = name
_ = value
self.written = true
pub func set_vec2(name: str, value: f32[2]):
_ = name
_ = value
self.written = true
pub func set_vec3(name: str, value: f32[4]):
_ = name
_ = value
self.written = true
pub func set_vec4(name: str, value: f32[4]):
_ = name
_ = value
self.written = true
## Whether the vertex is in vertex group `name`; put it in or take it out.
pub func in_group(name: str) -> bool:
_ = name
return false
pub func set_group(name: str, member: bool):
_ = name
_ = member
self.written = true
## The box around a geometry, in world space (lane 3 is 0).
pub struct Bounds:
pub let min: f32[4]
pub let max: f32[4]
pub let center: f32[4]
pub let size: f32[4]
## Where a ray met a geometry: the primitive (-1 for a miss), its parametric uv (for
## `primuv_*`), the world position and the distance along the ray.
pub struct Hit:
pub let prim: i32
pub let uv: f32[2]
pub let position: f32[4]
pub let distance: f32
## Up to 16 point numbers, nearest first.
pub struct Near:
pub let count: i32
pub let points: i32[16]
## A text (VEX string), up to 256 bytes (longer results are cut). Made by `k.text("…")`,
## `p.text("name")`, `g.point_text(i, "name")`, `k.itoa`, `k.sprintf` and these methods;
## each method that makes a text gives a new one.
pub struct Text:
var unused: i32
## Its length in bytes (VEX `strlen`).
pub func length() -> i32:
return 0
## Whether it is the same text as `other`.
pub func equals(other: const Text*) -> bool:
_ = other
return false
## This text followed by `other`.
pub func concat(other: const Text*) -> const Text*:
return other
## Whether it starts or ends with `other` (VEX `startswith`, `endswith`).
pub func startswith(other: const Text*) -> bool:
_ = other
return false
pub func endswith(other: const Text*) -> bool:
_ = other
return false
## The byte where `other` first starts, or -1 (VEX `find`).
pub func find(other: const Text*) -> i32:
_ = other
return -1
## Every `old` replaced by `replacement` (VEX `replace`).
pub func replace(old: const Text*, replacement: const Text*) -> const Text*:
_ = old
return replacement
## Bytes `start` to `end` (not included), Python style: negative counts from the end.
pub func slice(start: i32, end: i32) -> const Text*:
_ = start
_ = end
return (const Text*)(void*)4096
## How many pieces `separator` splits it into, and piece `index` (VEX `split`).
pub func split_count(separator: const Text*) -> i32:
_ = separator
return 1
pub func split(separator: const Text*, index: i32) -> const Text*:
_ = index
return separator
## This text, `separator`, then `other` (VEX `join` of two).
pub func join(separator: const Text*, other: const Text*) -> const Text*:
_ = separator
return other
## Its number (VEX `atoi`, `atof`); 0 when it is not one.
pub func to_i32() -> i32:
return 0
pub func to_f32() -> f32:
return 0.0
## Floats (VEX float[]), up to 64 items; methods that change it give a new array
## (`a = a.append(x)`). `for i in 0..<a.len(): a.at(i)` walks it.
pub struct FloatArray:
var unused: i32
## How many items (VEX `len`).
pub func len() -> i32:
return 0
## Item `i` (out of range faults).
pub func at(i: i32) -> f32:
_ = i
return 0.0
## With item `i` replaced by `value`.
pub func set(i: i32, value: f32) -> const FloatArray*:
_ = i
_ = value
return (const FloatArray*)(void*)4096
## With `value` added at the end (VEX `append`; past 64 items faults), or inserted
## before item `i` (VEX `insert`).
pub func append(value: f32) -> const FloatArray*:
_ = value
return (const FloatArray*)(void*)4096
pub func insert(i: i32, value: f32) -> const FloatArray*:
_ = i
_ = value
return (const FloatArray*)(void*)4096
## Without its last item (VEX `pop`; read it first with `at(len() - 1)`), or without
## item `i` (VEX `removeindex`).
pub func pop() -> const FloatArray*:
return (const FloatArray*)(void*)4096
pub func remove(i: i32) -> const FloatArray*:
_ = i
return (const FloatArray*)(void*)4096
## With `count` items, new ones zero (VEX `resize`).
pub func resize(count: i32) -> const FloatArray*:
_ = count
return (const FloatArray*)(void*)4096
## Reversed (VEX `reverse`).
pub func reverse() -> const FloatArray*:
return (const FloatArray*)(void*)4096
## Items `start` to `end` (not included), Python style (VEX `slice`).
pub func slice(start: i32, end: i32) -> const FloatArray*:
_ = start
_ = end
return (const FloatArray*)(void*)4096
## Sorted ascending, stable (VEX `sort`; vectors by x, then y, then z), and the item
## numbers in that order (VEX `argsort`).
pub func sort() -> const FloatArray*:
return (const FloatArray*)(void*)4096
pub func argsort() -> const IntArray*:
return (const IntArray*)(void*)4096
## The first item equal to `value`, or -1 (VEX `find`).
pub func find(value: f32) -> i32:
_ = value
return -1
## Integers (VEX int[]), up to 64 items; methods that change it give a new array
## (`a = a.append(x)`). `for i in 0..<a.len(): a.at(i)` walks it.
pub struct IntArray:
var unused: i32
## How many items (VEX `len`).
pub func len() -> i32:
return 0
## Item `i` (out of range faults).
pub func at(i: i32) -> i32:
_ = i
return 0
## With item `i` replaced by `value`.
pub func set(i: i32, value: i32) -> const IntArray*:
_ = i
_ = value
return (const IntArray*)(void*)4096
## With `value` added at the end (VEX `append`; past 64 items faults), or inserted
## before item `i` (VEX `insert`).
pub func append(value: i32) -> const IntArray*:
_ = value
return (const IntArray*)(void*)4096
pub func insert(i: i32, value: i32) -> const IntArray*:
_ = i
_ = value
return (const IntArray*)(void*)4096
## Without its last item (VEX `pop`; read it first with `at(len() - 1)`), or without
## item `i` (VEX `removeindex`).
pub func pop() -> const IntArray*:
return (const IntArray*)(void*)4096
pub func remove(i: i32) -> const IntArray*:
_ = i
return (const IntArray*)(void*)4096
## With `count` items, new ones zero (VEX `resize`).
pub func resize(count: i32) -> const IntArray*:
_ = count
return (const IntArray*)(void*)4096
## Reversed (VEX `reverse`).
pub func reverse() -> const IntArray*:
return (const IntArray*)(void*)4096
## Items `start` to `end` (not included), Python style (VEX `slice`).
pub func slice(start: i32, end: i32) -> const IntArray*:
_ = start
_ = end
return (const IntArray*)(void*)4096
## Sorted ascending, stable (VEX `sort`; vectors by x, then y, then z), and the item
## numbers in that order (VEX `argsort`).
pub func sort() -> const IntArray*:
return (const IntArray*)(void*)4096
pub func argsort() -> const IntArray*:
return (const IntArray*)(void*)4096
## The first item equal to `value`, or -1 (VEX `find`).
pub func find(value: i32) -> i32:
_ = value
return -1
## Vectors (VEX vector[]; lanes 0 to 2, lane 3 zero), up to 64 items; methods that change it give a new array
## (`a = a.append(x)`). `for i in 0..<a.len(): a.at(i)` walks it.
pub struct VectorArray:
var unused: i32
## How many items (VEX `len`).
pub func len() -> i32:
return 0
## Item `i` (out of range faults).
pub func at(i: i32) -> f32[4]:
_ = i
return [0.0, 0.0, 0.0, 0.0]
## With item `i` replaced by `value`.
pub func set(i: i32, value: f32[4]) -> const VectorArray*:
_ = i
_ = value
return (const VectorArray*)(void*)4096
## With `value` added at the end (VEX `append`; past 64 items faults), or inserted
## before item `i` (VEX `insert`).
pub func append(value: f32[4]) -> const VectorArray*:
_ = value
return (const VectorArray*)(void*)4096
pub func insert(i: i32, value: f32[4]) -> const VectorArray*:
_ = i
_ = value
return (const VectorArray*)(void*)4096
## Without its last item (VEX `pop`; read it first with `at(len() - 1)`), or without
## item `i` (VEX `removeindex`).
pub func pop() -> const VectorArray*:
return (const VectorArray*)(void*)4096
pub func remove(i: i32) -> const VectorArray*:
_ = i
return (const VectorArray*)(void*)4096
## With `count` items, new ones zero (VEX `resize`).
pub func resize(count: i32) -> const VectorArray*:
_ = count
return (const VectorArray*)(void*)4096
## Reversed (VEX `reverse`).
pub func reverse() -> const VectorArray*:
return (const VectorArray*)(void*)4096
## Items `start` to `end` (not included), Python style (VEX `slice`).
pub func slice(start: i32, end: i32) -> const VectorArray*:
_ = start
_ = end
return (const VectorArray*)(void*)4096
## Sorted ascending, stable (VEX `sort`; vectors by x, then y, then z), and the item
## numbers in that order (VEX `argsort`).
pub func sort() -> const VectorArray*:
return (const VectorArray*)(void*)4096
pub func argsort() -> const IntArray*:
return (const IntArray*)(void*)4096
## The first item equal to `value`, or -1 (VEX `find`).
pub func find(value: f32[4]) -> i32:
_ = value
return -1
## A point cloud an input's `pcopen` found: up to 64 points near a position, nearest
## first. VEX's pcnumfound is `count()`, pcimport is `f32(i, name)` / `vec3(i, name)`, and
## pcfilter is `filter_f32(name)` / `filter_vec3(name)`.
pub struct PointCloud:
var unused: i32
## How many points were found (VEX `pcnumfound`).
pub func count() -> i32:
return 0
## The `i`-th found point's number and its distance from the position.
pub func point(i: i32) -> i32:
return i
pub func distance(i: i32) -> f32:
_ = i
return 0.0
## Point attribute `name` ("P" the position) of the `i`-th found point (VEX
## `pcimport`).
pub func f32(i: i32, name: str) -> f32:
_ = i
_ = name
return 0.0
pub func vec3(i: i32, name: str) -> f32[4]:
_ = i
_ = name
return [0.0, 0.0, 0.0, 0.0]
## Point attribute `name` averaged over the found points with weights
## `1 - (distance / radius)^2`, normalized (VEX `pcfilter`): one call smooths.
pub func filter_f32(name: str) -> f32:
_ = name
return 0.0
pub func filter_vec3(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
## A geometry the snippet reads: `k.input(0)` (the node's input as it was before this
## run) or `k.input(1)` (the second input; empty when not connected). Numbers out of
## range fail the cook at the element.
pub struct Geometry:
var unused: i32
## How many points and primitives there are.
pub func point_count() -> i32:
return 0
pub func prim_count() -> i32:
return 0
## Point `index`'s world position.
pub func point_P(index: i32) -> f32[4]:
_ = index
return [0.0, 0.0, 0.0, 0.0]
## Point attribute `name` of point `index` (0 when the geometry lacks it).
pub func point_f32(index: i32, name: str) -> f32:
_ = index
_ = name
return 0.0
pub func point_f64(index: i32, name: str) -> f64:
_ = index
_ = name
return 0.0
pub func point_i32(index: i32, name: str) -> i32:
_ = index
_ = name
return 0
pub func point_i64(index: i32, name: str) -> i64:
_ = index
_ = name
return 0
pub func point_vec2(index: i32, name: str) -> f32[2]:
_ = index
_ = name
return [0.0, 0.0]
pub func point_vec3(index: i32, name: str) -> f32[4]:
_ = index
_ = name
return [0.0, 0.0, 0.0, 0.0]
pub func point_vec4(index: i32, name: str) -> f32[4]:
_ = index
_ = name
return [0.0, 0.0, 0.0, 0.0]
## Primitive attribute `name` of primitive `index`.
pub func prim_f32(index: i32, name: str) -> f32:
_ = index
_ = name
return 0.0
pub func prim_f64(index: i32, name: str) -> f64:
_ = index
_ = name
return 0.0
pub func prim_i32(index: i32, name: str) -> i32:
_ = index
_ = name
return 0
pub func prim_i64(index: i32, name: str) -> i64:
_ = index
_ = name
return 0
pub func prim_vec2(index: i32, name: str) -> f32[2]:
_ = index
_ = name
return [0.0, 0.0]
pub func prim_vec3(index: i32, name: str) -> f32[4]:
_ = index
_ = name
return [0.0, 0.0, 0.0, 0.0]
pub func prim_vec4(index: i32, name: str) -> f32[4]:
_ = index
_ = name
return [0.0, 0.0, 0.0, 0.0]
## The points of primitive `prim`, in order: how many, and the `at`-th.
pub func prim_point_count(prim: i32) -> i32:
_ = prim
return 0
pub func prim_point(prim: i32, at: i32) -> i32:
_ = prim
_ = at
return 0
## The primitives using point `point`: how many, and the `at`-th.
pub func point_prim_count(point: i32) -> i32:
_ = point
return 0
pub func point_prim(point: i32, at: i32) -> i32:
_ = point
_ = at
return 0
## The points sharing an edge with point `point`: how many, and the `at`-th.
pub func neighbor_count(point: i32) -> i32:
_ = point
return 0
pub func neighbor(point: i32, at: i32) -> i32:
_ = point
_ = at
return 0
## The nearest point within `maxdist` of `position` (-1 for none).
pub func nearpoint(position: f32[4], maxdist: f32) -> i32:
_ = position
_ = maxdist
return -1
## The nearest points (at most `max_count`, up to 16) within `maxdist`, nearest first.
pub func nearpoints(position: f32[4], maxdist: f32, max_count: i32) -> Near:
_ = position
_ = maxdist
_ = max_count
return Near(count = 0, points = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
## The distance from `position` to the surface, and the closest primitive and its uv.
## A uv is (t + u, v) for barycentric (u, v) on the primitive's display triangle t
## (a triangle's is plain (u, v)); feed it to `primuv_*` as it is.
pub func xyzdist(position: f32[4]) -> f32:
_ = position
return 0.0
pub func closest_prim(position: f32[4]) -> i32:
_ = position
return -1
pub func closest_uv(position: f32[4]) -> f32[2]:
_ = position
return [0.0, 0.0]
## Point attribute `name` ("P" for positions) interpolated at `uv` on primitive `prim`.
pub func primuv_f32(prim: i32, uv: f32[2], name: str) -> f32:
_ = prim
_ = uv
_ = name
return 0.0
pub func primuv_vec3(prim: i32, uv: f32[2], name: str) -> f32[4]:
_ = prim
_ = uv
_ = name
return [0.0, 0.0, 0.0, 0.0]
## The first surface hit along the ray from `origin` in `direction`.
pub func intersect(origin: f32[4], direction: f32[4]) -> Hit:
_ = origin
_ = direction
return Hit(prim = -1, uv = [0.0, 0.0], position = [0.0, 0.0, 0.0, 0.0], distance = -1.0)
## The box around the points.
pub func bounds() -> Bounds:
return Bounds(min = [0.0, 0.0, 0.0, 0.0], max = [0.0, 0.0, 0.0, 0.0], center = [0.0, 0.0, 0.0, 0.0], size = [0.0, 0.0, 0.0, 0.0])
## The primitive of vertex `vertex` (VEX `vertexprim`); vertices are face corners,
## numbered linearly (VEX's linear vertex numbers).
pub func vertex_prim(vertex: i32) -> i32:
return vertex
## The point of vertex `vertex` (VEX `vertexpoint`).
pub func vertex_point(vertex: i32) -> i32:
return vertex
## The next and previous vertex using the same point, -1 past the ends (VEX
## `vertexnext`, `vertexprev`).
pub func vertex_next(vertex: i32) -> i32:
return vertex
pub func vertex_prev(vertex: i32) -> i32:
return vertex
## How many vertices primitive `prim` has, and its `at`-th (VEX `primvertexcount`,
## `primvertex`).
pub func prim_vertex_count(prim: i32) -> i32:
return prim
pub func prim_vertex(prim: i32, at: i32) -> i32:
return prim + at
## The vertices using point `point`, ascending: how many, and the `at`-th (VEX
## `pointvertices`).
pub func point_vertex_count(point: i32) -> i32:
return point
pub func point_vertex(point: i32, at: i32) -> i32:
return point + at
## Half-edges are named by the vertex they leave and run to the next vertex of their
## primitive. The next and previous half-edge around the primitive (VEX `hedge_next`,
## `hedge_prev`).
pub func hedge_next(hedge: i32) -> i32:
return hedge
pub func hedge_prev(hedge: i32) -> i32:
return hedge
## A half-edge's source and destination points (VEX `hedge_srcpoint`, `hedge_dstpoint`).
pub func hedge_src_point(hedge: i32) -> i32:
return hedge
pub func hedge_dst_point(hedge: i32) -> i32:
return hedge
## A half-edge's primitive (VEX `hedge_prim`).
pub func hedge_prim(hedge: i32) -> i32:
return hedge
## How many half-edges lie on the same edge, this one included, either direction (VEX
## `hedge_equivcount`): 1 on a boundary, 2 inside a manifold.
pub func hedge_equiv_count(hedge: i32) -> i32:
return hedge
## A half-edge from point `src` to point `dst`, or -1 (VEX `pointhedge`).
pub func point_hedge(src: i32, dst: i32) -> i32:
return src + dst
## Primitive `prim`'s first half-edge (VEX `primhedge`).
pub func prim_hedge(prim: i32) -> i32:
return prim
## The primitives sharing an edge with `prim`, ascending: how many, and the `at`-th
## (VEX `polyneighbours`).
pub func poly_neighbor_count(prim: i32) -> i32:
return prim
pub func poly_neighbor(prim: i32, at: i32) -> i32:
return prim + at
## How many points group pattern `group` holds (VEX `npointsgroup`; any group
## expression), and the same for primitives (VEX `nprimsgroup`). The pattern is a
## literal, expanded once per cook.
pub func npointsgroup(group: str) -> i32:
_ = group
return 0
pub func nprimsgroup(group: str) -> i32:
_ = group
return 0
## Pattern `pattern`'s points, ascending: how many, and the `at`-th (VEX
## `expandpointgroup` as a count and an index); the primitive forms likewise.
pub func expandpointgroup_count(pattern: str) -> i32:
_ = pattern
return 0
pub func expandpointgroup(pattern: str, at: i32) -> i32:
_ = pattern
return at
pub func expandprimgroup_count(pattern: str) -> i32:
_ = pattern
return 0
pub func expandprimgroup(pattern: str, at: i32) -> i32:
_ = pattern
return at
## The box's lowest corner, highest corner, center and size (VEX `getbbox_min` ...).
pub func getbbox_min() -> f32[4]:
return [0.0, 0.0, 0.0, 0.0]
pub func getbbox_max() -> f32[4]:
return [0.0, 0.0, 0.0, 0.0]
pub func getbbox_center() -> f32[4]:
return [0.0, 0.0, 0.0, 0.0]
pub func getbbox_size() -> f32[4]:
return [0.0, 0.0, 0.0, 0.0]
## `position` as a fraction of the box along each axis, 0 at its lowest corner and 1 at
## its highest; 0.5 along an axis without extent (VEX `relbbox`, `relpointbbox`: the
## same box for polygons).
pub func relbbox(position: f32[4]) -> f32[4]:
return position
pub func relpointbbox(position: f32[4]) -> f32[4]:
return position
## The closest surface position to `position` (VEX `minpos`).
pub func minpos(position: f32[4]) -> f32[4]:
return position
## Point `point`'s normal: its primitives' area vectors summed, unit length (VEX
## `computenormal` for a point); zero when they have no area.
pub func computenormal(point: i32) -> f32[4]:
_ = point
return [0.0, 0.0, 0.0, 0.0]
## The length along primitive `prim` between parametric `u1` and `u2` in 0..1 (VEX
## `primarclen`): a polygon's u runs once around it, each edge an equal share.
pub func primarclen(prim: i32, u1: f32, u2: f32) -> f32:
_ = prim
return u2 - u1
## The length of primitive `prim` as an open curve through its vertices (VEX
## `curvearclen`).
pub func curvearclen(prim: i32) -> f32:
_ = prim
return 0.0
## Point `point`'s distance along the surface's edges from the nearest point of group
## pattern `group`, -1 where none reaches (VEX `surfacedist`). Each pattern's field is
## computed once per cook (Dijkstra over the edges).
pub func surfacedist(group: str, point: i32) -> f32:
_ = group
return (f32)point
## The generalized winding number at `position`: 1 inside a closed outward-facing
## mesh, 0 outside, between at holes (VEX `windingnumber`; fast winding numbers,
## within about 0.2% of the exact value).
pub func windingnumber(position: f32[4]) -> f32:
_ = position
return 0.0
## Text attribute `name` of point or primitive `index` (VEX `point`/`prim` of a string
## attribute; "" without one).
pub func point_text(index: i32, name: str) -> const Text*:
_ = index
_ = name
return (const Text*)(void*)4096
pub func prim_text(index: i32, name: str) -> const Text*:
_ = index
_ = name
return (const Text*)(void*)4096
## Array attribute `name` of point, primitive or vertex `index` (Houdini's
## point(0, "name", i) of an array attribute), empty without one.
pub func point_f32_array(index: i32, name: str) -> const FloatArray*:
_ = index
_ = name
return (const FloatArray*)(void*)4096
pub func point_i32_array(index: i32, name: str) -> const IntArray*:
_ = index
_ = name
return (const IntArray*)(void*)4096
pub func point_vec3_array(index: i32, name: str) -> const VectorArray*:
_ = index
_ = name
return (const VectorArray*)(void*)4096
pub func prim_f32_array(index: i32, name: str) -> const FloatArray*:
_ = index
_ = name
return (const FloatArray*)(void*)4096
pub func prim_i32_array(index: i32, name: str) -> const IntArray*:
_ = index
_ = name
return (const IntArray*)(void*)4096
pub func prim_vec3_array(index: i32, name: str) -> const VectorArray*:
_ = index
_ = name
return (const VectorArray*)(void*)4096
pub func vertex_f32_array(index: i32, name: str) -> const FloatArray*:
_ = index
_ = name
return (const FloatArray*)(void*)4096
pub func vertex_i32_array(index: i32, name: str) -> const IntArray*:
_ = index
_ = name
return (const IntArray*)(void*)4096
pub func vertex_vec3_array(index: i32, name: str) -> const VectorArray*:
_ = index
_ = name
return (const VectorArray*)(void*)4096
## Open a point cloud (VEX `pcopen`): the nearest `max_count` points (up to 64) within
## `radius` of `position`, nearest first, read through the PointCloud's methods. A
## later open at the same place in the snippet (a loop) replaces this one's points.
pub func pcopen(position: f32[4], radius: f32, max_count: i32) -> const PointCloud*:
_ = position
_ = radius
_ = max_count
return (const PointCloud*)(void*)4096
## The same search as `pcopen` (VEX `pcfind`, whose point numbers are `pc.point(i)`).
pub func pcfind(position: f32[4], radius: f32, max_count: i32) -> const PointCloud*:
_ = position
_ = radius
_ = max_count
return (const PointCloud*)(void*)4096
## The points within `radius` whose own radius, point attribute `radius_name` times
## `scale`, reaches `position` (VEX `pcfind_radius`), nearest first, up to `max_count`.
pub func pcfind_radius(position: f32[4], radius_name: str, scale: f32, radius: f32, max_count: i32) -> const PointCloud*:
_ = position
_ = radius_name
_ = scale
_ = radius
_ = max_count
return (const PointCloud*)(void*)4096
## The trilinear value of volume grid `name` at `position` (VEX `volumesample`): ""
## names the first grid, "#2" the third, anything else a grid by name; an input with
## an SDF (and no grid of that name) samples the SDF exactly. 0 when there is neither.
pub func volume_sample(name: str, position: f32[4]) -> f32:
_ = name
_ = position
return 0.0
## A vector volume, grids `name.x`, `name.y` and `name.z` (VEX `volumesamplev`).
pub func volume_sample_vec3(name: str, position: f32[4]) -> f32[4]:
_ = name
return position
## The gradient at `position` by central differences a voxel apart (VEX
## `volumegradient`); for an SDF a thousandth of its extent apart.
pub func volume_gradient(name: str, position: f32[4]) -> f32[4]:
_ = name
return position
## Voxel (i, j, k)'s stored value, the grid's background outside its leaves (VEX
## `volumeindex`).
pub func volume_index(name: str, i: i32, j: i32, k: i32) -> f32:
_ = name
return (f32)(i + j + k)
## The nearest voxel's (i, j, k) to `position`, whole numbers in lanes 0 to 2 (VEX
## `volumepostoindex`).
pub func volume_pos_to_index(name: str, position: f32[4]) -> f32[4]:
_ = name
return position
## Voxel (i, j, k)'s center (VEX `volumeindextopos`).
pub func volume_index_to_pos(name: str, i: i32, j: i32, k: i32) -> f32[4]:
_ = name
return [(f32)i, (f32)j, (f32)k, 0.0]
## The voxels the grid's leaves span along each axis (VEX `volumeres`; a sparse grid
## has no fixed resolution); zero without a grid.
pub func volume_res(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
## The grid's voxel edge length (VEX `volumevoxeldiameter` over the square root of 3).
pub func volume_voxel_size(name: str) -> f32:
_ = name
return 0.0
## The tricubic (Catmull-Rom) value at `position`: smooth across voxels and through
## each voxel's value (VEX `volumesmoothsample`).
pub func volume_smooth_sample(name: str, position: f32[4]) -> f32:
_ = name
_ = position
return 0.0
## The trilinear value at index-space `index` (voxel (i, j, k) at (i, j, k); VEX
## `volumesample` of a position from `volume_index_to_pos`).
pub func volume_sample_index(name: str, index: f32[4]) -> f32:
_ = name
_ = index
return 0.0
## 1 when voxel (i, j, k) is active, else 0 (VEX `volumeindexactive`).
pub func volume_index_active(name: str, i: i32, j: i32, k: i32) -> i32:
_ = name
return i + j + k
## 0 for a fog grid, 1 a level set, 2 the input's SDF, -1 when there is none.
pub func volume_type(name: str) -> i32:
_ = name
return 0
## The grid's value outside its voxels (0 without a grid).
pub func volume_background(name: str) -> f32:
_ = name
return 0.0
## The grid's index-to-world transform: rows the images of the index axes, then
## the translation (VEX `primintrinsic` "transform"); identity without a grid.
pub func volume_transform(name: str) -> Mat4:
_ = name
return Mat4.identity()
## The voxel a snippet runs for (Run Over Voxels, Houdini's Volume Wrangle): one run per
## active voxel of the target grid. Reads see the input; writes become grids on the
## target's voxels when the run ends.
pub struct Voxel:
## The voxel's center, in world space (read only).
pub var P: f32[4]
## The target grid's value here; writing sets it.
pub var value: f32
## The voxel's index along x, y and z (read only).
pub var ix: i32
pub var iy: i32
pub var iz: i32
## This voxel's number among the target's leaf voxels (512 a leaf).
pub let voxnum: i32
## How many voxels the target's active ones span along x, y and z (VEX `volumeres`).
pub let res: f32[4]
var written: bool
## Grid `name` of the volume at this voxel (0 without one): by index when it shares
## the target's transform, trilinear at the center when not.
pub func f32(name: str) -> f32:
_ = name
return 0.0
## Grid `name` set at this voxel; a grid the volume lacks is made on the target's
## voxels and transform (a fog grid, background 0).
pub func set_f32(name: str, value: f32):
_ = name
_ = value
self.written = true
## The vector grids `name.x`, `name.y`, `name.z` at this voxel.
pub func vec3(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
## The vector grids `name.x`, `name.y`, `name.z` set at this voxel.
pub func set_vec3(name: str, value: f32[4]):
_ = name
_ = value
self.written = true
## The node: the timeline, its spare parameters, the detail attributes, the inputs, and
## edits queued for after the run (new points and primitives, attribute sets, removals:
## applied in element order, so the result is the same on any number of threads).
pub struct Kernel:
## The timeline's frame, seconds (frame 1 is 0) and frames per second.
pub let frame: f64
pub let time: f64
pub let fps: f64
var written: bool
## Input `index`: 0 the node's own input, 1 its second.
pub func input(index: i32) -> const Geometry*:
_ = index
return (const Geometry*)(void*)4096
## Ramp parameter `name` (a float ramp row on the node, made on first use) at `t`,
## clamped to `0..1` (Houdini's `chramp`); without data, a line from 0 to 1.
pub func ramp(name: str, t: f32) -> f32:
_ = name
return t
## Color ramp parameter `name` at `t`: red, green and blue in lanes 0 to 2, lane 3
## zero; without data, black to white.
pub func ramp_color(name: str, t: f32) -> f32[4]:
_ = name
return [t, t, t, 0.0]
## Print to the node's console (VEX `printf`): `format` with `%d`/`%i` (rounded),
## `%f`, `%e`, `%g` (optional precision, `%.3f`) and `%%` filled from `a` to `d` in
## order; a newline ends a line. Messages appear in element order, the first 200.
pub func printf(format: str, a: f32 = 0.0, b: f32 = 0.0, c: f32 = 0.0, d: f32 = 0.0):
_ = format
_ = a
_ = b
_ = c
_ = d
## Add `message` to the node's warnings; the cook succeeds (the node shows the first
## warning in element order and how many there were).
pub func warning(message: str):
_ = message
## Fail the cook with `message` at this line and element, as a trap does.
pub func error(message: str):
_ = message
## A text from a literal (`k.text("piece_")`).
pub func text(literal: str) -> const Text*:
_ = literal
return (const Text*)(void*)4096
## `n` as decimal text (VEX `itoa`).
pub func itoa(n: i32) -> const Text*:
_ = n
return (const Text*)(void*)4096
## `format` filled as `printf` fills it (numbers `a` to `d`), as a text (VEX
## `sprintf`; texts join with `concat` and `join`).
pub func sprintf(format: str, a: f32 = 0.0, b: f32 = 0.0, c: f32 = 0.0, d: f32 = 0.0) -> const Text*:
_ = format
_ = a
_ = b
_ = c
_ = d
return (const Text*)(void*)4096
## Queue setting text attribute `name` of point or primitive `index` (a new one's
## number too); the attribute becomes text, its other values kept.
pub func set_point_text(index: i32, name: str, value: const Text*):
_ = index
_ = name
_ = value
pub func set_prim_text(index: i32, name: str, value: const Text*):
_ = index
_ = name
_ = value
## Queue setting array attribute `name` of point or primitive `index` (a new one's
## number too; Houdini's setpointattrib of an array).
pub func set_point_f32_array(index: i32, name: str, value: const FloatArray*):
_ = index
_ = name
_ = value
pub func set_point_i32_array(index: i32, name: str, value: const IntArray*):
_ = index
_ = name
_ = value
pub func set_point_vec3_array(index: i32, name: str, value: const VectorArray*):
_ = index
_ = name
_ = value
pub func set_prim_f32_array(index: i32, name: str, value: const FloatArray*):
_ = index
_ = name
_ = value
pub func set_prim_i32_array(index: i32, name: str, value: const IntArray*):
_ = index
_ = name
_ = value
pub func set_prim_vec3_array(index: i32, name: str, value: const VectorArray*):
_ = index
_ = name
_ = value
## Empty arrays of floats, integers and vectors.
pub func floats() -> const FloatArray*:
return (const FloatArray*)(void*)4096
pub func ints() -> const IntArray*:
return (const IntArray*)(void*)4096
pub func vectors() -> const VectorArray*:
return (const VectorArray*)(void*)4096
## Queue a new point at world position `position`; its number, for add_prim and the
## set_point_ accessors (an element adds at most 1024 points and 1024 primitives).
pub func add_point(position: f32[4]) -> i32:
_ = position
return 0
## Queue a new polygon through the first `count` of `points` (3 or more); its number.
pub func add_prim(points: i32[16], count: i32) -> i32:
_ = points
_ = count
return 0
## Queue removing point `index` (and the primitives using it), or primitive `index`.
pub func remove_point(index: i32):
_ = index
pub func remove_prim(index: i32):
_ = index
## Queue setting attribute `name` of point `index` (a new point's number too); it wins over writes through `p`.
pub func set_point_f32(index: i32, name: str, value: f32):
_ = index
_ = name
_ = value
pub func set_point_f64(index: i32, name: str, value: f64):
_ = index
_ = name
_ = value
pub func set_point_i32(index: i32, name: str, value: i32):
_ = index
_ = name
_ = value
pub func set_point_i64(index: i32, name: str, value: i64):
_ = index
_ = name
_ = value
pub func set_point_vec2(index: i32, name: str, value: f32[2]):
_ = index
_ = name
_ = value
pub func set_point_vec3(index: i32, name: str, value: f32[4]):
_ = index
_ = name
_ = value
pub func set_point_vec4(index: i32, name: str, value: f32[4]):
_ = index
_ = name
_ = value
## Queue setting attribute `name` of primitive `index`.
pub func set_prim_f32(index: i32, name: str, value: f32):
_ = index
_ = name
_ = value
pub func set_prim_f64(index: i32, name: str, value: f64):
_ = index
_ = name
_ = value
pub func set_prim_i32(index: i32, name: str, value: i32):
_ = index
_ = name
_ = value
pub func set_prim_i64(index: i32, name: str, value: i64):
_ = index
_ = name
_ = value
pub func set_prim_vec2(index: i32, name: str, value: f32[2]):
_ = index
_ = name
_ = value
pub func set_prim_vec3(index: i32, name: str, value: f32[4]):
_ = index
_ = name
_ = value
pub func set_prim_vec4(index: i32, name: str, value: f32[4]):
_ = index
_ = name
_ = value
## Spare parameter `name` (a row on the node, created on first use) and its default.
pub func f32(name: str, default: f32 = 0.0) -> f32:
_ = name
return default
pub func f64(name: str, default: f64 = 0.0) -> f64:
_ = name
return default
pub func i32(name: str, default: i32 = 0) -> i32:
_ = name
return default
pub func i64(name: str, default: i64 = 0) -> i64:
_ = name
return default
pub func vec2(name: str, default: f32[2] = [0.0, 0.0]) -> f32[2]:
_ = name
return default
pub func vec3(name: str, default: f32[4] = [0.0, 0.0, 0.0, 0.0]) -> f32[4]:
_ = name
return default
pub func vec4(name: str, default: f32[4] = [0.0, 0.0, 0.0, 0.0]) -> f32[4]:
_ = name
return default
## Detail attribute `name` (0 when the geometry lacks it).
pub func detail_f32(name: str) -> f32:
_ = name
return 0.0
pub func detail_f64(name: str) -> f64:
_ = name
return 0.0
pub func detail_i32(name: str) -> i32:
_ = name
return 0
pub func detail_i64(name: str) -> i64:
_ = name
return 0
pub func detail_vec2(name: str) -> f32[2]:
_ = name
return [0.0, 0.0]
pub func detail_vec3(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
pub func detail_vec4(name: str) -> f32[4]:
_ = name
return [0.0, 0.0, 0.0, 0.0]
## Set detail attribute `name` (Run Over Detail and Numbers, whose `k` may change).
pub func set_detail_f32(name: str, value: f32):
_ = name
_ = value
self.written = true
pub func set_detail_f64(name: str, value: f64):
_ = name
_ = value
self.written = true
pub func set_detail_i32(name: str, value: i32):
_ = name
_ = value
self.written = true
pub func set_detail_i64(name: str, value: i64):
_ = name
_ = value
self.written = true
pub func set_detail_vec2(name: str, value: f32[2]):
_ = name
_ = value
self.written = true
pub func set_detail_vec3(name: str, value: f32[4]):
_ = name
_ = value
self.written = true
pub func set_detail_vec4(name: str, value: f32[4]):
_ = name
_ = value
self.written = true
"""