It isn't difficult at all in DBPro:
null = make matrix4(1)
null = make matrix4(2)
null = make matrix4(3)
null = make vector3(4)
null = make vector3(5)
projection matrix4 1 ` Put the projection matrix into 1
view matrix4 2 ` Put the view matrix into 2
world matrix4 3 ` Put the world matrix into 3
set vector3 4, PosX, PosY, PosZ ` Put the world position into 4
project vector3 5, 4, 1, 2, 3 ` Apply all 3 matrix's to 4 and put the result into 5
if z vector3(5) < 0.0
` Behind the camera near range
else
if z vector3(5) > 1.0
` Beyond the camera far range
else
` In camera range
endif
endif
ScreenX = x vector3(5)
ScreenY = y vector3(5)
The projection matrix needs to be reset if you change resolution, FOV or aspect ratio, the view matrix needs to be reset if you move or rotate the camera, and I haven't figured out yet what affects the world matrix which after minor experimentation some time ago, seems to be the identity matrix (but I'm perfectly happy to be show to be wrong there).