mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Add texture views. Fixes #2022.
Add love.graphics.newTextureView(basetexture, viewsettings). Requires GLSL4 support. Add 'viewformats' boolean setting to texture setting tables. Add Texture:hasViewFormats. The viewsettings table has the following fields: format = nil, -- set this to a pixel format to override the base format. It must have the same number of bytes per pixel as the original, and the 'viewformats' setting on the original texture must be true for this to work. Cannot be used for compressed or depth/stencil textures. type = nil, -- set this to a texture type to override the base texture type. 2d base textures can make [2d, array] views. [array, cube] base textures can make [2d, array, cube] views. mipmapstart = nil, -- set to a number to use a less detailed mipmap level as a base. mipmapcount = nil, -- set to a number to override the number of mipmaps in the texture view. layerstart = nil, -- set to a number to use a specific layer or cube face as a base. layers = nil, -- set to a number to override the number of layers in an array texture view.
This commit is contained in:
@@ -300,6 +300,13 @@ int w_Texture_isReadable(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Texture_hasViewFormats(lua_State *L)
|
||||
{
|
||||
Texture *t = luax_checktexture(L, 1);
|
||||
luax_pushboolean(L, t->hasViewFormats());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Texture_setDepthSampleMode(lua_State *L)
|
||||
{
|
||||
Texture *t = luax_checktexture(L, 1);
|
||||
@@ -511,6 +518,7 @@ const luaL_Reg w_Texture_functions[] =
|
||||
{ "isCanvas", w_Texture_isCanvas },
|
||||
{ "isComputeWritable", w_Texture_isComputeWritable },
|
||||
{ "isReadable", w_Texture_isReadable },
|
||||
{ "hasViewFormats", w_Texture_hasViewFormats },
|
||||
{ "getMipmapMode", w_Texture_getMipmapMode },
|
||||
{ "getDepthSampleMode", w_Texture_getDepthSampleMode },
|
||||
{ "setDepthSampleMode", w_Texture_setDepthSampleMode },
|
||||
|
||||
Reference in New Issue
Block a user