Skip to main content

NodeRef

Struct NodeRef 

Source
pub struct NodeRef(/* private fields */);
Expand description

A handle on a node. Fluent TSL methods hang off this; see tsl.rs.

Implementations§

Source§

impl NodeRef

Source

pub fn new(node: Node) -> Self

Wraps a node in a new handle.

Source

pub fn as_rc(&self) -> &Rc<Node>

The Rc<Node> this handle wraps.

Source

pub fn node(&self) -> &Node

The Node this handle wraps.

Source

pub fn key(&self) -> usize

The identity the builder keys its per-node state on.

Source

pub fn ty(&self) -> Type

Node.getNodeType( builder ).

Source§

impl NodeRef

Source

pub fn bypass(&self, call: impl Into<NodeRef>) -> NodeRef

node.bypass( call ) — see bypass.

Source

pub fn uniform_flow(&self) -> NodeRef

node.uniformFlow() — see uniform_flow.

Source

pub fn set_name(&self, name: &'static str) -> NodeRef

node.setName( name ). Three has two: on a uniform it is UniformNode.setName(), which renames the node in place and returns it, so every reference to the uniform takes name and a second setName wins over the first. On any other node it is the method chaining of the free set_name, a context.

Source

pub fn label(&self, name: &'static str) -> NodeRef

👎Deprecated:

three.js r179 renamed label() to setName(); use set_name

node.label( name ) — deprecated in three for set_name, with the same two forms.

Source

pub fn to_vertex_stage(&self) -> NodeRef

node.toVertexStage() — see vertex_stage.

Source

pub fn debug(&self, callback: Option<DebugCallback>) -> NodeRef

node.debug( callback ) — see debug.

Source§

impl NodeRef

Source

pub fn to_float(&self) -> NodeRef

x.toFloat() — TSLCore.js’ addMethodChaining( 'toFloat', float ).

Source

pub fn to_int(&self) -> NodeRef

x.toInt().

Source

pub fn to_uint(&self) -> NodeRef

x.toUint().

Source

pub fn to_bool(&self) -> NodeRef

x.toBool().

Source

pub fn to_vec2(&self) -> NodeRef

x.toVec2().

Source

pub fn to_vec3(&self) -> NodeRef

x.toVec3().

Source

pub fn to_vec4(&self) -> NodeRef

x.toVec4().

Source

pub fn to_color(&self) -> NodeRef

x.toColor() — a vec3.

Source

pub fn to_ivec2(&self) -> NodeRef

x.toIVec2().

Source

pub fn to_ivec3(&self) -> NodeRef

x.toIVec3().

Source

pub fn to_ivec4(&self) -> NodeRef

x.toIVec4().

Source

pub fn to_uvec2(&self) -> NodeRef

x.toUVec2().

Source

pub fn to_uvec3(&self) -> NodeRef

x.toUVec3().

Source

pub fn to_uvec4(&self) -> NodeRef

x.toUVec4().

Source

pub fn to_bvec2(&self) -> NodeRef

x.toBVec2().

Source

pub fn to_bvec3(&self) -> NodeRef

x.toBVec3().

Source

pub fn to_bvec4(&self) -> NodeRef

x.toBVec4().

Source

pub fn to_mat2(&self) -> NodeRef

x.toMat2().

Source

pub fn to_mat3(&self) -> NodeRef

x.toMat3() — from a mat4, NodeBuilder.format()’s column narrowing.

Source

pub fn to_mat4(&self) -> NodeRef

x.toMat4().

Source

pub fn atan(&self) -> NodeRef

x.atan() — one-argument MathNode.ATAN.

Source

pub fn acos(&self) -> NodeRef

x.acos().

Source

pub fn tan(&self) -> NodeRef

x.tan().

Source

pub fn sinh(&self) -> NodeRef

x.sinh().

Source

pub fn cosh(&self) -> NodeRef

x.cosh().

Source

pub fn tanh(&self) -> NodeRef

x.tanh().

Source

pub fn asinh(&self) -> NodeRef

x.asinh().

Source

pub fn acosh(&self) -> NodeRef

x.acosh().

Source

pub fn atanh(&self) -> NodeRef

x.atanh().

Source

pub fn round(&self) -> NodeRef

x.round().

Source

pub fn trunc(&self) -> NodeRef

x.trunc().

Source

pub fn degrees(&self) -> NodeRef

x.degrees().

Source

pub fn radians(&self) -> NodeRef

x.radians().

Source

pub fn determinant(&self) -> NodeRef

m.determinant().

Source

pub fn inverse(&self) -> NodeRef

m.inverse().

Source

pub fn transpose(&self) -> NodeRef

m.transpose().

Source

pub fn pow2(&self) -> NodeRef

x.pow2().

Source

pub fn pow4(&self) -> NodeRef

x.pow4().

Source

pub fn difference(&self, b: impl Into<NodeRef>) -> NodeRef

a.difference( b ).

Source

pub fn cbrt(&self) -> NodeRef

x.cbrt().

Source

pub fn length_sq(&self) -> NodeRef

a.lengthSq().

Source

pub fn length(&self) -> NodeRef

v.length() — MathNode.LENGTH.

Source

pub fn face_forward( &self, i: impl Into<NodeRef>, nref: impl Into<NodeRef>, ) -> NodeRef

n.faceForward( i, nref ).

Source

pub fn all(&self) -> NodeRef

b.all() — MathNode.ALL, see super::all.

Source

pub fn any(&self) -> NodeRef

b.any() — MathNode.ANY, see any.

Source

pub fn transform_normal_by_view_matrix( &self, view_matrix: impl Into<NodeRef>, ) -> NodeRef

n.transformNormalByViewMatrix( viewMatrix ).

Source

pub fn transform_normal(&self, matrix: impl Into<NodeRef>) -> NodeRef

n.transformNormal( matrix ) — see transform_normal. Three’s matrix defaults to modelWorldMatrix; pass model_world_matrix() for its no-argument form.

Source

pub fn transform_normal_by_inverse_view_matrix( &self, view_matrix: impl Into<NodeRef>, ) -> NodeRef

n.transformNormalByInverseViewMatrix( viewMatrix ).

Source

pub fn xor(&self, b: impl Into<NodeRef>) -> NodeRef

a.xor( b ).

Source

pub fn bit_not(&self) -> NodeRef

a.bitNot().

Source

pub fn count_one_bits(&self) -> NodeRef

x.countOneBits().

Source

pub fn count_trailing_zeros(&self) -> NodeRef

x.countTrailingZeros().

Source

pub fn count_leading_zeros(&self) -> NodeRef

x.countLeadingZeros().

Source

pub fn mod_(&self, b: impl Into<NodeRef>) -> NodeRef

a.mod( b ) — see mod_.

Source

pub fn hash(&self) -> NodeRef

x.hash().

Source

pub fn remap( &self, in_low: impl Into<NodeRef>, in_high: impl Into<NodeRef>, out_low: impl Into<NodeRef>, out_high: impl Into<NodeRef>, ) -> NodeRef

x.remap( inLow, inHigh, outLow, outHigh ) — Remap.js’ addMethodChaining( 'remap', remap ).

Source

pub fn remap_clamp( &self, in_low: impl Into<NodeRef>, in_high: impl Into<NodeRef>, out_low: impl Into<NodeRef>, out_high: impl Into<NodeRef>, ) -> NodeRef

x.remapClamp( inLow, inHigh, outLow, outHigh ).

Source

pub fn smoothstep( &self, low: impl Into<NodeRef>, high: impl Into<NodeRef>, ) -> NodeRef

x.smoothstep( low, high ) — MathNode.js’ smoothstepElement: smoothstep( low, high, x ).

Source

pub fn step(&self, edge: impl Into<NodeRef>) -> NodeRef

x.step( edge ) — MathNode.js’ stepElement: step( edge, x ).

Source§

impl NodeRef

Source

pub fn add(&self, other: impl Into<NodeRef>) -> NodeRef

a.add( b ) — a + b.

Source

pub fn sub(&self, other: impl Into<NodeRef>) -> NodeRef

a.sub( b ) — a - b.

Source

pub fn mul(&self, other: impl Into<NodeRef>) -> NodeRef

a.mul( b ) — a * b.

Source

pub fn div(&self, other: impl Into<NodeRef>) -> NodeRef

a.div( b ) — a / b.

Source

pub fn modulo(&self, other: impl Into<NodeRef>) -> NodeRef

OperatorNode( '%' ) — integer remainder. (MathNode’s float mod is mod_float, which lowers to a helper instead.)

Source

pub fn equal(&self, other: impl Into<NodeRef>) -> NodeRef

a.equal( b ) — a == b.

Source

pub fn not_equal(&self, other: impl Into<NodeRef>) -> NodeRef

a.notEqual( b ) — a != b.

Source

pub fn less_than_equal(&self, other: impl Into<NodeRef>) -> NodeRef

a.lessThanEqual( b ) — a <= b.

Source

pub fn greater_than(&self, other: impl Into<NodeRef>) -> NodeRef

a.greaterThan( b ) — a > b.

Source

pub fn greater_than_equal(&self, other: impl Into<NodeRef>) -> NodeRef

a.greaterThanEqual( b ) — a >= b.

Source

pub fn less_than(&self, other: impl Into<NodeRef>) -> NodeRef

a.lessThan( b ) — a < b.

Source

pub fn and(&self, other: impl Into<NodeRef>) -> NodeRef

a.and( b ) — a && b.

Source

pub fn or(&self, other: impl Into<NodeRef>) -> NodeRef

a.or( b ) — a || b.

Source

pub fn not(&self) -> NodeRef

x.not() — ( ! x ).

Source

pub fn shift_left(&self, other: impl Into<NodeRef>) -> NodeRef

a.shiftLeft( b ) — a << b.

Source

pub fn shift_right(&self, other: impl Into<NodeRef>) -> NodeRef

a.shiftRight( b ) — a >> b.

Source

pub fn bit_and(&self, other: impl Into<NodeRef>) -> NodeRef

a.bitAnd( b ) — a & b.

Source

pub fn bit_or(&self, other: impl Into<NodeRef>) -> NodeRef

a.bitOr( b ) — a | b.

Source

pub fn bit_xor(&self, other: impl Into<NodeRef>) -> NodeRef

a.bitXor( b ) — a ^ b.

Source

pub fn one_minus(&self) -> NodeRef

oneMinus() — 1.0 - x, emitted in that order.

Source

pub fn negate(&self) -> NodeRef

x.negate() — -x.

Source

pub fn normalize(&self) -> NodeRef

x.normalize() — MathNode.NORMALIZE.

Source

pub fn cos(&self) -> NodeRef

x.cos() — MathNode.COS.

Source

pub fn sin(&self) -> NodeRef

x.sin() — MathNode.SIN.

Source

pub fn asin(&self) -> NodeRef

x.asin() — MathNode.ASIN.

Source

pub fn atan2(&self, x: impl Into<NodeRef>) -> NodeRef

y.atan( x ) — MathNode.ATAN with two arguments, which WGSL spells atan2( y, x ). The receiver is the numerator, as in TSL.

Source

pub fn floor(&self) -> NodeRef

x.floor() — MathNode.FLOOR.

Source

pub fn fract(&self) -> NodeRef

x.fract() — MathNode.FRACT.

Source

pub fn sqrt(&self) -> NodeRef

x.sqrt() — MathNode.SQRT.

Source

pub fn abs(&self) -> NodeRef

x.abs() — MathNode.ABS.

Source

pub fn saturate(&self) -> NodeRef

saturate() — clamp( x, 0, 1 ), which three.js emits with vector bounds when x is a vector.

Source

pub fn pow(&self, other: impl Into<NodeRef>) -> NodeRef

x.pow( y ) — MathNode.POW.

Source

pub fn pow3(&self) -> NodeRef

pow3( x ) — MathNode’s POW3 is the multiplication chain x * x * x, not a pow() call.

Source

pub fn reciprocal(&self) -> NodeRef

node.reciprocal() — 1.0 / node, which is how OperatorNode prints it.

Source

pub fn exp2(&self) -> NodeRef

x.exp2() — see exp2.

Source

pub fn max(&self, other: impl Into<NodeRef>) -> NodeRef

x.max( y ) — MathNode.MAX.

Source

pub fn min(&self, other: impl Into<NodeRef>) -> NodeRef

x.min( y ) — MathNode.MIN.

Source

pub fn clamp(&self, lo: impl Into<NodeRef>, hi: impl Into<NodeRef>) -> NodeRef

x.clamp( lo, hi ) — MathNode.CLAMP.

Source

pub fn dot(&self, other: impl Into<NodeRef>) -> NodeRef

a.dot( b ) — see dot.

Source

pub fn cross(&self, other: impl Into<NodeRef>) -> NodeRef

a.cross( b ) — see cross.

Source

pub fn mix(&self, a: impl Into<NodeRef>, b: impl Into<NodeRef>) -> NodeRef

adjustment.mix( a, b ) — see mix.

Source

pub fn swizzle(&self, components: &'static str) -> NodeRef

node[ components ] — the general form of .x / .xy / .rgb, for when the component is chosen at build time.

Source

pub fn x(&self) -> NodeRef

node.x — the first component.

Source

pub fn y(&self) -> NodeRef

node.y — the second component.

Source

pub fn z(&self) -> NodeRef

node.z — the third component.

Source

pub fn w(&self) -> NodeRef

node.w — the fourth component.

Source

pub fn xy(&self) -> NodeRef

node.xy — the first two components.

Source

pub fn yz(&self) -> NodeRef

node.yz — the second and third components.

Source

pub fn zw(&self) -> NodeRef

node.zw — the third and fourth components.

Source

pub fn zx(&self) -> NodeRef

node.zx — the third and first components.

Source

pub fn xyz(&self) -> NodeRef

node.xyz — the first three components.

Source

pub fn xz(&self) -> NodeRef

node.xz — the first and third components.

Source

pub fn zzz(&self) -> NodeRef

node.zzz — the third component broadcast to a vec3.

Source

pub fn rgb(&self) -> NodeRef

node.rgb — the first three components, spelled for a color.

Source

pub fn a(&self) -> NodeRef

node.a — the fourth component, spelled for a color’s alpha.

Source

pub fn set_z(&self, z: impl Into<NodeRef>) -> NodeRef

vec4( node.x, node.y, z, node.w ) — SetNode for .setZ().

Source

pub fn to(&self, ty: Type) -> NodeRef

type( node ) — cast to another type, a no-op if node is already ty.

Source

pub fn element(&self, index: usize) -> NodeRef

m.element( i ) — a matrix column, or a vector component.

Source

pub fn element_node(&self, index: NodeRef) -> NodeRef

array( … ).element( node ).

Source

pub fn select(&self, a: impl Into<NodeRef>, b: impl Into<NodeRef>) -> NodeRef

cond.select( a, b ).

Source

pub fn flip_y(&self) -> NodeRef

.flipY() — FlipNode over the y component: vec2( v.x, 1.0 - v.y ).

FlipNode.generate() does not ask the usage counter for a temp, it takes one unconditionally (builder.getVarFromNode( this )) and assigns the source snippet into it, because it has to read two components of the source and will not evaluate it twice. So the var here is explicit rather than a needs_var promotion, and it is the flip’s var, not the source’s.

Divergence, cosmetic (docs/nodes.md §8): three writes the flipped component as the bare string 1.0 - v.y; the port builds it out of sub, so it comes out parenthesised as ( 1.0 - v.y ). Same value, two characters more.

Source

pub fn flip_x(&self) -> NodeRef

.flipX() — FlipNode over the x component: vec2( 1.0 - v.x, v.y ). Same var and same cosmetic parenthesisation as flip_y; ReflectorNode’s default uv, screenUV.flipX(), is the caller.

Source

pub fn to_var(&self, name: &'static str) -> NodeRef

node.toVar( name ) — see to_var.

Source

pub fn context(&self, value: ContextValue) -> NodeRef

node.context( { … } ) — see context.

Source

pub fn isolate(&self) -> NodeRef

node.isolate() — see isolate.

Source

pub fn to_varying(&self, name: &'static str) -> NodeRef

node.toVarying( name ) — see to_varying.

Source

pub fn add_assign(&self, value: impl Into<NodeRef>) -> NodeRef

target.addAssign( value ) — target = ( target + value ).

Source

pub fn sub_assign(&self, value: impl Into<NodeRef>) -> NodeRef

target.subAssign( value ) — target = ( target - value ).

Source

pub fn mul_assign(&self, value: impl Into<NodeRef>) -> NodeRef

target.mulAssign( value ) — target = ( target * value ).

Source

pub fn div_assign(&self, value: impl Into<NodeRef>) -> NodeRef

target.divAssign( value ) — target = ( target / value ).

Source

pub fn assign(&self, value: impl Into<NodeRef>) -> NodeRef

target.assign( value ) — a statement.

Trait Implementations§

Source§

impl Clone for NodeRef

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&NodeRef> for NodeRef

Source§

fn from(n: &NodeRef) -> Self

Converts to this type from the input type.
Source§

impl From<&ReflectorNode> for NodeRef

Source§

fn from(node: &ReflectorNode) -> Self

Converts to this type from the input type.
Source§

impl From<&RetroPassNode> for NodeRef

Source§

fn from(retro: &RetroPassNode) -> NodeRef

Converts to this type from the input type.
Source§

impl From<&SampleNode> for NodeRef

Source§

fn from(node: &SampleNode) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for NodeRef

Source§

fn from(c: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Matrix4> for NodeRef

Source§

fn from(m: Matrix4) -> Self

Converts to this type from the input type.
Source§

impl From<SampleNode> for NodeRef

Source§

fn from(node: SampleNode) -> Self

Converts to this type from the input type.
Source§

impl From<Vector2> for NodeRef

Source§

fn from(v: Vector2) -> Self

Converts to this type from the input type.
Source§

impl From<Vector3> for NodeRef

Source§

fn from(v: Vector3) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for NodeRef

Source§

fn from(v: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for NodeRef

Source§

fn from(v: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for NodeRef

Source§

fn from(v: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for NodeRef

Source§

fn from(v: i32) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for NodeRef

Source§

fn from(v: u32) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.