In a nutshell:
If you use the "Disable Backface Culling" assembly trick to flip your 3D sprites with TranformSprite3D, this will not work reliably on windows 7. The result is missing sprites. The code floating around the forum is wrong and will cause this problem (some of which is from me.. so, guilty).
This is the wrong code...
Code: Select all
;Disable Backface Culling
Define pd3d.IDirect3DDevice9
Start3D()
EnableASM
!extrn _PB_Screen_Direct3DDevice
!MOV dword EAX, [_PB_Screen_Direct3DDevice]
!MOV dword [v_pd3d],EAX
DisableASM
pd3d\SetRenderState(22,1)
Stop3D()
;0=No Flip, 1=Horiz, 2=Vert, 3=Both
Procedure TformSprite3D(SpriteID.l,scale.f=512,flipmode.i=0)
Select flipmode.i
Case 0
TransformSprite3D(SpriteID,0,0,0,scale.f,0,0,scale.f,scale.f,0,0,scale.f,0)
Case 1
TransformSprite3D(SpriteID,scale.f,0,0,0,0,0,0,scale.f,0,scale.f,scale.f,0)
Case 2
TransformSprite3D(SpriteID,0,scale.f,0,scale.f,scale.f,0,scale.f,0,0,0,0,0)
Case 3
TransformSprite3D(SpriteID,scale.f,scale.f,0,0,scale.f,0,0,0,0,scale.f,0,0)
EndSelect
EndProcedure
Code: Select all
;Disable Backface Culling
Define pd3d.IDirect3DDevice9
Start3D()
EnableASM
!extrn _PB_Screen_Direct3DDevice
!MOV dword EAX, [_PB_Screen_Direct3DDevice]
!MOV dword [v_pd3d],EAX
DisableASM
pd3d\SetRenderState(22,1)
pd3d\SetRenderState(7,0)
Stop3D()
;0=No Flip, 1=Horiz, 2=Vert, 3=Both
Procedure TformSprite3D(SpriteID.l,scale.f=512,flipmode.i=0)
z.f=1.0
Select flipmode.i
Case 0
TransformSprite3D(SpriteID,0,0,z.f,scale.f,0,z.f,scale.f,scale.f,z.f,0,scale.f,z.f)
Case 1
TransformSprite3D(SpriteID,scale.f,0,z.f,0,0,z.f,0,scale.f,z.f,scale.f,scale.f,z.f)
Case 2
TransformSprite3D(SpriteID,0,scale.f,z.f,scale.f,scale.f,z.f,scale.f,0,z.f,0,0,z.f)
Case 3
TransformSprite3D(SpriteID,scale.f,scale.f,z.f,0,scale.f,z.f,0,0,z.f,scale.f,0,z.f)
EndSelect
EndProcedure
pd3d\SetRenderState(22,1) uses the IDirect3DDevice9::SetRenderState TYPE of D3DRS_CULLMODE (22) and sets it to D3DCULL_NONE (1), disabling backface culling as you'd expect, but by default, the z-buffer is still taken into account even though you draw your sprite3D's in a set order. What was missing from the first code is..
Code: Select all
pd3d\SetRenderState(7,0)