mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-23 20:49:57 +01:00
Add comments
This commit is contained in:
parent
606020312d
commit
2aa9ba225b
1 changed files with 30 additions and 24 deletions
20
raycastlib.h
20
raycastlib.h
|
@ -105,6 +105,10 @@ typedef struct
|
|||
Unit height;
|
||||
} Camera;
|
||||
|
||||
/**
|
||||
Holds an information about a single rendered pixel (for a pixel function
|
||||
that works as a fragment shader.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Vector2D position; ///< On-screen position.
|
||||
|
@ -123,9 +127,10 @@ typedef struct
|
|||
} RayConstraints;
|
||||
|
||||
/**
|
||||
Function used to retrieve the cells of the rendered scene. It should return
|
||||
a "type" of given square as an integer (e.g. square height) - between squares
|
||||
that return different numbers there is considered to be a collision.
|
||||
Function used to retrieve some information about cells of the rendered scene.
|
||||
It should return a characteristic of given square as an integer (e.g. square
|
||||
height, texture index, ...) - between squares that return different numbers
|
||||
there is considered to be a collision.
|
||||
*/
|
||||
typedef Unit (*ArrayFunction)(int16_t x, int16_t y);
|
||||
|
||||
|
@ -136,7 +141,6 @@ typedef void
|
|||
|
||||
/**
|
||||
Simple-interface function to cast a single ray.
|
||||
|
||||
@return The first collision result.
|
||||
*/
|
||||
HitResult castRay(Ray ray, ArrayFunction arrayFunc);
|
||||
|
@ -184,7 +188,7 @@ void castRaysMultiHit(Camera cam, ArrayFunction arrayFunc,
|
|||
RayConstraints constraints);
|
||||
|
||||
/**
|
||||
Renders a complete camera view.
|
||||
Using provided functions, renders a complete complex camera view.
|
||||
|
||||
@param cam camera whose view to render
|
||||
@param floorHeightFunc function that returns floor height (in Units)
|
||||
|
@ -390,7 +394,7 @@ int8_t pointIsLeftOfRay(Vector2D point, Ray ray)
|
|||
|
||||
/**
|
||||
Casts a ray within a single square, to collide with the square borders.
|
||||
*/
|
||||
*/
|
||||
void castRaySquare(Ray localRay, Vector2D *nextCellOff, Vector2D *collOff)
|
||||
{
|
||||
profileCall(castRaySquare);
|
||||
|
@ -607,7 +611,9 @@ ArrayFunction _floorFunction = 0;
|
|||
ArrayFunction _ceilFunction = 0;
|
||||
uint8_t _computeTextureCoords = 0;
|
||||
|
||||
/// Helper function that determines intersection with both ceiling and floor.
|
||||
/**
|
||||
Helper function that determines intersection with both ceiling and floor.
|
||||
*/
|
||||
Unit _floorCeilFunction(int16_t x, int16_t y)
|
||||
{
|
||||
// TODO: adjust also for RAYCAST_TINY
|
||||
|
|
Loading…
Reference in a new issue