ReactOS 0.4.17-dev-923-g4c9a150
sprite.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008 Tony Wasserka
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 *
18 */
19
20
21#include "d3dx9_private.h"
22
24
25/* the combination of all possible D3DXSPRITE flags */
26#define D3DXSPRITE_FLAGLIMIT 511
27
29{
33};
34
35struct sprite
36{
37 IDirect3DTexture9 *texture;
44};
45
47{
48 ID3DXSprite ID3DXSprite_iface;
50
52 IDirect3DVertexDeclaration9 *vdecl;
53 IDirect3DStateBlock9 *stateblock;
58
59 /* Store the relevant caps to prevent multiple GetDeviceCaps calls */
63
64 struct sprite *sprites;
65 int sprite_count; /* number of sprites to be drawn */
66 int allocated_sprites; /* number of (pre-)allocated sprites */
67};
68
69static inline struct d3dx9_sprite *impl_from_ID3DXSprite(ID3DXSprite *iface)
70{
72}
73
74static HRESULT WINAPI d3dx9_sprite_QueryInterface(ID3DXSprite *iface, REFIID riid, void **out)
75{
76 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
77
78 if (IsEqualGUID(riid, &IID_ID3DXSprite)
80 {
81 IUnknown_AddRef(iface);
82 *out = iface;
83 return S_OK;
84 }
85
86 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
87
88 *out = NULL;
89 return E_NOINTERFACE;
90}
91
92static ULONG WINAPI d3dx9_sprite_AddRef(ID3DXSprite *iface)
93{
95 ULONG refcount = InterlockedIncrement(&sprite->ref);
96
97 TRACE("%p increasing refcount to %lu.\n", sprite, refcount);
98
99 return refcount;
100}
101
102static ULONG WINAPI d3dx9_sprite_Release(ID3DXSprite *iface)
103{
105 ULONG refcount = InterlockedDecrement(&sprite->ref);
106
107 TRACE("%p decreasing refcount to %lu.\n", sprite, refcount);
108
109 if (!refcount)
110 {
111 if (sprite->sprites)
112 {
113 int i;
114
116 {
117 for (i = 0; i < sprite->sprite_count; ++i)
118 {
119 if (sprite->sprites[i].texture)
121 }
122 }
123
124 free(sprite->sprites);
125 }
126
127 if (sprite->stateblock)
129 if (sprite->vdecl)
131 if (sprite->device)
133 free(sprite);
134 }
135
136 return refcount;
137}
138
139static HRESULT WINAPI d3dx9_sprite_GetDevice(struct ID3DXSprite *iface, struct IDirect3DDevice9 **device)
140{
142
143 TRACE("iface %p, device %p.\n", iface, device);
144
145 if (!device)
146 return D3DERR_INVALIDCALL;
147 *device = sprite->device;
149
150 return D3D_OK;
151}
152
154{
156
157 TRACE("iface %p, transform %p.\n", iface, transform);
158
159 if (!transform)
160 return D3DERR_INVALIDCALL;
162
163 return D3D_OK;
164}
165
167{
169
170 TRACE("iface %p, transform %p.\n", iface, transform);
171
172 if (!transform)
173 return D3DERR_INVALIDCALL;
175
176 return D3D_OK;
177}
178
180 const D3DXMATRIX *world, const D3DXMATRIX *view)
181{
182 FIXME("iface %p, world %p, view %p stub!\n", iface, world, view);
183
184 return E_NOTIMPL;
185}
186
188 const D3DXMATRIX *world, const D3DXMATRIX *view)
189{
190 FIXME("iface %p, world %p, view %p stub!\n", iface, world, view);
191
192 return E_NOTIMPL;
193}
194
195/* Helper function */
196static void set_states(struct d3dx9_sprite *object)
197{
199 D3DVIEWPORT9 vp;
200
201 /* Miscellaneous stuff */
205
206 /* Render states */
233
234 /* Texture stage states */
245
246 /* Sampler states */
249
250 if(object->texfilter_caps & D3DPTFILTERCAPS_MAGFANISOTROPIC)
253
256
257 if(object->texfilter_caps & D3DPTFILTERCAPS_MINFANISOTROPIC)
260
261 if(object->texfilter_caps & D3DPTFILTERCAPS_MIPFLINEAR)
264
267
268 /* Matrices */
269 D3DXMatrixIdentity(&mat);
273 D3DXMatrixOrthoOffCenterLH(&mat, vp.X+0.5f, (float)vp.Width+vp.X+0.5f, (float)vp.Height+vp.Y+0.5f, vp.Y+0.5f, vp.MinZ, vp.MaxZ);
275}
276
277static HRESULT WINAPI d3dx9_sprite_Begin(ID3DXSprite *iface, DWORD flags)
278{
279 struct d3dx9_sprite *This = impl_from_ID3DXSprite(iface);
280 HRESULT hr;
281
282 TRACE("iface %p, flags %#lx.\n", iface, flags);
283
285
286/* TODO: Implement flags:
287D3DXSPRITE_BILLBOARD: makes the sprite always face the camera
288D3DXSPRITE_DONOTMODIFY_RENDERSTATE: name says it all
289D3DXSPRITE_OBJECTSPACE: do not change device transforms
290D3DXSPRITE_SORT_DEPTH_BACKTOFRONT: sort by position
291D3DXSPRITE_SORT_DEPTH_FRONTTOBACK: sort by position
292D3DXSPRITE_SORT_TEXTURE: sort by texture (so that it doesn't change too often)
293*/
294/* Seems like alpha blending is always enabled, regardless of D3DXSPRITE_ALPHABLEND flag */
298 FIXME("Flags unsupported: %#lx.\n", flags);
299 /* These flags should only matter to performance */
301 TRACE("Flags unsupported: %#lx.\n", flags);
302
303 if(This->vdecl==NULL) {
304 static const D3DVERTEXELEMENT9 elements[] =
305 {
310 };
311 IDirect3DDevice9_CreateVertexDeclaration(This->device, elements, &This->vdecl);
312 }
313
315 if(This->stateblock==NULL) {
316 /* Tell our state block what it must store */
318 if(hr!=D3D_OK) return hr;
319
321
323 IDirect3DDevice9_SetStreamSource(This->device, 0, NULL, 0, sizeof(struct sprite_vertex));
326
327 IDirect3DDevice9_EndStateBlock(This->device, &This->stateblock);
328 }
329 IDirect3DStateBlock9_Capture(This->stateblock); /* Save current state */
330 }
331
332 /* Apply device state */
334
335 This->flags=flags;
336 This->ready=TRUE;
337
338 return D3D_OK;
339}
340
341static HRESULT WINAPI d3dx9_sprite_Draw(ID3DXSprite *iface, IDirect3DTexture9 *texture,
342 const RECT *rect, const D3DXVECTOR3 *center, const D3DXVECTOR3 *position, D3DCOLOR color)
343{
344 struct d3dx9_sprite *This = impl_from_ID3DXSprite(iface);
345 struct sprite *new_sprites;
346 D3DSURFACE_DESC texdesc;
347 int new_size;
348
349 TRACE("iface %p, texture %p, rect %s, center %p, position %p, color 0x%08lx.\n",
350 iface, texture, wine_dbgstr_rect(rect), center, position, color);
351
352 if(texture==NULL) return D3DERR_INVALIDCALL;
353 if(!This->ready) return D3DERR_INVALIDCALL;
354
355 if (This->allocated_sprites <= This->sprite_count)
356 {
357 new_size = This->allocated_sprites ? This->allocated_sprites * 2 : 32;
358 new_sprites = realloc(This->sprites, new_size * sizeof(*This->sprites));
359 if (!new_sprites)
360 return E_OUTOFMEMORY;
361 This->sprites = new_sprites;
362 This->allocated_sprites = new_size;
363 }
364 This->sprites[This->sprite_count].texture=texture;
367
368 /* Reuse the texture desc if possible */
369 if(This->sprite_count) {
370 if(This->sprites[This->sprite_count-1].texture!=texture) {
372 } else {
373 texdesc.Width=This->sprites[This->sprite_count-1].texw;
374 texdesc.Height=This->sprites[This->sprite_count-1].texh;
375 }
376 } else IDirect3DTexture9_GetLevelDesc(texture, 0, &texdesc);
377
378 This->sprites[This->sprite_count].texw=texdesc.Width;
379 This->sprites[This->sprite_count].texh=texdesc.Height;
380
381 if (rect)
382 This->sprites[This->sprite_count].rect = *rect;
383 else
384 SetRect(&This->sprites[This->sprite_count].rect, 0, 0, texdesc.Width, texdesc.Height);
385
386 if(center==NULL) {
387 This->sprites[This->sprite_count].center.x=0.0f;
388 This->sprites[This->sprite_count].center.y=0.0f;
389 This->sprites[This->sprite_count].center.z=0.0f;
390 } else This->sprites[This->sprite_count].center=*center;
391
392 if(position==NULL) {
393 This->sprites[This->sprite_count].pos.x=0.0f;
394 This->sprites[This->sprite_count].pos.y=0.0f;
395 This->sprites[This->sprite_count].pos.z=0.0f;
396 } else This->sprites[This->sprite_count].pos=*position;
397
398 This->sprites[This->sprite_count].color=color;
399 This->sprites[This->sprite_count].transform=This->transform;
400 This->sprite_count++;
401
402 return D3D_OK;
403}
404
405static HRESULT WINAPI d3dx9_sprite_Flush(ID3DXSprite *iface)
406{
407 struct d3dx9_sprite *This = impl_from_ID3DXSprite(iface);
408 struct sprite_vertex *vertices;
409 int i, count=0, start;
410
411 TRACE("iface %p.\n", iface);
412
413 if(!This->ready) return D3DERR_INVALIDCALL;
414 if(!This->sprite_count) return D3D_OK;
415
416/* TODO: use of a vertex buffer here */
417 vertices = malloc(sizeof(*vertices) * 6 * This->sprite_count);
418
419 for(start=0;start<This->sprite_count;start+=count,count=0) {
420 i=start;
421 while(i<This->sprite_count &&
422 (count==0 || This->sprites[i].texture==This->sprites[i-1].texture)) {
423 float spritewidth=(float)This->sprites[i].rect.right-(float)This->sprites[i].rect.left;
424 float spriteheight=(float)This->sprites[i].rect.bottom-(float)This->sprites[i].rect.top;
425
426 vertices[6*i ].pos.x = This->sprites[i].pos.x - This->sprites[i].center.x;
427 vertices[6*i ].pos.y = This->sprites[i].pos.y - This->sprites[i].center.y;
428 vertices[6*i ].pos.z = This->sprites[i].pos.z - This->sprites[i].center.z;
429 vertices[6*i+1].pos.x = spritewidth + This->sprites[i].pos.x - This->sprites[i].center.x;
430 vertices[6*i+1].pos.y = This->sprites[i].pos.y - This->sprites[i].center.y;
431 vertices[6*i+1].pos.z = This->sprites[i].pos.z - This->sprites[i].center.z;
432 vertices[6*i+2].pos.x = spritewidth + This->sprites[i].pos.x - This->sprites[i].center.x;
433 vertices[6*i+2].pos.y = spriteheight + This->sprites[i].pos.y - This->sprites[i].center.y;
434 vertices[6*i+2].pos.z = This->sprites[i].pos.z - This->sprites[i].center.z;
435 vertices[6*i+3].pos.x = This->sprites[i].pos.x - This->sprites[i].center.x;
436 vertices[6*i+3].pos.y = spriteheight + This->sprites[i].pos.y - This->sprites[i].center.y;
437 vertices[6*i+3].pos.z = This->sprites[i].pos.z - This->sprites[i].center.z;
438 vertices[6*i ].col = This->sprites[i].color;
439 vertices[6*i+1].col = This->sprites[i].color;
440 vertices[6*i+2].col = This->sprites[i].color;
441 vertices[6*i+3].col = This->sprites[i].color;
442 vertices[6*i ].tex.x = (float)This->sprites[i].rect.left / (float)This->sprites[i].texw;
443 vertices[6*i ].tex.y = (float)This->sprites[i].rect.top / (float)This->sprites[i].texh;
444 vertices[6*i+1].tex.x = (float)This->sprites[i].rect.right / (float)This->sprites[i].texw;
445 vertices[6*i+1].tex.y = (float)This->sprites[i].rect.top / (float)This->sprites[i].texh;
446 vertices[6*i+2].tex.x = (float)This->sprites[i].rect.right / (float)This->sprites[i].texw;
447 vertices[6*i+2].tex.y = (float)This->sprites[i].rect.bottom / (float)This->sprites[i].texh;
448 vertices[6*i+3].tex.x = (float)This->sprites[i].rect.left / (float)This->sprites[i].texw;
449 vertices[6*i+3].tex.y = (float)This->sprites[i].rect.bottom / (float)This->sprites[i].texh;
450
451 vertices[6*i+4]=vertices[6*i];
452 vertices[6*i+5]=vertices[6*i+2];
453
454 D3DXVec3TransformCoordArray(&vertices[6 * i].pos, sizeof(*vertices),
455 &vertices[6 * i].pos, sizeof(*vertices), &This->sprites[i].transform, 6);
456 count++;
457 i++;
458 }
459
460 IDirect3DDevice9_SetTexture(This->device, 0, (struct IDirect3DBaseTexture9 *)This->sprites[start].texture);
462
464 2 * count, vertices + 6 * start, sizeof(*vertices));
465 }
466 free(vertices);
467
469 for(i=0;i<This->sprite_count;i++)
470 IDirect3DTexture9_Release(This->sprites[i].texture);
471
472 This->sprite_count=0;
473
474 /* Flush may be called more than once, so we don't reset This->ready here */
475
476 return D3D_OK;
477}
478
479static HRESULT WINAPI d3dx9_sprite_End(ID3DXSprite *iface)
480{
482
483 TRACE("iface %p.\n", iface);
484
485 if (!sprite->ready)
486 return D3DERR_INVALIDCALL;
487
488 ID3DXSprite_Flush(iface);
489
490 if (sprite->stateblock && !(sprite->flags & D3DXSPRITE_DONOTSAVESTATE))
491 IDirect3DStateBlock9_Apply(sprite->stateblock); /* Restore old state */
492
493 sprite->ready = FALSE;
494
495 return D3D_OK;
496}
497
498static HRESULT WINAPI d3dx9_sprite_OnLostDevice(ID3DXSprite *iface)
499{
501
502 TRACE("iface %p.\n", iface);
503
504 if (sprite->stateblock)
506 if (sprite->vdecl)
508 sprite->vdecl = NULL;
509 sprite->stateblock = NULL;
510
511 /* Reset some variables */
513
514 return D3D_OK;
515}
516
517static HRESULT WINAPI d3dx9_sprite_OnResetDevice(ID3DXSprite *iface)
518{
520 int i;
521
522 TRACE("iface %p.\n", iface);
523
525 {
526 for (i = 0; i < sprite->sprite_count; ++i)
527 {
528 if (sprite->sprites[i].texture)
530 }
531 }
532
533 sprite->sprite_count = 0;
534 sprite->flags = 0;
535 sprite->ready = FALSE;
536
537 /* keep matrices */
538 /* device objects get restored on Begin */
539
540 return D3D_OK;
541}
542
543static const ID3DXSpriteVtbl d3dx9_sprite_vtbl =
544{
559};
560
562{
563 struct d3dx9_sprite *object;
564 D3DCAPS9 caps;
565
566 TRACE("device %p, sprite %p.\n", device, sprite);
567
568 if(device==NULL || sprite==NULL) return D3DERR_INVALIDCALL;
569
570 if (!(object = calloc(1, sizeof(*object))))
571 {
572 *sprite = NULL;
573 return E_OUTOFMEMORY;
574 }
575 object->ID3DXSprite_iface.lpVtbl = &d3dx9_sprite_vtbl;
576 object->ref=1;
577 object->device=device;
578 IUnknown_AddRef(device);
579
580 object->vdecl=NULL;
581 object->stateblock=NULL;
582
583 D3DXMatrixIdentity(&object->transform);
584 D3DXMatrixIdentity(&object->view);
585
587 object->texfilter_caps=caps.TextureFilterCaps;
588 object->maxanisotropy=caps.MaxAnisotropy;
589 object->alphacmp_caps=caps.AlphaCmpCaps;
590
591 ID3DXSprite_OnResetDevice(&object->ID3DXSprite_iface);
592
593 object->sprites=NULL;
594 object->allocated_sprites=0;
595 *sprite=&object->ID3DXSprite_iface;
596
597 return D3D_OK;
598}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
RECT rect
Definition: combotst.c:67
@ D3DRS_VERTEXBLEND
Definition: d3d8types.h:783
@ D3DRS_SHADEMODE
Definition: d3d8types.h:731
@ D3DRS_STENCILENABLE
Definition: d3d8types.h:755
@ D3DRS_WRAP0
Definition: d3d8types.h:764
@ D3DRS_CULLMODE
Definition: d3d8types.h:738
@ D3DRS_ALPHATESTENABLE
Definition: d3d8types.h:734
@ D3DRS_SRCBLEND
Definition: d3d8types.h:736
@ D3DRS_CLIPPLANEENABLE
Definition: d3d8types.h:784
@ D3DRS_ALPHAFUNC
Definition: d3d8types.h:741
@ D3DRS_DESTBLEND
Definition: d3d8types.h:737
@ D3DRS_FILLMODE
Definition: d3d8types.h:730
@ D3DRS_CLIPPING
Definition: d3d8types.h:772
@ D3DRS_BLENDOP
Definition: d3d8types.h:802
@ D3DRS_ALPHABLENDENABLE
Definition: d3d8types.h:743
@ D3DRS_COLORWRITEENABLE
Definition: d3d8types.h:800
@ D3DRS_SPECULARENABLE
Definition: d3d8types.h:745
@ D3DRS_ALPHAREF
Definition: d3d8types.h:740
@ D3DRS_DIFFUSEMATERIALSOURCE
Definition: d3d8types.h:779
@ D3DRS_INDEXEDVERTEXBLENDENABLE
Definition: d3d8types.h:799
@ D3DRS_LIGHTING
Definition: d3d8types.h:773
@ D3DRS_RANGEFOGENABLE
Definition: d3d8types.h:754
@ D3DRS_FOGENABLE
Definition: d3d8types.h:744
#define D3DCOLORWRITEENABLE_ALPHA
Definition: d3d8types.h:151
@ D3DSHADE_GOURAUD
Definition: d3d8types.h:823
@ D3DTADDRESS_CLAMP
Definition: d3d8types.h:862
@ D3DTTFF_DISABLE
Definition: d3d8types.h:944
#define D3DCOLORWRITEENABLE_RED
Definition: d3d8types.h:148
@ D3DBLEND_SRCALPHA
Definition: d3d8types.h:513
@ D3DBLEND_INVSRCALPHA
Definition: d3d8types.h:514
@ D3DTEXF_POINT
Definition: d3d8types.h:871
@ D3DTEXF_ANISOTROPIC
Definition: d3d8types.h:873
@ D3DTEXF_LINEAR
Definition: d3d8types.h:872
@ D3DTSS_ALPHAARG2
Definition: d3d8types.h:917
@ D3DTSS_COLOROP
Definition: d3d8types.h:912
@ D3DTSS_TEXCOORDINDEX
Definition: d3d8types.h:922
@ D3DTSS_ALPHAOP
Definition: d3d8types.h:915
@ D3DTSS_COLORARG1
Definition: d3d8types.h:913
@ D3DTSS_TEXTURETRANSFORMFLAGS
Definition: d3d8types.h:934
@ D3DTSS_ALPHAARG1
Definition: d3d8types.h:916
@ D3DTSS_COLORARG2
Definition: d3d8types.h:914
@ D3DTOP_MODULATE
Definition: d3d8types.h:884
@ D3DTOP_DISABLE
Definition: d3d8types.h:881
#define D3DCOLORWRITEENABLE_GREEN
Definition: d3d8types.h:149
@ D3DMCS_COLOR1
Definition: d3d8types.h:665
@ D3DBLENDOP_ADD
Definition: d3d8types.h:527
#define D3DTA_DIFFUSE
Definition: d3d8types.h:139
#define D3DTA_TEXTURE
Definition: d3d8types.h:141
@ D3DCULL_NONE
Definition: d3d8types.h:561
@ D3DPT_TRIANGLELIST
Definition: d3d8types.h:721
@ D3DCMP_GREATER
Definition: d3d8types.h:541
#define D3DCOLORWRITEENABLE_BLUE
Definition: d3d8types.h:150
@ D3DTS_VIEW
Definition: d3d8types.h:955
@ D3DTS_PROJECTION
Definition: d3d8types.h:956
#define D3DTS_WORLD
Definition: d3d8types.h:85
@ D3DFILL_SOLID
Definition: d3d8types.h:586
#define IDirect3DTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:860
#define IDirect3DDevice9_SetIndices(p, a)
Definition: d3d9.h:1439
#define IDirect3DDevice9_CreateVertexDeclaration(p, a, b)
Definition: d3d9.h:1421
#define IDirect3DTexture9_AddRef(p)
Definition: d3d9.h:841
#define IDirect3DDevice9_SetTextureStageState(p, a, b, c)
Definition: d3d9.h:1402
#define IDirect3DDevice9_DrawPrimitiveUP(p, a, b, c, d)
Definition: d3d9.h:1418
#define IDirect3DDevice9_SetNPatchMode(p, a)
Definition: d3d9.h:1414
#define IDirect3DStateBlock9_Release(p)
Definition: d3d9.h:1128
#define IDirect3DDevice9_SetRenderState(p, a, b)
Definition: d3d9.h:1392
#define IDirect3DDevice9_SetPixelShader(p, a)
Definition: d3d9.h:1442
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1342
#define IDirect3DVertexDeclaration9_Release(p)
Definition: d3d9.h:1013
#define IDirect3DDevice9_SetStreamSource(p, a, b, c, d)
Definition: d3d9.h:1435
#define IDirect3DDevice9_GetViewport(p, a)
Definition: d3d9.h:1383
#define IDirect3DDevice9_EndStateBlock(p, a)
Definition: d3d9.h:1396
#define IDirect3DDevice9_SetTransform(p, a, b)
Definition: d3d9.h:1379
#define IDirect3DDevice9_SetVertexShader(p, a)
Definition: d3d9.h:1427
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1336
#define IDirect3DStateBlock9_Apply(p)
Definition: d3d9.h:1132
#define IDirect3DDevice9_BeginStateBlock(p)
Definition: d3d9.h:1395
#define IDirect3DStateBlock9_Capture(p)
Definition: d3d9.h:1131
#define IDirect3DDevice9_SetTexture(p, a, b)
Definition: d3d9.h:1400
#define IDirect3DTexture9_Release(p)
Definition: d3d9.h:842
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1335
#define IDirect3DDevice9_SetVertexDeclaration(p, a)
Definition: d3d9.h:1422
#define IDirect3DDevice9_SetSamplerState(p, a, b, c)
Definition: d3d9.h:1404
@ D3DRS_ENABLEADAPTIVETESSELLATION
Definition: d3d9types.h:1028
@ D3DRS_SEPARATEALPHABLENDENABLE
Definition: d3d9types.h:1048
@ D3DRS_SRGBWRITEENABLE
Definition: d3d9types.h:1038
@ D3DDECLUSAGE_TEXCOORD
Definition: d3d9types.h:241
@ D3DDECLUSAGE_POSITION
Definition: d3d9types.h:236
@ D3DDECLUSAGE_COLOR
Definition: d3d9types.h:246
@ D3DSAMP_MIPFILTER
Definition: d3d9types.h:1239
@ D3DSAMP_MAXMIPLEVEL
Definition: d3d9types.h:1241
@ D3DSAMP_SRGBTEXTURE
Definition: d3d9types.h:1243
@ D3DSAMP_MAXANISOTROPY
Definition: d3d9types.h:1242
@ D3DSAMP_MINFILTER
Definition: d3d9types.h:1238
@ D3DSAMP_ADDRESSU
Definition: d3d9types.h:1233
@ D3DSAMP_MAGFILTER
Definition: d3d9types.h:1237
@ D3DSAMP_ADDRESSV
Definition: d3d9types.h:1234
@ D3DSAMP_MIPMAPLODBIAS
Definition: d3d9types.h:1240
@ D3DDECLTYPE_FLOAT3
Definition: d3d9types.h:273
@ D3DDECLTYPE_D3DCOLOR
Definition: d3d9types.h:275
@ D3DDECLTYPE_FLOAT2
Definition: d3d9types.h:272
#define D3DDECL_END()
Definition: d3d9types.h:329
@ D3DDECLMETHOD_DEFAULT
Definition: d3d9types.h:258
#define D3D_OK
Definition: d3d.h:106
#define D3DERR_INVALIDCALL
Definition: sprite.c:27
static HRESULT WINAPI d3dx9_sprite_SetTransform(ID3DXSprite *iface, const D3DXMATRIX *transform)
Definition: sprite.c:166
HRESULT WINAPI D3DXCreateSprite(struct IDirect3DDevice9 *device, struct ID3DXSprite **sprite)
Definition: sprite.c:561
static HRESULT WINAPI d3dx9_sprite_GetTransform(ID3DXSprite *iface, D3DXMATRIX *transform)
Definition: sprite.c:153
static void set_states(struct d3dx9_sprite *object)
Definition: sprite.c:196
static HRESULT WINAPI d3dx9_sprite_QueryInterface(ID3DXSprite *iface, REFIID riid, void **out)
Definition: sprite.c:74
static HRESULT WINAPI d3dx9_sprite_SetWorldViewLH(ID3DXSprite *iface, const D3DXMATRIX *world, const D3DXMATRIX *view)
Definition: sprite.c:187
static struct d3dx9_sprite * impl_from_ID3DXSprite(ID3DXSprite *iface)
Definition: sprite.c:69
static HRESULT WINAPI d3dx9_sprite_OnLostDevice(ID3DXSprite *iface)
Definition: sprite.c:498
static HRESULT WINAPI d3dx9_sprite_GetDevice(struct ID3DXSprite *iface, struct IDirect3DDevice9 **device)
Definition: sprite.c:139
static HRESULT WINAPI d3dx9_sprite_End(ID3DXSprite *iface)
Definition: sprite.c:479
static HRESULT WINAPI d3dx9_sprite_Flush(ID3DXSprite *iface)
Definition: sprite.c:405
static HRESULT WINAPI d3dx9_sprite_SetWorldViewRH(ID3DXSprite *iface, const D3DXMATRIX *world, const D3DXMATRIX *view)
Definition: sprite.c:179
#define D3DXSPRITE_FLAGLIMIT
Definition: sprite.c:26
static HRESULT WINAPI d3dx9_sprite_Begin(ID3DXSprite *iface, DWORD flags)
Definition: sprite.c:277
static ULONG WINAPI d3dx9_sprite_AddRef(ID3DXSprite *iface)
Definition: sprite.c:92
static const ID3DXSpriteVtbl d3dx9_sprite_vtbl
Definition: sprite.c:543
static HRESULT WINAPI d3dx9_sprite_Draw(ID3DXSprite *iface, IDirect3DTexture9 *texture, const RECT *rect, const D3DXVECTOR3 *center, const D3DXVECTOR3 *position, D3DCOLOR color)
Definition: sprite.c:341
static ULONG WINAPI d3dx9_sprite_Release(ID3DXSprite *iface)
Definition: sprite.c:102
static HRESULT WINAPI d3dx9_sprite_OnResetDevice(ID3DXSprite *iface)
Definition: sprite.c:517
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
D3DXMATRIX *WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:439
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoordArray(D3DXVECTOR3 *out, UINT outstride, const D3DXVECTOR3 *in, UINT instride, const D3DXMATRIX *matrix, UINT elements)
Definition: math.c:1913
#define D3DPTFILTERCAPS_MIPFLINEAR
Definition: d3d8caps.h:132
#define D3DPTFILTERCAPS_MINFANISOTROPIC
Definition: d3d8caps.h:130
#define D3DPTFILTERCAPS_MAGFANISOTROPIC
Definition: d3d8caps.h:135
#define D3DXSPRITE_DONOTMODIFY_RENDERSTATE
Definition: d3dx9core.h:34
#define D3DXSPRITE_BILLBOARD
Definition: d3dx9core.h:36
#define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT
Definition: d3dx9core.h:40
#define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK
Definition: d3dx9core.h:39
#define D3DXSPRITE_DONOTSAVESTATE
Definition: d3dx9core.h:33
#define ID3DXSprite_OnResetDevice(p)
Definition: d3dx9core.h:454
#define D3DXSPRITE_SORT_TEXTURE
Definition: d3dx9core.h:38
#define ID3DXSprite_Flush(p)
Definition: d3dx9core.h:451
#define D3DXSPRITE_OBJECTSPACE
Definition: d3dx9core.h:35
#define D3DXSPRITE_DO_NOT_ADDREF_TEXTURE
Definition: d3dx9core.h:41
DWORD IDirect3DDevice9
Definition: dxva2api.idl:22
size_t const new_size
Definition: expand.cpp:66
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLenum GLenum transform
Definition: glext.h:9407
GLenum GLuint texture
Definition: glext.h:6295
GLuint color
Definition: glext.h:6243
GLbitfield flags
Definition: glext.h:7161
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
static const MAT2 mat
Definition: font.c:51
static float(__cdecl *square_half_float)(float x
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define calloc
Definition: rosglue.h:14
#define TRACE(s)
Definition: solgame.cpp:4
FLOAT x
Definition: d3dx9math.h:64
FLOAT y
Definition: d3dx9math.h:64
Definition: dcommon.idl:28
DWORD TextureFilterCaps
Definition: d3d9caps.h:280
DWORD MaxAnisotropy
Definition: d3d9caps.h:291
DWORD AlphaCmpCaps
Definition: d3d9caps.h:277
DWORD texfilter_caps
Definition: sprite.c:60
struct sprite * sprites
Definition: sprite.c:64
DWORD maxanisotropy
Definition: sprite.c:61
IDirect3DDevice9 * device
Definition: sprite.c:51
IDirect3DStateBlock9 * stateblock
Definition: sprite.c:53
D3DXMATRIX transform
Definition: sprite.c:54
BOOL ready
Definition: sprite.c:57
DWORD flags
Definition: sprite.c:56
IDirect3DVertexDeclaration9 * vdecl
Definition: sprite.c:52
LONG ref
Definition: sprite.c:49
D3DXMATRIX view
Definition: sprite.c:55
int allocated_sprites
Definition: sprite.c:66
int sprite_count
Definition: sprite.c:65
ID3DXSprite ID3DXSprite_iface
Definition: sprite.c:48
DWORD alphacmp_caps
Definition: sprite.c:62
Definition: devices.h:37
DWORD col
Definition: sprite.c:31
D3DXVECTOR3 pos
Definition: sprite.c:30
D3DXVECTOR2 tex
Definition: sprite.c:32
Definition: sprite.c:36
D3DCOLOR color
Definition: sprite.c:42
D3DXVECTOR3 center
Definition: sprite.c:40
IDirect3DTexture9 * texture
Definition: sprite.c:37
D3DXVECTOR3 pos
Definition: sprite.c:41
UINT texh
Definition: sprite.c:38
RECT rect
Definition: sprite.c:39
D3DXMATRIX transform
Definition: sprite.c:43
UINT texw
Definition: sprite.c:38
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479