mirror text

Just starting out? Need help? Post your questions and find answers here.
Ampli
User
User
Posts: 54
Joined: Sun Jul 29, 2007 7:05 pm
Location: Sweden

mirror text

Post 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?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: mirror text

Post 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*
oh... and have a nice day.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Re: mirror text

Post 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
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Ampli
User
User
Posts: 54
Joined: Sun Jul 29, 2007 7:05 pm
Location: Sweden

Re: mirror text

Post by Ampli »

Perfect. just what i wanted. thanks alot.

/ampli
Post Reply