Page 1 of 1
mirror text
Posted: Tue Sep 22, 2009 4:52 pm
by Ampli
i want to find a way to mirror 3d sprites. lets say we have one sprite with text on and we rotate it, it wont be correct.. sure its rotated but not mirrored. i tryed transform command and zoom command but no luck. any ideas?
Re: mirror text
Posted: Tue Sep 22, 2009 6:45 pm
by Kaeru Gaman
mirroring is no functionality of Sprite3D, because they are Quad-Meshes with a transparent backside.
you'll have to mirror the Texture itself and crate a new Sprite3D, sorry.
PS
perhaps there is a way when you manipulate th u/v coordinates of the Texture on the Mesh.
look for the ClipSprite3D routine in the forums, use those clip coordinates like you used the transform coordinates when you tried to mirror your sprite.
mirroring the Texture without turning the Mesh over could be possible.
PPS
pse alter the topic title. mirrored text is something completely different.
*BOOOM*
Re: mirror text
Posted: Tue Sep 22, 2009 6:57 pm
by Fluid Byte
It's possible with a little DirectX tweak found here:
http://www.purebasic.fr/english/viewtop ... 13&t=38251
Example for DirectX 9:
Code: Select all
InitSprite() : InitKeyboard() : InitSprite3D()
OpenWindow(0,0,0,640,480,"void",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,640,480,0,0,0)
CreateSprite(0,128,128,#PB_Sprite_Texture)
StartDrawing(SpriteOutput(0))
Box(0,0,128,128,#Red)
DrawingMode(1)
DrawText(8,50,"P U R E B A S I C")
StopDrawing()
CreateSprite3D(0,0)
TransformSprite3D(0,0,0,-128,0,-128,128,0,128)
Define pd3d.IDirect3DDevice9
Repeat
Repeat
EventID = WindowEvent()
Select EventID
Case #PB_Event_CloseWindow : End
EndSelect
Until Event = 0
ExamineKeyboard()
ClearScreen(#White)
Start3D()
!extrn _PB_Screen_Direct3DDevice
!MOV dword EAX, [_PB_Screen_Direct3DDevice]
!MOV dword [v_pd3d],EAX
pd3d\SetRenderState(22,1)
DisplaySprite3D(0,150,20)
Stop3D()
FlipBuffers()
Delay(1)
Until KeyboardPushed(#PB_Key_Escape)
[/size]
[edit]
Change "_PB_Screen_Direct3DDevice" to "PB_Screen_Direct3DDevice" for 64-Bit compatibility
Re: mirror text
Posted: Wed Sep 23, 2009 5:55 pm
by Ampli
Perfect. just what i wanted. thanks alot.
/ampli