Esempio n. 1
0
        public static FinalizeAction finalizeAction = Finalize;          //class identified for FinalizeData
        public static void Finalize(TileData data, StopToken stop)
        {
                        #if CTS_PRESENT
            if (data.globals.ctsProfile == null)
            {
                return;
            }


            //purging if no outputs
            if (data.finalize.GetTypeCount(finalizeAction) == 0)
            {
                if (stop != null && stop.stop)
                {
                    return;
                }
                data.apply.Add(CustomShaderOutput200.ApplyData.Empty);
                return;
            }

            //creating control textures contents
            (CTSLayer[] layers, MatrixWorld[] matrices, MatrixWorld[] masks) =
                data.finalize.ProductArrays <CTSLayer, MatrixWorld, MatrixWorld>(finalizeAction, data.subDatas);
            CoordRect colorsRect = data.area.active.rect;

            Color[][] colors = CustomShaderOutput200.BlendMatrices(colorsRect, matrices, masks, layers.Select(l => l.Opacity), layers.Select(l => l.channelNum));

            //pushing to apply
            if (stop != null && stop.stop)
            {
                return;
            }
            //var applyData = new ApplyData() { colors = colors };
            var applyData = new ApplyData()
            {
                textureColors = colors,
                profile       = (CTSProfile)data.globals.ctsProfile,
            };

            Graph.OnBeforeOutputFinalize?.Invoke(typeof(ApplyData), data, applyData, stop);
            data.apply.Add(applyData);
                        #endif
        }
        public static FinalizeAction finalizeAction = Finalize;         //class identified for FinalizeData
        public static void Finalize(TileData data, StopToken stop)
        {
            #if __MICROSPLAT__
            //purging if no outputs
            if (data.finalize.GetTypeCount(finalizeAction) == 0)
            {
                if (stop != null && stop.stop)
                {
                    return;
                }
                data.apply.Add(CustomShaderOutput200.ApplyData.Empty);
                return;
            }

            //creating control textures contents
            (MicroSplatLayer[] layers, MatrixWorld[] matrices, MatrixWorld[] masks) =
                data.finalize.ProductArrays <MicroSplatLayer, MatrixWorld, MatrixWorld>(finalizeAction, data.subDatas);
            CoordRect colorsRect = data.area.active.rect;

            Color[][] colors = CustomShaderOutput200.BlendMatrices(colorsRect, matrices, masks, layers.Select(l => l.Opacity), layers.Select(l => l.channelNum));

            //pushing to apply
            if (stop != null && stop.stop)
            {
                return;
            }
            //var applyData = new ApplyData() { colors = colors };
            var applyData = new ApplyData()
            {
                textureColors   = colors,
                textureNames    = new string[] { "_CustomControl0", "_CustomControl1", "_CustomControl2", "_CustomControl3" },
                textureFormat   = TextureFormat.RGBA32,
                assignComponent = data.globals.assignComponent,
                propData        = data.globals.microSplatPropData as MicroSplatPropData,
            };

            Graph.OnBeforeOutputFinalize?.Invoke(typeof(CustomShaderOutput200), data, applyData, stop);
            data.apply.Add(applyData);
            #endif
        }