Ejemplo n.º 1
0
        public void Update()
        {
            if (!_initializationWasSuccessfull)
            {
                return;
            }

            _movementCustodian.Update();
            if (_movementCustodian.IsMovementPossible())
            {
                RunOnceBox.RunOnce(ref _movementStartBox, () =>
                {
                    Debug.Log("time to moving " + Time.realtimeSinceStartup);
                }, 3);
            }
            Traveller.SetActive(_movementCustodian.IsMovementPossible());
            Overlay.SetMovementPossibilityDetails(_movementCustodian.ThisFrameBlockingProcesses);

            _updaterUntilException.Execute(() => { _ultraUpdatableContainer.Update(new MockedFromGameObjectCameraForUpdate(Traveller)); });
            var position3D            = Traveller.transform.position;
            var travellerFlatPosition = new Vector2(position3D.x, position3D.z);

            _eTerrainHeightPyramidFacade.Update(travellerFlatPosition);

            if (_gameInitializationFields.HasField <MultipleLevelsHeightPyramidExplorerGO>())
            {
                var explorer = _gameInitializationFields.Retrive <MultipleLevelsHeightPyramidExplorerGO>();
                explorer.UpdateTravellingUniforms(travellerFlatPosition, _eTerrainHeightPyramidFacade.PyramidCenterWorldSpacePerLevel);
                explorer.UpdateHeightmapSegmentFillingState(_heightmapListenersContainer.ListenersDict.ToDictionary(c => c.Key, c => c.Value.TokensDict));
            }
        }
        public void Start()
        {
            _once = new RunOnceBox(() =>
            {
                var screenSize = new IntVector2(Screen.width, Screen.height);
                var blockSize  = new IntVector2(16, 16);
                var blockCount = new IntVector2(Mathf.CeilToInt(screenSize.X / (float)blockSize.X), Mathf.CeilToInt(screenSize.Y / (float)blockSize.Y));

                var divisionSettings = new GridDivisionSettings()
                {
                    BlockCount = blockCount,
                    BlockSize  = blockSize,
                    ScreenSize = screenSize
                };

                FindObjectOfType <LineMeasuringPpDirectorOc>().RequireScreenshotsSet((screenshotsSet) =>
                {
                    var gauge  = new BlockSpecificationGauge(divisionSettings);
                    var result = gauge.TakeMeasurement(screenshotsSet);

                    var ppDirector = FindObjectOfType <DebugIllustrationPPDirectorOC>();
                    ppDirector.ShowIllustrations(screenshotsSet.HatchMainTexture.ToTexture2D(), result.GenerateIllustration());
                    File.WriteAllText(@"C:\mgr\tmp\blockFilling.json", JsonUtility.ToJson(result.GeneratePoco()));
                });
            }, 4);
        }
Ejemplo n.º 3
0
 public void Start()
 {
     _collectAlignableMaterialsBox = new RunOnceBox(() =>
     {
         var materialsFromMMProcessor =
             FindObjectOfType <MyMethodPostProcessingDirectorOC>().RenderingMaterials;
         _materialsToAlign.AddRange(materialsFromMMProcessor);
     }, 3);
 }
Ejemplo n.º 4
0
 public void Start()
 {
     _runOnce = new RunOnceBox(() =>
     {
         var mat = GetComponent <MeshRenderer>().material;
         var mmPostProcessingDirector = FindObjectOfType <MyMethodPostProcessingDirectorOC>();
         AlignUniforms();
         //AddUniformCycleData(mat);
         AddUniformCycleData3D(mat, mmPostProcessingDirector.SeedPositionTexture3D);
         UpdateMaterialKeywords();
     }, 4);
 }
Ejemplo n.º 5
0
        public void Start()
        {
            _once = new RunOnceBox(() =>
            {
                var tamIdPostProcessingDirectorOc = FindObjectOfType <TamIdPostProcessingDirectorOC>();
                var tamTex = GenerateMockTexture(tamIdPostProcessingDirectorOc.FragmentTexWidth);
                var mat    = GetComponent <MeshRenderer>().material;
                mat.SetTexture("_TamIdTex", tamTex);

                mat.SetBuffer("_AppendBuffer", tamIdPostProcessingDirectorOc.TamidFragmentBuffer);
                mat.SetInt("_FragmentTexWidth", tamIdPostProcessingDirectorOc.FragmentTexWidth);
            });
        }
Ejemplo n.º 6
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);
            });
        }
        public void Start()
        {
            _once = new RunOnceBox(() =>
            {
                FindObjectOfType <LineMeasuringPpDirectorOc>().RequireScreenshotsSet((screenshotsSet) =>
                {
                    var gauge = new StrokesPixelCountGauge();

                    var sw = new MyStopWatch();
                    sw.StartSegment("PixelCountTime");
                    var result          = gauge.TakeMeasurement(screenshotsSet);
                    var debIllustration = result.GenerateIllustration();

                    var poco = result.GeneratePoco();
                    Debug.Log(sw.CollectResults());
                    Debug.Log(JsonUtility.ToJson(poco));
                    File.WriteAllText(@"C:\mgr\tmp\pixelCount.json", JsonUtility.ToJson(poco));

                    var ppDirector = FindObjectOfType <DebugIllustrationPPDirectorOC>();
                    ppDirector.ShowIllustrations(screenshotsSet.HatchMainTexture.ToTexture2D(), debIllustration);
                });
            }, 4);
        }
