Updates for bazel on windows.

This commit is contained in:
2023-05-17 14:26:26 -07:00
parent a8c0ef05fb
commit 9e8f04e9b4
84 changed files with 2789 additions and 5836 deletions

372
camera.h
View File

@@ -17,361 +17,121 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef OpenArena__camera_h__
#define OpenArena__camera_h__
#if defined HAVE_CONFIG_H
// clang-format off
#include "config.h"
#endif
#include <cmath>
#ifdef WIN32
#include <windows.h> //Currently used for mouse stuff this should be replaced by oa_input
#endif
#include "window.h"
// clang-format on
namespace OpenArena {
/*!
* \brief
* The Camera class represents a camera or view in 3-dimensional space.
*
* The Camera class maintains location, view, and orientation (up view) vectors.
* The Camera can be moved and rotated in any direction. It includes a wrapper,
* Look(), for gluLookAt.
*
* \remarks
*
* \see
*/
/// @brief The Camera class represents a camera or view in 3-dimensional space.
///
/// The Camera class maintains location, view, and orientation (up view) vectors.
/// The Camera can be moved and rotated in any direction. It includes a wrapper,
/// Look(), for gluLookAt.
class Camera {
public:
/*!
* \brief
* Creates a new Camera object.
*
* Creates a new Camera object located at the origin, pointing at the negative
* z-axis with up being the positive y-axis.
*
*/
Camera(); // Default Constructor
/// @brief Creates a new Camera object.
/// Creates a new Camera object located at the origin, pointing at the negative
/// z-axis with up being the positive y-axis.
Camera();
// Camera(const Camera&); //Copy Constructor
/*!
* \brief
* Returns this Camera's position.
*
* \returns
* This Camera's position as a Vec3d vector.
*
* Returns this Camera's position.
*
*/
/// @brief Returns this Camera's position.
/// @return This Camera's position as a Vec3d vector
Vec3f Position();
/*!
* \brief
* Returns the view vector of this camera.
*
* \returns
* The view vector of this camera.
*
* \remarks
*
* \see
*/
/// @brief Returns the view vector of this camera.
/// @return The view vector of this camera.
Vec3d View();
/*!
* \brief
* Returns a vector pointing up with respect to the view.
*
* \returns
* A vector pointing up with respect to the view.
*
* \remarks
*
* \see
*/
/// @brief Returns a vector pointing up with respect to the view.
/// @return A vector pointing up with respect to the view.
Vec3d UpVector();
/*!
* \brief
* Returns this Camera's strafe vector.
*
* The strafe axis is an axis perpendicular to both the up vector and the view
* vector.
*
* \returns
* This Camera's strafe vector.
*
* \remarks
*
* \see
*/
/// @brief Returns this Camera's strafe vector.
/// The strafe axis is an axis perpendicular to both the up vector and the view vector.
/// @return This Camera's strafe vector.
Vec3d Strafe();
/*!
* \brief
* Relocates and reorients this Camera.
*
* \param xpos
* The x-coordinate of the new position vector.
*
* \param ypos
* The y-coordinate of the new position vector.
*
* \param zpos
* The z-coordinate of the new position vector.
*
* \param xview
* The x-coordinate of the new view vector.
*
* \param yview
* The y-coordinate of the new view vector.
*
* \param zview
* The z-coordinate of the new view vector.
*
* \param xup
* The x-coordinate of the new up vector.
*
* \param yup
* The y-coordinate of the new up vector.
*
* \param zup
* The z-coordinate of the new up vector.
*
* \remarks
*
* \see
*/
void PositionCamera(double xpos,
double ypos,
double zpos,
double xview,
double yview,
double zview,
double xup,
double yup,
double zup);
/// @brief Relocates and reorients this Camera.
/// @param xpos The x-cooridnate of the new position vector.
/// @param ypos The y-coordinate of the new position vector.
/// @param zpos The z-coordinate of the new position vector.
/// @param xview The x-coordinate of the new view vector.
/// @param yview The y-coordiante of the new view vector.
/// @param zview The z-cooridnate of the new view vector.
/// @param xup The x-coordinate of the new up vector.
/// @param yup The y-coordinate of the new up vector.
/// @param zup The z-coordinate of the new up vector.
void PositionCamera(double xpos, double ypos, double zpos, double xview, double yview, double zview, double xup,
double yup, double zup);
/*!
* \brief
* Relocates and reorients this Camera.
*
* \param pos
* The new position vector.
*
* \param view
* The new view vector.
*
* \param up
* The new up vector.
*
* \remarks
*
* \see
*/
/// @brief Relocates and reorients this Camera.
/// @param pos The new position vector.
/// @param view The new view vector.
/// @param up The new up vector.
void PositionCamera(Vec3d pos, Vec3d view, Vec3d up);
/*!
* \brief
* Rotates the camera a given ammount around a given axis.
*
* \param angle
* The number of degrees to rotate.
*
* \param axis
* A vector representing the axis to rotate around.
*
* This method passes the arguments to glRotatef()
* \remarks
*
* \see
*/
/// @brief Rotates the camera a given amount around a given axis.
/// @param angle The number of degrees to rotate. Is this actually degrees not radians?
/// @param axis A vector representing the axis to rotate around.
/// This method passes the arguments to glRotatef().
void RotateView(double angle, Vec3d axis);
/*!
* \brief
* Rotates the camera a given ammount around a given axis.
*
* \param angle
* The number of degrees to rotate.
*
* \param X
* The x component of the vector representing the axis to rotate around
*
* \param Y
* The y component of the vector representing the axis to rotate around
*
* \param Z
* The z component of the vector representing the axis to rotate around
*
* \remarks
* The vector should be normalized as the values get passed directly to
* glRotatef().
*
* \see
*/
/// @brief Rotates the camera a given amount around a given axis.
/// @param angle The number of degrees to rotate.
/// @param X The x-component of the vector representing the axis to rotate around.
/// @param Y The y-component of the vector representing the axis to rotate around.
/// @param Z The z-component of the vector representing the axis to rotate around.
/// The vector should be normalized as the values get passed directly to glRotatef().
void RotateView(double angle, double X, double Y, double Z);
/*!
* \brief
* Updates the view and up vectors based on mouse movement.
*
* \param window
* The Window used to get the mouse coordinates.
*
* \remarks
* This will be removed in favor of some sort of event trigger.
*
* \see
*/
/// @brief Updates the view and up vectors based on mouse movement.
/// @param window The Window used to get the mouse coordinates.
/// This will be removed in favor of some sort of event trigger.
void SetViewByMouse(Window window);
/*!
* \brief
* Moves the camera along its strafe axis a given distance.
*
* \param speed
* The distance to move.
*
* \remarks
*
* \see
*/
/// @brief Moves the camera along its strafe axis a given distance.
/// @param speed The distance to move.
void StrafeCamera(double speed);
// Purpose:
// Moves the camera along it's strafe vector speed units.
/*!
* \brief
* Moves the camera along its view vector a given number of units.
*
* \param speed
* The distance to move the camera.
*
* \remarks
*
* \see
*/
/// @brief Moves the camera along its view vector a given number of units.
/// @param speed The distance to move the camera.
void MoveCamera(double speed);
/*!
* \brief
* Recalculates the strafe vector.
*
* \remarks
*
* \see
*/
/// @brief Recalculates the strafe vector.
void Update();
/*!
* \brief
* Calls gluLookAt to tell OpenGL where to render from.
*
* \remarks
* Uses the position, view, and up vectors.
*
* \see
*/
/// @brief Calls gluLookAt to tell OpenGL where to render from.
/// Uses the position, view, and up vectors.
void Look();
/*!
* \brief
* Write brief comment for RotateHorizontal here.
*
* \param angle
* Description of parameter angle.
*
* \throws <exception class>
* Description of criteria for throwing this exception.
*
* Write detailed description for RotateHorizontal here.
*
* \remarks
* Write remarks for RotateHorizontal here.
*
* \see
* Separate items with the '|' character.
*/
void RotateHorizontal(float angle);
/*!
* \brief
* Write brief comment for RotateVertical here.
*
* \param angle
* Description of parameter angle.
*
* \throws <exception class>
* Description of criteria for throwing this exception.
*
* Write detailed description for RotateVertical here.
*
* \remarks
* Write remarks for RotateVertical here.
*
* \see
* Separate items with the '|' character.
*/
void RotateVertical(float angle);
private:
/*!
* \brief
* Write brief comment for GetUpVector here.
*
* \returns
* Write description of return value here.
*
* \throws <exception class>
* Description of criteria for throwing this exception.
*
* Write detailed description for GetUpVector here.
*
* \remarks
* Write remarks for GetUpVector here.
*
* \see
* Separate items with the '|' character.
*/
Vec3f GetUpVector();
/*!
* \brief
* Returns a unit vector pointing to the immediate right of the current view.
*
*
* \returns
* A unit vector pointing to the immediate right of the current view.
*
* Returns a unit vector pointing to the immediate right of the current view.
* This is the direction of a positive strafe movement.
*
* \remarks
*
* \see
*/
/// @brief Returns a unit vector pointing to the immediate right of the current view.
/// @return A unit vector pointing to the immediate right of the current view.
/// Returns a unit vector pointing to the immediate right of the current view. This is the direction of a positive
/// strafe movement.
Vec3f GetRightVector();
/*!
* \brief
* Returns a unit vector pointing directly into the current view.
*
* \returns
* A unit vector pointing directly into the current view.
*
* Returns a unit vector pointing directly into the current view. This is the
* direction of positive movement.
*
* \remarks
*
* \see
*/
/// @brief Returns a unit vector pointing directly into the current view.
/// @return A unit vector pointing directly into the current view.
/// Returns a unit vector pointing directly into the current view. This is the direction of positive movement.
Vec3f GetForwardVector();
void UpdateVectors();