Skip to content

Instantly share code, notes, and snippets.

@nickdarnell
Created March 28, 2015 03:07
Show Gist options
  • Save nickdarnell/5aee92dbb7550e34d916 to your computer and use it in GitHub Desktop.
Save nickdarnell/5aee92dbb7550e34d916 to your computer and use it in GitHub Desktop.
MIN_INSIDE_FACES = 4;
MIN_INSIDE_PERCENTAGE = 0.03f;
int cubemap_sides_seeing_inside = 0;
for (int i = 0; i < 6; i++)
{
RenderCubeMapSide(i);
float backfacePercentage = CalculateBackfacePercentage(i);
if (backfacePercentage > MIN_INSIDE_PERCENTAGE)
cubemap_sides_seeing_inside++;
}
if (cubemap_sides_seeing_inside >= MIN_INSIDE_FACES || cubemap_sides_seeing_inside == 0)
{
if (cubemap_sides_seeing_inside >= MIN_INSIDE_FACES)
cell.Status = CellStatus.Inside;
else // cubemap_sides_seeing_inside == 0
cell.Status = CellStatus.Outside;
// Propagate cell status...
}
else
{
// Unable to solve status exactly.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment