View on Asset Store (opens in new tab)
Package details
- Latest version
- 1.0
- Last updated
- First released
- Unity version
- 2018.4.28 or later
- Package size
- 313 KB
- Files
- 5
- Favorites
- 12
- Views in the past week
- 4
Price tracking
- Last checked
- Tracked since
- Lowest recorded
- Free on
Vector Swizzle
Price Free
Get it free on Asset Store (opens in new tab)
Affiliate link · Purchases support this site
Price history
Last 6 months
USDAsset preview
1 / 1
Vector Swizzle screenshot 1
About this asset
** Description **
Vector swizzle aims to bring the "swizzle" feature that is used in shader languages (GLSL, HLSL...) to Unity vector types.
For a detailed explanation of the feature check the openGL documentation down here :
https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)#Swizzling
** Features **
- Added "Vector4Int" type for coherence
- xyzw / rgba / stpq masks without mixing symbols from different masks
- Implemented the same way as the GLSL implementation
- Allows for both get and set
- Each "unit" field also wrapped in an extension method for typing consistence ( v.x == v.x() )
- Works on Vector2, Vector3, Vector4, Vector2Int, Vector3Int, Vector4Int, Color & Color32
** Examples **
==== Sample 1
Vector4 va = new Vector4(1.0f,2.0f,3.0f,4.0f);
va.xzy();
- Equivalent to : Vector4 va = new Vector4(1.0f,2.0f,3.0f,4.0f);
new Vector3(va.x, va.z, va.y);
==== Sample 2
Vector2 position2D =
new Vector2(transform.position.x,
transform.position.y);
- Equivalent to :
Vector2 position2D = transform.position.xy();
==== Sample 3 : Want to assign fields ?
Vector2 mousePos;
transform.position.xy(mousePos);
- Equivalent to :
transform.position.x = mousePos.x;
transform.position.y = mousePos.y;
** Contact / Help / Bug report **
I'm open to suggestion and feedbacks so don't hesitate to contact me through github or mail :
https://github.com/seb776
[email protected]
Vector swizzle aims to bring the "swizzle" feature that is used in shader languages (GLSL, HLSL...) to Unity vector types.
For a detailed explanation of the feature check the openGL documentation down here :
https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)#Swizzling
** Features **
- Added "Vector4Int" type for coherence
- xyzw / rgba / stpq masks without mixing symbols from different masks
- Implemented the same way as the GLSL implementation
- Allows for both get and set
- Each "unit" field also wrapped in an extension method for typing consistence ( v.x == v.x() )
- Works on Vector2, Vector3, Vector4, Vector2Int, Vector3Int, Vector4Int, Color & Color32
** Examples **
==== Sample 1
Vector4 va = new Vector4(1.0f,2.0f,3.0f,4.0f);
va.xzy();
- Equivalent to : Vector4 va = new Vector4(1.0f,2.0f,3.0f,4.0f);
new Vector3(va.x, va.z, va.y);
==== Sample 2
Vector2 position2D =
new Vector2(transform.position.x,
transform.position.y);
- Equivalent to :
Vector2 position2D = transform.position.xy();
==== Sample 3 : Want to assign fields ?
Vector2 mousePos;
transform.position.xy(mousePos);
- Equivalent to :
transform.position.x = mousePos.x;
transform.position.y = mousePos.y;
** Contact / Help / Bug report **
I'm open to suggestion and feedbacks so don't hesitate to contact me through github or mail :
https://github.com/seb776
[email protected]
From the publisher's Asset Store listing.