mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 13:53:36 +02:00
Added mipmaps to sfRenderTexture and sfTexture.
This commit is contained in:
1 parent
ae727f0a04
commit
962a685570
4 files changed
+55
No files matched your search
@@ -316,4 +316,20 @@ CSFML_GRAPHICS_API void sfRenderTexture_setRepeated(sfRenderTexture* renderTextu
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfRenderTexture_isRepeated(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Generate a mipmap using the current texture data
|
||||
///
|
||||
/// This function is similar to sfTexture_generateMipmap and operates
|
||||
/// on the texture used as the target for drawing.
|
||||
/// Be aware that any draw operation may modify the base level image data.
|
||||
/// For this reason, calling this function only makes sense after all
|
||||
/// drawing is completed and display has been called. Not calling display
|
||||
/// after subsequent drawing will lead to undefined behavior if a mipmap
|
||||
/// had been previously generated.
|
||||
///
|
||||
/// \return sfTrue if mipmap generation was successful, sfFalse if unsuccessful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfRenderTexture_generateMipmap(sfRenderTexture* renderTexture);
|
||||
|
||||
#endif // SFML_RENDERTEXTURE_H
|
||||
@@ -264,6 +264,31 @@ CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, sfBool repeate
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Generate a mipmap using the current texture data
|
||||
///
|
||||
/// Mipmaps are pre-computed chains of optimized textures. Each
|
||||
/// level of texture in a mipmap is generated by halving each of
|
||||
/// the previous level's dimensions. This is done until the final
|
||||
/// level has the size of 1x1. The textures generated in this process may
|
||||
/// make use of more advanced filters which might improve the visual quality
|
||||
/// of textures when they are applied to objects much smaller than they are.
|
||||
/// This is known as minification. Because fewer texels (texture elements)
|
||||
/// have to be sampled from when heavily minified, usage of mipmaps
|
||||
/// can also improve rendering performance in certain scenarios.
|
||||
///
|
||||
/// Mipmap generation relies on the necessary OpenGL extension being
|
||||
/// available. If it is unavailable or generation fails due to another
|
||||
/// reason, this function will return false. Mipmap data is only valid from
|
||||
/// the time it is generated until the next time the base level image is
|
||||
/// modified, at which point this function will have to be called again to
|
||||
/// regenerate it.
|
||||
///
|
||||
/// \return sfTrue if mipmap generation was successful, sfFalse if unsuccessful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfTexture_generateMipmap(sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the underlying OpenGL handle of the texture.
|
||||
///
|
||||
|
||||
@@ -281,3 +281,10 @@ sfBool sfRenderTexture_isRepeated(const sfRenderTexture* renderTexture)
|
||||
{
|
||||
CSFML_CALL_RETURN(renderTexture, isRepeated(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfRenderTexture_generateMipmap(sfRenderTexture* renderTexture)
|
||||
{
|
||||
CSFML_CALL_RETURN(renderTexture, generateMipmap(), sfFalse);
|
||||
}
|
||||
@@ -256,6 +256,13 @@ sfBool sfTexture_isRepeated(const sfTexture* texture)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfTexture_generateMipmap(sfTexture* texture)
|
||||
{
|
||||
CSFML_CALL_PTR_RETURN(texture, generateMipmap(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfTexture_getNativeHandle(const sfTexture* texture)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user