Ejemplo n.º 8
0
        public void Start(
            Dictionary <HeightPyramidLevel, HeightPyramidLevelTemplate> templates,
            Dictionary <EGroundTextureType, OneGroundTypeLevelTextureEntitiesGenerator> groundEntitiesGenerators
            )
        {
            var heightLevels = _startConfiguration.HeightPyramidLevels.OrderBy(c => c.GetIndex()).ToList();
            var heightPyramidMapConfiguration = _startConfiguration.CommonConfiguration;
            var perLevelConfigurations        = _startConfiguration.PerLevelConfigurations;

            _pyramidRootGo = new GameObject("HeightPyramidRoot");

            var floorTextureArrays = groundEntitiesGenerators.SelectMany(c => c.Value.FloorTextureArrayGenerator()).ToList();

            _perLevelEntites = new Dictionary <HeightPyramidLevel, HeightPyramidLevelEntities>();
            foreach (var level in heightLevels)
            {
                var perLevelConfiguration = perLevelConfigurations[level];

                var perGroundTypesEntities = groundEntitiesGenerators.Select(c =>
                {
                    var generator = c.Value;

                    var fillingListener = generator.SegmentFillingListenerGeneratorFunc(level, floorTextureArrays);

                    var segmentFiller = new SegmentFiller(heightPyramidMapConfiguration.SlotMapSize, perLevelConfiguration.SegmentFillerStandByMarginsSize,
                                                          perLevelConfiguration.BiggestShapeObjectInGroupLength, fillingListener);

                    return(new PerGroundTypeEntities()
                    {
                        Filler = segmentFiller
                    });
                }).ToList();

                var perLevelTemplate = templates[level];

                IPyramidShapeInstancer shapeInstancer = null;
                if (heightPyramidMapConfiguration.MergeShapesOfRings)
                {
                    shapeInstancer = new MergedMeshesPyramidShapeInstancer(_meshGeneratorUtProxy, heightPyramidMapConfiguration, perLevelConfiguration);
                }
                else
                {
                    shapeInstancer = new SeparateMeshPerTemplateShapeInstancer(_meshGeneratorUtProxy, heightPyramidMapConfiguration, perLevelConfiguration);
                }
                var group = shapeInstancer.CreateGroup(perLevelTemplate, level, _pyramidRootGo);

                var heightPyramidLocationParametersUpdaterConfiguration = new HeightPyramidLocationParametersUpdaterConfiguration()
                {
                    TransitionSingleStep = perLevelConfiguration.BiggestShapeObjectInGroupLength * perLevelConfiguration.TransitionSingleStepPercent
                };
                var updater            = new HeightPyramidLocationUniformsGenerator(heightPyramidLocationParametersUpdaterConfiguration);
                var transitionResolver = new HeightPyramidGroupTransitionResolver(group, heightPyramidLocationParametersUpdaterConfiguration);

                _perLevelEntites[level] = new HeightPyramidLevelEntities()
                {
                    PerGroundEntities         = perGroundTypesEntities,
                    ShapeGroup                = group,
                    LocationUniformsGenerator = updater,
                    TransitionResolver        = transitionResolver,
                    LevelTemplate             = perLevelTemplate,
                    PerLevelConfiguration     = perLevelConfiguration,
                };
            }

            var heightmapUniformsSetter = new HeightPyramidSegmentsUniformsSetter();
            var groupMover = new HeightPyramidGroupMover();

            ComputeBuffer configurationBuffer  = _buffersManager.EPyramidConfigurationBuffer;
            var           bufferReloaderRootGo = Object.FindObjectOfType <BufferReloaderRootGO>();

            var ePyramidPerFrameParametersBuffer = _buffersManager.PyramidPerFrameParametersBuffer;

            foreach (var pair in _perLevelEntites)
            {
                var shapeGroup         = pair.Value.ShapeGroup;
                var heightPyramidLevel = pair.Key;
                var ringsPerLevelCount = _startConfiguration.CommonConfiguration.MaxRingsPerLevelCount; //TODO
                heightmapUniformsSetter.InitializePyramidUniforms(shapeGroup, heightPyramidLevel, floorTextureArrays, heightLevels.Count, ringsPerLevelCount);
                heightmapUniformsSetter.PassPyramidBuffers(shapeGroup, configurationBuffer, bufferReloaderRootGo, ePyramidPerFrameParametersBuffer);
            }

            _fillingInitializationBox = new RunOnceBox(() =>
            {
                foreach (var pair in _perLevelEntites)
                {
                    foreach (var perGroundEntities in pair.Value.PerGroundEntities)
                    {
                        perGroundEntities.Filler.InitializeField(_startConfiguration.InitialTravellerPosition);
                    }
                }
            });
            if (_startConfiguration.GenerateInitialSegmentsDuringStart)
            {
                _fillingInitializationBox.Update();
            }

            _pyramidCommonEntites = new HeightPyramidCommonEntites()
            {
                HeightPyramidMapConfiguration = heightPyramidMapConfiguration,
                HeightmapUniformsSetter       = heightmapUniformsSetter,
                GroupMover         = groupMover,
                FloorTextureArrays = floorTextureArrays
            };
        }
Ejemplo n.º 9
0
 public void Start()
 {
     _defineTestRunOnce       = new RunOnceBox(DefineTest);
     _botsToWaitForCompletion = 0;
 }