예제 #1
0
        protected override void Process()
        {
            lock (_dependencies)
            {
                if (!_dependencies.Any())
                {
                    throw new InvalidOperationException("Cannot perform blending without any dependencies to blend.");
                }

                var sources = Dependencies.Cast <HeightMapNode>();
                var result  = sources.First().Result;

                if (Dimensions.HasValue)
                {
                    result = new HeightMap(Dimensions.Value.Height, Dimensions.Value.Width, result.Data);
                }

                foreach (var source in sources.Skip(1))
                {
                    result = BlendMode.Blend(result, source.Result);
                }

                Result = result;
            }
        }