Ejemplo n.º 1
0
        public void MergeWith(EditableMesh edm, PlaytimePainter other)
        {
            if (uv2DistributeRow > 1)
            {
                var tile   = Vector2.one / uv2DistributeRow;
                var y      = uv2DistributeCurrent / uv2DistributeRow;
                var x      = uv2DistributeCurrent - y * uv2DistributeRow;
                var offset = tile;
                offset.Scale(new Vector2(x, y));
                edm.TileAndOffsetUVs(offset, tile, 1);
                uv2DistributeCurrent++;
            }

            triangles.AddRange(edm.triangles);

            var tf = other.transform;

            int groupOffset = maxGroupIndex + 1;

            foreach (var point in edm.meshPoints)
            {
                foreach (var vertex in point.vertices)
                {
                    vertex.groupIndex += groupOffset;
                    maxGroupIndex      = Mathf.Max(maxGroupIndex, vertex.groupIndex);
                }

                point.WorldPos = tf.TransformPoint(point.localPos);
                meshPoints.Add(point);
            }
        }
Ejemplo n.º 2
0
        public void MergeWith(EditableMesh edm, PlaytimePainter other)
        {
            if (uv2DistributeRow > 1)
            {
                var tile   = Vector2.one / uv2DistributeRow;
                var y      = uv2DistributeCurrent / uv2DistributeRow;
                var x      = uv2DistributeCurrent - y * uv2DistributeRow;
                var offset = tile;
                offset.Scale(new Vector2(x, y));
                edm.TileAndOffsetUVs(offset, tile, 1);
                uv2DistributeCurrent++;
            }


            triangles.AddRange(edm.triangles);

            var tf = other.transform;

            foreach (var v in edm.meshPoints)
            {
                v.WorldPos = tf.TransformPoint(v.localPos);
                meshPoints.Add(v);
            }
        }