예제 #1
0
 private void MeshDepthFromLight(object @object, int x, int y, float z)
 {
     if (x < RenderWidth && y < RenderHeight)
     {
         if (z.ApproxLessThan(ShadowMap.Values[x][y], 1E-4f))
         {
             ShadowMap.Values[x][y] = z;
         }
     }
 }
예제 #2
0
 // Check if point is visible from the camera
 private void ZBufferCheck(object colour, int x, int y, float z)
 {
     try
     {
         if (z.ApproxLessThan(zBuffer.Values[x][y], 1E-4f))
         {
             zBuffer.Values[x][y]      = z;
             colourBuffer.Values[x][y] = (Color)colour;
         }
     }
     catch (IndexOutOfRangeException e)
     {
         throw new IndexOutOfRangeException($"Attempted to render outside the canvas at ({x}, {y}, {z})", e);
     }
 }
예제 #3
0
 private void TexturedCheckAgainstZBuffer(Bitmap texture, int x, int y, float z, int tx, int ty)
 {
     try
     {
         if (z.ApproxLessThan(zBuffer.Values[x][y], 1E-4f))
         {
             zBuffer.Values[x][y]      = z;
             colourBuffer.Values[x][y] = texture.GetPixel(tx, ty * -1 + texture.Height - 1);
         }
     }
     catch (IndexOutOfRangeException e)
     {
         throw new IndexOutOfRangeException($"Attempted to render outside the canvas at ({x}, {y}, {z})", e);
     }
 }