Debug Drawing 0.4 - ZackWilde27/Z3dPy GitHub Wiki

DebugRender() will visualize rays, lights, hitboxes, and dots for debugging.

Setup

DebugRender() uses the same internal lists as Render().

z3dpy.AddThing(myThing)

z3dpy.rays.append(myRay)

z3dpy.lights.append(myLight)

# Dots is a list of locations to put a dot
z3dpy.dots.append([1.0, 2.0, 3.0])

Drawing

DebugRender() only draws the debug stuff, so it's a skippable second step instead of replacing the normal drawing.

drawDebug = True

for tri in z3dpy.RenderThings([myThing, myOtherThing]):
    win32gui.Polygon(dc, [(floor(tri[0][0]), floor(tri[0][1])), (floor(tri[1][0]), floor(tri[1][1])), (floor(tri[2][0]), floor(tri[2][1]))])

if drawDebug:
    for tri in z3dpy.DebugRender():
        win32gui.Polygon(dc, [(floor(tri[0][0]), floor(tri[0][1])), (floor(tri[1][0]), floor(tri[1][1])), (floor(tri[2][0]), floor(tri[2][1]))])

DebugRender() has a few optional parameters, including a train to draw using dots, wether or not to clear the rays list after drawing, etc.

# DebugRaster(*train, *sortKey, *bReverse, *clearRays)
for tri in z3dpy.DebugRender(myTrain, z3dpy.triSortAverage, True, False)