コード例 #1
0
        public void UpdateSelectedMaterials()
        {
            if (outlineMesh)
            {
                SyncOutlineGameObject();
            }
            UpdateOutlineGameObjectSelected();
            int materialLength = outlineGameObject ? unselectedMaterials.Length : unselectedMaterials.Length * 2;

            if (selectedMaterials == null || materialLength != selectedMaterials.Length)   // avoid GC alloc on subsequent calls
            {
                selectedMaterials = new Material[materialLength];
            }

            for (int i = 0; i < unselectedMaterials.Length; i++)
            {
                Color color;
                if (unselectedMaterials[i].HasProperty("_Color"))
                {
                    color = unselectedMaterials[i].color + highlightMaterial.GetColor("_TintColor") / 3;
                }
                else
                {
                    color = unselectedMaterials[i].GetColor("_TintColor") + highlightMaterial.GetColor("_TintColor") / 3;
                }
                color.a = 1.0f;
                Material material = MaterialCache.MaterialByColor(color, renderMesh, renderWireframe, renderNormals, textureCacheId);

                selectedMaterials[i] = material;
                if (!outlineGameObject)
                {
                    selectedMaterials[i + unselectedMaterials.Length] = outlineMaterial;
                }
            }
        }
コード例 #2
0
        public void UpdateStickySelectedMaterial()
        {
            Color color = material.color * stickySelectedMaterial.color;

            color.a = 1.0f;
            blendedStickySelectedMaterial = MaterialCache.MaterialByColor(color, true, true, true);
        }
コード例 #3
0
        public static List <UnityEngine.Material> GetMaterials(Mesh mesh)
        {
            List <UnityEngine.Material> materials   = new List <UnityEngine.Material>();
            List <Material>             mmMaterials = mesh.materials.GetMaterials();

            foreach (Material mmMaterial in mmMaterials)
            {
                UnityEngine.Material material = MaterialCache.MaterialByColor(mmMaterial.color, mesh.GetRenderMesh(), mesh.GetRenderWireframe(), mesh.GetRenderNormals());
                materials.Add(material);
            }
            return(materials);
        }
コード例 #4
0
 public void UpdateStickySelectedMaterials()
 {
     blendedStickySelectedMaterials = new Material[unselectedMaterials.Length];
     for (int i = 0; i < unselectedMaterials.Length; i++)
     {
         if (stickySelectedMaterial)
         {
             Color color = unselectedMaterials[i].color * stickySelectedMaterial.color;
             color.a = 1.0f;
             blendedStickySelectedMaterials[i] = MaterialCache.MaterialByColor(color, renderMesh, renderWireframe, renderNormals, textureCacheId);
         }
         else
         {
             Color color = unselectedMaterials[i].color * Color.red;
             color.a = 1.0f;
             blendedStickySelectedMaterials[i] = MaterialCache.MaterialByColor(color, renderMesh, renderWireframe, renderNormals, textureCacheId);
         }
     }
 }
コード例 #5
0
 public static UnityEngine.Material MaterialToInstance(Mesh mesh, Material material, bool noWireframe = false)
 {
     return(MaterialCache.MaterialByColor(material.color, mesh.GetRenderMesh(), mesh.GetRenderWireframe(), mesh.GetRenderNormals()));
 }
コード例 #6
0
 public static UnityEngine.Material MaterialToInstance(Material material, bool renderMesh, bool renderWireframe, bool renderNormals)
 {
     return(MaterialCache.MaterialByColor(material.color, renderMesh, renderWireframe, renderNormals));
 }