HOG2
|
#include <iostream>
#include <vector>
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <cassert>
#include "GLUtil.h"
#include "Trackball.h"
#include "Common.h"
Go to the source code of this file.
Classes | |
class | bmp_header |
Variables | |
static unsigned long | gNextWindowID = 0 |
char | gDefaultMap [1024] = "" |
const recVec | gOrigin (0.0, 0.0, 0.0) |
static std::vector< commandLineCallbackData * > | commandLineCallbacks |
static std::vector< joystickCallbackData * > | joystickCallbacks |
static std::vector< mouseCallbackData * > | mouseCallbacks |
static std::vector< mouseCallbackData2 * > | mouseCallbacks2 |
static std::vector< windowCallbackData * > | windowCallbacks |
static std::vector< frameCallbackData * > | glDrawCallbacks |
static keyboardCallbackData * | keyboardCallbacks [256] |
int AddViewport | ( | unsigned long | windowID, |
const Graphics::rect & | initial, | ||
const Graphics::rect & | fin, | ||
viewportType | v | ||
) |
Definition at line 325 of file Common.cpp.
References viewport::active, viewport::bounds, viewport::finalBound, GetContext(), MAXPORTS, recContext::numPorts, pContextInfo, viewport::type, and recContext::viewports.
int AddViewport | ( | unsigned long | windowID, |
const Graphics::rect & | r, | ||
viewportType | v | ||
) |
Definition at line 306 of file Common.cpp.
References viewport::active, viewport::bounds, viewport::finalBound, GetContext(), MAXPORTS, recContext::numPorts, pContextInfo, viewport::type, and recContext::viewports.
void cameraLookAt | ( | GLfloat | x, |
GLfloat | y, | ||
GLfloat | z, | ||
float | cameraSpeed, | ||
int | port | ||
) |
Definition at line 775 of file Common.cpp.
References recContext::camera, recContext::currPort, getCurrentContext(), pContextInfo, updateProjection(), recCamera::viewDir, recCamera::viewPos, recVec::x, recVec::y, and recVec::z.
recVec cameraLookingAt | ( | int | port | ) |
Definition at line 766 of file Common.cpp.
References recContext::camera, recContext::currPort, getCurrentContext(), pContextInfo, and recCamera::viewDir.
void cameraMoveTo | ( | GLfloat | x, |
GLfloat | y, | ||
GLfloat | z, | ||
float | cameraSpeed, | ||
int | port | ||
) |
Definition at line 792 of file Common.cpp.
References recContext::camera, recContext::currPort, getCurrentContext(), pContextInfo, updateProjection(), recCamera::viewPos, recVec::x, recVec::y, and recVec::z.
void cameraOffset | ( | GLfloat | x, |
GLfloat | y, | ||
GLfloat | z, | ||
float | cameraSpeed, | ||
int | port | ||
) |
Definition at line 808 of file Common.cpp.
References recContext::camera, recContext::currPort, getCurrentContext(), pContextInfo, updateProjection(), recCamera::viewPos, recVec::x, recVec::y, and recVec::z.
bool DoKeyboardCallbacks | ( | pRecContext | pContextInfo, |
unsigned char | keyHit, | ||
tKeyboardModifier | mod | ||
) |
Definition at line 122 of file Common.cpp.
References getModifierText(), kAnyModifier, keyboardCallbacks, keyboardCallbackData::next, pContextInfo, PrintKeyboardAssignments(), and recContext::windowID.
Referenced by DoKeyboardCommand().
bool DoKeyboardCommand | ( | pRecContext | pContextInfo, |
unsigned char | keyHit, | ||
bool | shift, | ||
bool | cntrl, | ||
bool | alt | ||
) |
Definition at line 703 of file Common.cpp.
References DoKeyboardCallbacks(), kAltDown, kControlDown, kNoModifier, kShiftDown, and pContextInfo.
Referenced by keyPressed(), and RunHOGGUI().
int GetActivePort | ( | unsigned long | windowID | ) |
Definition at line 929 of file Common.cpp.
References recContext::currPort, GetContext(), and pContextInfo.
Referenced by MyDisplayHandler().
recVec GetHeading | ( | unsigned long | windowID, |
int | which | ||
) |
Definition at line 1036 of file Common.cpp.
References GetHeading(), recVec::x, recVec::y, and recVec::z.
Referenced by GetHeading().
void GetHeading | ( | unsigned long | windowID, |
int | which, | ||
GLdouble & | hx, | ||
GLdouble & | hy, | ||
GLdouble & | hz | ||
) |
Definition at line 1043 of file Common.cpp.
References recContext::camera, recRotation::cameraRotation, GetContext(), pContextInfo, PI, and recCamera::rotations.
void GetKeyAssignmentDescriptions | ( | std::vector< std::string > & | keys | ) |
Definition at line 97 of file Common.cpp.
References keyboardCallbacks, and keyboardCallbackData::next.
void GetKeyAssignments | ( | std::vector< char > & | keys | ) |
Definition at line 84 of file Common.cpp.
References keyboardCallbacks, and keyboardCallbackData::next.
const char* getModifierText | ( | tKeyboardModifier | t | ) |
Definition at line 60 of file Common.cpp.
References kAltDown, kAnyModifier, kControlDown, kNoModifier, and kShiftDown.
Referenced by DoKeyboardCallbacks(), and PrintKeyboardAssignments().
int GetNumPorts | ( | unsigned long | windowID | ) |
Definition at line 923 of file Common.cpp.
References GetContext(), recContext::numPorts, and pContextInfo.
Referenced by MyDisplayHandler(), and MyFrameHandler().
point3d GetOGLPos | ( | pRecContext | pContextInfo, |
int | x, | ||
int | y | ||
) |
Definition at line 867 of file Common.cpp.
References recFrustum::bottom, recContext::camera, recContext::currPort, recFrustum::far, recCamera::frust, HandleFrame(), recFrustum::left, recFrustum::near, recContext::numPorts, pContextInfo, point3d, recFrustum::right, setViewport(), recFrustum::top, and updateModelView().
Graphics::rect GlobalHOGToViewport | ( | const Graphics::rect & | loc, |
int | port | ||
) |
Definition at line 393 of file Common.cpp.
References getCurrentContext(), GlobalHOGToViewport(), pContextInfo, and recContext::viewports.
Graphics::point GlobalHOGToViewport | ( | Graphics::point | where, |
int | viewport | ||
) |
Definition at line 381 of file Common.cpp.
References getCurrentContext(), GlobalHOGToViewport(), pContextInfo, and recContext::viewports.
Referenced by GlobalHOGToViewport(), and HandleMouse().
Graphics::point GlobalHOGToViewport | ( | pRecContext | pContextInfo, |
const viewport & | v, | ||
Graphics::point | where | ||
) |
Definition at line 407 of file Common.cpp.
References Graphics::rect::bottom, viewport::bounds, kScaleToFill, kScaleToSquare, Graphics::rect::left, max, pContextInfo, Graphics::rect::right, Graphics::rect::top, viewport::type, recContext::windowHeight, recContext::windowWidth, Graphics::point::x, and Graphics::point::y.
float GlobalHOGToViewportX | ( | float | x, |
int | v | ||
) |
Definition at line 347 of file Common.cpp.
References getCurrentContext(), pContextInfo, recContext::viewports, ViewportToGlobalHOG(), and Graphics::point::x.
float GlobalHOGToViewportY | ( | float | y, |
int | v | ||
) |
Definition at line 369 of file Common.cpp.
References getCurrentContext(), pContextInfo, recContext::viewports, ViewportToGlobalHOG(), recContext::windowHeight, and Graphics::point::y.
void HandleFrame | ( | pRecContext | pContextInfo, |
int | viewport | ||
) |
Definition at line 163 of file Common.cpp.
References viewport::bounds, recContext::display, Graphics::Display::EndFrame(), viewport::finalBound, glDrawCallbacks, Graphics::rect::lerp(), recContext::numPorts, pContextInfo, recContext::viewports, and recContext::windowID.
Referenced by drawGL(), and GetOGLPos().
void HandleJoystickMovement | ( | pRecContext | pContextInfo, |
double | panX, | ||
double | panY | ||
) |
Definition at line 198 of file Common.cpp.
References joystickCallbacks, pContextInfo, and recContext::windowID.
bool HandleMouse | ( | pRecContext | pContextInfo, |
int | xWindow, | ||
int | yWindow, | ||
point3d | where, | ||
tButtonType | button, | ||
tMouseEventType | mouse | ||
) |
Definition at line 564 of file Common.cpp.
References viewport::bounds, GlobalHOGToViewport(), HandleMouseClick(), MAXPORTS, pContextInfo, Graphics::PointInRect(), and recContext::viewports.
Referenced by RunHOGGUI().
bool HandleMouse | ( | pRecContext | pContextInfo, |
point3d | where, | ||
tButtonType | button, | ||
tMouseEventType | mouse | ||
) |
Definition at line 582 of file Common.cpp.
References viewport::bounds, GlobalHOGToViewport(), HandleMouseClick(), MAXPORTS, pContextInfo, Graphics::PointInRect(), and recContext::viewports.
bool HandleMouseClick | ( | pRecContext | pContextInfo, |
int | viewport, | ||
int | x, | ||
int | y, | ||
point3d | where, | ||
tButtonType | button, | ||
tMouseEventType | mouse | ||
) |
Definition at line 600 of file Common.cpp.
References HandleMouseClick(), mouseCallbacks2, pContextInfo, and recContext::windowID.
Referenced by HandleMouse(), HandleMouseClick(), if(), mouseMovedButton(), and mouseMovedNoButton().
bool HandleMouseClick | ( | pRecContext | pContextInfo, |
int | x, | ||
int | y, | ||
point3d | where, | ||
tButtonType | button, | ||
tMouseEventType | mouse | ||
) |
Definition at line 619 of file Common.cpp.
References mouseCallbacks, pContextInfo, and recContext::windowID.
void HandleWindowEvent | ( | pRecContext | pContextInfo, |
tWindowEventType | e | ||
) |
Definition at line 652 of file Common.cpp.
References pContextInfo, windowCallbacks, and recContext::windowID.
Referenced by RunHOGGUI().
void initialConditions | ( | pRecContext | pContextInfo | ) |
Definition at line 680 of file Common.cpp.
References recContext::camera, recRotation::cameraRotation, recContext::currPort, gNextWindowID, gTrackBallRotation, kScaleToSquare, MAXPORTS, recContext::moveAllPortsTogether, recContext::numPorts, pContextInfo, ReinitViewports(), resetCamera(), recCamera::rotations, recCamera::thirdPerson, recContext::windowID, and recRotation::worldRotation.
Referenced by RunHOGGUI().
void InstallCommandLineHandler | ( | CommandLineCallback | CLC, |
const char * | arg, | ||
const char * | param, | ||
const char * | usage | ||
) |
Definition at line 207 of file Common.cpp.
References commandLineCallbacks.
Referenced by InstallHandlers().
void InstallFrameHandler | ( | FrameCallback | glCall, |
unsigned long | windowID, | ||
void * | userdata | ||
) |
Definition at line 143 of file Common.cpp.
References glDrawCallbacks.
Referenced by MyWindowHandler().
void InstallJoystickHandler | ( | JoystickCallback | jC, |
void * | userdata | ||
) |
Definition at line 179 of file Common.cpp.
References joystickCallbacks.
void InstallKeyboardHandler | ( | KeyboardCallback | kf, |
const char * | title, | ||
const char * | description, | ||
tKeyboardModifier | mod, | ||
unsigned char | firstKey, | ||
unsigned char | lastKey | ||
) |
Definition at line 73 of file Common.cpp.
References keyboardCallbacks.
Referenced by InstallHandlers().
void InstallMouseClickHandler | ( | MouseCallback | mC, |
tMouseEventType | which | ||
) |
Definition at line 255 of file Common.cpp.
References mouseCallbacks.
Referenced by InstallHandlers().
void InstallMouseClickHandler | ( | MouseCallback2 | mC, |
tMouseEventType | which | ||
) |
Definition at line 260 of file Common.cpp.
References mouseCallbacks2.
void InstallWindowHandler | ( | WindowCallback | wC | ) |
Definition at line 634 of file Common.cpp.
References windowCallbacks.
Referenced by InstallHandlers().
void MoveViewport | ( | unsigned long | windowID, |
int | port, | ||
const Graphics::rect & | newLocation | ||
) |
Definition at line 341 of file Common.cpp.
References viewport::finalBound, GetContext(), pContextInfo, and recContext::viewports.
void PrintCommandLineArguments | ( | ) |
Definition at line 213 of file Common.cpp.
References commandLineCallbacks.
Referenced by ProcessCommandLineArgs().
void PrintKeyboardAssignments | ( | ) |
Definition at line 109 of file Common.cpp.
References getModifierText(), keyboardCallbacks, and keyboardCallbackData::next.
Referenced by DoKeyboardCallbacks().
void ProcessCommandLineArgs | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 222 of file Common.cpp.
References commandLineCallbacks, and PrintCommandLineArguments().
Referenced by RunHOGGUI().
void ReinitViewports | ( | unsigned long | windowID, |
const Graphics::rect & | r, | ||
viewportType | v | ||
) |
Definition at line 291 of file Common.cpp.
References viewport::active, viewport::bounds, viewport::finalBound, GetContext(), MAXPORTS, recContext::numPorts, pContextInfo, viewport::type, and recContext::viewports.
Referenced by initialConditions().
void RemoveFrameHandler | ( | FrameCallback | glCall, |
unsigned long | windowID, | ||
void * | userdata | ||
) |
Definition at line 148 of file Common.cpp.
References glDrawCallbacks.
Referenced by MyWindowHandler().
void RemoveJoystickHandler | ( | JoystickCallback | jC, |
void * | userdata | ||
) |
Definition at line 184 of file Common.cpp.
References joystickCallbacks.
void RemoveMouseClickHandler | ( | MouseCallback | mC | ) |
Definition at line 265 of file Common.cpp.
References mouseCallbacks.
void RemoveMouseClickHandler | ( | MouseCallback2 | mC | ) |
Definition at line 278 of file Common.cpp.
References mouseCallbacks2.
void RemoveWindowHandler | ( | WindowCallback | wC | ) |
Definition at line 639 of file Common.cpp.
References windowCallbacks.
void resetCamera | ( | ) |
Definition at line 722 of file Common.cpp.
References recContext::camera, recRotation::cameraRotation, getCurrentContext(), gTrackBallRotation, gTrackingContextInfo, MAXPORTS, recContext::numPorts, pContextInfo, resetCamera(), recCamera::rotations, updateProjection(), and recRotation::worldRotation.
Referenced by initialConditions(), and resetCamera().
void resetCamera | ( | recCamera * | pCamera | ) |
Definition at line 748 of file Common.cpp.
References recCamera::aperture, recCamera::viewDir, recCamera::viewPos, recCamera::viewUp, recVec::x, recVec::y, and recVec::z.
void SaveScreenshot | ( | unsigned long | windowID, |
const char * | filename | ||
) |
Definition at line 970 of file Common.cpp.
References bmp_header::bfSize, bmp_header::biHeight, bmp_header::biSizeImage, bmp_header::biWidth, GetContext(), recContext::globalCamera, height, pContextInfo, recCamera::viewHeight, recCamera::viewWidth, and width.
Referenced by MyFrameHandler().
void SetActivePort | ( | unsigned long | windowID, |
int | which | ||
) |
Definition at line 935 of file Common.cpp.
References recContext::currPort, GetContext(), and pContextInfo.
Referenced by MyDisplayHandler().
void SetNumPorts | ( | unsigned long | windowID, |
int | count | ||
) |
Definition at line 903 of file Common.cpp.
References recContext::currPort, recContext::display, GetContext(), MAXPORTS, recContext::numPorts, pContextInfo, Graphics::Display::SetNumViewports(), setPortCamera(), Graphics::Display::SetViewport(), and updateProjection().
Referenced by MyDisplayHandler(), and MyWindowHandler().
void setPortCamera | ( | pRecContext | pContextInfo, |
int | currPort | ||
) |
Definition at line 823 of file Common.cpp.
References recContext::camera, recContext::globalCamera, pContextInfo, recCamera::viewHeight, recCamera::viewOriginX, recCamera::viewOriginY, and recCamera::viewWidth.
Referenced by resizeGL(), and SetNumPorts().
void setViewport | ( | pRecContext | pContextInfo, |
int | currPort | ||
) |
Definition at line 846 of file Common.cpp.
References recContext::display, recContext::globalCamera, pContextInfo, Graphics::Display::SetViewport(), recCamera::viewHeight, and recCamera::viewWidth.
Referenced by drawGL(), and GetOGLPos().
void SetZoom | ( | int | windowID, |
float | amount | ||
) |
Definition at line 1012 of file Common.cpp.
References recCamera::aperture, recContext::camera, recContext::currPort, GetContext(), recContext::moveAllPortsTogether, recContext::numPorts, pContextInfo, and updateProjection().
Graphics::rect ViewportToGlobalHOG | ( | const Graphics::rect & | loc, |
int | port | ||
) |
Definition at line 400 of file Common.cpp.
References getCurrentContext(), pContextInfo, recContext::viewports, and ViewportToGlobalHOG().
Graphics::point ViewportToGlobalHOG | ( | Graphics::point | where, |
int | viewport | ||
) |
Definition at line 387 of file Common.cpp.
References getCurrentContext(), pContextInfo, recContext::viewports, and ViewportToGlobalHOG().
Referenced by GlobalHOGToViewportX(), GlobalHOGToViewportY(), updateProjection(), ViewportToGlobalHOG(), ViewportToGlobalHOGX(), and ViewportToScreen().
Graphics::point ViewportToGlobalHOG | ( | pRecContext | pContextInfo, |
const viewport & | v, | ||
Graphics::point | where | ||
) |
Definition at line 489 of file Common.cpp.
References Graphics::rect::bottom, viewport::bounds, kScaleToFill, kScaleToSquare, Graphics::rect::left, max, pContextInfo, Graphics::rect::right, Graphics::rect::top, viewport::type, recContext::windowHeight, recContext::windowWidth, Graphics::point::x, and Graphics::point::y.
float ViewportToGlobalHOGX | ( | float | x, |
int | v | ||
) |
Definition at line 358 of file Common.cpp.
References getCurrentContext(), pContextInfo, recContext::viewports, ViewportToGlobalHOG(), and Graphics::point::x.
Referenced by ViewportToScreenX().
|
static |
Definition at line 34 of file Common.cpp.
Referenced by InstallCommandLineHandler(), PrintCommandLineArguments(), and ProcessCommandLineArgs().
char gDefaultMap[1024] = "" |
Definition at line 29 of file Common.cpp.
Referenced by CreateSimulation(), MyCLHandler(), and MyFrameHandler().
|
static |
Definition at line 39 of file Common.cpp.
Referenced by HandleFrame(), InstallFrameHandler(), and RemoveFrameHandler().
|
static |
Definition at line 28 of file Common.cpp.
Referenced by initialConditions().
const recVec gOrigin(0.0, 0.0, 0.0) |
|
static |
Definition at line 35 of file Common.cpp.
Referenced by HandleJoystickMovement(), InstallJoystickHandler(), and RemoveJoystickHandler().
|
static |
Definition at line 42 of file Common.cpp.
Referenced by DoKeyboardCallbacks(), GetKeyAssignmentDescriptions(), GetKeyAssignments(), InstallKeyboardHandler(), and PrintKeyboardAssignments().
|
static |
Definition at line 36 of file Common.cpp.
Referenced by HandleMouseClick(), InstallMouseClickHandler(), and RemoveMouseClickHandler().
|
static |
Definition at line 37 of file Common.cpp.
Referenced by HandleMouseClick(), InstallMouseClickHandler(), and RemoveMouseClickHandler().
|
static |
Definition at line 38 of file Common.cpp.
Referenced by HandleWindowEvent(), InstallWindowHandler(), and RemoveWindowHandler().