예제 #1
0
    public static void AddReadRequest(VFVoxelChunkData chunkData)
    {
        IntVector4 chunkPos = chunkData.ChunkPosLod;

        // Req to chunks out of range will return, these chunks will be null and can not be write according to WriteVoxelAtIdx's code
        if (chunkPos.x < 0 || chunkPos.x >= VoxelTerrainConstants._worldMaxCX)
        {
            return;
        }
        if (chunkPos.y < 0 || chunkPos.y >= VoxelTerrainConstants.WorldMaxCY(chunkPos.w))
        {
            return;
        }
        if (chunkPos.z < 0 || chunkPos.z >= VoxelTerrainConstants._worldMaxCZ)
        {
            return;
        }

        // no caching
        IntVector4 piecePos;

        VFFileDataClone.WorldChunkPosToPiecePos(chunkPos, out piecePos);

        IntVector4 fileIndex;

        VFFileDataClone.PiecePos2FileIndex(piecePos, out fileIndex);

        VFPieceDataClone pieceData = GetPieceDataSub(piecePos, GetFileSetSub(fileIndex));

        pieceData.Decompress();
        pieceData.SetChunkData(chunkData);
        pieceData._data = null;
        pieceData       = null;
    }
예제 #2
0
    public static bool GetPieceData(out VFPieceDataClone pieceData, IntVector4 piecePos)        // ret if cache hit
    {
        IntVector4 fileIndex;

        VFFileDataClone.PiecePos2FileIndex(piecePos, out fileIndex);
        VFFileDataClone fileSet = null;        //fileSetCache.Find(iter=>VFFileDataClone.Match(iter, fileIndex));

        //if(fileSet == null)
        {
            fileSet = GetFileSetSub(fileIndex);
            //fileSetCache.Add(fileSet);
        }

        pieceData = GetPieceDataSub(piecePos, fileSet);
        fileSet   = null;
        //fileDataCache.Add(fileData);
        return(false);
    }