Added angle radian conversion
This commit is contained in:
parent
7c83ece187
commit
61ec153832
1 changed files with 2 additions and 3 deletions
|
@ -27,12 +27,11 @@ Ray PerspectiveCamera::createRay(float x, float y) const {
|
||||||
// Set up a left-handed coordinate system,
|
// Set up a left-handed coordinate system,
|
||||||
// in which the camera looks along the positive z-Axis
|
// in which the camera looks along the positive z-Axis
|
||||||
|
|
||||||
float angle_x = x * this->fovAngle;
|
float angle_x = x * this->fovAngle * 2 * PI / 360;
|
||||||
float angle_y = y * this->fovAngle;
|
float angle_y = y * this->fovAngle * 2 * PI / 360;
|
||||||
|
|
||||||
Vector3d rotationVector = crossProduct(forwardDirection, upDirection);
|
Vector3d rotationVector = crossProduct(forwardDirection, upDirection);
|
||||||
Vector3d rotated_x = rotateVector(forwardDirection, upDirection, angle_x);
|
Vector3d rotated_x = rotateVector(forwardDirection, upDirection, angle_x);
|
||||||
Vector3d directionVector = rotateVector(rotated_x, rotationVector, angle_y);
|
Vector3d directionVector = rotateVector(rotated_x, rotationVector, angle_y);
|
||||||
|
|
||||||
return Ray {this->position, directionVector};
|
return Ray {this->position, directionVector};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue