public static FinalizeAction finalizeAction = Finalize;          //class identified for FinalizeData
        public static void Finalize(TileData data, StopToken stop)
        {
                        #if __MEGASPLAT__
            if (data.globals.megaSplatTexList == 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
            (MegaSplatLayer[] layers, MatrixWorld[] matrices, MatrixWorld[] masks) =
                data.finalize.ProductArrays <MegaSplatLayer, MatrixWorld, MatrixWorld>(finalizeAction, data.subDatas);
            CoordRect colorsRect = data.area.active.rect;

            Color[] controlColors = BlendMegaSplat(data.area, data.heights, data.globals.megaSplatTexList as MegaSplatTextureList,
                                                   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 CustomShaderOutput200.ApplyData()
            {
                textureColors = new Color[][] { controlColors },
                textureNames  = new string[] { "_SplatControl" },
                textureFormat = TextureFormat.RGBA32
            };

            Graph.OnBeforeOutputFinalize?.Invoke(typeof(CustomShaderOutput200), data, applyData, stop);
            data.apply.Add(applyData);
                        #endif
        }
Ejemplo n.º 2
0
        public static FinalizeAction finalizeAction = Finalize;          //class identified for FinalizeData
        public static void Finalize(TileData data, StopToken stop)
        {
            //purging if no outputs
            if (data.OutputsCount(typeof(RTPOutput200), inSubs: true) == 0)
            {
                if (stop != null && stop.stop)
                {
                    return;
                }
                data.MarkApply(CustomShaderOutput200.ApplyData.Empty);
                return;
            }

            //creating control textures contents
            Color[][] colors = null;             //TODO: re-use colors array
//			CustomShaderOutput200.BlendControlTextures(ref colors, typeof(RTPOutput200), data);

            //pushing to apply
            if (stop != null && stop.stop)
            {
                return;
            }
            var controlTexturesData = new CustomShaderOutput200.ApplyData()
            {
                textureColors          = colors,
                textureFormat          = TextureFormat.RGBA32,
                textureBaseMapDistance = 10000000,                 //no base map
                textureNames           = new string[colors != null ? colors.Length : 0]
            };

            for (int t = 0; t < controlTexturesData.textureNames.Length; t++)
            {
                controlTexturesData.textureNames[t] = "_Control" + (t + 1);
            }

            Graph.OnOutputFinalized?.Invoke(typeof(RTPOutput200), data, controlTexturesData, stop);
            data.MarkApply(controlTexturesData);
        }