public bool Repack(MeshConstructor sm)
        {
            if (!sm.Valid)
            {
                Debug.Log("Got no data for mesh regeneration. ");
                return(false);
            }

            sm.mesh.Clear();

            VertexDataTypes.CurMeshDta = sm;

            foreach (var vs in dtaLnks)
            {
                if (vs.enabled)
                {
                    vs.Pack();
                }
            }

            foreach (var vt in VertexDataTypes.DataTypes)
            {
                vt.Clear();
            }

            return(true);
        }
Beispiel #2
0
        public void Redraw()
        {
            previewEdMesh = null;

            if (target)
            {
                editedMesh.Dirty = false;

                var mc = new MeshConstructor(editedMesh, target.MeshProfile, target.SharedMesh);

                if (!editedMesh.dirtyVertexIndexes && EditedMesh.Dirty)
                {
                    if (EditedMesh.dirtyPosition)
                    {
                        mc.UpdateMesh <VertexDataTypes.VertexPos>();
                    }

                    if (editedMesh.dirtyColor)
                    {
                        mc.UpdateMesh <VertexDataTypes.VertexColor>();
                    }

                    if (editedMesh.dirtyUvs)
                    {
                        mc.UpdateMesh <VertexDataTypes.VertexUv>();
                    }
                }
                else
                {
                    var m = mc.Construct();
                    target.SharedMesh = m;
                    target.UpdateMeshCollider(m);
                }
            }
        }
        public bool UpdatePackage <T>(MeshConstructor sm) where T : VertexDataSource
        {
            VertexDataTypes.CurMeshDta = sm;

            foreach (var vs in dtaLnks)
            {
                if (vs.enabled && !vs.FilterOutData <T>())
                {
                    vs.Pack();
                }
            }

            foreach (var vt in VertexDataTypes.DataTypes)
            {
                vt.Clear();
            }

            return(true);
        }