Page 1 of 1

ClipSprite3D for DirectX9 subsystem

Posted: Wed Mar 11, 2009 10:21 pm
by Fluid Byte
Does anyone know how to convert the ClipSprite3D code from Stefan Moebius to work with the DirectX9 subsystem?

Here's the original code:

http://www.purebasic.fr/english/viewtop ... 78&start=5

I tried it myself but I failed. All I could figure out is that the datatype for width, height and others has to be changed from WORD to LONG.

Posted: Sat Mar 14, 2009 4:36 pm
by Fluid Byte
I guess not, eh? :?

Posted: Sat Mar 14, 2009 5:11 pm
by Kaeru Gaman
did you manage to look up the changes of structures for DX9 on the MSDN or is there some doc coming with the DX9-SDK?

(I have no idea myself, just don't wanna leave you completely alone here... )

Posted: Sat Mar 14, 2009 8:11 pm
by Fluid Byte
Kaeru Gaman wrote:did you manage to look up the changes of structures for DX9 on the MSDN or is there some doc coming with the DX9-SDK?
Uhmm...., where can I do that and what exactly I have to look for? Sorry, I'm totally overstrained with the 3D/DirectX stuff. :oops:

Or like Kwaï said:
I'm a asshole in programming with a egg head
:o
Kaeru Gaman wrote:(I have no idea myself, just don't wanna leave you completely alone here... )
I appreciate that man. At least I'm not clueless alone :P

Well, I searched the forums a little and had a closer look at the posts from S.M. Now I know the exact size of a memory block for a Sprite3D and the correct offsets for the Width/Height. I think it's possible to remove the dependency for IDirectDrawSurface7 and hardcode the needed values. So a little more Peek&Poke madness ...

Posted: Sat Mar 14, 2009 9:08 pm
by Kaeru Gaman
well, I would guess the IDirectDrawSurface7 struct should be replaced by a IDirectDrawSurface9 struct or whatever it's named now...

the dx9sdk is somewhere avaliable for download... I downloaded it last summer...
I don't remember from where, but have a search in the german forums, maybe ts told me the link...

Posted: Sat Mar 14, 2009 10:19 pm
by Fluid Byte
Try a search for IDirectDrawSurface9 on Google :wink:

The problem is that DirectDraw has been discontinued and DX9 only uses Direct3D. :?

Posted: Sat Mar 14, 2009 10:37 pm
by Kaeru Gaman
I looked in the code once more...

when I understand it halfways, this Interface is only used to verify the surface itself.

Code: Select all

  *DDS.IDirectDrawSurface7=*Sprite3D\Texture
  DDSDESC.DDSURFACEDESC2
  DDSDESC\dwSize=SizeOf(DDSURFACEDESC2)
  Result=*DDS\GetSurfaceDesc(DDSDESC) 
to "clip" the texture, you only need to re-define the tu/tv Vectors in the Sprite3D structure.
here the values from DDSDESC are only used as divisor for your pixelwise clip-coordinates.

so it seems, if you get the correct divisors on your own, you only need to access PB's Sprite3D struct, nothing else...

I would suspect, the vectors are floats between 0 and 1,
so the width and heigth of your origin 2D texturesprite should do the jobs as divisors...

Posted: Sat Mar 14, 2009 11:16 pm
by Fluid Byte
Image

The ZIP-file for the download of the DX9 Subsystem v0.5 contains a modified version of ClipSprite3D!

http://www.purebasic.fr/english/viewtopic.php?t=22184

Posted: Sat Mar 14, 2009 11:30 pm
by Kaeru Gaman

never mind...


Image

... it's saturday night, anyways.