3D OpenGL Engine

BlitzPlus Forums/BlitzPlus Programming/3D OpenGL Engine

CSG is coming along well. Here is a 300-sided CSG cylinder. This would have absolutely killed my old routines:


That took 16 seconds to build from the plane list. Small CSG objects compile from the plane list instantly. I compiled 100 7-sided polygons in 31 milliseconds, so each one took less than 1 millisecond.

You use CSG objects for the actual walls and most of the line picking. I don't plan on writing any collision for triangles, except for some picking routines. Even then, you use a CSG bounding box around the mesh to optimize the checks.

Brushes are the only thing the player collides with. Collision with static meshes is handled by placing an invisible brush around the static mesh. It doesn't have to be a box. You can get a pretty good fit by using one or more brushes.

I haven't gotten to testing yet, but I expect this system to produce collisions and linepicking several times faster than Blitz3D, even without a BSP tree. For instance, I can calculate sphere-brush intersection, or tell if the sphere is IN the brush (something that is impossible with Blitz's MeshesIntersect()) in less than 1 millisecond:
Function SphereInBrush(brush,x#,y#,z#,radius#)
For f=1 To CountFaces(brush)
	face=getface(brush,f)
	nx#=facenx(face)
	ny#=faceny(face)
	nz#=facenz(face)
	d#=faced(face)	
	If pointplanedistance(x,y,z,nx,ny,nz,d)>radius
		Return False
		EndIf
	Next
Return True
End Function