Ejemplo n.º 1
0
        private void CalculateRenderMesh(Chunk chunk, MeshData meshData, int x1, int y1, int z1, int x2, int y2, int z2,
                                         Block bA, Block bB, BlockAttributeCalculator aBAC, BlockAttributeCalculator bBAC, int direction, bool bBInRange)
        {
            BlockRenderType aBACRenderType = aBAC.GetBlockRenderType(bA.ExtendId);

            if (aBACRenderType == BlockRenderType.Part)
            {
                //渲染(特殊)物块
                aBAC.CalculateSpecialMesh(chunk, x1, y1, z1, meshData, bA, bB, bBAC, (Direction)direction);
            }

            BlockRenderType bBACRenderType = bBAC.GetBlockRenderType(bB.ExtendId);

            if (bBACRenderType == BlockRenderType.Part)
            {
                //不能因为x2,y2,z2有可能不在chunk中 而需要保证x2,y2,z2在chunk中)
//				Chunk tempChunk = chunk;
//				if(!bBInRange)
//				{
//					int x2WorldPos = chunk.worldPos.x + x2;
//					int y2WorldPos = chunk.worldPos.y + y2;
//					int z2WorldPos = chunk.worldPos.z + z2;
//					tempChunk = chunk.world.GetChunk(x2WorldPos,y2WorldPos,z2WorldPos);
//					x2 = x2WorldPos - tempChunk.worldPos.x;
//					y2 = y2WorldPos - tempChunk.worldPos.y;
//					z2 = z2WorldPos - tempChunk.worldPos.z;
//				}
                //渲染(特殊)物块(不能确定当前坐标会在chunk中)
                bBAC.CalculateSpecialMesh(chunk, x2, y2, z2, meshData, bB, bA, aBAC, (Direction)(-direction));
            }
        }