TextureExtensions.GetUVCoordinates

Extension Method in TextureExtensions

Declaration

public static void GetUVCoordinates(this Texture2D texture, int px, int py, out float u, out float v)

Description

Maps the pixel coordinates in the range [0..width-1] and [0..height-1] to UV coordinates in the range [0..1].

Parameters

textureThe texture to get the UV coordinates from.
pxThe pixel coordinate in the x-axis.
pyThe pixel coordinate in the y-axis.
uThe output UV coordinate in the x-axis.
vThe output UV coordinate in the y-axis.