![]() |
OpenVDB 13.0.1
|
| Category | Type | Definition | Attribute Syntax | Points | Voxels |
|---|---|---|---|---|---|
| Scalars | bool | Boolean value, true or false | bool@ | Yes | Yes |
| int16* | 16-bit signed integer value | int16@ | Yes | No | |
| int32 | 32-bit signed integer value | int32@, int@, i@ | Yes | Yes | |
| int | Alias for integer type (typically int32) | ||||
| int64 | 64-bit signed integer value | int64@ | Yes | Yes | |
| float | 32-bit floating point value | float@ f@ @ | Yes | Yes | |
| double | 64-bit floating point value | double@ | Yes | Yes | |
| Vectors | vec2i | 2-element vector of integer values | vec2i@ | No | No |
| vec2f | 2-element vector of float values | vec2f@ | No | No | |
| vec2d | 2-element vector of double values | vec2d@ | No | No | |
| vec3i | 3-element vector of integer values | vec3i@ | Yes | Yes | |
| vec3f | 3-element vector of float values | vec3f@ v@ | Yes | Yes | |
| vec3d | 3-element vector of double values | vec3d@ | Yes | Yes | |
| vec4i | 4-element vector of integer values | vec4i@ | No | No | |
| vec4f | 4-element vector of float values | vec4f@ | No | No | |
| vec4d | 4-element vector of double values | vec4d@ | No | No | |
| Matrices | mat3f | 3x3-matrix of float values | mat3f@ | Yes | No |
| mat3d | 3x3-matrix of double values | mat3d@ | Yes | No | |
| mat4f | 4x4-matrix of float values | mat4f@ | Yes | No | |
| mat4d | 4x4-matrix of double values | mat4d@ | Yes | No | |
| Strings | string | A string of characters | string@ | Yes | Yes |
| Operators | ||||||||
|---|---|---|---|---|---|---|---|---|
| Binary Operators | Unary Operators | Other | ||||||
| Assignments | Arithmetic | Comparisons / Relational | Logical | Arithmetic | Logical | Increment / Decrement | Container Access | Other |
|
a = b |
a + b |
a == b |
a && b |
+a |
!a |
++a |
a[] |
a(...) |
| Operator Name | Operator Syntax | Returns |
|---|---|---|
| Simple assignment | lhs = rhs | Reference to lhs |
| Addition assignment | lhs += rhs | |
| Subtraction assignment | lhs -= rhs | |
| Multiplication assignment | lhs *= rhs | |
| Division assignment | lhs /= rhs | |
| Modulo assignment | lhs %= rhs | |
| Bitwise AND assignment | lhs &= rhs | |
| Bitwise OR assignment | lhs |= rhs | |
| Bitwise XOR assignment | lhs ^= rhs | |
| Bitwise shift left assignment | lhs <<= rhs | |
| Bitwise shift right assignment | lhs >>= rhs |
| lhs = rhs |
| Left Operand Type | Binary Op(s) | Right Operand Type | Description |
|---|---|---|---|
| scalar | = | scalar | On type mismatch, right hand side is copied and implicitly cast to the left hand side type. |
| vector | = | scalar | Each element of the vector is set to the right hand side scalar. i.e. a[0] = b; ... a[n-1] = b; where n is the size of the vector. If the scalar type does not match element type of vector, the scalar is copied and implicitly cast to that type. |
| vector | Component wise assignment i.e. a[0] = b; ... a[n-1] = b; where n is the size of the vector. vec3f a = 0, b = 1;
a = b;
vec3f a = 0, b = 1;
for (int i = 0; i < 3; ++i) a[i] = b[i];
| ||
| matrix | = | scalar | Diagonal matrix construction. Each diagonal component of the left hand side matrix is set to to the right hand side scalar. All other components are zero initialized i.e. mat3f a;
int dim = 3, b = 1;
for (int i = 0; i < dim; ++i)
a[i] = (i % (dim+1) == 0) ? b : 0;
|
| matrix | Component wise assignment i.e. a[0] = b[0]; ... a[n-1] = b[n-1]; where n is the total size of the matrix. mat4f a = 0, b = 1;
a = b;
mat4f a = 0, b = 1;
for (int i = 0; i < 16; ++i) a[i] = b[i];
| ||
| string | = | string | Replaces the contents of the left hand side string with a copy of the contents in the right hand side string. |
| lhs op rhs |
Where op is one of:
| += | -= | *= | /= | %= | &= | |= | ^= | <<= | >>= |
| Operator Name | Operator Syntax | Returns |
|---|---|---|
| Addition | lhs + rhs | The sum of both operands |
| Subtraction | lhs - rhs | The first operand minus the second operand |
| Multiplication | lhs * rhs | The product of both operands |
| Division | lhs / rhs | The first operand divided by the second operand |
| Modulo | lhs % rhs | The floored modulo operator. See Multiplicative operands |
| Bitwise AND | lhs & rhs | The integral bitwise AND result of each bit in the first operand applied to the bit at the same location in the second operand |
| Bitwise OR | lhs | rhs | The integral bitwise OR result of each bit in the first operand applied to the bit at the same location in the second operand |
| Bitwise XOR | lhs ^ rhs | The integral bitwise XOR result of each bit in the first operand applied to the bit at the same location in the second operand |
| Bitwise shift left | lhs << rhs | The integral bitwise left shift of the first operand by the second operand |
| Bitwise shift right | lhs >> rhs | The integral bitwise right shift of the first operand by the second operand |
| lhs + rhs |
| lhs - rhs |
| Left Operand Type | Binary Op(s) | Right Operand Type | Description |
|---|---|---|---|
| scalar | + - | scalar | Returns the result of the scalar addition or subtraction. |
| vector | Performs per component binary operations (after implicit conversion) with the left hand side scalar to every element of the right hand side vector or matrix, returning a vector or matrix. vec3f a = 2.0f;
int b = 1;
vec3f c = b + a;
vec3f a = 2.0f;
int b = 1;
vec3f c;
for (int i = 0; i < 3; ++i) c[i] = b + a[i];
| ||
| matrix | |||
| vector | + - | scalar | Same as scalar op vector |
| vector | Performs per component binary operations (after implicit conversion), returning a new vector with each element holding the corresponding result. Operand sizes must match. vec3f a = 2, b = 1;
vec3f c = a - b;
vec3f a = 2, b = 1;
vec3f c;
for (int i = 0; i < 3; ++i) c[i] = a[i] - b[i];
| ||
| matrix | + - | scalar | Same as scalar op matrix |
| matrix | Performs per component binary operations (after implicit conversion), returning a new matrix with each element holding the corresponding result. Operand sizes must match. mat4f a = 0, b = 1;
mat4f c = a - b;
mat4f a = 0, b = 1;
mat4f c;
for (int i = 0; i < 16; ++i) c[i] = a[i] - b[i];
| ||
| string | + | string | Performs string concatenation |
| lhs * rhs |
| lhs / rhs |
| lhs % rhs |
| Left Operand Type | Binary Op(s) | Right Operand Type | Description |
|---|---|---|---|
| scalar | * / % | scalar | Returns the result of the scalar multiplication, division or remainder of the division respectively. |
| vector | Performs per component binary operations (after implicit conversion) with the left hand side scalar to every element of the right hand side vector. The scalar is effectively treated as a vector of the same size as the right hand side type. vec3f a = 2.0f;
int b = 1;
vec3f c = b * a;
vec3f a = 2.0f;
int b = 1;
vec3f c;
for (int i = 0; i < 3; ++i) c[i] = b * a[i];
| ||
| * | matrix | Performs matrix multiplication after diagonal matrix construction from the left hand side scalar. mat3f a = 1;
float b = 1;
mat3f c = a * b;
mat3f a = 1;
float b = 1;
mat3f tmp = b; // diagonal matrix
mat3f c = a * tmp;
| |
| vector | * / % | scalar | Same as scalar op vector with the operands reversed (importantly for division and modulus) |
| vector | Performs per component binary operations (after implicit conversion), returning a new vector with each element holding the corresponding result. Operand sizes must match. vec3f a = 2, b = 1;
vec3f c = a * b;
vec3f a = 2, b = 1;
vec3f c;
for (int i = 0; i < 3; ++i) c[i] = a[i] * b[i];
| ||
| * | matrix | Transforms the left hand side vector by the right hand side matrix using matrix multiplication. This is the same as calling the transform function. e.g: mat4f a = identity4();
vec3f b = { 1, 2, 3 };
b = b * a;
mat4f a = identity4();
vec3f b = { 1, 2, 3 };
b = transform(b, a);
mat4f a = identity4();
vec3f b = { 1, 2, 3 };
// b * a is equal to:
vec4f tmp;
tmp[0] = b[0];
tmp[1] = b[1];
tmp[2] = b[2];
tmp[3] = 1;
tmp = tmp * a;
b[0] = tmp[0];
b[1] = tmp[1];
b[2] = tmp[2];
| |
| matrix | * | scalar | Same as scalar * matrix |
| vector | Transforms the right hand side vector by the left hand side matrix using matrix multiplication. This is the same as calling the pretransform function. e.g: mat4f a = identity4();
vec3f b = { 1, 2, 3 };
b = a * b;
mat4f a = identity4();
vec3f b = { 1, 2, 3 };
b = pretransform(a, b);
mat4f a = identity4();
vec3f b = { 1, 2, 3 };
// a * b is equal to:
vec4f tmp;
tmp[0] = b[0];
tmp[1] = b[1];
tmp[2] = b[2];
tmp[3] = 1;
tmp = a * tmp;
b[0] = tmp[0];
b[1] = tmp[1];
b[2] = tmp[2];
| ||
| matrix | Performs matrix multiplication and returns the matrix product, which is matrix of matchign size and type. Operand sizes must match. e.g: mat4f a = 1, b = 2;
mat4f c = a * b;
mat4f a = 1, b = 2;
mat4f c;
for(int i = 0; i < 4; ++i) {
for(int j = 0; j < 4; ++j) {
for(int k = 0; k < 4; ++k) {
c[i,j] += a[i,k] * b[k,j];
}
}
}
|
| lhs & rhs |
| lhs | rhs |
| lhs ^ rhs |
| lhs << rhs |
| lhs >> rhs |
| Left Operand Type | Binary Op(s) | Right Operand Type | Description |
|---|---|---|---|
| intergral | & | ^ << >> | intergral | Returns the result of the bitwise operation as described above. If either operand is not an integral type (bool int32 or int64), the program is ill formed. |
| Operator Name | Operator Syntax | Returns |
|---|---|---|
| Equal to | lhs == rhs | Returns true if both operands are equal |
| Not equal to | lhs != rhs | Returns true if operands are not equal |
| Less than | lhs < rhs | Returns true the left hand side value is less than the right hand side |
| Greater than | lhs > rhs | Returns true the left hand side value is greater than the right hand side |
| Less than or equal to | lhs <= rhs | Returns true the left hand side value is less than or equal to the right hand side |
| Greater than or equal to | lhs >= rhs | Returns true the left hand side value is greater than or equal to the right hand side |
| Left Operand Type | Binary Op(s) | Right Operand Type | Description |
|---|---|---|---|
| scalar | == != < > <= >= | scalar | Returns the result of the scalar comparison. |
| == != | vector | Performs per component comparisons (after implicit conversion) with the lefthand side scalar to every element of the right hand side vector or matrix and perform a logical AND combination on the results of these comparisons. This effectively returns true if every element of the vector or matrix is equal to the scalar. vec3f a = 2.0f;
int b = 1;
bool c = b == a;
vec3f a = 2.0f;
int b = 1;
bool c = a[0] == b;
for (int i = 1; i < 3; ++i) c &= a[i] == b;
| |
| matrix | |||
| vector | == != < > <= >= | scalar | Same as scalar op vector |
| == != | vector | Performs binary comparison operations (after implicit conversion) on each pair corresponding components in the vector operands and returns true if all component pairs are equal. Operand sizes must match. vec3f a = 1, b = 2;
bool c = a == b;
vec3f a = 1, b = 2;
bool c = a[0] == b[0];
for (int i = 1; i < 3; ++i) c &= a[i] == b[i];
| |
| matrix | == != < > <= >= | scalar | Same as scalar op matrix |
| == != | matrix | Performs binary comparison operations (after implicit conversion) on each pair corresponding components in the matrix operands and returns true if all component pairs are equal. Operand sizes must match. mat4f a = 1, b = 2;
bool c = a == b;
mat4f a = 1, b = 2;
bool c = a[0] == b[0];
for (int i = 1; i < 16; ++i) c &= a[i] == b[i];
|
| Operator Name | Operator Syntax | Returns |
|---|---|---|
| AND | lhs && rhs | Returns true if both operands are true. Otherwise, the result is false. This operator is short-circuiting. |
| Inclusive OR | lhs || rhs | Returns true if either the first or the second operand is true. This operator is short-circuiting. |
| Left Operand Type | Binary Op(s) | Right Operand Type | Description |
|---|---|---|---|
| scalar | && || | scalar | Returns the result of the scalar logical operation. Both scalars are converted to bools if they are not already. |
| Operator Name | Operator Syntax | Returns |
|---|---|---|
| Unary plus | +a | Returns the value of its operand, a |
| Unary minus | -a | Returns the negative representation of a |
| Bitwise NOT | ~a | Returns the bitwise NOT (one's complement) value of a. This operator is only valid on integral element types. |
| Operand Type | Binary Op(s) | Description |
|---|---|---|
| scalar | + - ~ | Returns the result of the scalar unary operations. |
| vector | Performs per component unary operations, returning a new vector with each element holding the corresponding result. Operand sizes must match. vec3f a = 2;
vec3f b = -a;
vec3f a = 2;
vec3f b;
for (int i = 0; i < 3; ++i) b[i] = -a[i];
| |
| matrix | + - | Performs per component unary operations, returning a new matrix with each element holding the corresponding result. Operand sizes must match. vec3f a = 2;
vec3f b = -a;
vec3f a = 2;
vec3f b;
for (int i = 0; i < 3; ++i) b[i] = -a[i];
|
| Operator Name | Operator Syntax | Returns |
|---|---|---|
| Logical NOT | !a | Returns true if the operand is false. Otherwise, returns false. |
| Operand Type | Binary Op(s) | Description |
|---|---|---|
| scalar | ! | Returns the result of the scalar logical operation. The scalar operand is converted to a bool if it is not already. |
| vector | Performs per component unary operations, returning a new vector with each element holding the corresponding result. Operand sizes must match. vec3i a = 2;
vec3i b = !a;
vec3i a = 2;
vec3i b;
for (int i = 0; i < 3; ++i) b[i] = !a[i];
|
| Operator Name | Operator Syntax | Returns |
|---|---|---|
| Pre-increment | ++a | Returns a reference to the incremented result. |
| Post-increment | a++ | Returns a copy of the incremented result. |
| Pre-decrement | --a | Returns a reference to the decremented result. |
| Post-decrement | a-- | Returns a copy of the decremented result. |
| Operand Type | Binary Op(s) | Description |
|---|---|---|
| scalar | ++(pre) (post)++ --(pre) (post)-- | Returns the result (reference or copy) of the scalar increment or decrement operation. Note: boolean incrementation and decrementation is not supported. Only int32, int64, float and double types are valid. |
| Operator Name | Operator Syntax | Returns |
|---|---|---|
| Dot Component Access | vector . component | Reference to component component of vector |
| Container Component Access | container [ exp ] | Reference to component at index exp of container |
| Matrix Component Access | matrix [ exp1, exp2 ] | Reference to component in row exp1, column exp2. Also equal to returning a reference to component at index: [exp1 * dimension + exp2] of matrix where dimension is the the size of the matrix |
| vector . component |
| Component | Access Index | Result |
|---|---|---|
| A.x | 0 | |
| A.r | 0 | |
| A.y | 1 | |
| A.g | 1 | |
| A.z | 2 | |
| A.b | 2 | |
| container [exp] |
| matrix [exp1, exp2] |
|
| |||||
| Access [a] | Access [a,b] | Result | Access [a] | Access [a,b] | Result | |
|---|---|---|---|---|---|---|
| A[0] | A[0,0] | ![]() | A[0] | A[0,0] | ![]() | |
| A[1] | A[0,1] | ![]() | A[1] | A[0,1] | ![]() | |
| A[2] | A[0,2] | ![]() | A[2] | A[0,2] | ![]() | |
| A[3] | A[1,0] | ![]() | A[3] | A[0,3] | ![]() | |
| A[4] | A[1,1] | ![]() | A[4] | A[1,0] | ![]() | |
| A[5] | A[1,2] | ![]() | A[5] | A[1,1] | ![]() | |
| A[6] | A[2,0] | ![]() | A[6] | A[1,2] | ![]() | |
| A[7] | A[2,1] | ![]() | A[7] | A[1,3] | ![]() | |
| A[8] | A[2,2] | ![]() | A[8] | A[2,0] | ![]() | |
| A[9] | A[2,1] | ![]() | ||||
| A[10] | A[2,2] | ![]() | ||||
| A[11] | A[2,3] | ![]() | ||||
| A[12] | A[3,0] | ![]() | ||||
| A[13] | A[3,1] | ![]() | ||||
| A[14] | A[3,2] | ![]() | ||||
| A[15] | A[3,3] | ![]() | ||||
| Operator Name | Operator Syntax | Returns |
|---|---|---|
| Call / Explicit Cast | a(...) | Returns the result of a function call or inbuilt explicit cast |
| Comma | a, b, ... | Returns the value of the last expression after chained evaluation |
| Ternary Conditional | a ? b : c | b if a is true, c otherwise. |
| Ternary Conditional | a ? : c | a if a is true, c otherwise. |
| Vector/Matrix Initializer | { a, b, ... } | Returns a temporary vector or matrix |
| func(a, b, c, ...) |
| a, b, ... |
| a ? b : c |
| { a, b, ... } |
| Precedence | Operator | Description | Associativity |
|---|---|---|---|
| 1 | () | Parenthesis | Left-to-right |
| 2 | a++ a-- | Suffix/postfix Increment / Decrement | |
type() | Functional cast | ||
a() | Function call | ||
a[] . | Container Access | ||
| 3 | ++a --a | Prefix Increment / Decrement | Right-to-left |
+a -a | Unary plus and minus | ||
! ~ | Logical NOT and Logical NOT | ||
| 4 | a*b a/b ab | Multiplication, division, and remainder | Left-to-right |
| 5 | a+b a−b | Addition and subtraction | |
| 6 | << >> | Bitwise left shift and right shift | |
| 7 | < <= | For Comparisons / Relational operators < and ≤ respectively | |
> >= | For Comparisons / Relational operators > and ≥ respectively | ||
| 8 | == != | For Comparisons / Relational operators = and ≠ respectively | |
| 9 | & | Arithmetic AND | |
| 10 | ^ | Arithmetic XOR (exclusive or) | |
| 11 | | | Arithmetic OR (inclusive or) | |
| 12 | && | Logical AND | |
| 13 | || | Logical OR | |
| 14 | a?b:c | Ternary operator | Right-to-left |
= | Direct assignment | ||
+= -= | Compound assignment by sum and difference | ||
*= /= %= | Compound assignment by product, quotient, and remainder | ||
<<= >>= | Compound assignment by bitwise left shift and right shift | ||
&= ^= |= | Compound assignment by bitwise AND, XOR, and OR | ||
| 15 | , | Comma | Left-to-right |
| Type | Literal Tokens |
|---|---|
| bool | Tokens true and false |
| int32 | No suffix, automatically infered from integral literals |
| int64 | The letter l e.g. int64 a = 10l;
|
| float | The letter f e.g. float a = 0.0f;
|
| double | No suffix, automatically infered from floating point literals. |
| string | Character strings wrapped in double quotes " " |
Further, the active states of OpenVDB voxels change which voxels AX will process. The defined behavior for all cases is shown below.