예제 #1
0
        public void ShouldComputeQuadrantForLevel()
        {
            var treeLocation = 0b011100;

            Assert.That(TreeLocationHelper.quadrantForLevel(treeLocation, 0), Is.EqualTo(0b0));
            Assert.That(TreeLocationHelper.quadrantForLevel(treeLocation, 1), Is.EqualTo(0b11));
            Assert.That(TreeLocationHelper.quadrantForLevel(treeLocation, 2), Is.EqualTo(0b01));
        }
예제 #2
0
    protected override TerrainQuadTree initialize(int quadrant)
    {
        var nextLevel      = level + 1;
        var newChunkLength = chunkLength / 2;
        var newCenter      = TerrainQuadTreeHelper.computeCenter(face, center, quadrant, newChunkLength);

        return(new TerrainQuadTree(
                   newCenter,
                   planetPosition,
                   newChunkLength,
                   face,
                   viewDistance,
                   maxLevel,
                   nextLevel,
                   this,
                   material,
                   TreeLocationHelper.childTreeLocation(treeLocation, quadrant, nextLevel),
                   meshGenerator
                   ));
    }
예제 #3
0
 public void ShouldComputeCorrectChildTreeLocation()
 {
     Assert.That(TreeLocationHelper.childTreeLocation(0, 1, 0), Is.EqualTo(0b01));
     Assert.That(TreeLocationHelper.childTreeLocation(0b01, 3, 1), Is.EqualTo(0b1101));
     Assert.That(TreeLocationHelper.childTreeLocation(0b1101, 2, 2), Is.EqualTo(0b101101));
 }