mirror of https://github.com/axmolengine/axmol.git
Remove unnecessary constructors.
This commit is contained in:
parent
3ebacd33e9
commit
e065f94aa4
|
@ -98,16 +98,6 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
TextureBackend::TextureBackend(const TextureDescriptor& descriptor)
|
||||
: _bitsPerElement(computeBitsPerElement(descriptor.textureFormat))
|
||||
, _width(descriptor.width)
|
||||
, _height(descriptor.height)
|
||||
, _textureType(descriptor.textureType)
|
||||
, _textureFormat(descriptor.textureFormat)
|
||||
, _textureUsage(descriptor.textureUsage)
|
||||
{
|
||||
}
|
||||
|
||||
TextureBackend::~TextureBackend()
|
||||
{}
|
||||
|
||||
|
@ -121,15 +111,4 @@ void TextureBackend::updateTextureDescriptor(const cocos2d::backend::TextureDesc
|
|||
_height = descriptor.height;
|
||||
}
|
||||
|
||||
Texture2DBackend::Texture2DBackend(const TextureDescriptor& descriptor)
|
||||
: TextureBackend(descriptor)
|
||||
{
|
||||
}
|
||||
|
||||
TextureCubemapBackend::TextureCubemapBackend(const TextureDescriptor &descriptor)
|
||||
: TextureBackend(descriptor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CC_BACKEND_END
|
||||
|
|
|
@ -110,7 +110,7 @@ protected:
|
|||
/**
|
||||
* @param descriptor Specifies the texture descirptor.
|
||||
*/
|
||||
TextureBackend(const TextureDescriptor& descriptor);
|
||||
TextureBackend() {}
|
||||
virtual ~TextureBackend();
|
||||
|
||||
/// The bytes of all components.
|
||||
|
@ -184,12 +184,6 @@ public:
|
|||
* @return Texture height.
|
||||
*/
|
||||
inline std::size_t getHeight() const { return _height; }
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @param descriptor Specifies the texture descriptor.
|
||||
*/
|
||||
Texture2DBackend(const TextureDescriptor& descriptor);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -204,12 +198,6 @@ public:
|
|||
* @param data Specifies a pointer to the image data in memory.
|
||||
*/
|
||||
virtual void updateFaceData(TextureCubeFace side, void *data, int index = 0) = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @param descriptor Specifies the texture descriptor.
|
||||
*/
|
||||
TextureCubemapBackend(const TextureDescriptor& descriptor);
|
||||
};
|
||||
|
||||
//end of _backend group
|
||||
|
|
|
@ -275,7 +275,7 @@ void TextureInfoMTL::recreateSampler(const SamplerDescriptor &descriptor)
|
|||
|
||||
/// CLASS TextureMTL
|
||||
TextureMTL::TextureMTL(id<MTLDevice> mtlDevice, const TextureDescriptor& descriptor)
|
||||
: backend::Texture2DBackend(descriptor), _textureInfo(mtlDevice)
|
||||
: _textureInfo(mtlDevice)
|
||||
{
|
||||
updateTextureDescriptor(descriptor);
|
||||
}
|
||||
|
@ -291,8 +291,9 @@ void TextureMTL::updateSamplerDescriptor(const SamplerDescriptor &sampler)
|
|||
|
||||
void TextureMTL::updateTextureDescriptor(const cocos2d::backend::TextureDescriptor &descriptor, int index)
|
||||
{
|
||||
_textureInfo._descriptor = descriptor;
|
||||
TextureBackend::updateTextureDescriptor(descriptor, index);
|
||||
|
||||
_textureInfo._descriptor = descriptor;
|
||||
_textureInfo.ensure(index, MTL_TEXTURE_2D);
|
||||
updateSamplerDescriptor(descriptor.samplerDescriptor);
|
||||
if (PixelFormat::RGB888 == _textureFormat)
|
||||
|
@ -391,7 +392,7 @@ void TextureMTL::generateMipmaps()
|
|||
|
||||
/// CLASS TextureCubeMTL
|
||||
TextureCubeMTL::TextureCubeMTL(id<MTLDevice> mtlDevice, const TextureDescriptor& descriptor)
|
||||
: backend::TextureCubemapBackend(descriptor), _textureInfo(mtlDevice)
|
||||
: _textureInfo(mtlDevice)
|
||||
{
|
||||
updateTextureDescriptor(descriptor);
|
||||
}
|
||||
|
@ -402,7 +403,7 @@ TextureCubeMTL::~TextureCubeMTL()
|
|||
|
||||
void TextureCubeMTL::updateTextureDescriptor(const cocos2d::backend::TextureDescriptor &descriptor, int index)
|
||||
{
|
||||
TextureBackend::updateTextureDescriptor(descriptor);
|
||||
TextureBackend::updateTextureDescriptor(descriptor, index);
|
||||
|
||||
_textureInfo._descriptor = descriptor;
|
||||
_textureInfo.ensure(index, MTL_TEXTURE_CUBE);
|
||||
|
|
|
@ -114,7 +114,7 @@ GLuint TextureInfoGL::ensure(int index, GLenum target)
|
|||
return texID;
|
||||
}
|
||||
|
||||
Texture2DGL::Texture2DGL(const TextureDescriptor& descriptor) : Texture2DBackend(descriptor)
|
||||
Texture2DGL::Texture2DGL(const TextureDescriptor& descriptor)
|
||||
{
|
||||
updateTextureDescriptor(descriptor);
|
||||
|
||||
|
@ -141,6 +141,7 @@ void Texture2DGL::initWithZeros()
|
|||
void Texture2DGL::updateTextureDescriptor(const cocos2d::backend::TextureDescriptor &descriptor, int index)
|
||||
{
|
||||
TextureBackend::updateTextureDescriptor(descriptor, index);
|
||||
|
||||
UtilsGL::toGLTypes(descriptor.textureFormat, _textureInfo.internalFormat, _textureInfo.format, _textureInfo.type, _isCompressed);
|
||||
|
||||
bool isPow2 = ISPOW2(_width) && ISPOW2(_height);
|
||||
|
@ -331,12 +332,10 @@ void Texture2DGL::getBytes(std::size_t x, std::size_t y, std::size_t width, std:
|
|||
}
|
||||
|
||||
TextureCubeGL::TextureCubeGL(const TextureDescriptor& descriptor)
|
||||
:TextureCubemapBackend(descriptor)
|
||||
{
|
||||
assert(_width == _height);
|
||||
_textureType = TextureType::TEXTURE_CUBE;
|
||||
UtilsGL::toGLTypes(_textureFormat, _textureInfo.internalFormat, _textureInfo.format, _textureInfo.type, _isCompressed);
|
||||
updateSamplerDescriptor(descriptor.samplerDescriptor);
|
||||
updateTextureDescriptor(descriptor);
|
||||
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
// Listen this event to restored texture id after coming to foreground on Android.
|
||||
|
@ -351,8 +350,10 @@ TextureCubeGL::TextureCubeGL(const TextureDescriptor& descriptor)
|
|||
|
||||
void TextureCubeGL::updateTextureDescriptor(const cocos2d::backend::TextureDescriptor &descriptor, int index)
|
||||
{
|
||||
backend::TextureCubemapBackend::updateTextureDescriptor(descriptor, index);
|
||||
|
||||
UtilsGL::toGLTypes(descriptor.textureFormat, _textureInfo.internalFormat, _textureInfo.format, _textureInfo.type, _isCompressed);
|
||||
_textureFormat = descriptor.textureFormat;
|
||||
|
||||
updateSamplerDescriptor(descriptor.samplerDescriptor);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue