Class ConversionUtils
Extensions for converting data formats to each other
Namespace: i5.Toolkit.Core.Utilities
Assembly: cs.temp.dll.dll
Syntax
public static class ConversionUtils
Methods
ToColor(Vector3)
Converts a Vector3 to a Color Maps the x-value to the red channel, the y-value to the green channel and the z-value to the blue channel
Declaration
public static Color ToColor(this Vector3 vector)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector | The Vector3 which should be converted |
Returns
Type | Description |
---|---|
Color | Returns a color which has the same rgb values as the vector has xyz values |
ToColor(Vector4)
Converts a Vector4 to a Color Maps the x-value to the red channel, the y-value to the green channel, the z-value to the blue channel and the w-value to the alpha channel
Declaration
public static Color ToColor(this Vector4 vector)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | vector | The Vector4 which should be converted |
Returns
Type | Description |
---|---|
Color | Returns a color which has the same rgba values as the vector has xyzw values |
ToVector3(Color)
Converts a Color to a Vector3 Maps the red channel to the x value, the green channel to the y value and the blue channel to the z value
Declaration
public static Vector3 ToVector3(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to convert |
Returns
Type | Description |
---|---|
Vector3 | Returns a Vector3 which has the same xyz values as the color has rgb values |
ToVector4(Color)
Converts a Color to a Vector4 Maps the red channel to the x value, the green channel to the y value, the blue channel to the z value and the alpha channel to the w value
Declaration
public static Vector4 ToVector4(this Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to convert |
Returns
Type | Description |
---|---|
Vector4 | Returns a Vector4 which has the same xyzw values as the color has rgba values |