mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-27 00:17:30 +01:00
3d2a55e788
Basically fixing original Bug#427 reported by MArkus Elfring. Unfortunately there are still more defines (in IrrCompileConfig.h) which also are not nice c++ Lots of files touched for very minor cleanup *sigh* git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6253 dfc29bdd-3216-0410-991c-e03cc46cb475
98 lines
2.5 KiB
C++
98 lines
2.5 KiB
C++
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
// This file is part of the "Irrlicht Engine".
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
#ifndef IRR_C_DIRECTX9_TEXTURE_H_INCLUDED
|
|
#define IRR_C_DIRECTX9_TEXTURE_H_INCLUDED
|
|
|
|
#include "IrrCompileConfig.h"
|
|
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
|
|
|
|
#include "irrArray.h"
|
|
#include "ITexture.h"
|
|
#include "IImage.h"
|
|
#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
|
|
#include "irrMath.h" // needed by borland for sqrtf define
|
|
#endif
|
|
#include <d3d9.h>
|
|
|
|
namespace irr
|
|
{
|
|
namespace video
|
|
{
|
|
|
|
class CD3D9Driver;
|
|
|
|
class CD3D9Texture : public ITexture
|
|
{
|
|
public:
|
|
CD3D9Texture(const io::path& name, const core::array<IImage*>& image, E_TEXTURE_TYPE type, CD3D9Driver* driver);
|
|
|
|
CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const io::path& name, E_TEXTURE_TYPE type, const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
|
|
|
virtual ~CD3D9Texture();
|
|
|
|
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 mipmapLevel=0, u32 layer = 0, E_TEXTURE_LOCK_FLAGS lockFlags = ETLF_FLIP_Y_UP_RTT) IRR_OVERRIDE;
|
|
|
|
virtual void unlock() IRR_OVERRIDE;
|
|
|
|
virtual void regenerateMipMapLevels(void* data = 0, u32 layer = 0) IRR_OVERRIDE;
|
|
|
|
IDirect3DBaseTexture9* getDX9BaseTexture() const;
|
|
IDirect3DTexture9* getDX9Texture() const;
|
|
IDirect3DCubeTexture9* getDX9CubeTexture() const;
|
|
|
|
inline bool HasVertexTextureSupport() const
|
|
{
|
|
return VertexTextureSupport;
|
|
}
|
|
|
|
private:
|
|
friend class CD3D9Driver;
|
|
|
|
void releaseTexture();
|
|
|
|
void generateRenderTarget();
|
|
|
|
ECOLOR_FORMAT getBestColorFormat(ECOLOR_FORMAT format);
|
|
|
|
void getImageValues(const IImage* image);
|
|
|
|
void uploadTexture(void* data, u32 mipmapLevel, u32 layer);
|
|
|
|
//! Helper function for mipmap generation.
|
|
bool createManualMipMaps(u32 level);
|
|
|
|
//! Helper function for mipmap generation.
|
|
void copy16BitMipMap(char* src, char* tgt,
|
|
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const;
|
|
|
|
//! Helper function for mipmap generation.
|
|
void copy32BitMipMap(char* src, char* tgt,
|
|
s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const;
|
|
|
|
|
|
CD3D9Driver* Driver;
|
|
|
|
D3DFORMAT InternalFormat;
|
|
|
|
bool LockReadOnly;
|
|
void* LockData;
|
|
u32 LockLayer;
|
|
u32 MipLevelLocked;
|
|
|
|
bool HardwareMipMaps;
|
|
bool VertexTextureSupport;
|
|
|
|
IDirect3DDevice9* Device;
|
|
IDirect3DTexture9* Texture;
|
|
IDirect3DCubeTexture9* CubeTexture;
|
|
IDirect3DSurface9* RTTSurface;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif
|
|
#endif
|