-
Notifications
You must be signed in to change notification settings - Fork 3
voctopus.kernel.asm
#Functions
The last bit of a value is a flag for a pointer, so this shifts a number left and then sets the last bit to 1 to flag it as a pointer. It has to be decoded in reverse.
Sets maximum depth value. Maximum depth should not be modified during runtime due to side effects not being tested for. If you need a larger octree, copy the current tree into a larger one. Never, ever decrease an octree's depth.
Parameters
name | type | description |
---|---|---|
n | int |
Sets maximum depth value. Maximum depth should not be modified during |
runtime due to side effects not being tested for. If you need a larger | ||
octree, copy the current tree into a larger one. Never, ever decrease | ||
an octree's depth. |
Accessor for max depth value.
Sets the current depth value.
Accessor for current depth value.
Increments current depth value. Used during octree traversal.
Sets firstOffset value. This generally should not be changed during runtime.
Gets firstOffset value.
Sets nextOffset value. This is generally handled through allocateOctet and shouldn't be set manually.
Parameters
name | type | description |
---|---|---|
n | int |
Sets nextOffset value. This is generally handled through allocateOctet and |
shouldn't be set manually. |
Gets nextOffset value. This value is managed by allocateOctet, so you shouldn't access it directly unless you need to read it without incrementing it.
Returns: int
Increments the next octet value, then returns the previous value. This is used to keep track of the next available octet memory space.
Gets raw int value of octant at index i.
Parameters
name | type | description |
---|---|---|
i | int |
32-bit index |
Sets octant at index i to value v.
Parameters
name | type | description |
---|---|---|
i | int |
32-bit index |
v | int |
32-bit value |
For debugging purposes.
Decodes the red value from an rgba value.
Parameters
name | type | description |
---|---|---|
n | int |
32-bit rgba value |
Returns: int
8-bit color value
Decodes the green value from an rgba value.
Parameters
name | type | description |
---|---|---|
n | int |
32-bit rgba value |
Returns: int
8-bit color value
Decodes the blue value from an rgba value.
Parameters
name | type | description |
---|---|---|
n | int |
32-bit rgba value |
Returns: int
8-bit color value
Decodes the alpha value from an rgba value.
Parameters
name | type | description |
---|---|---|
n | int |
32-bit rgba value |
Returns: int
4-bit alpha value
Determines whether a value is flagged as a pointer by checking the first bit.
Decode a pointer from a stored value. Returns 0 if the value wasn't a pointer. Note this only works correctly if n is a value from the octree.
Parameters
name | type | description |
---|---|---|
n | octant |
an octant value from the octree |
Returns: int
a decoded pointer, or 0 if it wasn't a pointer
Reads a value from the index with the assumption that it's a pointer.
Parameters
name | type | description |
---|---|---|
i | int |
index to read from |
Returns: int
value decoded as a pointer
Sets a value at the index as an encoded pointer.
Parameters
name | type | description |
---|---|---|
i | int |
index to read from |
n | int |
pointer to set |
Sets the current pointer value, used during traversal. Note that this value is not encoded as a pointer, because it's not in the octree and converting it back and forth is computationally wasteful.
Parameters
name | type | description |
---|---|---|
p | int |
pointer to set |
Translates a set of rgba values to an unsigned 32-bit int.
Parameters
name | type | description |
---|---|---|
r | int |
Translates a set of rgba values to an unsigned 32-bit int. |
g | int |
Translates a set of rgba values to an unsigned 32-bit int. |
b | int |
Translates a set of rgba values to an unsigned 32-bit int. |
a | int |
Translates a set of rgba values to an unsigned 32-bit int. |
Returns: int
Calculates inverse of current depth. Used in octantIdentity calculation.
Prepares internal variables for a voxel lookup. Called whenever these values need to be refreshed during a voxel lookup or related calculations.
Parameters
name | type | description |
---|---|---|
x | int |
x-coordinate |
y | int |
y-coordinate |
z | int |
z-coordinate |
d | int |
target depth |
Finds the identity of an octant for the prepared vector at the current depth.
Returns: int
Derives the pointer for the octant at the current depth and vector from the octet pointer.
Returns: int
Initializes an octet at the depth and vector set using prepareLookup
Single step in traversal. Used when walking the tree.
Check the ray - box intersection of a voxel (which is an axis-aligned bounding box)
Parameters
name | type | description |
---|---|---|
bs[x,y,z | double |
box start (top, left, back) |
be[x,y,z | double |
box end (bottom, right, front) |
ro[x,y,z | double |
ray origin |
rd[x,y,z | double |
inverse of ray direction (inverse should be precalculated) |
Returns: int
1 if there was a hit, otherwise 0