3D OpenGL Engine

BlitzPlus Forums/BlitzPlus Programming/3D OpenGL Engine

Wooooo!

Blitz3D:
Graphics 400,300,16,2

Include "progs\mouse.bb"

box=CreateCube()

EntityPickMode box,2

start=MilliSecs()
For n=1 To 1000000
	LinePick 10,0,0,-10,0,0
	Next
RuntimeError MilliSecs()-start

Results with 2700 msecs

BlitzPlus+Phobos code:
Include "phobos\phobos.bb"
Include "progs\mouse.bb"
Include "progs\curvevalue.bb"
Include "progs\fps.bb"

brus=createbrush()
d#=-1
addface brus,1,0,0,d
addface brus,-1,0,0,d
addface brus,0,1,0,d
addface brus,0,-1,0,d
addface brus,0,0,1,d
addface brus,0,0,-1,d

compilebrush brus,0

start=MilliSecs()
For n=1 To 1000000
	LineIntersectsBrush brus,10,0,0,-10,0,0
	Next
RuntimeError MilliSecs()-start


Results with 960 msecs.

So Brush-picking is almost 3 times as fast as Blitz3D triangle-picking routines. I tried it with a 16-sided cylinder, to see if the ratio changed with mesh complexity, but it stayed about the same, at 6500 vs. 2300. In both cases, brush picking takes 35% of the time poly-picking did. A BSP tree should push that number down to roughly 5-6%, if we predict a square-root increase in performance.