Guest User

Untitled

a guest
Apr 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1.                 while(x < cellsx && x >= 0 && y < cellsy && y >= 0
  2.                       && z < cellsz && z >= 0)
  3.                 {
  4.                     voxelValue = model[z * (cellsy) * (cellsx) + y * (cellsx) + x ];
  5.                     alpha = (voxelValue & 0xF0)/256.0;
  6.                     if (alpha <  1 - alphaSencity) alpha = 0;
  7.  
  8.                     if (alpha > 0)
  9.                     {
  10.                         color = (voxelValue & 0xF)/16.0;
  11.                         if (color > colorSencity) color = 1;
  12.  
  13.  
  14.                         prevColor = alpha*prevColor + (1 - alpha) * color;
  15.  
  16.  
  17.                         if (prevColor <= 0)
  18.                         {
  19.                             prevColor = 0;
  20.                             break;
  21.                         }
  22.                     }
  23.  
  24.                     //qDebug() << x << y << z;
  25.  
  26.  
  27.                     if(ray.x() && tMaxX <= tMaxY && tMaxX <= tMaxZ)
  28.                     {
  29.                         tMaxX += tDeltaX;
  30.                         x += stepX;
  31.                     }
  32.                     else if(ray.y() && tMaxY <= tMaxZ && tMaxY <= tMaxX)
  33.                     {
  34.                         tMaxY += tDeltaY;
  35.                         y += stepY;
  36.                     }
  37.                     else
  38.                     {
  39.                         tMaxZ += tDeltaZ;
  40.                         z += stepZ;
  41.                     }
  42.                 }
Add Comment
Please, Sign In to add comment