Bonjour Micoute.
La face cachée d'un sprite: C'est drole parce mon sujet d'exploration depuis quelques jours était comment afficher les faces cachées d'un objet 3D et j'avais découvert (partiellement) le sens du mot Culling.
C'est moins impressionnant en 2D mais cette notion existe aussi en 2D et se résume à implanter cette procédure.
Code : Tout sélectionner
;Disable Backface Culling
Procedure BackFaceCullingDisable()
Global pd3d.IDirect3DDevice9
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)
EndProcedure
Que ce soit à l'endroit ou à l'envers, un
M reste un M
Code : Tout sélectionner
;Disable Backface Culling
Procedure BackFaceCullingDisable()
Global pd3d.IDirect3DDevice9
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)
EndProcedure
InitSprite()
OpenWindow(0, 0, 0, 800, 600, "Ecran", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0), 0, 0, 0)
SpriteQuality(1)
Font = FontID(LoadFont(#PB_Any, "Arial", 192))
CreateSprite(1, 256, 256, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(1))
DrawingFont(Font) : DrawingMode(1)
Box(0,0,256,256,$FF0000)
DrawText(20, 0, "E", $0000FF, 0)
StopDrawing()
BackFaceCullingDisable()
Repeat
ClearScreen(0)
;a.f = ElapsedMilliseconds()/1000
;ZoomSprite(1, 200*Sin(a), 200)
;DisplayTransparentSprite(1, 400-100*Sin(a), 200)
x+Rh
TransformSprite(1, x,0, SpriteWidth(1)-x,0, SpriteWidth(1)-x,SpriteHeight(1), x, SpriteHeight(1))
If x>SpriteWidth(1) ;
Rh=-1
ElseIf X=0
Rh=1
EndIf
DisplayTransparentSprite(1, 150, 100)
FlipBuffers()
Until WindowEvent() = #PB_Event_CloseWindow
J'ai tiré cette procédure de ce que j'ai posté sur ce lien.
http://www.purebasic.fr/french/viewtopi ... 24#p169124