Functions 0.4 - ZackWilde27/Z3dPy GitHub Wiki
Table of Contents:
- List Object Functions
- Triangles
- Rays
- Particles
- Hits
- Vector Functions
- VectorUV Functions
- Triangle Functions
- Matrix Functions
- Mesh Functions
- Thing Functions
- Collisions and Physics Functions
- Train Functions
- Lighting
- Rastering
- Custom Pipeline Functions
- Misc. Functions
Arguments marked with a * are optional
Unless it returns void, functions that change an input (such as VectorAdd) will return a new object without updating the originals.
Quite a few parameters specify the type of variable expected, with a starting letter:
f for float, v for vector, Capitals mean normalized.
A few objects are still lists, so these are more human-friendly ways to access properties.
returns the first point of a triangle.
returns the second point of a triangle.
returns the third point of a triangle.
returns the normal of the triangle.
TriGetNormal() will retrieve the stored normal, wheras GetNormal() will calculate a new one.
sets the normal of the triangle (set automatically during rasterization)
returns the colour of the triangle.
sets the colour of the triangle
returns the world position of the triangle
sets the world position of a triangle
returns the baked lighting colour of the triangle
sets the baked lighting colour of a triangle
returns the id of the triangle
sets the id of a triangle (set automatically during rasterization)
returns the start position of a ray
sets the start position of a ray
returns the end position of a ray
sets the end position of a ray
returns the direction of a ray
returns the length of a ray
returns wether or not the ray is an arrow
sets wether or not the ray is an arrow
returns the time left of a particle
sets the time left of a particle. I made a mistake and it says iLayer, but it's a float.
returns the position of a particle
sets the position of a particle
returns the velocity of a particle
sets the velocity of a particle
returns wether or not it hit.
and if so...
returns the position of the hit
returns the distance between the ray start and the hit
returns the normal of the triangle that was hit
returns the triangle that was hit
returns the sum of the vectors
returns a vector with the float added to each axis
returns the first vector subtracted by the second vector
returns the first vector multiplied by the second
returns the vector multiplied by the float
returns the first vector divided by the second
returns a vector, divided by the float
returns a vector with each axis modulo'd individually
returns a vector with each axis modulo'd by the int (I meant I instead of F).
returns the cross product of 2 vectors
returns the dot product of 2 vectors
returns a vector with each axis floor()'d
returns a vector with each axis abs()'d
returns the axis of a vector added together
returns the vector rotated around the x axis
returns the vector rotated around the y axis
returns the vector rotated around the z axis
returns whether or not the vectors are equal
returns whether or not vector1 is greater than vector2, in terms of absolute magnitude
returns the negated vector
returns a vector with the strongest axis being 1, others are 0
returns a vector where all axis below the fThreshold are 0
returns the distance between the two vectors
returns the direction from the first vector towards the second
returns the point where a line intersects a plane
returns a float from -1 to 1 indicating which side of the plane the given point lies on.
returns the length of a vector
returns the normalized vector
shortcut for using a max() on each axis individually.
shortcut for using a min() on each axis individually.
shortcut for using a max() on each axis.
shortcut for using a min() on each axis.
returns the average of a given list of vectors.
returns a rot with each axis wrapped to 0-359
returns the rotated target direction, used to get anything's up, forward, right, or anything-in-between vector
The second vector does not have to be a vectorUV. The first vector's normal and UV are carried.
adds the second vector to the first.
subtracts the second vector from the first.
multiplies the first vector by the second.
multiplies the vectorUV by a float
divides the first vector by the second
divides the vectorUV by a float
returns the point where a line intersects a plane, with interpolated UV coordinates
Shortcut instead of floor()-ing each axis
Shortcut instead of VectorAdd-ing each point
Shortcut instead of VectorSub-ing each point
You get the point
Calculates the normal of a triangle.
returns the center point of a triangle
returns a list of triangles, either containing the original triangle if it's in front of the plane, split up triangles that clip the plane, or no triangles if it's behind the plane.
does a TriClipAgainstPlane(), for the camera's near clip plane
does a TriClipAgainstPlane(), for all 4 edges of the screen.
returns the average point's distance from the camera. A key for sorting triangles.
returns the furthest point from the camera. A key for sorting triangles.
returns the closest point from the camera. A key for sorting triangles.
returns a list of tris, given a list of vectors
multiplies the vector by the matrix and returns the vectorUV
returns the vector by the matrix
returns the multiplied matrixes
Shortcut for multiplying a matrix by each point of a triangle
returns a point-at matrix, given a position, target location, and up direction
returns the inverse of the point-at matrix given a position, target location, and up direction.
returns a projection matrix, given an FOV
returns an X rotation matrix given an angle value in degrees
returns an Y rotation matrix given an angle value in degrees
returns an Z rotation matrix given an angle value in degrees
Creates a mesh from an OBJ, DAE, X3D, PLY, or STL file.
Creates an animated mesh from an OBJ sequence or AnimatedOBJ file
adds a thing to the specified layer (third layer by default)
adds a list of things to the specified layer (third layer by default)
removes a thing from the specified layer (third layer by default)
returns a list of all things in all layers.
Adds a dupe to the global list in the iLayer, and returns it.
If iLayer is -1, doesn't add to global list.
returns a list of things that are colliding
takes the list from GatherCollisions() and sets the position of things to try and separate them.
sets the position of things based on their physics calculations. Gravity is included, so there's a floor that things won't fall past. (0 unless specified.)
same as HandlePhysicsFloor() except uses a train to determine height.
will GatherCollisions(), then applies velocity to separate any collisions. Will only push objects that have a physics body.
Blurs the terrain into smooth hills and creates a mesh out of the points, stored in z3dpy.trainMesh
returns the height at a certain location, interpolating between values.
returns the shade of a triangle, using cheap direction based lighting. optionally you can specify whether or not to add to the global rays list for drawing. (False by default)
returns the shade of a triangle, using an expensive technique that checks for shadows.
saves the lighting calculations to each triangle's shade variable. optional parameter to specify expensive lighting. Shadowcasters is the list of Things to check for collisions.
converts a triangle to lines, and gives them to the draw function as they are calculated.
converts a triangle to pixels, and gives them to the draw function as they are calculated.
converts a triangle to pixels with Affine-mapped UVs, and gives them to the draw function as they are calculated.
Turns local triangles into world triangles, executing the material's shaders before and after.
The old method of transforming triangles, with a rotation matrix. (needs a TranslateTris() afterwards)
WTransformTris() only does rotation, so TranslateTris() is needed afterwards
Turns world triangles into view triangles
Turns view triangles into screen-space triangles.
returns the hex form of a colour, prefixed with a '#'
interpolates between numbers in a list based on fIndex
returns the list, with the index removed, for temporary exclusion, or for replacing the list as a solution to remove()
flattens an N-dimensional list.
It's like find but with multiple options, sweeps through the string until any of the characters in the symbols string are encountered.
returns the sign of the input, positive, negative, or 0
returns if a and b are pointing at the same object, does not compare value. This might not work depending on the interpreter.