From ffb82ec01e718cc12ee00b0b4b48a33985d7471b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sun, 30 Sep 2018 14:12:21 +0200 Subject: [PATCH] Adjust helloRay --- helloRay.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/helloRay.cpp b/helloRay.cpp index 463f3b0..10e5ef4 100644 --- a/helloRay.cpp +++ b/helloRay.cpp @@ -10,19 +10,22 @@ function that will render pixels. It allows super performance. */ #define RCL_COMPUTE_WALL_TEXCOORDS 0 -/* ^ We won't be using textures, so turn them off. */ +#define RCL_COMPUTE_FLOOR_TEXCOORDS 0 +#define RCL_COMPUTE_FLOOR_DEPTH 0 +#define RCL_COMPUTE_FLOOR_DEPTH 0 +#define RCL_COMPUTE_CEILING_DEPTH 0 +/* ^ Turn off features we won't be using, so that the program runs faster. -/* There are many other options that can be defined here, check the library - for details. Don't forget to disable the features you won't be using - it - will speed up the rendering. */ + There are many other options that can be defined here, check the library + for details. */ #include "raycastlib.h" #include "Pokitto.h" Pokitto::Core pokitto; -RCL_Camera camera; // Defines a view that will be rendered. -RCL_RayConstraints constraints; +RCL_Camera camera; // Defines a view that will be rendered. +RCL_RayConstraints constraints; // Says the details of casting individual rays. /* Function that for given square coordinates returns height of the floor (in RCL_Units). */ @@ -35,7 +38,9 @@ RCL_Unit floorHeightAt(int16_t x, int16_t y) make the walls twice as high. */ /* You can either generate the level procedurally as above, or read it from - an array and return it here. */ + an array and return it here. You can also animate the level here, there + are no limits. Just keep in mind this function should be fast because + it will get called a lot. */ } /* Function that will be called by the library in order to draw individual @@ -46,7 +51,7 @@ void pixelFunc(RCL_PixelInfo *pixel) uint8_t color; /* The pixel variable holds all kind of info about the pixel to be rendered. - Check the PixelInfo struct for details. */ + Check the RCL_PixelInfo struct for details. */ if (pixel->isWall) color = pixel->hit.direction + 2; // give walls different colors @@ -76,9 +81,9 @@ int main() RCL_initCamera(&camera); /* To initialize all parameters so that none remains undefined. */ - // Set the camera position to square [4;6]. - camera.position.x = 4 * RCL_UNITS_PER_SQUARE; - camera.position.y = 6 * RCL_UNITS_PER_SQUARE; + // Set the camera position to the middle of square [2;3]. + camera.position.x = 2 * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2; + camera.position.y = 3 * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2; camera.height = RCL_UNITS_PER_SQUARE;