UVAtlas.Partition Method |
Language: |
Creates one or more UV texture atlases (like UVAtlas.Create), without performing the final packing step.
Visual Basic Public Shared Function Partition( _
ByVal mesh As Mesh, _
ByVal maxChartNumber As Integer, _
ByVal maxStretch As Single, _
ByVal textureIndex As Integer, _
ByVal adjacency() As Integer, _
ByVal imtArray() As Single, _
ByVal callback As PercentageCompleteCallback, _
ByVal callbackFrequency As Single _
) As UVAtlasOutputC# public static UVAtlasOutput Partition(
Mesh mesh,
int maxChartNumber,
float maxStretch,
int textureIndex,
int[] adjacency,
float[] imtArray,
PercentageCompleteCallback callback,
float callbackFrequency
);C++ public:
static UVAtlasOutput Partition(
Mesh^ mesh,
int maxChartNumber,
float maxStretch,
int textureIndex,
array<int>^ adjacency,
array<float>^ imtArray,
PercentageCompleteCallback^ callback,
float callbackFrequency
);JScript public static function Partition(
mesh : Mesh,
maxChartNumber : int,
maxStretch : float,
textureIndex : int,
adjacency : int[],
imtArray : float[],
callback : PercentageCompleteCallback,
callbackFrequency : float
) : UVAtlasOutput;
mesh Microsoft.DirectX.Direct3D.Mesh
Input mesh used to calculate the atlas. The atlas must have a position channel and at least a 2-D texture channel.maxChartNumber System.Int32
The maximum number of charts required for the atlas. If this is 0, the atlas will be parameterized based solely on stretch.maxStretch System.Single
The maximum stretch resulting from the atlasing algorithm. 0 means do not stretch; 1 means any amount of stretching is allowed.textureIndex System.Int32
Specifies which texture coordinate to write to in the output mesh (which is cloned from the input mesh). Useful if your vertex has multiple texture coordinates.adjacency System.Int32[]
An array with 3 Int32s per face, indicating which triangles are adjacent to each other.imtArray System.Single[]
An array with 3 floating-point values per face, describing the integrated metric tensor for that face. See remarks.callback Microsoft.DirectX.Direct3D.PercentageCompleteCallback
A callback function that can be used to monitor progress.callbackFrequency System.Single
How often the callback specified by will be used. Use 0.0001f as a default value.
Microsoft.DirectX.Direct3D.UVAtlasOutput
Contains data about the created texture atlases.
Integrated Metric Tensor Array
The IMTArray is an array of integrated metric tensors. Each element uses 3 Singles to describe an IMT for a single face. The IMT controls how the triangle is stretched in the atlas. The IMT (3 singles - (a,b,c)) contains a symmetric 2x2 matrix as shown here:
a b b cGiven a vector (s,t) and two vectors v1 and v2:
vector v1 vector v2 = v1 + (s,t)The distance between vector v1 and v2 is:
sqrt((s, t) * M * (s, t)^T)In other words, the vector (s,t) enables you to specify the magnitude of the stretch in an arbitrary direction in UV space; where s is the direction from the first to the second vertex, and t is the cross product of the normal and s. For example: a = b = 1 would scale the vector (1,1) by 2, and the vector (1,-1) by 0. Note that this is multiplying the edge length by the square of the matrix; if you want the face to stretch to twice its size with no shearing, the IMT value should be (2, 0, 2), which is the identity matrix times 2.
You can calculate IMTs from texture or vertex signal data by using the methods in the IntegratedMetricTensor class.
Exceptions
Direct3DXException The operation failed.
Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.