You need to sign in or sign up before continuing.
Commit 274c52d5 authored by hybrid's avatar hybrid

Use dummy texture in null driver and software texture only in software driver....

Use dummy texture in null driver and software texture only in software driver. Use the dimension function for optimal texture sizes instead of local one.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2397 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 352e1955
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CNullDriver.h" #include "CNullDriver.h"
#include "CSoftwareTexture.h"
#include "os.h" #include "os.h"
#include "CImage.h" #include "CImage.h"
#include "CAttributes.h" #include "CAttributes.h"
...@@ -529,11 +528,7 @@ ITexture* CNullDriver::addTexture(const core::dimension2d<u32>& size, ...@@ -529,11 +528,7 @@ ITexture* CNullDriver::addTexture(const core::dimension2d<u32>& size,
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES //! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const core::string<c16>& name) ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const core::string<c16>& name)
{ {
#ifdef _IRR_COMPILE_WITH_SOFTWARE_ return new SDummyTexture(name);
return new CSoftwareTexture(surface, name);
#else
return 0;
#endif
} }
......
...@@ -239,6 +239,14 @@ bool CSoftwareDriver::endScene() ...@@ -239,6 +239,14 @@ bool CSoftwareDriver::endScene()
} }
//! 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 core::string<c16>& name)
{
return new CSoftwareTexture(surface, name);
}
//! sets a render target //! sets a render target
bool CSoftwareDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer, bool CSoftwareDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer,
bool clearZBuffer, SColor color) bool clearZBuffer, SColor color)
......
...@@ -99,6 +99,10 @@ namespace video ...@@ -99,6 +99,10 @@ namespace video
//! Returns the transformation set by setTransform //! Returns the transformation set by setTransform
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const; virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const;
//! 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 core::string<c16>& name);
//! Creates a render target texture. //! Creates a render target texture.
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size, virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
const core::string<c16>& name); const core::string<c16>& name);
......
...@@ -23,11 +23,8 @@ CSoftwareTexture::CSoftwareTexture(IImage* image, const core::string<c16>& name, ...@@ -23,11 +23,8 @@ CSoftwareTexture::CSoftwareTexture(IImage* image, const core::string<c16>& name,
if (image) if (image)
{ {
core::dimension2d<u32> optSize;
OrigSize = image->getDimension(); OrigSize = image->getDimension();
core::dimension2d<u32> optSize=OrigSize.getOptimalSize();
optSize.Width = getTextureSizeFromSurfaceSize(OrigSize.Width);
optSize.Height = getTextureSizeFromSurfaceSize(OrigSize.Height);
Image = new CImage(ECF_A1R5G5B5, image); Image = new CImage(ECF_A1R5G5B5, image);
...@@ -109,18 +106,6 @@ CImage* CSoftwareTexture::getTexture() ...@@ -109,18 +106,6 @@ CImage* CSoftwareTexture::getTexture()
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 CSoftwareTexture::getTextureSizeFromSurfaceSize(s32 size) const
{
s32 ts = 0x01;
while(ts < size)
ts <<= 1;
return ts;
}
//! returns driver type of texture (=the driver, who created the texture) //! returns driver type of texture (=the driver, who created the texture)
E_DRIVER_TYPE CSoftwareTexture::getDriverType() const E_DRIVER_TYPE CSoftwareTexture::getDriverType() const
{ {
......
...@@ -61,10 +61,6 @@ public: ...@@ -61,10 +61,6 @@ public:
virtual bool isRenderTarget() const; virtual bool isRenderTarget() const;
private: private:
//! returns the size of a texture which would be the optimize size for rendering it
inline s32 getTextureSizeFromSurfaceSize(s32 size) const;
CImage* Image; CImage* Image;
CImage* Texture; CImage* Texture;
core::dimension2d<u32> OrigSize; core::dimension2d<u32> OrigSize;
......
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