Added pure virtual function, KRTexture2D::GetDimensions(). Implemented GetDimensions in all KRTexture2D sub classes.
This commit is contained in:
@@ -47,6 +47,7 @@ public:
|
|||||||
|
|
||||||
virtual bool uploadTexture(GLenum target, int lod_max_dim, int ¤t_lod_max_dim, bool compress = false, bool premultiply_alpha = false) = 0;
|
virtual bool uploadTexture(GLenum target, int lod_max_dim, int ¤t_lod_max_dim, bool compress = false, bool premultiply_alpha = false) = 0;
|
||||||
virtual void bind(GLuint texture_unit);
|
virtual void bind(GLuint texture_unit);
|
||||||
|
virtual Vector2i getDimensions() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
KRDataBlock *m_pData;
|
KRDataBlock *m_pData;
|
||||||
|
|||||||
@@ -123,6 +123,11 @@ KRTextureKTX::~KRTextureKTX() {
|
|||||||
m_blocks.clear();
|
m_blocks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector2i KRTextureKTX::getDimensions() const
|
||||||
|
{
|
||||||
|
return Vector2i::Create(Vector2i::Create(m_header.pixelWidth, m_header.pixelHeight));
|
||||||
|
}
|
||||||
|
|
||||||
long KRTextureKTX::getMemRequiredForSize(int max_dim)
|
long KRTextureKTX::getMemRequiredForSize(int max_dim)
|
||||||
{
|
{
|
||||||
int target_dim = max_dim;
|
int target_dim = max_dim;
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public:
|
|||||||
bool uploadTexture(GLenum target, int lod_max_dim, int ¤t_lod_max_dim, bool compress = false, bool premultiply_alpha = false);
|
bool uploadTexture(GLenum target, int lod_max_dim, int ¤t_lod_max_dim, bool compress = false, bool premultiply_alpha = false);
|
||||||
|
|
||||||
virtual long getMemRequiredForSize(int max_dim);
|
virtual long getMemRequiredForSize(int max_dim);
|
||||||
|
virtual Vector2i getDimensions() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -144,6 +144,11 @@ KRTexturePVR::~KRTexturePVR() {
|
|||||||
m_blocks.clear();
|
m_blocks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector2i KRTexturePVR::getDimensions() const
|
||||||
|
{
|
||||||
|
return Vector2i::Create(m_iWidth, m_iHeight);
|
||||||
|
}
|
||||||
|
|
||||||
long KRTexturePVR::getMemRequiredForSize(int max_dim)
|
long KRTexturePVR::getMemRequiredForSize(int max_dim)
|
||||||
{
|
{
|
||||||
int target_dim = max_dim;
|
int target_dim = max_dim;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
bool uploadTexture(GLenum target, int lod_max_dim, int ¤t_lod_max_dim, bool compress = false, bool premultiply_alpha = false);
|
bool uploadTexture(GLenum target, int lod_max_dim, int ¤t_lod_max_dim, bool compress = false, bool premultiply_alpha = false);
|
||||||
|
|
||||||
virtual long getMemRequiredForSize(int max_dim);
|
virtual long getMemRequiredForSize(int max_dim);
|
||||||
|
virtual Vector2i getDimensions() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ KRTextureTGA::KRTextureTGA(KRContext &context, KRDataBlock *data, std::string na
|
|||||||
data->lock();
|
data->lock();
|
||||||
TGA_HEADER *pHeader = (TGA_HEADER *)data->getStart();
|
TGA_HEADER *pHeader = (TGA_HEADER *)data->getStart();
|
||||||
|
|
||||||
|
m_dimensions.x = pHeader->width;
|
||||||
|
m_dimensions.y = pHeader->height;
|
||||||
m_max_lod_max_dim = pHeader->width > pHeader->height ? pHeader->width : pHeader->height;
|
m_max_lod_max_dim = pHeader->width > pHeader->height ? pHeader->width : pHeader->height;
|
||||||
m_min_lod_max_dim = m_max_lod_max_dim; // Mipmaps not yet supported for TGA images
|
m_min_lod_max_dim = m_max_lod_max_dim; // Mipmaps not yet supported for TGA images
|
||||||
switch(pHeader->imagetype) {
|
switch(pHeader->imagetype) {
|
||||||
@@ -415,6 +417,11 @@ long KRTextureTGA::getMemRequiredForSize(int max_dim)
|
|||||||
return m_imageSize;
|
return m_imageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector2i KRTextureTGA::getDimensions() const
|
||||||
|
{
|
||||||
|
return m_dimensions;
|
||||||
|
}
|
||||||
|
|
||||||
std::string KRTextureTGA::getExtension()
|
std::string KRTextureTGA::getExtension()
|
||||||
{
|
{
|
||||||
return "tga";
|
return "tga";
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual long getMemRequiredForSize(int max_dim);
|
virtual long getMemRequiredForSize(int max_dim);
|
||||||
|
virtual Vector2i getDimensions() const override;
|
||||||
private:
|
private:
|
||||||
long m_imageSize;
|
long m_imageSize;
|
||||||
|
Vector2i m_dimensions;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user