From 0e7e75624392df6b8f1e83fc9cd91ff1a6693b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Tue, 11 Sep 2018 09:07:24 +0200 Subject: [PATCH] Add comments --- raycastlib.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/raycastlib.h b/raycastlib.h index 7f385f3..7cdc813 100644 --- a/raycastlib.h +++ b/raycastlib.h @@ -8,6 +8,7 @@ author: Miloslav "drummyfish" Ciz license: CC0 + version: 0.1 - Game field's bottom left corner is at [0,0]. - X axis goes right. @@ -245,6 +246,13 @@ void render(Camera cam, ArrayFunction floorHeightFunc, ArrayFunction ceilingHeightFunc, ArrayFunction typeFunction, PixelFunction pixelFunc, RayConstraints constraints); +/** + Renders given camera view, with help of provided functions. This function is + simpler and faster than render(...) and is meant to be rendering scenes + with simple 1-intersection raycasting. The render(...) function can give more + accurate results than this function, so it's to be considered even for simple + scenes. +*/ void renderSimple(Camera cam, ArrayFunction floorHeightFunc, ArrayFunction typeFunc, PixelFunction pixelFunc, RayConstraints constraints); @@ -1129,7 +1137,8 @@ PixelInfo mapToScreen(Vector2D worldPosition, Unit height, Camera camera) Unit cos = cosInt(HORIZONTAL_FOV_HALF); Unit b = - (result.depth * sinInt(HORIZONTAL_FOV_HALF)) / (cos == 0 ? 1 : cos); // sin/cos = tan + (result.depth * sinInt(HORIZONTAL_FOV_HALF)) / (cos == 0 ? 1 : cos); + // sin/cos = tan result.position.x = (a * middleColumn) / b; result.position.x = middleColumn - result.position.x;