private void DrawWireframe(SpriteCache sprite) { Debug.Assert(Event.current.type == EventType.Repaint); Debug.Assert(sprite != null); var meshPreview = sprite.GetMeshPreview(); Debug.Assert(meshPreview != null); m_Material.mainTexture = null; m_Material.SetFloat("_Opacity", 0.35f); m_Material.SetFloat("_VertexColorBlend", 0f); m_Material.color = Color.white; GL.wireframe = true; DrawingUtility.DrawMesh(meshPreview.mesh, m_Material, sprite.GetLocalToWorldMatrixFromMode()); GL.wireframe = false; }
private void DrawDefaultSpriteMesh(SpriteCache sprite) { Debug.Assert(m_Material != null); var meshPreview = sprite.GetMeshPreview(); var meshCache = sprite.GetMesh(); var skeleton = skinningCache.GetEffectiveSkeleton(sprite); Debug.Assert(meshPreview != null); if (meshPreview.canSkin == false || skeleton.isPosePreview == false) { m_Material.mainTexture = meshCache.textureDataProvider.texture; m_Material.SetFloat("_Opacity", 1f); m_Material.SetFloat("_VertexColorBlend", 0f); m_Material.color = new Color(1f, 1f, 1f, 1f); DrawingUtility.DrawMesh(meshPreview.defaultMesh, m_Material, sprite.GetLocalToWorldMatrixFromMode()); } }
private void DrawSpriteMesh(SpriteCache sprite, float weightMapOpacity) { Debug.Assert(m_Material != null); var meshPreview = sprite.GetMeshPreview(); var meshCache = sprite.GetMesh(); Debug.Assert(meshPreview != null); if (meshPreview.mesh == null || meshPreview.mesh.vertexCount == 0) { DrawDefaultSpriteMesh(sprite); } else { m_Material.mainTexture = meshCache.textureDataProvider.texture; m_Material.SetFloat("_Opacity", 1f); m_Material.SetFloat("_VertexColorBlend", weightMapOpacity); m_Material.color = Color.white; DrawingUtility.DrawMesh(meshPreview.mesh, m_Material, sprite.GetLocalToWorldMatrixFromMode()); } }