Anima2D.SpriteMeshEditorWindow.DrawMesh(UnityEngine.Vector3[], UnityEngine.Vector2[], UnityEngine.Color[], int[], UnityEngine.Material)

Here are the examples of the csharp api Anima2D.SpriteMeshEditorWindow.DrawMesh(UnityEngine.Vector3[], UnityEngine.Vector2[], UnityEngine.Color[], int[], UnityEngine.Material) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : SpriteMeshEditorWindow.cs
License : MIT License
Project Creator : Crazy-Marvin

void DrawSpriteMesh()
		{
			if(m_SpriteMeshCache)
			{
				Texture mainTexture = m_Texture;
				
				List<Color> colors = new List<Color>(m_SpriteMeshCache.nodes.Count);
				
				if(m_SpriteMeshCache.mode == Mode.Mesh &&
				   m_SpriteMeshCache.isBound &&
				   weightEditor.overlayColors)
				{
					foreach(Node node in m_SpriteMeshCache.nodes)
					{
						BoneWeight boneWeight = m_SpriteMeshCache.GetBoneWeight(node);
						int boneIndex0 = boneWeight.boneIndex0;
						int boneIndex1 = boneWeight.boneIndex1;
						int boneIndex2 = boneWeight.boneIndex2;
						int boneIndex3 = boneWeight.boneIndex3;
						float weight0 = boneIndex0 < 0 ? 0f : boneWeight.weight0;
						float weight1 = boneIndex1 < 0 ? 0f : boneWeight.weight1;
						float weight2 = boneIndex2 < 0 ? 0f : boneWeight.weight2;
						float weight3 = boneIndex3 < 0 ? 0f : boneWeight.weight3;
						
						Color vertexColor = m_BindPoseColors[Mathf.Max(0,boneIndex0)] * weight0 +
							m_BindPoseColors[Mathf.Max(0,boneIndex1)] * weight1 +
								m_BindPoseColors[Mathf.Max(0,boneIndex2)] * weight2 +
								m_BindPoseColors[Mathf.Max(0,boneIndex3)] * weight3;
						
						colors.Add (vertexColor);
					}
					
					mainTexture = null;
				}
				
				meshGuiMaterial.mainTexture = mainTexture;
				DrawMesh(m_Points.ToArray(),
				         m_UVs.ToArray(),
				         colors.ToArray(),
				         m_SpriteMeshCache.indices.ToArray(),
				         meshGuiMaterial);
			}
		}