コード例 #1
0
        /// <summary>
        /// Gets the material with the specified usage that is attached to this material.
        /// </summary>
        protected internal override void OnResolveMaterialPart(MaterialUsage usage, MaterialPart existingInstance)
        {
            var result    = ((MaterialPaintGroup)existingInstance);
            var srcCount  = materialParts.Count;
            var destCount = result.materialParts.Count;

            if (srcCount > 0 && destCount > 0)
            {
                var src      = 0;
                var dest     = 0;
                var srcPart  = materialParts[0];
                var destPart = result.materialParts[0];
                var srcType  = srcPart.GetType();
                var destType = destPart.GetType();

                // Source material parts is a super set of destination material parts.
                while (dest < destCount)
                {
                    destPart = result.materialParts[dest++];
                    destType = destPart.GetType();

                    while (src < srcCount)
                    {
                        srcPart = materialParts[src++];
                        srcType = srcPart.GetType();
                        if (srcType == destType)
                        {
                            srcPart.OnResolveMaterialPart(usage, destPart);
                            break;
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: MaterialPart.cs プロジェクト: Hengle/Engine-Nine
 /// <summary>
 /// Gets the material with the specified usage that is attached to this material.
 /// </summary>
 protected internal virtual void OnResolveMaterialPart(MaterialUsage usage, MaterialPart existingInstance)
 {
 }