Ejemplo n.º 1
0
        Ring1Root CreateRootNode_TODO_DELETE(Ring1SubmapTextures submapTextures)
        {
            var terrainParentGameObject = new GameObject("TerrainParent");

            var unityCoordsCalculator = new UnityCoordsCalculator(new Vector2(256, 256));
            var nodeListener          = new Ring1NodeObjects(
                (node) => new List <IRing1NodeListener>()
            {
                //todo
                //new Ring1NodeShaderHeightTerrain(node, _ring1LodData, terrainParentGameObject, submapTextures,
                //    unityCoordsCalculator, null) //todo this null
//                      new Ring1NodeDirectHeightTerrain(node, _ring1LodData, terrainParentGameObject, submapTextures, unityCoordsCalculator, heightmapArray)
            }
                );

            _visibilityResolver = new Ring1VisibilityResolver(new Ring1BoundsCalculator(unityCoordsCalculator));
            _visibilityResolver.SetFovDataOverride(true);

            _nodeSplitController = new NodeSplitController(
                maximumLodLevel: MyConstants.MAXIMUM_LOD_LEVEL,
                minimumLodLevel: 0,
                precisionDistances: new Dictionary <float, int>
            {
                { 50, 3 },
                { 100, 2 },
                { 200, 1 }
            },
                coordsCalculator: unityCoordsCalculator
                );

            return(new Ring1Root(
                       new Ring1Node(
                           _nodeSplitController,
                           nodeListener,
                           _visibilityResolver,
                           new MyRectangle(0, 0, 0.5f, 0.5f),
                           1, Ring1NodePositionEnum.DOWN_LEFT),
                       new Ring1Node(
                           _nodeSplitController,
                           nodeListener,
                           _visibilityResolver,
                           new MyRectangle(0.5f, 0, 0.5f, 0.5f),
                           1, Ring1NodePositionEnum.DOWN_RIGHT),
                       new Ring1Node(
                           _nodeSplitController,
                           nodeListener,
                           _visibilityResolver,
                           new MyRectangle(0, 0.5f, 0.5f, 0.5f),
                           1, Ring1NodePositionEnum.TOP_LEFT),
                       new Ring1Node(
                           _nodeSplitController,
                           nodeListener,
                           _visibilityResolver,
                           new MyRectangle(0.5f, 0.5f, 0.5f, 0.5f),
                           1, Ring1NodePositionEnum.TOP_RIGHT),
                       nodeListener
                       ));
        }
Ejemplo n.º 2
0
 public Ring1Node(NodeSplitController nodeSplitController, IRing1NodeListener nodeListener,
                  Ring1VisibilityResolver visibilityResolver, MyRectangle ring1Position, int quadLodLevel,
                  Ring1NodePositionEnum nodePositionEnum)
 {
     _nodeSplitController = nodeSplitController;
     _nodeListener        = nodeListener;
     _visibilityResolver  = visibilityResolver;
     _ring1Position       = ring1Position;
     _quadLodLevel        = quadLodLevel;
     _nodePositionEnum    = nodePositionEnum;
     _nodeListener.CreatedNewNode(this);
 }
Ejemplo n.º 3
0
        private Ring1Root CreateRootNode(RootNodeCreationParameters parameters)
        {
            int maximumLodLevel = parameters.PrecisionDistances.Values.Max();
            int minimumLodLevel = parameters.PrecisionDistances.Values.Min();

            _visibilityResolver =
                new Ring1VisibilityResolver(new Ring1BoundsCalculator(parameters.UnityCoordsCalculator), parameters.InitialCameraPosition);
            _visibilityResolver.SetFovDataOverride(true);

            _nodeSplitController = new NodeSplitController(
                maximumLodLevel: maximumLodLevel,
                minimumLodLevel: minimumLodLevel,
                precisionDistances: parameters.PrecisionDistances,
                coordsCalculator: parameters.UnityCoordsCalculator
                );
            //_nodeSplitController.SetCameraPosition(parameters.InitialCameraPosition);
            //Debug.Log("F11 First camera position "+parameters.InitialCameraPosition);

            return(new Ring1Root(
                       new Ring1Node(
                           _nodeSplitController,
                           parameters.NodeListener,
                           _visibilityResolver,
                           new MyRectangle(0, 0, 0.5f, 0.5f),
                           1, Ring1NodePositionEnum.DOWN_LEFT),
                       new Ring1Node(
                           _nodeSplitController,
                           parameters.NodeListener,
                           _visibilityResolver,
                           new MyRectangle(0.5f, 0, 0.5f, 0.5f),
                           1, Ring1NodePositionEnum.DOWN_RIGHT),
                       new Ring1Node(
                           _nodeSplitController,
                           parameters.NodeListener,
                           _visibilityResolver,
                           new MyRectangle(0, 0.5f, 0.5f, 0.5f),
                           1, Ring1NodePositionEnum.TOP_LEFT),
                       new Ring1Node(
                           _nodeSplitController,
                           parameters.NodeListener,
                           _visibilityResolver,
                           new MyRectangle(0.5f, 0.5f, 0.5f, 0.5f),
                           1, Ring1NodePositionEnum.TOP_RIGHT),
                       parameters.NodeListener
                       ));
        }