EntityOrder > 0 ignores existing ZBuffer

Blitz3D Forums/Blitz3D Bug Reports/EntityOrder > 0 ignores existing ZBuffer

Ok, I made an example showing the problem:

;When using EntityOrder > 0 an entity should be drawn behind the other entities. 
;Generally it does, but it ignores existing z-buffer values, which makes this command useless with multi pass rendering.
;In this example the sphere should be shown with both, EntityOrder > 0 or disabled, but it clearly isn't. 
;EntityOrder > 0 should never redraw existing stuff!


Graphics3D 800, 600, 32, 2
SetBuffer BackBuffer()


  ;setup cam
  cam = CreateCamera()
  PositionEntity cam, 0, 0, -2


  ;setup scene
  sphere = CreateSphere()
	
	
  ;setup skybox	
  skybox = CreateCube(cam)
  FlipMesh skybox
  ScaleEntity skybox, 5, 5, 5

  EntityColor skybox, 100,100,255
  

	
Repeat

	If KeyHit(57) Then skyOrder = 1 - skyOrder
	EntityOrder skybox, skyOrder

	;first render pass only showing sphere
	HideEntity skybox
	ShowEntity sphere
	
	CameraClsMode cam, 1, 1
	RenderWorld
	
	
	;second render pass only showing skybox
	ShowEntity skybox
	HideEntity sphere
	
	CameraClsMode cam, 0, 0
	RenderWorld
	
	Text 10, 10, "Hit Space to Enable/Disable EntityOrder for Skybox(EntityOrder: " + skyOrder + ")"
	
	Flip


Until KeyHit(1)