Rastering - ZackWilde27/Z3dPy GitHub Wiki
In this case, when I say Rastering I mean taking the 3D triangle and converting it to 2D.
Functions
Rastering can be done automatically with different functions depending on what you need.
for tri in Raster(*sortingMethod, *bReverse):
# Raster the internal list of things
for tri in CRaster(*sortingMethod, *bReverse):
# Raster the internal list of things using the C++ extension
for tri in DebugRaster(*train, *sortingMethod, *bReverse, *clearRays):
# Raster the internal list of things, as well as visualizing light sources, hitboxes, and other things.
for tri in RasterMeshList(meshList, *sortingMethod, *bReverseSort):
# Raster a list of meshes
for tri in RasterThings(thingList, *emitterList, *sortingMethod, *bReverse):
# Raster a list of things. Automatically renders static based on thing's isMovable
Or if you want custom rastering, the Custom Render Pipeline can be used to replace these functions
Each tri will have pre-calculated normals, and world-position. Colour and Id will be based on the mesh it came from.
Sorting Method and bReverse
Sorting method is the sort key, it takes a function. There are 3 built-in options:
- triSortAverage
- triSortClosest
- triSortFurthest
bReverse will reverse sorting. Should be True, except when using the pixel shaders.
Internal List
Raster() uses an internal list of things, which can be manipulated with AddThing() and RemoveThing()
z3dpy.AddThing(myCharacter)
z3dpy.AddThings([thatTree, thatOtherTree])
z3dpy.RemoveThing(thatOtherTree)
# Note: It'll update when OG is changed.
z3dpy.ThingSetPosX(myCharacter, 5)