Author Topic: Code Bugs  (Read 3884 times)


  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Code Bugs
« on: October 23, 2015, 12:03:33 pm »
void ZVoxelWorld::SectorUpdateFaceCulling(Long x, Long y, Long z, bool Isolated)

  UByte * BlocMatrix[3];

This is only a byte, but it's using Sector::Data which is UShort now.

This is OK because there's only 238 types right now.... but will be a problem with voxel type 256 ... or type&0xFF == 0


  • Administrator
  • Jr. Member
  • *****
  • Posts: 68
    • View Profile
Re: Code Bugs
« Reply #1 on: October 25, 2015, 12:58:22 am »
hi, d3x0r,

Thank you for finding this bug. This one could have made problems.  :o

I should also check other face culling functions : in Blackvoxel, this work is distributed among several modules in several threads.

This function (ZWorld::SectorUpdateFaceCulling()) is dedicated for cases where a complete sector needs to get a full face culling.

A little summary about Face culling in Blackvoxel...

The birth of sectors occurs in the ZFileSectorLoader object powered by a dedicated thread. After creation or loading, the face culling of the sector core voxels are computed using ZFileSectorLoader::LimitedUpdateFaceCulling(). Sector's external faces aren't done : at this point, the sector isn't integrated to the world(the concept of world isn't yet existing), so data are missing to compute face culling for boundaries : neighboring sectors are needed for that.

Further, sectors are integrated to the world by the main thread. But remaining culling is done by a third thread along with the MVI engine. When some inter-sector face culling is remaining to do (Indicated by the multi bit field ZVoxelSector::PartialCulling), it's done by the ZWorld::SectorUpdateFaceCulling_Partial() function. This function is doing the face culling link between sectors and can do selective work side by side as soon as some neigboring sectors become availlable.

Some face culling is also done in ZWorld::SetVoxel_WithCullingUpdate() when individual voxels are modified.

The Blackvoxel Teams.