1
0
Fork 0
Toy-Raytracer/Player.h

40 lines
740 B
C
Raw Normal View History

2019-05-27 13:50:49 +02:00
//
// Created by trotfunky on 27/05/19.
//
#ifndef RAYCASTING_PLAYER_H
#define RAYCASTING_PLAYER_H
#include <cmath>
static constexpr float deg_to_rad = 3.14159265/180;
2019-05-27 13:50:49 +02:00
class Player {
public:
2024-01-28 22:08:35 +00:00
Player(float x, float y, float alpha);
2019-05-27 13:50:49 +02:00
2024-01-28 22:08:35 +00:00
float x;
float y;
float orientation;
2019-05-27 13:50:49 +02:00
2024-01-28 22:08:35 +00:00
float moveSpeed = 5;
float rotationSpeed = 180;
2024-01-28 22:08:35 +00:00
float currentMoveSpeedX = 0;
float currentMoveSpeedY = 0;
2024-01-28 22:08:35 +00:00
float currentRotationSpeed = 0;
2024-01-28 22:08:35 +00:00
/* View properties. */
float fov = 70;
float sensorSize = 0.035; /* 35mm, about equivalent to human eye ? */
float focalLength = sensorSize / (2*tanf((fov*deg_to_rad)/2));
2024-01-28 22:08:35 +00:00
void move(float dx, float dy);
void rotate(float alpha);
void updateSpeed(float localX, float localY);
2019-05-27 13:50:49 +02:00
};
#endif //RAYCASTING_PLAYER_H