private List <ChunkFeature> GetUnfittedChunkIndices(ChunkRequest chunkRequest, List <ChunkFeature> chunkFeatures)
        {
            List <ChunkFeature> unfittedChunkIndices = new List <ChunkFeature>();

            for (int index = 0; index < chunkFeatures.Count; ++index)
            {
                ChunkFeature chunkFeature        = chunkFeatures[index];
                ChunkFeature chunkChainedFeature = chunkFeature;

                int  chunkNumOffset = 0;
                bool chained        = false;
                while (chunkChainedFeature != null)
                {
                    ChunkRequest nextChunkRequest = new ChunkRequest()
                    {
                        chunkNum = chunkRequest.chunkNum - chunkNumOffset,
                    };


                    if (chained && nextChunkRequest.chunkNum != 0 && nextChunkRequest.chunkNum == chunkRequest.sprintEndChunkNum)
                    {
                        unfittedChunkIndices.Add(chunkFeature);
                        break;
                    }

                    int nextDepth = ChunkMath.Depth(nextChunkRequest);
                    int nextDepthStartChunkNum = ChunkMath.DepthStartChunkNum(nextChunkRequest);
                    int nextDepthEndChunkNum   = ChunkMath.DepthEndChunkNum(nextChunkRequest);
                    int nextSideChunkNum       = ChunkMath.SideChunkNum(nextChunkRequest);

                    // Mark chunk feature to be removed if it hits a corner and it is supposed to skip corners
                    if (chunkChainedFeature.SkipCorners && (chained || nextChunkRequest.chunkNum != nextDepthEndChunkNum) &&
                        (nextSideChunkNum == nextDepth - 1 ||
                         nextChunkRequest.chunkNum == nextDepthStartChunkNum))
                    {
                        unfittedChunkIndices.Add(chunkFeature);
                        break;
                    }

                    chunkChainedFeature = chunkChainedFeature.ChunkChainNext;
                    chunkNumOffset++;
                    chained = true;
                }
            }

            return(unfittedChunkIndices);
        }
Example #2
0
        private Quaternion BirdseyeRotation(ChunkView chunkView, ChunkRequest chunkRequest)
        {
            int side = ChunkMath.Side(chunkRequest);
            int depthStartChunkNum = ChunkMath.DepthStartChunkNum(chunkRequest);
            int depthEndChunkNum   = ChunkMath.DepthEndChunkNum(chunkRequest);

            if (chunkRequest.chunkNum == depthStartChunkNum || chunkRequest.chunkNum == depthEndChunkNum)
            {
                side = 5;
            }

            side = (side + 4) % 6;

            return(Quaternion.AngleAxis(
                       side * 60,
                       chunkView.Up
                       ));
        }