2007-05-20 11:03:49 -07:00
|
|
|
// Copyright (C) 2002-2007 Nikolaus Gebhardt
|
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
|
|
|
#ifndef __C_SOFTWARE_TEXTURE_H_INCLUDED__
|
|
|
|
#define __C_SOFTWARE_TEXTURE_H_INCLUDED__
|
|
|
|
|
|
|
|
#include "ITexture.h"
|
|
|
|
#include "CImage.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace video
|
|
|
|
{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
interface for a Video Driver dependent Texture.
|
|
|
|
*/
|
|
|
|
class CSoftwareTexture : public ITexture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
CSoftwareTexture(IImage* surface, const char* name);
|
|
|
|
|
|
|
|
//! destructor
|
|
|
|
virtual ~CSoftwareTexture();
|
|
|
|
|
|
|
|
//! lock function
|
|
|
|
virtual void* lock();
|
|
|
|
|
|
|
|
//! unlock function
|
|
|
|
virtual void unlock();
|
|
|
|
|
|
|
|
//! Returns original size of the texture.
|
2007-09-15 17:18:13 -07:00
|
|
|
virtual const core::dimension2d<s32>& getOriginalSize() const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Returns (=size) of the texture.
|
2007-09-15 17:18:13 -07:00
|
|
|
virtual const core::dimension2d<s32>& getSize() const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! returns unoptimized surface
|
|
|
|
virtual CImage* getImage();
|
|
|
|
|
|
|
|
//! returns texture surface
|
|
|
|
virtual CImage* getTexture();
|
|
|
|
|
|
|
|
//! returns driver type of texture (=the driver, who created the texture)
|
2007-09-15 17:18:13 -07:00
|
|
|
virtual E_DRIVER_TYPE getDriverType() const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! returns color format of texture
|
|
|
|
virtual ECOLOR_FORMAT getColorFormat() const;
|
|
|
|
|
|
|
|
//! returns pitch of texture (in bytes)
|
|
|
|
virtual u32 getPitch() const;
|
|
|
|
|
|
|
|
//! Regenerates the mip map levels of the texture. Useful after locking and
|
|
|
|
//! modifying the texture
|
|
|
|
virtual void regenerateMipMapLevels();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
//! returns the size of a texture which would be the optimize size for rendering it
|
2007-09-15 17:18:13 -07:00
|
|
|
inline s32 getTextureSizeFromSurfaceSize(s32 size) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
CImage* Image;
|
|
|
|
CImage* Texture;
|
|
|
|
core::dimension2d<s32> OrigSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // end namespace video
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|