ClipSprite3D for DirectX9 subsystem

Advanced game related topics
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

ClipSprite3D for DirectX9 subsystem

Post 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.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

I guess not, eh? :?
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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... )
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

Post 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 ...
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
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

Post by Fluid Byte »

Try a search for IDirectDrawSurface9 on Google :wink:

The problem is that DirectDraw has been discontinued and DX9 only uses Direct3D. :?
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
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

Post 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
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »


never mind...


Image

... it's saturday night, anyways.
oh... and have a nice day.
Post Reply