Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, 1 invisible), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
using D3DXSPRITE in Lite-c #470534
01/19/18 03:17
01/19/18 03:17
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline OP
Expert
Matt_Aufderheide  Offline OP
Expert
M

Joined: Oct 2003
Posts: 4,131
I don't think sprites are drawn using d3dxsprite in A8 commercial, so I want to to try to use it in my game.. but frankly I cant figure out how to use that interface in Lite-C ....its not in the d3d9 header.. any idea?

Re: using D3DXSPRITE in Lite-c [Re: Matt_Aufderheide] #470569
01/22/18 09:27
01/22/18 09:27
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
what you can do in lite-c is get the d3d device pointer (using draw_begin(), I think) and then perform drawcalls using d3d interface functions like DrawPrimitive(), DrawIndexedPrimitive() or DrawPrimitiveUp() for example. note: the last one is more of a legacy thing from dx8 iirc. it's usually pretty bad for 3d geometry, since it always streams vertex data from the ram to your graphics card when drawing. still, I have used it successfully for 2d sprite drawing (since the vertex data is tiny in that case)
Alternatively, acknex has an engine function called draw_quad() which is basically the same but with some limitations. On the other hand, that way you don't have to fiddle around with d3d9 api stuff.

also, lite-c does not include d3dx9 helpers, afaik, and d3dxsprite sounds like another helper api that's built upon d3d9. (besides that, it most likely uses the same functions as mentioned above but provides a simpler interface for them). if you desperately want to use it you'd have to create a wrapper plugin dll for lite-c.

and lastly, if you're trying to draw sprites in you 3d level, I'm not entirely sure that's possible. acknex' limitations might be a problem here.

hope that helps laugh


POTATO-MAN saves the day! - Random
Re: using D3DXSPRITE in Lite-c [Re: Kartoffel] #470580
01/22/18 23:35
01/22/18 23:35
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline OP
Expert
Matt_Aufderheide  Offline OP
Expert
M

Joined: Oct 2003
Posts: 4,131
actually it is possible.. I got it working fine. Doesn't need a DLL, just have to declare the D3DXSPRITE interface as per the d3dx headers..

then I I just create an effect from file and and do the sprite drawing in that effect pass.. all of it I bind to a view /material event.. so I can control what layer its on...

if anyone want sot to see some code...

put the following in some header...

#define D3DXSPRITE_DONOTSAVESTATE (1 << 0)
#define D3DXSPRITE_DONOTMODIFY_RENDERSTATE (1 << 1)
#define D3DXSPRITE_OBJECTSPACE (1 << 2)
#define D3DXSPRITE_BILLBOARD (1 << 3)
#define D3DXSPRITE_ALPHABLEND (1 << 4)
#define D3DXSPRITE_SORT_TEXTURE (1 << 5)
#define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK (1 << 6)
#define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT (1 << 7)


#undef INTERFACE
#define INTERFACE ID3DXSprite

DECLARE_INTERFACE_(ID3DXSprite, IUnknown)

{
// IUnknown
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;

// ID3DXSprite
STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;

STDMETHOD(GetTransform)(THIS_ D3DXMATRIX *pTransform) PURE;
STDMETHOD(SetTransform)(THIS_ CONST D3DXMATRIX *pTransform) PURE;

STDMETHOD(SetWorldViewRH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE;
STDMETHOD(SetWorldViewLH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE;

STDMETHOD(Begin)(THIS_ DWORD Flags) PURE;
STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE9 pTexture, CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pCenter, CONST D3DXVECTOR3 *pPosition, D3DCOLOR Color) PURE;
STDMETHOD(Flush)(THIS) PURE;
STDMETHOD(End)(THIS) PURE;

STDMETHOD(OnLostDevice)(THIS) PURE;
STDMETHOD(OnResetDevice)(THIS) PURE;
};


MY_DECLARE_INTERFACE(ID3DXSprite)
typedef ID3DXSprite *LPD3DXSPRITE;

HRESULT WINAPI

D3DXCreateSprite(
LPDIRECT3DDEVICE9 pDevice,
LPD3DXSPRITE* ppSprite);
/////////////////////////////////////////////////////////////


simply create the sprite like this

pd3dDev = (LPDIRECT3DDEVICE9)draw_begin();
if (!pd3dDev) return(0);

//create d3dxsprite object
hr=D3DXCreateSprite(
pd3ddev,
&SPRITE
);

everything else should be straightforward...

Re: using D3DXSPRITE in Lite-c [Re: Matt_Aufderheide] #470587
01/23/18 10:56
01/23/18 10:56
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
good to know, I thought d3dx stuff needed additional libraries that you couldn't use in acknex directly.

thanks for sharing


POTATO-MAN saves the day! - Random

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1