2 * IDirect3DVolumeTexture9 implementation
4 * Copyright 2002-2003 Jason Edmeades
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "d3d9_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
27 /* IDirect3DVolumeTexture9 IUnknown parts follow: */
28 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_QueryInterface(LPDIRECT3DVOLUMETEXTURE9 iface
, REFIID riid
, LPVOID
* ppobj
) {
29 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
31 if (IsEqualGUID(riid
, &IID_IUnknown
)
32 || IsEqualGUID(riid
, &IID_IDirect3DResource9
)
33 || IsEqualGUID(riid
, &IID_IDirect3DBaseTexture9
)
34 || IsEqualGUID(riid
, &IID_IDirect3DVolumeTexture9
)) {
35 IDirect3DVolumeTexture9Impl_AddRef(iface
);
40 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
44 ULONG WINAPI
IDirect3DVolumeTexture9Impl_AddRef(LPDIRECT3DVOLUMETEXTURE9 iface
) {
45 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
46 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
50 ULONG WINAPI
IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9 iface
) {
51 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
52 ULONG ref
= --This
->ref
;
55 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
57 for (i
= 0; i
< This
->levels
; i
++) {
58 if (This
->volumes
[i
] != NULL
) {
59 TRACE("(%p) : Releasing volume %p\n", This
, This
->volumes
[i
]);
60 IDirect3DVolume9Impl_Release((LPDIRECT3DVOLUME9
) This
->volumes
[i
]);
63 HeapFree(GetProcessHeap(), 0, This
);
68 /* IDirect3DVolumeTexture9 IDirect3DResource9 Interface follow: */
69 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE9 iface
, IDirect3DDevice9
** ppDevice
) {
70 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
71 return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9
) This
, ppDevice
);
74 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface
, REFGUID refguid
, CONST
void* pData
, DWORD SizeOfData
, DWORD Flags
) {
75 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
76 FIXME("(%p) : stub\n", This
);
80 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface
, REFGUID refguid
, void* pData
, DWORD
* pSizeOfData
) {
81 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
82 FIXME("(%p) : stub\n", This
);
86 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE9 iface
, REFGUID refguid
) {
87 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
88 FIXME("(%p) : stub\n", This
);
92 DWORD WINAPI
IDirect3DVolumeTexture9Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE9 iface
, DWORD PriorityNew
) {
93 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
94 return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9
) This
, PriorityNew
);
97 DWORD WINAPI
IDirect3DVolumeTexture9Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE9 iface
) {
98 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
99 return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9
) This
);
102 void WINAPI
IDirect3DVolumeTexture9Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE9 iface
) {
103 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
104 FIXME("(%p) : stub\n", This
);
108 D3DRESOURCETYPE WINAPI
IDirect3DVolumeTexture9Impl_GetType(LPDIRECT3DVOLUMETEXTURE9 iface
) {
109 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
110 return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9
) This
);
113 /* IDirect3DVolumeTexture9 IDirect3DBaseTexture9 Interface follow: */
114 DWORD WINAPI
IDirect3DVolumeTexture9Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE9 iface
, DWORD LODNew
) {
115 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
116 return IDirect3DBaseTexture9Impl_SetLOD((LPDIRECT3DBASETEXTURE9
) This
, LODNew
);
119 DWORD WINAPI
IDirect3DVolumeTexture9Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE9 iface
) {
120 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
121 return IDirect3DBaseTexture9Impl_GetLOD((LPDIRECT3DBASETEXTURE9
) This
);
124 DWORD WINAPI
IDirect3DVolumeTexture9Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE9 iface
) {
125 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
126 return IDirect3DBaseTexture9Impl_GetLevelCount((LPDIRECT3DBASETEXTURE9
) This
);
129 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface
, D3DTEXTUREFILTERTYPE FilterType
) {
130 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
131 return IDirect3DBaseTexture9Impl_SetAutoGenFilterType((LPDIRECT3DBASETEXTURE9
) This
, FilterType
);
134 D3DTEXTUREFILTERTYPE WINAPI
IDirect3DVolumeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface
) {
135 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
136 return IDirect3DBaseTexture9Impl_GetAutoGenFilterType((LPDIRECT3DBASETEXTURE9
) This
);
139 void WINAPI
IDirect3DVolumeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DVOLUMETEXTURE9 iface
) {
140 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
141 FIXME("(%p) : stub\n", This
);
145 /* IDirect3DVolumeTexture9 Interface follow: */
146 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE9 iface
, UINT Level
, D3DVOLUME_DESC
* pDesc
) {
147 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
148 if (Level
< This
->levels
) {
149 TRACE("(%p) Level (%d)\n", This
, Level
);
150 return IDirect3DVolume9Impl_GetDesc((LPDIRECT3DVOLUME9
) This
->volumes
[Level
], pDesc
);
152 FIXME("(%p) level(%d) overflow Levels(%d)\n", This
, Level
, This
->levels
);
153 return D3DERR_INVALIDCALL
;
158 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE9 iface
, UINT Level
, IDirect3DVolume9
** ppVolumeLevel
) {
159 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
160 if (Level
< This
->levels
) {
161 *ppVolumeLevel
= (LPDIRECT3DVOLUME9
) This
->volumes
[Level
];
162 IDirect3DVolume9Impl_AddRef((LPDIRECT3DVOLUME9
) *ppVolumeLevel
);
163 TRACE("(%p) -> level(%d) returning volume@%p\n", This
, Level
, *ppVolumeLevel
);
165 FIXME("(%p) Level(%d) overflow Levels(%d)\n", This
, Level
, This
->levels
);
166 return D3DERR_INVALIDCALL
;
171 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface
, UINT Level
, D3DLOCKED_BOX
* pLockedVolume
, CONST D3DBOX
* pBox
, DWORD Flags
) {
173 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
174 if (Level
< This
->levels
) {
176 * Not dirtified while Surfaces don't notify dirtification
177 * This->Dirty = TRUE;
179 hr
= IDirect3DVolume9Impl_LockBox((LPDIRECT3DVOLUME9
) This
->volumes
[Level
], pLockedVolume
, pBox
, Flags
);
180 TRACE("(%p) Level (%d) success(%lu)\n", This
, Level
, hr
);
182 FIXME("(%p) level(%d) overflow Levels(%d)\n", This
, Level
, This
->levels
);
183 return D3DERR_INVALIDCALL
;
188 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE9 iface
, UINT Level
) {
190 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
191 if (Level
< This
->levels
) {
192 hr
= IDirect3DVolume9Impl_UnlockBox((LPDIRECT3DVOLUME9
) This
->volumes
[Level
]);
193 TRACE("(%p) -> level(%d) success(%lu)\n", This
, Level
, hr
);
195 FIXME("(%p) level(%d) overflow Levels(%d)\n", This
, Level
, This
->levels
);
196 return D3DERR_INVALIDCALL
;
201 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE9 iface
, CONST D3DBOX
* pDirtyBox
) {
202 IDirect3DVolumeTexture9Impl
*This
= (IDirect3DVolumeTexture9Impl
*)iface
;
203 FIXME("(%p) : stub\n", This
);
209 IDirect3DVolumeTexture9Vtbl Direct3DVolumeTexture9_Vtbl
=
211 IDirect3DVolumeTexture9Impl_QueryInterface
,
212 IDirect3DVolumeTexture9Impl_AddRef
,
213 IDirect3DVolumeTexture9Impl_Release
,
214 IDirect3DVolumeTexture9Impl_GetDevice
,
215 IDirect3DVolumeTexture9Impl_SetPrivateData
,
216 IDirect3DVolumeTexture9Impl_GetPrivateData
,
217 IDirect3DVolumeTexture9Impl_FreePrivateData
,
218 IDirect3DVolumeTexture9Impl_SetPriority
,
219 IDirect3DVolumeTexture9Impl_GetPriority
,
220 IDirect3DVolumeTexture9Impl_PreLoad
,
221 IDirect3DVolumeTexture9Impl_GetType
,
222 IDirect3DVolumeTexture9Impl_SetLOD
,
223 IDirect3DVolumeTexture9Impl_GetLOD
,
224 IDirect3DVolumeTexture9Impl_GetLevelCount
,
225 IDirect3DVolumeTexture9Impl_SetAutoGenFilterType
,
226 IDirect3DVolumeTexture9Impl_GetAutoGenFilterType
,
227 IDirect3DVolumeTexture9Impl_GenerateMipSubLevels
,
228 IDirect3DVolumeTexture9Impl_GetLevelDesc
,
229 IDirect3DVolumeTexture9Impl_GetVolumeLevel
,
230 IDirect3DVolumeTexture9Impl_LockBox
,
231 IDirect3DVolumeTexture9Impl_UnlockBox
,
232 IDirect3DVolumeTexture9Impl_AddDirtyBox
236 /* IDirect3DDevice9 IDirect3DVolumeTexture9 Methods follow: */
237 HRESULT WINAPI
IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9 iface
,
238 UINT Width
, UINT Height
, UINT Depth
, UINT Levels
, DWORD Usage
,
239 D3DFORMAT Format
, D3DPOOL Pool
,
240 IDirect3DVolumeTexture9
** ppVolumeTexture
, HANDLE
* pSharedHandle
) {
242 IDirect3DDevice9Impl
*This
= (IDirect3DDevice9Impl
*)iface
;
243 FIXME("(%p) : stub\n", This
);