### Shader code for blending textures using mesh.color Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/manual/modes_texture.html Use this shader code to blend four textures based on the mesh.color channel. The final color is computed by lerping between the base texture and three blend textures using the color components. This example assumes a shader with five textures: one base and four blend textures. ```hlsl // sample the texture fixed4 col1 = tex2D(_MainTex, i.uv); fixed4 col2 = tex2D(_Texture1, i.uv); fixed4 col3 = tex2D(_Texture2, i.uv); fixed4 col4 = tex2D(_Texture3, i.uv); fixed4 final_color = lerp(lerp(lerp(col1, col2, i.color.y), col3, i.color.z), col4, i.color.w); ``` -------------------------------- ### RndVec3 Methods and Operators Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.RndVec3.html Documentation for the methods and operators of the RndVec3 struct, including equality comparers, hash code generation, stringification, and implicit conversions. ```APIDOC ## RndVec3 Methods and Operators ### Description Provides methods and operators for the RndVec3 struct, which is a Vector3 that is sortable and equatable by a rounded value (resolution). ### Methods #### Equals(object) Equality comparer for RndVec3 ##### Declaration ```csharp public override bool Equals(object b) ``` ##### Parameters | Type | Name | Description | |------|------|-------------| | object | b | System.Object that should be compare to this | ##### Returns | Type | Description | |------|-------------| | bool | true if the 2 elements are RndVec3 (or Vector3) and are equals | ##### Overrides ValueType.Equals(object) #### Equals(RndVec3) Equality comparer for RndVec3 ##### Declaration ```csharp public bool Equals(RndVec3 p) ``` ##### Parameters | Type | Name | Description | |------|------|-------------| | RndVec3 | p | RndVec3 to compare to this | ##### Returns | Type | Description | |------|-------------| | bool | true if the 2 RndVec3 are equals | #### Equals(Vector3) Equality comparer for a RndVec3 with a Vector3 ##### Declaration ```csharp public bool Equals(Vector3 p) ``` ##### Parameters | Type | Name | Description | |------|------|-------------| | Vector3 | p | Vector3 to compare to this | ##### Returns | Type | Description | |------|-------------| | bool | true if this is equal to the Vector3 regarding the RndVec3 resolution | #### GetHashCode() HashCode Generation ##### Declaration ```csharp public override int GetHashCode() ``` ##### Returns | Type | Description | |------|-------------| | int | unique hashcode for RndVec3 | ##### Overrides ValueType.GetHashCode() #### ToString() Stringification of the RndVec3 data ##### Declaration ```csharp public override string ToString() ``` ##### Returns | Type | Description | |------|-------------| | string | String representing the RndVec3 | ##### Overrides ValueType.ToString() ### Operators #### implicit operator Vector3(RndVec3) Constructor for a Vector3 from a RndVec3 ##### Declaration ```csharp public static implicit operator Vector3(RndVec3 p) ``` ##### Parameters | Type | Name | Description | |------|------|-------------| | RndVec3 | p | input RndVec3 | ##### Returns | Type | Description | |------|-------------| | Vector3 | Vector3 representing p | #### implicit operator RndVec3(Vector3) Constructor for a RndVec3 from a Vector3 ##### Declaration ```csharp public static implicit operator RndVec3(Vector3 p) ``` ##### Parameters | Type | Name | Description | |------|------|-------------| | Vector3 | p | input Vector3 | ##### Returns | Type | Description | |------|-------------| | RndVec3 | RndVec3 representing p | ``` -------------------------------- ### OnInspectorGUI() Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEditor.Polybrush.PrefabPaletteEditor.html Overriding function to make a custom IMGUI inspector. This method is called by Unity to render the inspector GUI for the PrefabPaletteEditor. ```APIDOC ## OnInspectorGUI() ### Description Overriding function to make a custom IMGUI inspector. ### Declaration ```csharp public override void OnInspectorGUI() ``` ### Overrides Editor.OnInspectorGUI() ``` -------------------------------- ### PolybrushMeshEditor Class Declaration Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEditor.Polybrush.PolybrushMeshEditor.html The class declaration for PolybrushMeshEditor, showing its inheritance from Editor and its attributes. ```APIDOC ## [Class] PolybrushMeshEditor ### Description Custom Editor for AdditionalVertexStreams. Provides a custom inspector for PolybrushMesh components. ### Inheritance - object - Object - ScriptableObject - Editor - PolybrushMeshEditor ### Attributes - [CanEditMultipleObjects] - [CustomEditor(typeof(PolybrushMesh))] ### Syntax ```csharp [CanEditMultipleObjects] [CustomEditor(typeof(PolybrushMesh))] public class PolybrushMeshEditor : Editor ``` ### Namespace UnityEditor.Polybrush ### Assembly Unity.Polybrush.Editor.dll ``` -------------------------------- ### Math.Clamp(int, int, int) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Clamps an integer value to a specified range. ```APIDOC ## Math.Clamp(int, int, int) ### Description Clamp a int to a range. ### Method Clamp(int value, int lowerBound, int upperBound) ### Parameters - **value** (int) - Required - The value to clamp. - **lowerBound** (int) - Required - The lowest value that the clamped value can be. - **upperBound** (int) - Required - The highest value that the clamped value can be. ### Returns - **int** - A value clamped with the range of lowerBound and upperBound. ``` -------------------------------- ### PolyEdge.GetHashCode() Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.PolyEdge.html HashCode Generation for PolyEdge. ```APIDOC ## GetHashCode() ### Description HashCode Generation. ### Declaration public override int GetHashCode() ### Returns - **int** - Unique hashcode for PolyEdge. ``` -------------------------------- ### Math.Average(IList, IList) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Computes the average of a Vector3 array, optionally using a subset of indices. ```APIDOC ## Math.Average(IList, IList) ### Description Gets the average of a vector array. ### Method Average(IList array, IList indexes = null) ### Parameters - **array** (IList) - Required - The array. - **indexes** (IList) - Optional - If provided the average is the sum of all points contained in the indexes array. If not, the entire v array is used. ### Returns - **Vector3** - Average Vector3 of passed vertex array. ``` -------------------------------- ### Reset() Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/Global%20Namespace.PolyAsset.html Protected virtual method that is called when resetting Polybrush Assets from the inspector to prevent them from losing their names. ```APIDOC ## Reset() ### Description Resets the Polybrush Asset so that when reset from the inspector, the asset does not lose its name. ### Method Reset() ### Declaration ``` protected virtual void Reset() ``` ### Remarks This method is protected and virtual, allowing derived classes to override the reset behavior. ``` -------------------------------- ### Math.Average(IList, IList) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Computes the average of a Vector4 array, optionally using a subset of indices. ```APIDOC ## Math.Average(IList, IList) ### Description Average a set of Vector4. ### Method Average(IList v, IList indexes = null) ### Parameters - **v** (IList) - Required - The collection from which to select indices. - **indexes** (IList) - Optional - The indexes to use to compute the average value. ### Returns - **Vector4** - Average Vector4 from selected values. ``` -------------------------------- ### PolyEdge.ToString() Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.PolyEdge.html Stringification of the PolyEdge data. ```APIDOC ## ToString() ### Description Stringification of the PolyEdge data. ### Declaration public override string ToString() ### Returns - **string** - String representing the PolyEdge. ``` -------------------------------- ### Math.Average(IList, IList) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Computes the average of a Vector2 array, optionally using a subset of indices. ```APIDOC ## Math.Average(IList, IList) ### Description Gets the average of a vector array. ### Method Average(IList array, IList indexes = null) ### Parameters - **array** (IList) - Required - The array. - **indexes** (IList) - Optional - If provided the average is the sum of all points contained in the indexes array. If not, the entire v array is used. ### Returns - **Vector2** - Average Vector3 of passed vertex array. ``` -------------------------------- ### CommonEdge.Equals(CommonEdge) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.CommonEdge.html Equality comparer for CommonEdge that compares against another CommonEdge. ```APIDOC ## Equals(CommonEdge) ### Description Equality comparer for CommonEdge. Compares this instance to another CommonEdge. ### Declaration public bool Equals(CommonEdge b) ### Parameters - **b** (CommonEdge) - Required - CommonEdge to compare to this. ### Returns - **bool** - true if the 2 CommonEdge are equal. ``` -------------------------------- ### TriangleArea(Vector3, Vector3, Vector3) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Static method that computes the area of a triangle from three vertex positions. ```APIDOC ## TriangleArea(Vector3, Vector3, Vector3) ### Description Get the area of a triangle. ### Declaration public static float TriangleArea(Vector3 x, Vector3 y, Vector3 z) ### Parameters - **x** (Vector3) - First vertex position of the triangle. - **y** (Vector3) - Second vertex position of the triangle. - **z** (Vector3) - Third vertex position of the triangle. ### Returns - **float** - The area of the triangle. ### Remarks Reference: http://www.iquilezles.org/blog/?p=1579 ``` -------------------------------- ### CommonEdge.Equals(object) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.CommonEdge.html Equality comparer for CommonEdge that compares against a System.Object. ```APIDOC ## Equals(object) ### Description Equality comparer for CommonEdge. Compares this instance to a System.Object. ### Declaration public override bool Equals(object b) ### Parameters - **b** (object) - Required - System.Object that should be compared to this. ### Returns - **bool** - true if the 2 elements are CommonEdge and are equal. ``` -------------------------------- ### PolyEdge.Equals(PolyEdge) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.PolyEdge.html Equality comparer for PolyEdge. Compares this PolyEdge to another PolyEdge. ```APIDOC ## Equals(PolyEdge) ### Description Equality comparer for PolyEdge. Compares this PolyEdge to another PolyEdge. ### Declaration public bool Equals(PolyEdge p) ### Parameters - **p** (PolyEdge) - PolyEdge to compare to this. ### Returns - **bool** - true if the 2 PolyEdge are equal. ``` -------------------------------- ### PolyEdge.Equals(object) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.PolyEdge.html Equality comparer for PolyEdge. Compares this PolyEdge to a System.Object. ```APIDOC ## Equals(object) ### Description Equality comparer for PolyEdge. Compares this PolyEdge to a System.Object. ### Declaration public override bool Equals(object b) ### Parameters - **b** (object) - System.Object that should be compared to this. ### Returns - **bool** - true if the 2 elements are PolyEdge and are equal. ``` -------------------------------- ### CommonEdge.ToString() Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.CommonEdge.html Returns a string representation of the CommonEdge data. ```APIDOC ## ToString() ### Description Stringification of the CommonEdge data. ### Declaration public override string ToString() ### Returns - **string** - String representing the CommonEdge. ``` -------------------------------- ### CommonEdge.GetHashCode() Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.CommonEdge.html Generates a unique hash code for CommonEdge. ```APIDOC ## GetHashCode() ### Description HashCode Generation for CommonEdge. ### Declaration public override int GetHashCode() ### Returns - **int** - unique hashcode for CommonEdge. ``` -------------------------------- ### PolybrushMeshEditor class declaration Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEditor.Polybrush.PolybrushMeshEditor.html Declares the PolybrushMeshEditor class with the CanEditMultipleObjects and CustomEditor attributes, targeting the PolybrushMesh type. Inherits from Editor. ```csharp [CanEditMultipleObjects] [CustomEditor(typeof(PolybrushMesh))] public class PolybrushMeshEditor : Editor ``` -------------------------------- ### Math.GetNearestPointRayRay(Ray, Ray) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Calculates the nearest point between two rays. ```APIDOC ## Math.GetNearestPointRayRay(Ray, Ray) ### Description Calculate the nearest point between two rays. ### Method GetNearestPointRayRay(Ray a, Ray b) ### Parameters - **a** (Ray) - Required - First ray. - **b** (Ray) - Required - Second ray. ### Returns - **Vector3** - The nearest point between the given rays. ``` -------------------------------- ### Math.Normal(Vector3, Vector3, Vector3) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Calculates the unit normal vector of a triangle defined by three points. ```APIDOC ## Math.Normal(Vector3, Vector3, Vector3) ### Description Calculate the unit vector normal of 3 points. Equivalent to: B-A x C-A ### Method Normal(Vector3 p0, Vector3 p1, Vector3 p2) ### Parameters - **p0** (Vector3) - Required - First point of the triangle. - **p1** (Vector3) - Required - Second point of the triangle. - **p2** (Vector3) - Required - Third point of the triangle. ### Returns - **Vector3** - The normalized (unit length) normal vector of the triangle's surface. ``` -------------------------------- ### PolyEdge operator !=(PolyEdge, PolyEdge) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.PolyEdge.html Equality comparer for PolyEdge with != operator. ```APIDOC ## operator !=(PolyEdge, PolyEdge) ### Description Equality comparer for PolyEdge with != operator. ### Declaration public static bool operator !=(PolyEdge a, PolyEdge b) ### Parameters - **a** (PolyEdge) - PolyEdge to compare. - **b** (PolyEdge) - PolyEdge to compare to. ### Returns - **bool** - true if the 2 elements are different. ``` -------------------------------- ### ScaleAroundPoint(Vector2, Vector2, Vector2) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Scales a Vector2 using origin as the pivot point. Returns the scaled position. ```APIDOC ## ScaleAroundPoint(Vector2, Vector2, Vector2) ### Description Scales a Vector2 using origin as the pivot point. ### Declaration public static Vector2 ScaleAroundPoint(this Vector2 v, Vector2 origin, Vector2 scale) ### Parameters - **v** (Vector2) - Vector2 original point. - **origin** (Vector2) - The pivot to scale from. - **scale** (Vector2) - Vector2 representing the scale factor for the X and Y axes. ### Returns - **Vector2** - A Vector2 position that has been scaled around the origin point. ``` -------------------------------- ### Math.DistancePointLineSegment(Vector2, Vector2, Vector2) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Calculates the distance between a point and a finite line segment in 2D. ```APIDOC ## Math.DistancePointLineSegment(Vector2, Vector2, Vector2) ### Description Get the distance between a point and a finite line segment. ### Method DistancePointLineSegment(Vector2 point, Vector2 lineStart, Vector2 lineEnd) ### Parameters - **point** (Vector2) - Required - The point. - **lineStart** (Vector2) - Required - Line start. - **lineEnd** (Vector2) - Required - Line end. ### Returns - **float** - The distance from point to the nearest point on a line segment. ### Remarks http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment ``` -------------------------------- ### Math.DistancePointLineSegment(Vector3, Vector3, Vector3) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.Math.html Calculates the distance between a point and a finite line segment in 3D. ```APIDOC ## Math.DistancePointLineSegment(Vector3, Vector3, Vector3) ### Description Get the distance between a point and a finite line segment. ### Method DistancePointLineSegment(Vector3 point, Vector3 lineStart, Vector3 lineEnd) ### Parameters - **point** (Vector3) - Required - The point. - **lineStart** (Vector3) - Required - Line start. - **lineEnd** (Vector3) - Required - Line end. ### Returns - **float** - The distance from point to the nearest point on a line segment. ### Remarks http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment ``` -------------------------------- ### PolyEdge operator ==(PolyEdge, PolyEdge) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.PolyEdge.html Equality comparer for PolyEdge with == operator. ```APIDOC ## operator ==(PolyEdge, PolyEdge) ### Description Equality comparer for PolyEdge with == operator. ### Declaration public static bool operator ==(PolyEdge a, PolyEdge b) ### Parameters - **a** (PolyEdge) - PolyEdge to compare. - **b** (PolyEdge) - PolyEdge to compare to. ### Returns - **bool** - true if the 2 elements are equal. ``` -------------------------------- ### CommonEdge.operator !=(CommonEdge, CommonEdge) Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/UnityEngine.Polybrush.CommonEdge.html Equality comparer for CommonEdge using the != operator. ```APIDOC ## operator !=(CommonEdge, CommonEdge) ### Description Equality comparer for CommonEdge with != operator. ### Declaration public static bool operator !=(CommonEdge a, CommonEdge b) ### Parameters - **a** (CommonEdge) - Required - CommonEdge to compare. - **b** (CommonEdge) - Required - CommonEdge to compare to. ### Returns - **bool** - true if the 2 elements are different. ``` -------------------------------- ### PolyAsset Class Declaration Source: https://docs.unity3d.com/Packages/com.unity.polybrush%401.2/api/Global%20Namespace.PolyAsset.html The PolyAsset class is declared as a public class inheriting from ScriptableObject. It is the base class for Polybrush assets and implements a Reset() function to preserve the asset name during inspector resets. ```APIDOC ## PolyAsset Class ### Description Super class for every Polybrush Assets implementing Reset() function so that when you reset them from the inspector they don't loose their name. ### Inheritance - object - Object - ScriptableObject - PolyAsset ### Namespace Global Namespace ### Assembly Unity.Polybrush.Editor.dll ### Syntax ```csharp public class PolyAsset : ScriptableObject ``` ### Inherited Members - ScriptableObject.SetDirty() - ScriptableObject.CreateInstance(string) - ScriptableObject.CreateInstance(Type) - ScriptableObject.CreateInstance() - Object.GetInstanceID() - Object.GetHashCode() - Object.Equals(object) - Object.InstantiateAsync(T) - Object.InstantiateAsync(T, Transform) - Object.InstantiateAsync(T, Vector3, Quaternion) - Object.InstantiateAsync(T, Transform, Vector3, Quaternion) - Object.InstantiateAsync(T, int) - Object.InstantiateAsync(T, int, Transform) - Object.InstantiateAsync(T, int, Vector3, Quaternion) - Object.InstantiateAsync(T, int, ReadOnlySpan, ReadOnlySpan) - Object.InstantiateAsync(T, int, Transform, Vector3, Quaternion) - Object.InstantiateAsync(T, int, Transform, ReadOnlySpan, ReadOnlySpan) - Object.InstantiateAsync(T, InstantiateParameters) - Object.InstantiateAsync(T, int, InstantiateParameters) - Object.InstantiateAsync(T, Vector3, Quaternion, InstantiateParameters) - Object.InstantiateAsync(T, int, Vector3, Quaternion, InstantiateParameters) - Object.InstantiateAsync(T, int, ReadOnlySpan, ReadOnlySpan, InstantiateParameters) - Object.Instantiate(Object, Vector3, Quaternion) - Object.Instantiate(Object, Vector3, Quaternion, Transform) - Object.Instantiate(Object) - Object.Instantiate(Object, Scene) - Object.Instantiate(T, InstantiateParameters) - Object.Instantiate(T, Vector3, Quaternion, InstantiateParameters) - Object.Instantiate(Object, Transform) - Object.Instantiate(Object, Transform, bool) - Object.Instantiate(T) - Object.Instantiate(T, Vector3, Quaternion) - Object.Instantiate(T, Vector3, Quaternion, Transform) - Object.Instantiate(T, Transform) - Object.Instantiate(T, Transform, bool) - Object.Destroy(Object, float) - Object.Destroy(Object) - Object.DestroyImmediate(Object, bool) - Object.DestroyImmediate(Object) - Object.FindObjectsOfType(Type) - Object.FindObjectsOfType(Type, bool) - Object.FindObjectsByType(Type, FindObjectsSortMode) - Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode) - Object.DontDestroyOnLoad(Object) - Object.DestroyObject(Object, float) - Object.DestroyObject(Object) - Object.FindSceneObjectsOfType(Type) - Object.FindObjectsOfTypeIncludingAssets(Type) - Object.FindObjectsOfType() - Object.FindObjectsByType(FindObjectsSortMode) - Object.FindObjectsOfType(bool) - Object.FindObjectsByType(FindObjectsInactive, FindObjectsSortMode) - Object.FindObjectOfType() - Object.FindObjectOfType(bool) - Object.FindFirstObjectByType() - Object.FindAnyObjectByType() - Object.FindFirstObjectByType(FindObjectsInactive) - Object.FindAnyObjectByType(FindObjectsInactive) - Object.FindObjectsOfTypeAll(Type) - Object.FindObjectOfType(Type) - Object.FindFirstObjectByType(Type) - Object.FindAnyObjectByType(Type) - Object.FindObjectOfType(Type, bool) - Object.FindFirstObjectByType(Type, FindObjectsInactive) - Object.FindAnyObjectByType(Type, FindObjectsInactive) - Object.ToString() - Object.name - Object.hideFlags - object.Equals(object, object) - object.GetType() - object.MemberwiseClone() - object.ReferenceEquals(object, object) ```