ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

d3d9_texture.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:       See COPYING in the top level directory
00003  * PROJECT:         ReactOS ReactX
00004  * FILE:            dll/directx/d3d9/d3d9_texture.c
00005  * PURPOSE:         d3d9.dll internal texture surface functions
00006  * PROGRAMERS:      Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
00007  */
00008 #include "d3d9_texture.h"
00009 
00010 #define LOCK_D3DDEVICE9()   D3D9BaseObject_LockDevice(&This->BaseResource.BaseObject)
00011 #define UNLOCK_D3DDEVICE9() D3D9BaseObject_UnlockDevice(&This->BaseResource.BaseObject)
00012 
00013 /* Convert a IDirect3DBaseTexture9 pointer safely to the internal implementation struct */
00014 Direct3DBaseTexture9_INT* IDirect3DBaseTexture9ToImpl(LPDIRECT3DBASETEXTURE9 iface)
00015 {
00016     if (NULL == iface)
00017         return NULL;
00018 
00019     return (Direct3DBaseTexture9_INT*)((ULONG_PTR)iface - FIELD_OFFSET(Direct3DBaseTexture9_INT, lpVtbl));
00020 }
00021 
00022 void InitDirect3DBaseTexture9(Direct3DBaseTexture9_INT* pBaseTexture,
00023                               IDirect3DBaseTexture9Vtbl* pVtbl,
00024                               DWORD Usage,
00025                               UINT Levels,
00026                               D3DFORMAT Format,
00027                               D3DPOOL Pool,
00028                               struct _Direct3DDevice9_INT* pDevice,
00029                               enum REF_TYPE RefType)
00030 {
00031     InitDirect3DResource9(&pBaseTexture->BaseResource, Pool, pDevice, RefType);
00032 
00033     pBaseTexture->lpVtbl = pVtbl;
00034     pBaseTexture->Format = Format;
00035     pBaseTexture->wPaletteIndex = 0xFFFF;
00036     pBaseTexture->Usage = Usage;
00037     pBaseTexture->MipMapLevels = Levels;
00038     pBaseTexture->MipMapLevels2 = Levels;
00039 
00040     pBaseTexture->FilterType = D3DTEXF_LINEAR;
00041     pBaseTexture->bIsAutoGenMipMap = (Usage & D3DUSAGE_AUTOGENMIPMAP) != 0;
00042 }
00043 
00044 /*++
00045 * @name IDirect3DBaseTexture9::GetAutoGenFilterType
00046 * @implemented
00047 *
00048 * The function D3D9Texture_GetAutoGenFilterType returns filter type
00049 * that is used when automated mipmaping is set.
00050 *
00051 * @param LPDIRECT3DBASETEXTURE9 iface
00052 * Pointer to a IDirect3DBaseTexture9 interface
00053 *
00054 * @return D3DTEXTUREFILTERTYPE
00055 * Filter type used when automated mipmaping is set for the specified texture.
00056 *
00057 */
00058 D3DTEXTUREFILTERTYPE WINAPI D3D9Texture_GetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface)
00059 {
00060     D3DTEXTUREFILTERTYPE FilterType;
00061     Direct3DBaseTexture9_INT* This = IDirect3DBaseTexture9ToImpl(iface);
00062     LOCK_D3DDEVICE9();
00063 
00064     FilterType = This->dwFilterType;
00065 
00066     UNLOCK_D3DDEVICE9();
00067     return FilterType;
00068 }
00069 
00070 /*++
00071 * @name IDirect3DBaseTexture9::GetLOD
00072 * @implemented
00073 *
00074 * The function D3D9Texture_GetLOD returns the number 
00075 * max LODs for the specified texture, if it's managed.
00076 *
00077 * @param LPDIRECT3DBASETEXTURE9 iface
00078 * Pointer to a IDirect3DBaseTexture9 interface
00079 *
00080 * @return DWORD
00081 * Returns the number of LODs in the specified texture if it's managed.
00082 *
00083 */
00084 DWORD WINAPI D3D9Texture_GetLOD(LPDIRECT3DBASETEXTURE9 iface)
00085 {
00086     DWORD MaxLOD = 0;
00087     Direct3DBaseTexture9_INT* This = IDirect3DBaseTexture9ToImpl(iface);
00088     LOCK_D3DDEVICE9();
00089 
00090     if (This->BaseResource.bIsManaged)
00091         MaxLOD = This->MaxLOD;
00092 
00093     UNLOCK_D3DDEVICE9();
00094     return MaxLOD;
00095 }
00096 
00097 /*++
00098 * @name IDirect3DBaseTexture9::GetLevelCount
00099 * @implemented
00100 *
00101 * The function D3D9Texture_GetLevelCount returns the number of mip map levels
00102 * in the specified texture.
00103 *
00104 * @param LPDIRECT3DBASETEXTURE9 iface
00105 * Pointer to a IDirect3DBaseTexture9 interface
00106 *
00107 * @return DWORD
00108 * Returns the number of levels in the specified texture.
00109 *
00110 */
00111 DWORD WINAPI D3D9Texture_GetLevelCount(LPDIRECT3DBASETEXTURE9 iface)
00112 {
00113     DWORD MipMapLevels;
00114     Direct3DBaseTexture9_INT* This = IDirect3DBaseTexture9ToImpl(iface);
00115     LOCK_D3DDEVICE9();
00116 
00117     MipMapLevels = This->MipMapLevels;
00118 
00119     UNLOCK_D3DDEVICE9();
00120     return MipMapLevels;
00121 }

Generated on Sun May 27 2012 04:21:17 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.