An incremental texture space allocator.
更多...
#include <TextureLayout.h>
|
| bool | AddElement (uint32 &OutBaseX, uint32 &OutBaseY, uint32 ElementSizeX, uint32 ElementSizeY) |
| | Finds a free area in the texture large enough to contain a surface with the given size. 更多...
|
| |
| | FTextureLayout (uint32 MinSizeX, uint32 MinSizeY, uint32 MaxSizeX, uint32 MaxSizeY, bool bInPowerOfTwoSize=false, ETextureLayoutAspectRatio InAspect=ETextureLayoutAspectRatio::None, bool bInAlignByFour=true) |
| | Minimal initialization constructor. 更多...
|
| |
|
uint32 | GetSizeX () const |
| | Returns the minimum texture width which will contain the allocated surfaces.
|
| |
|
uint32 | GetSizeY () const |
| | Returns the minimum texture height which will contain the allocated surfaces.
|
| |
| bool | RemoveElement (uint32 ElementBaseX, uint32 ElementBaseY, uint32 ElementSizeX, uint32 ElementSizeY) |
| | Removes a previously allocated element from the layout and collapses the tree as much as possible, In order to create the largest free block possible and return the tree to its state before the element was added. 更多...
|
| |
An incremental texture space allocator.
For best results, add the elements ordered descending in size.
◆ FTextureLayout()
| FTextureLayout::FTextureLayout |
( |
uint32 |
MinSizeX, |
|
|
uint32 |
MinSizeY, |
|
|
uint32 |
MaxSizeX, |
|
|
uint32 |
MaxSizeY, |
|
|
bool |
bInPowerOfTwoSize = false, |
|
|
ETextureLayoutAspectRatio |
InAspect = ETextureLayoutAspectRatio::None, |
|
|
bool |
bInAlignByFour = true |
|
) |
| |
|
inline |
Minimal initialization constructor.
- 参数
-
| MinSizeX | - The minimum width of the texture. |
| MinSizeY | - The minimum height of the texture. |
| MaxSizeX | - The maximum width of the texture. |
| MaxSizeY | - The maximum height of the texture. |
| InPowerOfTwoSize | - True if the texture size must be a power of two. |
| bInForce2To1Aspect | - True if the texture size must have a 2:1 aspect. |
| bInAlignByFour | - True if the texture size must be a multiple of 4.. |
◆ AddElement()
| bool FTextureLayout::AddElement |
( |
uint32 & |
OutBaseX, |
|
|
uint32 & |
OutBaseY, |
|
|
uint32 |
ElementSizeX, |
|
|
uint32 |
ElementSizeY |
|
) |
| |
|
inline |
Finds a free area in the texture large enough to contain a surface with the given size.
If a large enough area is found, it is marked as in use, the output parameters OutBaseX and OutBaseY are set to the coordinates of the upper left corner of the free area and the function return true. Otherwise, the function returns false and OutBaseX and OutBaseY remain uninitialized.
- 参数
-
| OutBaseX | - If the function succeeds, contains the X coordinate of the upper left corner of the free area on return. |
| OutBaseY | - If the function succeeds, contains the Y coordinate of the upper left corner of the free area on return. |
| ElementSizeX | - The size of the surface to allocate in horizontal pixels. |
| ElementSizeY | - The size of the surface to allocate in vertical pixels. |
- 返回
- True if succeeded, false otherwise.
◆ RemoveElement()
| bool FTextureLayout::RemoveElement |
( |
uint32 |
ElementBaseX, |
|
|
uint32 |
ElementBaseY, |
|
|
uint32 |
ElementSizeX, |
|
|
uint32 |
ElementSizeY |
|
) |
| |
|
inline |
Removes a previously allocated element from the layout and collapses the tree as much as possible, In order to create the largest free block possible and return the tree to its state before the element was added.
- 返回
- True if the element specified by the input parameters existed in the layout.
该类的文档由以下文件生成: