예제 #1
0
        public void Start()
        {
            var sw = new MyStopWatch();

            sw.StartSegment("TamIdGeneration");
            TaskUtils.SetGlobalMultithreading(false);
            var tonesCount  = 3;
            var levelsCount = 3;
            var layersCount = 1;

            var tamTones = TAMTone.CreateList(tonesCount, new Dictionary <int, TAMStrokeOrientation>()
            {
                { 0, TAMStrokeOrientation.Horizontal },
                { 3, TAMStrokeOrientation.Vertical },
                { 5, TAMStrokeOrientation.Both }
            });
            var tamMipmapLevels = TAMMipmapLevel.CreateList(levelsCount);

            var configuration = TamIdPackGenerationConfiguration
                                .GetDefaultTamIdConfiguration(tamTones, tamMipmapLevels, 1f, layersCount, StrokeImagePath, BlankImagePath, false);

            configuration.SmallestLevelSoleImageResolution = new IntVector2(256, 256);
            var packGenerator = new TamIdPackGenerator();
            var pack          = packGenerator.GenerateTamPack(configuration, false, FindObjectOfType <ComputeShaderContainerGameObject>());

            TamIdGeneratorGO.DrawDebugPlates(pack);
            var fileManager = new TamIdPackFileManager();

            Debug.Log("Sw: " + sw.CollectResults());

            var tamIdPath = TemporaryImagesPath + TamName + @"\";

            Directory.CreateDirectory(tamIdPath);
            fileManager.Save(tamIdPath, tamTones, tamMipmapLevels, layersCount, pack);
        }
예제 #2
0
        public void Start()
        {
            var sw = new MyStopWatch();

            sw.StartSegment("TamIdGeneration");
            TaskUtils.SetGlobalMultithreading(false);
            var tonesCount  = 5;
            var levelsCount = 5;
            var layersCount = 1;

            var tamTones = TAMTone.CreateList(tonesCount, new Dictionary <int, TAMStrokeOrientation>()
            {
                { 0, TAMStrokeOrientation.Horizontal },
                { 3, TAMStrokeOrientation.Vertical },
                { 5, TAMStrokeOrientation.Both }
            });
            var tamMipmapLevels = TAMMipmapLevel.CreateList(levelsCount);

            var configuration = TamIdPackGenerationConfiguration
                                .GetDefaultTamIdConfiguration(tamTones, tamMipmapLevels, ExclusionZoneMultiplier, layersCount, StrokeImagePath, BlankImagePath);

            ScaleStrokesGenerationConfiguration(configuration);
            configuration.UseSmoothAlpha = SmoothAlpha;

            var packGenerator = new TamIdPackGenerator();
            var pack          = packGenerator.GenerateTamPack(configuration, false, FindObjectOfType <ComputeShaderContainerGameObject>());

            DrawDebugPlates(pack);
            var fileManager = new TamIdPackFileManager();

            Debug.Log("Sw: " + sw.CollectResults());

            if (SaveToFile)
            {
                fileManager.Save(TemporaryImagesPath, tamTones, tamMipmapLevels, layersCount, pack);
                var generator  = new TamIdArrayGenerator();
                var tex2DArray = generator.Generate(pack, tamTones, tamMipmapLevels, layersCount);
                tex2DArray.wrapMode = TextureWrapMode.Repeat;
                if (SmoothAlpha)
                {
                    tex2DArray.filterMode = FilterMode.Trilinear;
                }
                MyAssetDatabase.CreateAndSaveAsset(tex2DArray, $"Assets/Generated/{AssetName}.asset");
            }
        }
예제 #3
0
        public void Start()
        {
            _once = new RunOnceBox(() =>
            {
                var sw = new MyStopWatch();
                sw.StartSegment("TamIdGeneration");
                TaskUtils.SetGlobalMultithreading(false);
                var tonesCount  = 2;
                var levelsCount = 4;
                var layersCount = 2;

                var tamTones = TAMTone.CreateList(tonesCount, new Dictionary <int, TAMStrokeOrientation>()
                {
                    { 0, TAMStrokeOrientation.Horizontal },
                    { 3, TAMStrokeOrientation.Vertical },
                    { 5, TAMStrokeOrientation.Both }
                });
                var tamMipmapLevels = TAMMipmapLevel.CreateList(levelsCount);

                var configuration = TamIdPackGenerationConfiguration
                                    .GetDefaultTamIdConfiguration(tamTones, tamMipmapLevels, 1f, layersCount, StrokeImagePath, BlankImagePath);
                var packGenerator = new TamIdPackGenerator();
                var pack          = packGenerator.GenerateTamPack(configuration, false, FindObjectOfType <ComputeShaderContainerGameObject>());
                var fileManager   = new TamIdPackFileManager();
                Debug.Log("Sw: " + sw.CollectResults());

                fileManager.Save(@"C:\mgr\tmp\tamid1\", tamTones, tamMipmapLevels, layersCount, pack);
                var generator  = new TamIdArrayGenerator();
                var tex2DArray = generator.Generate(pack, tamTones, tamMipmapLevels, layersCount);
                TamIdArray     = tex2DArray;


                var tamIdPostProcessingDirectorOc = FindObjectOfType <TamIdPostProcessingDirectorOC>();
                var mat = GetComponent <MeshRenderer>().material;
                TamIdArray.filterMode = FilterMode.Point;
                mat.SetTexture("_TamIdTexArray", TamIdArray);

                mat.SetBuffer("_AppendBuffer", tamIdPostProcessingDirectorOc.TamidFragmentBuffer);
                mat.SetInt("_FragmentTexWidth", tamIdPostProcessingDirectorOc.FragmentTexWidth);
            });
        }
예제 #4
0
        public void Start()
        {
            TaskUtils.SetGlobalMultithreading(false);
            var tonesCount  = 5;
            var levelsCount = 5;
            var layersCount = 1;

            var tamTones = TAMTone.CreateList(tonesCount, new Dictionary <int, TAMStrokeOrientation>()
            {
                { 0, TAMStrokeOrientation.Horizontal },
                { 3, TAMStrokeOrientation.Vertical },
                { 5, TAMStrokeOrientation.Both }
            });
            var tamMipmapLevels = TAMMipmapLevel.CreateList(levelsCount);

            var fileManager = new TamIdPackFileManager();

            var pack = fileManager.Load(TemporaryImagesPath, tamTones, tamMipmapLevels, layersCount);

            DrawDebugPlates(pack);
        }