CameraPick faster than linepick by around 47 times

Miscellaneous Forums/General Discussion/CameraPick faster than linepick by around 47 times

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

From tests i have performed and from Makepool's observation, linepick is around 47 times slower than camerapick. Surely this could be utilized in lightmapping, as, as i recall, lightmapping is done with linepicks.

Graphics3D 800,600
SetBuffer BackBuffer()


Global camera = CreateCamera()
PositionEntity camera,0,0,-20


Global cube = CreateCube()
EntityPickMode cube,2
PositionEntity cube,5,0,0

Global cube1 = CreateCube()
EntityPickMode cube1,2
PositionEntity cube1,0,0,0



While Not KeyHit(1)

	Cls


	If MouseHit(1) Then
		CameraPick(camera,MouseX(),MouseY())
		If PickedEntity() <> 0 Then
			flag$="picked with camera pick!, time of = "+PickedTime()+" entity = "+PickedEntity()
			EntityColor PickedEntity(),Rnd(0,255),Rnd(0,255),Rnd(0,255)
		Else
			flag$="nothing picked..."
		End If
	ElseIf MouseHit(2) Then
		LinePick(0,0,-20,0,0,20,1)
		If PickedEntity() <> 0 Then
			flag$="picked with line pick!, time of = "+PickedTime()+" entity = "+PickedEntity()
			EntityColor PickedEntity(),Rnd(0,255),Rnd(0,255),Rnd(0,255)
		Else
			flag$="nothing picked..."
		End If
	End If
	
	UpdateWorld
	RenderWorld
	Text 0,0,flag
	Flip
Wend
End