예제 #1
0
        private async Task <GRingTerrainId> CreateTerrainAsync()
        {
            var triplet = _tripletProvider.ProvideTriplet();

            var mesh = await _meshGeneratorUtProxy.AddOrder(() => PlaneGenerator.CreateFlatPlaneMesh(65, 65));

            var creationTemplatesList = new List <Ring1GroundPieceCreationTemplate>();
            int layerIndex            = 0;

            UniformsPack pack = new UniformsPack();

            pack.SetUniform("_LodLevel", _flatLod.ScalarValue);
            pack.SetUniform("_NodeId", LastId);

            var groundShapeDetails = await _groundShapeProvider.ProvideGroundTextureDetail();

            _groundShapeToken = groundShapeDetails.GroundShapeToken;
            pack.MergeWith(groundShapeDetails.Uniforms);

            creationTemplatesList.Add(
                new Ring1GroundPieceCreationTemplate()
            {
                Name             = $"TerrainElementLayer l:{layerIndex} fl:{_flatLod.ScalarValue}, X:{LastId++}",
                ParentGameObject = _parentObject,
                PieceMesh        = mesh,
                TransformTriplet = triplet,
                ShaderName       = "Custom/Terrain/DebugTerrainedLod",
                //ShaderName = "Custom/Terrain/Ring0",
                ShaderKeywordSet = groundShapeDetails.ShaderKeywordSet,
                Uniforms         = pack,
                Modifier         = new Ring1GroundPieceModifier()
            });


            var toReturn = new GRingTerrainId()
            {
                ElementsIds = creationTemplatesList.Select(c => _orderGrabber.AddCreationOrder(c)).ToList()
            };

            return(toReturn);
        }
예제 #2
0
 public async Task CreatedNewNodeAsync()
 {
     _terrainId = await CreateTerrainAsync();
 }