Commit f631c9cb authored by nadro's avatar nadro

- Added cubemap texture support for OpenGL driver.(this feature was available...

- Added cubemap texture support for OpenGL driver.(this feature was available in ogl-es branch before)
- Minor improvements in texture creation process.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5190 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 45c550ba
......@@ -92,6 +92,16 @@ enum E_TEXTURE_LOCK_MODE
ETLM_WRITE_ONLY
};
//! Enumeration describing the type of ITexture.
enum E_TEXTURE_TYPE
{
//! 2D texture.
ETT_2D,
//! Cubemap texture.
ETT_CUBEMAP
};
//! Where did the last IVideoDriver::getTexture call find this texture
enum E_TEXTURE_SOURCE
{
......@@ -119,8 +129,8 @@ class ITexture : public virtual IReferenceCounted
public:
//! constructor
ITexture(const io::path& name) : NamedPath(name), DriverType(EDT_NULL), OriginalColorFormat(ECF_UNKNOWN),
ColorFormat(ECF_UNKNOWN), Pitch(0), HasMipMaps(false), IsRenderTarget(false), Source(ETS_UNKNOWN)
ITexture(const io::path& name, E_TEXTURE_TYPE type) : NamedPath(name), DriverType(EDT_NULL), OriginalColorFormat(ECF_UNKNOWN),
ColorFormat(ECF_UNKNOWN), Pitch(0), HasMipMaps(false), IsRenderTarget(false), Source(ETS_UNKNOWN), Type(type)
{
}
......@@ -238,6 +248,9 @@ public:
return status;
}
//! Returns the type of texture
E_TEXTURE_TYPE getType() const { return Type; }
protected:
//! Helper function, helps to get the desired texture creation format from the flags.
......@@ -266,6 +279,7 @@ protected:
bool HasMipMaps;
bool IsRenderTarget;
E_TEXTURE_SOURCE Source;
E_TEXTURE_TYPE Type;
};
......
......@@ -423,6 +423,18 @@ namespace video
information. */
virtual ITexture* addTexture(const io::path& name, IImage* image) = 0;
//! Creates a cubemap texture from loaded IImages.
/** \param name A name for the texture. Later calls of getTexture() with this name will return this texture.
\param imagePosX Image (positive X) the texture is created from.
\param imageNegX Image (negative X) the texture is created from.
\param imagePosY Image (positive Y) the texture is created from.
\param imageNegY Image (negative Y) the texture is created from.
\param imagePosZ Image (positive Z) the texture is created from.
\param imageNegZ Image (negative Z) the texture is created from.
\return Pointer to the newly created texture. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ITexture* addTextureCubemap(const io::path& name, IImage* imagePosX, IImage* imageNegX, IImage* imagePosY,
IImage* imageNegY, IImage* imagePosZ, IImage* imageNegZ) = 0;
//! Adds a new render target texture to the texture cache.
/** \param size Size of the texture, in pixels. Width and
height should be a power of two (e.g. 64, 128, 256, 512, ...)
......
......@@ -740,13 +740,17 @@ void CD3D9Driver::setMaterial(const SMaterial& material)
}
}
//! returns a device dependent texture from a software surface (IImage)
video::ITexture* CD3D9Driver::createDeviceDependentTexture(IImage* surface,const io::path& name)
ITexture* CD3D9Driver::createDeviceDependentTexture(const io::path& name, IImage* image)
{
return new CD3D9Texture(surface, this, TextureCreationFlags, name);
CD3D9Texture* texture = new CD3D9Texture(image, this, TextureCreationFlags, name);
return texture;
}
/*ITexture* CD3D9Driver::createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image)
{
}*/
//! Enables or disables a texture creation flag.
void CD3D9Driver::setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag,
......
......@@ -346,9 +346,9 @@ namespace video
//! resets the device
bool reset();
//! returns a device dependent texture from a software surface (IImage)
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name) _IRR_OVERRIDE_;
virtual ITexture* createDeviceDependentTexture(const io::path& name, IImage* image) _IRR_OVERRIDE_;
/*virtual ITexture* createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image) _IRR_OVERRIDE_;*/
//! returns the current size of the screen or rendertarget
virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const _IRR_OVERRIDE_;
......
......@@ -19,7 +19,7 @@ namespace video
//! rendertarget constructor
CD3D9Texture::CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const io::path& name, const ECOLOR_FORMAT format)
: ITexture(name), Texture(0), RTTSurface(0), Driver(driver), HardwareMipMaps(false), IsCompressed(false)
: ITexture(name, ETT_2D), Texture(0), RTTSurface(0), Driver(driver), HardwareMipMaps(false), IsCompressed(false)
{
#ifdef _DEBUG
setDebugName("CD3D9Texture");
......@@ -40,7 +40,7 @@ CD3D9Texture::CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& si
//! constructor
CD3D9Texture::CD3D9Texture(IImage* image, CD3D9Driver* driver, u32 flags, const io::path& name)
: ITexture(name), Texture(0), RTTSurface(0), Driver(driver), HardwareMipMaps(false), IsCompressed(false)
: ITexture(name, ETT_2D), Texture(0), RTTSurface(0), Driver(driver), HardwareMipMaps(false), IsCompressed(false)
{
#ifdef _DEBUG
setDebugName("CD3D9Texture");
......
......@@ -421,6 +421,93 @@ void CNullDriver::renameTexture(ITexture* texture, const io::path& newName)
Textures.sort();
}
ITexture* CNullDriver::addTexture(const core::dimension2d<u32>& size, const io::path& name, ECOLOR_FORMAT format)
{
if (IImage::isRenderTargetOnlyFormat(format))
{
os::Printer::log("Could not create ITexture, format only supported for render target textures.", ELL_WARNING);
return 0;
}
if (0 == name.size())
return 0;
IImage* image = new CImage(format, size);
ITexture* t = 0;
core::array<IImage*> imageArray(1);
imageArray.push_back(image);
if (checkImage(imageArray))
{
t = createDeviceDependentTexture(name, image);
}
image->drop();
if (t)
{
addTexture(t);
t->drop();
}
return t;
}
ITexture* CNullDriver::addTexture(const io::path& name, IImage* image)
{
if (0 == name.size() || !image)
return 0;
ITexture* t = 0;
core::array<IImage*> imageArray(1);
imageArray.push_back(image);
if (checkImage(imageArray))
{
t = createDeviceDependentTexture(name, image);
}
if (t)
{
addTexture(t);
t->drop();
}
return t;
}
ITexture* CNullDriver::addTextureCubemap(const io::path& name, IImage* imagePosX, IImage* imageNegX, IImage* imagePosY,
IImage* imageNegY, IImage* imagePosZ, IImage* imageNegZ)
{
if (0 == name.size() || !imagePosX || !imageNegX || !imagePosY || !imageNegY || !imagePosZ || !imageNegZ)
return 0;
ITexture* t = 0;
core::array<IImage*> imageArray(1);
imageArray.push_back(imagePosX);
imageArray.push_back(imageNegX);
imageArray.push_back(imagePosY);
imageArray.push_back(imageNegY);
imageArray.push_back(imagePosZ);
imageArray.push_back(imageNegZ);
if (checkImage(imageArray))
{
t = createDeviceDependentTextureCubemap(name, imageArray);
}
if (t)
{
addTexture(t);
t->drop();
}
return t;
}
//! loads a Texture
ITexture* CNullDriver::getTexture(const io::path& filename)
......@@ -524,8 +611,14 @@ video::ITexture* CNullDriver::loadTextureFromFile(io::IReadFile* file, const io:
if (image)
{
// create texture from surface
texture = createDeviceDependentTexture(image, hashName.size() ? hashName : file->getFileName() );
core::array<IImage*> imageArray(1);
imageArray.push_back(image);
if (checkImage(imageArray))
{
texture = createDeviceDependentTexture(hashName.size() ? hashName : file->getFileName(), image);
}
os::Printer::log("Loaded texture", file->getFileName());
image->drop();
}
......@@ -559,7 +652,7 @@ void CNullDriver::addTexture(video::ITexture* texture)
video::ITexture* CNullDriver::findTexture(const io::path& filename)
{
SSurface s;
SDummyTexture dummy(filename);
SDummyTexture dummy(filename, ETT_2D);
s.Surface = &dummy;
s32 index = Textures.binary_search(s);
......@@ -569,54 +662,14 @@ video::ITexture* CNullDriver::findTexture(const io::path& filename)
return 0;
}
//! Creates a texture from a loaded IImage.
ITexture* CNullDriver::addTexture(const io::path& name, IImage* image)
ITexture* CNullDriver::createDeviceDependentTexture(const io::path& name, IImage* image)
{
if ( 0 == name.size() || !image)
return 0;
ITexture* t = createDeviceDependentTexture(image, name);
if (t)
{
addTexture(t);
t->drop();
}
return t;
return new SDummyTexture(name, ETT_2D);
}
//! creates a Texture
ITexture* CNullDriver::addTexture(const core::dimension2d<u32>& size,
const io::path& name, ECOLOR_FORMAT format)
ITexture* CNullDriver::createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image)
{
if(IImage::isRenderTargetOnlyFormat(format))
{
os::Printer::log("Could not create ITexture, format only supported for render target textures.", ELL_WARNING);
return 0;
}
if ( 0 == name.size () )
return 0;
IImage* image = new CImage(format, size);
ITexture* t = createDeviceDependentTexture(image, name);
image->drop();
addTexture(t);
if (t)
t->drop();
return t;
}
//! returns a device dependent texture from a software surface (IImage)
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const io::path& name)
{
return new SDummyTexture(name);
return new SDummyTexture(name, ETT_CUBEMAP);
}
bool CNullDriver::setRenderTarget(IRenderTarget* target, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil)
......@@ -1309,34 +1362,87 @@ bool CNullDriver::checkPrimitiveCount(u32 prmCount) const
return true;
}
bool CNullDriver::checkColorFormat(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) const
bool CNullDriver::checkImage(const core::array<IImage*>& image) const
{
bool status = true;
switch (format)
if (image.size() > 0)
{
case ECF_DXT1:
case ECF_DXT2:
case ECF_DXT3:
case ECF_DXT4:
case ECF_DXT5:
ECOLOR_FORMAT lastFormat = image[0]->getColorFormat();
core::dimension2d<u32> lastSize = image[0]->getDimension();
for (u32 i = 0; i < image.size() && status; ++i)
{
core::dimension2d<u32> sizePOT = size.getOptimalSize(true, false);
ECOLOR_FORMAT format = image[i]->getColorFormat();
core::dimension2d<u32> size = image[i]->getDimension();
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_DXT))
switch (format)
{
os::Printer::log("DXT texture compression not available.", ELL_ERROR);
status = false;
case ECF_DXT1:
case ECF_DXT2:
case ECF_DXT3:
case ECF_DXT4:
case ECF_DXT5:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_DXT))
{
os::Printer::log("DXT texture compression not available.", ELL_ERROR);
status = false;
}
else if (size.getOptimalSize(true, false) != size)
{
os::Printer::log("Invalid size of image for DXT texture, size of image must be power of two.", ELL_ERROR);
status = false;
}
break;
/*case ECF_PVRTC_RGB2:
case ECF_PVRTC_ARGB2:
case ECF_PVRTC_RGB4:
case ECF_PVRTC_ARGB4:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_PVRTC))
{
os::Printer::log("PVRTC texture compression not available.", ELL_ERROR);
status = false;
}
else if (size.getOptimalSize(true, false) != size)
{
os::Printer::log("Invalid size of image for PVRTC compressed texture, size of image must be power of two and squared.", ELL_ERROR);
status = false;
}
break;
case ECF_PVRTC2_ARGB2:
case ECF_PVRTC2_ARGB4:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_PVRTC2))
{
os::Printer::log("PVRTC2 texture compression not available.", ELL_ERROR);
status = false;
}
break;
case ECF_ETC1:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_ETC1))
{
os::Printer::log("ETC1 texture compression not available.", ELL_ERROR);
status = false;
}
break;
case ECF_ETC2_RGB:
case ECF_ETC2_ARGB:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_ETC2))
{
os::Printer::log("ETC2 texture compression not available.", ELL_ERROR);
status = false;
}
break;*/
default:
break;
}
else if (sizePOT != size)
{
os::Printer::log("Invalid size of image for DXT texture, size of image must be power of two.", ELL_ERROR);
if (format != lastFormat || size != lastSize)
status = false;
}
}
break;
default:
break;
}
else
{
status = false;
}
return status;
......
......@@ -95,9 +95,13 @@ namespace video
//! Renames a texture
virtual void renameTexture(ITexture* texture, const io::path& newName) _IRR_OVERRIDE_;
//! creates a Texture
virtual ITexture* addTexture(const core::dimension2d<u32>& size, const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) _IRR_OVERRIDE_;
virtual ITexture* addTexture(const io::path& name, IImage* image) _IRR_OVERRIDE_;
virtual ITexture* addTextureCubemap(const io::path& name, IImage* imagePosX, IImage* imageNegX, IImage* imagePosY,
IImage* imageNegY, IImage* imagePosZ, IImage* imageNegZ) _IRR_OVERRIDE_;
virtual bool setRenderTarget(IRenderTarget* target, u16 clearFlag, SColor clearColor = SColor(255,0,0,0),
f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_;
......@@ -680,17 +684,14 @@ namespace video
//! adds a surface, not loaded or created by the Irrlicht Engine
void addTexture(video::ITexture* surface);
//! Creates a texture from a loaded IImage.
virtual ITexture* addTexture(const io::path& name, IImage* image) _IRR_OVERRIDE_;
virtual ITexture* createDeviceDependentTexture(const io::path& name, IImage* image);
//! returns a device dependent texture from a software surface (IImage)
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name);
virtual ITexture* createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image);
//! checks triangle count and print warning if wrong
bool checkPrimitiveCount(u32 prmcnt) const;
bool checkColorFormat(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) const;
bool checkImage(const core::array<IImage*>& image) const;
// adds a material renderer and drops it afterwards. To be used for internal creation
s32 addAndDropMaterialRenderer(IMaterialRenderer* m);
......@@ -756,7 +757,7 @@ namespace video
struct SDummyTexture : public ITexture
{
SDummyTexture(const io::path& name) : ITexture(name) {};
SDummyTexture(const io::path& name, E_TEXTURE_TYPE type) : ITexture(name, type) {};
virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) _IRR_OVERRIDE_ { return 0; }
virtual void unlock()_IRR_OVERRIDE_ {}
......
......@@ -45,13 +45,19 @@ public:
bool IsCached;
};
COGLCoreTexture(const io::path& name, const core::array<IImage*>& image, TOGLDriver* driver) : ITexture(name), Driver(driver), TextureType(GL_TEXTURE_2D),
COGLCoreTexture(const io::path& name, const core::array<IImage*>& image, E_TEXTURE_TYPE type, TOGLDriver* driver) : ITexture(name, type), Driver(driver), TextureType(GL_TEXTURE_2D),
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_RGBA), PixelType(GL_UNSIGNED_BYTE), Converter(0), LockReadOnly(false), LockImage(0), LockLevel(0),
KeepImage(false), AutoGenerateMipMaps(false)
{
_IRR_DEBUG_BREAK_IF(image.size() == 0)
const GLenum textureType[2] =
{
GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP
};
DriverType = Driver->getDriverType();
TextureType = textureType[static_cast<int>(Type)];
HasMipMaps = Driver->getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
AutoGenerateMipMaps = Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE);
KeepImage = Driver->getTextureCreationFlag(ETCF_ALLOW_MEMORY_COPY);
......@@ -119,7 +125,7 @@ public:
}
}
COGLCoreTexture(const io::path& name, const core::dimension2d<u32>& size, ECOLOR_FORMAT format, TOGLDriver* driver) : ITexture(name), Driver(driver), TextureType(GL_TEXTURE_2D),
COGLCoreTexture(const io::path& name, const core::dimension2d<u32>& size, ECOLOR_FORMAT format, TOGLDriver* driver) : ITexture(name, ETT_2D), Driver(driver), TextureType(GL_TEXTURE_2D),
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_RGBA), PixelType(GL_UNSIGNED_BYTE), Converter(0), LockReadOnly(false), LockImage(0), LockLevel(0), KeepImage(false),
AutoGenerateMipMaps(false)
{
......
......@@ -2550,23 +2550,22 @@ inline void COpenGLDriver::getGLTextureMatrix(GLfloat *o, const core::matrix4& m
o[15] = 1.f;
}
//! returns a device dependent texture from a software surface (IImage)
video::ITexture* COpenGLDriver::createDeviceDependentTexture(IImage* surface, const io::path& name)
ITexture* COpenGLDriver::createDeviceDependentTexture(const io::path& name, IImage* image)
{
COpenGLTexture* texture = 0;
if (surface && checkColorFormat(surface->getColorFormat(), surface->getDimension()))
{
core::array<IImage*> imageArray(1);
imageArray.push_back(surface);
core::array<IImage*> imageArray(1);
imageArray.push_back(image);
texture = new COpenGLTexture(name, imageArray, this);
}
COpenGLTexture* texture = new COpenGLTexture(name, imageArray, ETT_2D, this);
return texture;
}
ITexture* COpenGLDriver::createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image)
{
COpenGLTexture* texture = new COpenGLTexture(name, image, ETT_CUBEMAP, this);
return texture;
}
//! Sets a material. All 3d drawing functions draw geometry now using this material.
void COpenGLDriver::setMaterial(const SMaterial& material)
......@@ -4464,48 +4463,6 @@ IImage* COpenGLDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RE
return newImage;
}
//! get depth texture for the given render target texture
ITexture* COpenGLDriver::createDepthTexture(ITexture* texture, bool shared)
{
/*if ((texture->getDriverType() != EDT_OPENGL) || (!texture->isRenderTarget()))
return 0;
COpenGLTexture* tex = static_cast<COpenGLTexture*>(texture);
if (!tex->isFrameBufferObject())
return 0;
if (shared)
{
for (u32 i=0; i<DepthTextures.size(); ++i)
{
if (DepthTextures[i]->getSize()==texture->getSize())
{
DepthTextures[i]->grab();
return DepthTextures[i];
}
}
DepthTextures.push_back(new COpenGLRenderBuffer(texture->getSize(), "depth1", this));
return DepthTextures.getLast();
}
return (new COpenGLRenderBuffer(texture->getSize(), "depth1", this));*/
return 0;
}
void COpenGLDriver::removeDepthTexture(ITexture* texture)
{
/*for (u32 i=0; i<DepthTextures.size(); ++i)
{
if (texture==DepthTextures[i])
{
DepthTextures.erase(i);
return;
}
}*/
}
//! Set/unset a clipping plane.
bool COpenGLDriver::setClipPlane(u32 index, const core::plane3df& plane, bool enable)
{
......
......@@ -382,9 +382,6 @@ namespace video
//! Returns the maximum texture size supported.
virtual core::dimension2du getMaxTextureSize() const _IRR_OVERRIDE_;
ITexture* createDepthTexture(ITexture* texture, bool shared=true);
void removeDepthTexture(ITexture* texture);
//! Removes a texture from the texture cache and deletes it, freeing lot of memory.
void removeTexture(ITexture* texture);
......@@ -420,8 +417,10 @@ namespace video
//! inits the parts of the open gl driver used on all platforms
bool genericDriverInit();
//! returns a device dependent texture from a software surface (IImage)
virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name) _IRR_OVERRIDE_;
virtual ITexture* createDeviceDependentTexture(const io::path& name, IImage* image) _IRR_OVERRIDE_;
virtual ITexture* createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image) _IRR_OVERRIDE_;
//! creates a transposed matrix in supplied GLfloat array to pass to OpenGL
inline void getGLMatrix(GLfloat gl_matrix[16], const core::matrix4& m);
......
......@@ -245,12 +245,11 @@ bool CSoftwareDriver::endScene()
return Presenter->present(BackBuffer, WindowId, SceneSourceRect);
}
//! returns a device dependent texture from a software surface (IImage)
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
ITexture* CSoftwareDriver::createDeviceDependentTexture(IImage* surface, const io::path& name)
ITexture* CSoftwareDriver::createDeviceDependentTexture(const io::path& name, IImage* image)
{
return new CSoftwareTexture(surface, name, false);
CSoftwareTexture2* texture = new CSoftwareTexture2(image, name, false);
return texture;
}
bool CSoftwareDriver::setRenderTarget(IRenderTarget* target, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil)
......
......@@ -98,9 +98,7 @@ namespace video
//! Returns the transformation set by setTransform
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const _IRR_OVERRIDE_;
//! returns a device dependent texture from a software surface (IImage)
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name) _IRR_OVERRIDE_;
virtual ITexture* createDeviceDependentTexture(const io::path& name, IImage* image) _IRR_OVERRIDE_;
//! Creates a render target texture.
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
......
......@@ -2256,16 +2256,12 @@ IImage* CBurningVideoDriver::createScreenShot(video::ECOLOR_FORMAT format, video
return 0;
}
//! returns a device dependent texture from a software surface (IImage)
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
ITexture* CBurningVideoDriver::createDeviceDependentTexture(IImage* surface, const io::path& name)
ITexture* CBurningVideoDriver::createDeviceDependentTexture(const io::path& name, IImage* image)
{
return new CSoftwareTexture2(
surface, name,
(getTextureCreationFlag(ETCF_CREATE_MIP_MAPS) ? CSoftwareTexture2::GEN_MIPMAP : 0 ) |
(getTextureCreationFlag(ETCF_ALLOW_NON_POWER_2) ? 0 : CSoftwareTexture2::NP2_SIZE ));
CSoftwareTexture2* texture = new CSoftwareTexture2(image, name, (getTextureCreationFlag(ETCF_CREATE_MIP_MAPS) ? CSoftwareTexture2::GEN_MIPMAP : 0) |
(getTextureCreationFlag(ETCF_ALLOW_NON_POWER_2) ? 0 : CSoftwareTexture2::NP2_SIZE));
return texture;
}
......
......@@ -172,9 +172,7 @@ namespace video
//! sets the current Texture
//bool setTexture(u32 stage, video::ITexture* texture);
//! returns a device dependent texture from a software surface (IImage)
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name) _IRR_OVERRIDE_;
virtual ITexture* createDeviceDependentTexture(const io::path& name, IImage* image) _IRR_OVERRIDE_;
video::CImage* BackBuffer;
video::IImagePresenter* Presenter;
......
......@@ -16,7 +16,7 @@ namespace video
//! constructor
CSoftwareTexture::CSoftwareTexture(IImage* image, const io::path& name, bool renderTarget)
: ITexture(name), Texture(0)
: ITexture(name, ETT_2D), Texture(0)
{
#ifdef _DEBUG
setDebugName("CSoftwareTexture");
......
......@@ -18,7 +18,7 @@ namespace video
//! constructor
CSoftwareTexture2::CSoftwareTexture2(IImage* image, const io::path& name, u32 flags)
: ITexture(name), MipMapLOD(0), Flags ( flags ), OriginalFormat(video::ECF_UNKNOWN)
: ITexture(name, ETT_2D), MipMapLOD(0), Flags ( flags ), OriginalFormat(video::ECF_UNKNOWN)
{
#ifdef _DEBUG
setDebugName("CSoftwareTexture2");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment