00001 // Filename: dxTextureContext8.h 00002 // Created by: drose (07Oct99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef DXTEXTURECONTEXT8_H 00020 #define DXTEXTURECONTEXT8_H 00021 00022 #include "dxgsg8base.h" 00023 #include "texture.h" 00024 #include "textureContext.h" 00025 00026 //#define DO_CUSTOM_CONVERSIONS 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : DXTextureContext8 00030 // Description : 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDADX DXTextureContext8 : public TextureContext { 00033 friend class DXGraphicsStateGuardian; 00034 friend class wdxGraphicsWindow; 00035 00036 public: 00037 DXTextureContext8(Texture *tex); 00038 ~DXTextureContext8(); 00039 00040 IDirect3DTexture8 *_pD3DTexture8; 00041 Texture *_tex; // ptr to parent, primarily for access to namestr 00042 IDirect3DTexture8 *CreateTexture(DXScreenData &scrn); 00043 00044 D3DFORMAT _PixBufD3DFmt; // the 'D3DFORMAT' the Panda PixelBuffer fmt corresponds to 00045 00046 bool _bHasMipMaps; 00047 00048 #ifdef DO_CUSTOM_CONVERSIONS 00049 DWORD _PixBufConversionType; // enum ConversionType 00050 #endif 00051 00052 // must be public since called from global callback fns 00053 void DeleteTexture(void); 00054 HRESULT FillDDSurfTexturePixels(void); 00055 00056 protected: 00057 unsigned int get_bits_per_pixel(PixelBuffer::Format format, int *alphbits); 00058 00059 public: 00060 static TypeHandle get_class_type() { 00061 return _type_handle; 00062 } 00063 static void init_type() { 00064 TextureContext::init_type(); 00065 register_type(_type_handle, "DXTextureContext8", 00066 TextureContext::get_class_type()); 00067 } 00068 virtual TypeHandle get_type() const { 00069 return get_class_type(); 00070 } 00071 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00072 00073 private: 00074 static TypeHandle _type_handle; 00075 }; 00076 00077 extern HRESULT ConvertD3DSurftoPixBuf(RECT &SrcRect,IDirect3DSurface8 *pD3DSurf8,PixelBuffer *pixbuf); 00078 00079 #endif 00080