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
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
32 #include "wine/debug.h"
34 #include "d3d9_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
38 /* IDirect3DVolumeTexture9 IUnknown parts follow: */
39 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_QueryInterface(LPDIRECT3DVOLUMETEXTURE9 iface
, REFIID riid
, LPVOID
* ppobj
) {
40 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
42 if (IsEqualGUID(riid
, &IID_IUnknown
)
43 || IsEqualGUID(riid
, &IID_IDirect3DResource9
)
44 || IsEqualGUID(riid
, &IID_IDirect3DBaseTexture9
)
45 || IsEqualGUID(riid
, &IID_IDirect3DVolumeTexture9
)) {
46 IDirect3DVolumeTexture9Impl_AddRef(iface
);
51 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
55 ULONG WINAPI
IDirect3DVolumeTexture9Impl_AddRef(LPDIRECT3DVOLUMETEXTURE9 iface
) {
56 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
57 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
61 ULONG WINAPI
IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9 iface
) {
62 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
63 ULONG ref
= --This
->ref
;
66 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
68 for (i
= 0; i
< This
->levels
; i
++) {
69 if (This
->volumes
[i
] != NULL
) {
70 TRACE("(%p) : Releasing volume %p\n", This
, This
->volumes
[i
]);
71 IDirect3DVolume9Impl_Release((LPDIRECT3DVOLUME9
) This
->volumes
[i
]);
74 HeapFree(GetProcessHeap(), 0, This
);
79 /* IDirect3DVolumeTexture9 IDirect3DResource9 Interface follow: */
80 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE9 iface
, IDirect3DDevice9
** ppDevice
) {
81 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
82 return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9
) This
, ppDevice
);
85 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface
, REFGUID refguid
, CONST
void* pData
, DWORD SizeOfData
, DWORD Flags
) {
86 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
87 FIXME("(%p) : stub\n", This
);
91 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface
, REFGUID refguid
, void* pData
, DWORD
* pSizeOfData
) {
92 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
93 FIXME("(%p) : stub\n", This
);
97 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE9 iface
, REFGUID refguid
) {
98 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
99 FIXME("(%p) : stub\n", This
);
103 DWORD WINAPI
IDirect3DVolumeTexture9Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE9 iface
, DWORD PriorityNew
) {
104 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
105 return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9
) This
, PriorityNew
);
108 DWORD WINAPI
IDirect3DVolumeTexture9Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE9 iface
) {
109 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
110 return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9
) This
);
113 void WINAPI
IDirect3DVolumeTexture9Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE9 iface
) {
114 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
115 FIXME("(%p) : stub\n", This
);
119 D3DRESOURCETYPE WINAPI
IDirect3DVolumeTexture9Impl_GetType(LPDIRECT3DVOLUMETEXTURE9 iface
) {
120 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
121 return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9
) This
);
124 /* IDirect3DVolumeTexture9 IDirect3DBaseTexture9 Interface follow: */
125 DWORD WINAPI
IDirect3DVolumeTexture9Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE9 iface
, DWORD LODNew
) {
126 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
127 return IDirect3DBaseTexture9Impl_SetLOD((LPDIRECT3DBASETEXTURE9
) This
, LODNew
);
130 DWORD WINAPI
IDirect3DVolumeTexture9Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE9 iface
) {
131 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
132 return IDirect3DBaseTexture9Impl_GetLOD((LPDIRECT3DBASETEXTURE9
) This
);
135 DWORD WINAPI
IDirect3DVolumeTexture9Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE9 iface
) {
136 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
137 return IDirect3DBaseTexture9Impl_GetLevelCount((LPDIRECT3DBASETEXTURE9
) This
);
140 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface
, D3DTEXTUREFILTERTYPE FilterType
) {
141 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
142 return IDirect3DBaseTexture9Impl_SetAutoGenFilterType((LPDIRECT3DBASETEXTURE9
) This
, FilterType
);
145 D3DTEXTUREFILTERTYPE WINAPI
IDirect3DVolumeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface
) {
146 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
147 return IDirect3DBaseTexture9Impl_GetAutoGenFilterType((LPDIRECT3DBASETEXTURE9
) This
);
150 void WINAPI
IDirect3DVolumeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DVOLUMETEXTURE9 iface
) {
151 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
152 FIXME("(%p) : stub\n", This
);
156 /* IDirect3DVolumeTexture9 Interface follow: */
157 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE9 iface
, UINT Level
, D3DVOLUME_DESC
* pDesc
) {
158 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
159 if (Level
< This
->levels
) {
160 TRACE("(%p) Level (%d)\n", This
, Level
);
161 return IDirect3DVolume9Impl_GetDesc((LPDIRECT3DVOLUME9
) This
->volumes
[Level
], pDesc
);
163 FIXME("(%p) level(%d) overflow Levels(%d)\n", This
, Level
, This
->levels
);
164 return D3DERR_INVALIDCALL
;
169 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE9 iface
, UINT Level
, IDirect3DVolume9
** ppVolumeLevel
) {
170 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
171 if (Level
< This
->levels
) {
172 *ppVolumeLevel
= (LPDIRECT3DVOLUME9
) This
->volumes
[Level
];
173 IDirect3DVolume9Impl_AddRef((LPDIRECT3DVOLUME9
) *ppVolumeLevel
);
174 TRACE("(%p) -> level(%d) returning volume@%p\n", This
, Level
, *ppVolumeLevel
);
176 FIXME("(%p) Level(%d) overflow Levels(%d)\n", This
, Level
, This
->levels
);
177 return D3DERR_INVALIDCALL
;
182 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface
, UINT Level
, D3DLOCKED_BOX
* pLockedVolume
, CONST D3DBOX
* pBox
, DWORD Flags
) {
184 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
185 if (Level
< This
->levels
) {
187 * Not dirtified while Surfaces don't notify dirtification
188 * This->Dirty = TRUE;
190 hr
= IDirect3DVolume9Impl_LockBox((LPDIRECT3DVOLUME9
) This
->volumes
[Level
], pLockedVolume
, pBox
, Flags
);
191 TRACE("(%p) Level (%d) success(%lu)\n", This
, Level
, hr
);
193 FIXME("(%p) level(%d) overflow Levels(%d)\n", This
, Level
, This
->levels
);
194 return D3DERR_INVALIDCALL
;
199 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE9 iface
, UINT Level
) {
201 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
202 if (Level
< This
->levels
) {
203 hr
= IDirect3DVolume9Impl_UnlockBox((LPDIRECT3DVOLUME9
) This
->volumes
[Level
]);
204 TRACE("(%p) -> level(%d) success(%lu)\n", This
, Level
, hr
);
206 FIXME("(%p) level(%d) overflow Levels(%d)\n", This
, Level
, This
->levels
);
207 return D3DERR_INVALIDCALL
;
212 HRESULT WINAPI
IDirect3DVolumeTexture9Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE9 iface
, CONST D3DBOX
* pDirtyBox
) {
213 ICOM_THIS(IDirect3DVolumeTexture9Impl
,iface
);
214 FIXME("(%p) : stub\n", This
);
220 ICOM_VTABLE(IDirect3DVolumeTexture9
) Direct3DVolumeTexture9_Vtbl
=
222 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
223 IDirect3DVolumeTexture9Impl_QueryInterface
,
224 IDirect3DVolumeTexture9Impl_AddRef
,
225 IDirect3DVolumeTexture9Impl_Release
,
226 IDirect3DVolumeTexture9Impl_GetDevice
,
227 IDirect3DVolumeTexture9Impl_SetPrivateData
,
228 IDirect3DVolumeTexture9Impl_GetPrivateData
,
229 IDirect3DVolumeTexture9Impl_FreePrivateData
,
230 IDirect3DVolumeTexture9Impl_SetPriority
,
231 IDirect3DVolumeTexture9Impl_GetPriority
,
232 IDirect3DVolumeTexture9Impl_PreLoad
,
233 IDirect3DVolumeTexture9Impl_GetType
,
234 IDirect3DVolumeTexture9Impl_SetLOD
,
235 IDirect3DVolumeTexture9Impl_GetLOD
,
236 IDirect3DVolumeTexture9Impl_GetLevelCount
,
237 IDirect3DVolumeTexture9Impl_SetAutoGenFilterType
,
238 IDirect3DVolumeTexture9Impl_GetAutoGenFilterType
,
239 IDirect3DVolumeTexture9Impl_GenerateMipSubLevels
,
240 IDirect3DVolumeTexture9Impl_GetLevelDesc
,
241 IDirect3DVolumeTexture9Impl_GetVolumeLevel
,
242 IDirect3DVolumeTexture9Impl_LockBox
,
243 IDirect3DVolumeTexture9Impl_UnlockBox
,
244 IDirect3DVolumeTexture9Impl_AddDirtyBox
248 /* IDirect3DDevice9 IDirect3DVolumeTexture9 Methods follow: */
249 HRESULT WINAPI
IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9 iface
,
250 UINT Width
, UINT Height
, UINT Depth
, UINT Levels
, DWORD Usage
,
251 D3DFORMAT Format
, D3DPOOL Pool
,
252 IDirect3DVolumeTexture9
** ppVolumeTexture
, HANDLE
* pSharedHandle
) {
254 ICOM_THIS(IDirect3DDevice9Impl
,iface
);
255 FIXME("(%p) : stub\n", This
);