1
0

Merging r6364 through r6379 from trunk to ogl-es branch

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6380 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2022-05-04 21:38:12 +00:00
parent 993f990036
commit 67a488fc5c
227 changed files with 19006 additions and 5574 deletions

View File

@@ -27,12 +27,25 @@ class CBurningVideoDriver;
*/
struct CSoftwareTexture2_Bound
{
f32 w; // width - 0.5f;
f32 h; // height- 0.5f;
f32 cx; // texelcenter x 1.f/width*0.5f
f32 cy; // texelcenter y 1.f/height*0.5f
//[0.5 / width, 1 - 0.5 / width]
//int dim[2];
f32 mat[4];
u32 area; // width * height
};
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
//! Enumeration describing the type of ITexture.
enum E_TEXTURE_TYPE
{
//! 2D texture.
ETT_2D,
//! Cubemap texture.
ETT_CUBEMAP
};
#endif
class CSoftwareTexture2 : public ITexture
{
public:
@@ -57,7 +70,8 @@ public:
if ( newLevel < 0 ) newLevel = 0;
else if ( newLevel >= (s32)array_size(MipMap)) newLevel = array_size(MipMap) - 1;
while ( newLevel > 0 && MipMap[newLevel] == 0 ) newLevel -= 1;
while ( newLevel > 0 && MipMap[newLevel] == 0 )
newLevel -= 1;
return newLevel;
}
@@ -83,20 +97,6 @@ public:
virtual void unlock() IRR_OVERRIDE
{
}
/*
//! compare the area drawn with the area of the texture
f32 getLODFactor( const f32 texArea ) const
{
return MipMap0_Area[0]* MipMap0_Area[1] * 0.5f * texArea;
//return MipMap[0]->getImageDataSizeInPixels () * texArea;
}
*/
const u32* getMipMap0_Area() const
{
return MipMap0_Area;
}
f32 get_lod_bias() const { return LodBIAS; }
//! returns unoptimized surface (misleading name. burning can scale down originalimage)
virtual CImage* getImage() const
@@ -115,6 +115,10 @@ public:
{
return TexBound[MipMapLOD];
}
const CSoftwareTexture2_Bound* getTexBound_index() const
{
return TexBound;
}
#if !defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
virtual void regenerateMipMapLevels(void* data = 0, u32 layer = 0) IRR_OVERRIDE;
@@ -124,15 +128,17 @@ public:
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
const core::dimension2d<u32>& getOriginalSize() const { return OriginalSize; };
const core::dimension2d<u32>& getSize() const { return Size; };
E_DRIVER_TYPE getDriverType() const { return DriverType; };
ECOLOR_FORMAT getColorFormat() const { return ColorFormat; };
ECOLOR_FORMAT getOriginalColorFormat() const { return OriginalColorFormat; };
const core::dimension2d<u32>& getOriginalSize() const { return OriginalSize; }
const core::dimension2d<u32>& getSize() const { return Size; }
E_DRIVER_TYPE getDriverType() const { return DriverType; }
ECOLOR_FORMAT getColorFormat() const { return ColorFormat; }
ECOLOR_FORMAT getOriginalColorFormat() const { return OriginalColorFormat; }
u32 getPitch() const { return Pitch; };
bool hasMipMaps() const { return HasMipMaps; }
bool isRenderTarget() const { return IsRenderTarget; }
E_TEXTURE_TYPE getType() const { return Type; }
core::dimension2d<u32> OriginalSize;
core::dimension2d<u32> Size;
E_DRIVER_TYPE DriverType;
@@ -141,6 +147,7 @@ public:
u32 Pitch;
bool HasMipMaps;
bool IsRenderTarget;
E_TEXTURE_TYPE Type;
#endif
private:
@@ -153,8 +160,10 @@ private:
CImage* MipMap[SOFTWARE_DRIVER_2_MIPMAPPING_MAX];
CSoftwareTexture2_Bound TexBound[SOFTWARE_DRIVER_2_MIPMAPPING_MAX];
u32 MipMap0_Area[2];
f32 LodBIAS; // Tweak mipmap selection
//Helper pointer for regenerateMipMapLevels (do not store per texture)
static const IImage* original_mip0;
};
/*!
@@ -169,8 +178,10 @@ public:
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) IRR_OVERRIDE;
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
public:
E_DRIVER_TYPE DriverType;
core::array<ITexture*> Texture;
core::array<ITexture*> Textures;
ITexture* DepthStencil;
#endif
protected: