World: Implement raycaster
Implement the basic raycaster, checking every block intersection and the block linked to that position. Split the screen uniformally along the width. Add data needed for camera maths in the Player class Specify constraints on the raycast parameters. Render the screen using the raycasts. Call the renderer in the main loop.
This commit is contained in:
parent
34625a841d
commit
b359ff171f
4 changed files with 126 additions and 28 deletions
8
World.h
8
World.h
|
@ -48,12 +48,12 @@ private:
|
|||
sf::Color wallColor = sf::Color(84,56,34)) const;
|
||||
/**
|
||||
* Cast a ray from a given position and return the on-screen scale.
|
||||
* @param originX Ray X origin
|
||||
* @param originY Ray Y origin
|
||||
* @param orientation Angle to cast to, in degrees
|
||||
* @param originX Ray X origin, strictly positive
|
||||
* @param originY Ray Y origin, strictly positive
|
||||
* @param orientation Angle to cast to, in degrees between 0 and 360
|
||||
* @return Scale on the screen of the hit wall.
|
||||
*/
|
||||
float castRay(float originX, float originY, float orientation);
|
||||
float castRay(float originX, float originY, float orientation) const;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue