#include <W3DView.h>
Inherits View, and SubsystemInterface.
Public Member Functions | |
| W3DView () | |
| ~W3DView () | |
| virtual void | init (void) |
| init/re-init the W3DView | |
| virtual void | reset (void) |
| virtual void | drawView (void) |
| draw this view | |
| virtual void | updateView (void) |
| called once per frame to determine the final camera and object transforms | |
| virtual void | draw () |
| draw this view | |
| virtual void | update () |
| called once per frame to determine the final camera and object transforms | |
| virtual Drawable * | pickDrawable (const ICoord2D *screen, Bool forceAttack, PickType pickType) |
| pick drawable given the screen pixel coords. If force attack, picks bridges. | |
| virtual Int | iterateDrawablesInRegion (IRegion2D *screenRegion, Bool(*callback)(Drawable *draw, void *userData), void *userData) |
| all drawables in the 2D screen region will call the 'callback' | |
| virtual void | setWidth (Int width) |
| virtual void | setHeight (Int height) |
| virtual void | setOrigin (Int x, Int y) |
| Sets location of top-left view corner on display. | |
| virtual void | scrollBy (Coord2D *delta) |
| Shift the view by the given delta. | |
| virtual void | forceRedraw () |
| virtual void | setAngle (Real angle) |
| Rotate the view around the up axis by the given angle. | |
| virtual void | setPitch (Real angle) |
| Rotate the view around the horizontal axis to the given angle. | |
| virtual void | setAngleAndPitchToDefault (void) |
| Set the view angle back to default. | |
| virtual void | lookAt (const Coord3D *o) |
| Center the view on the given coordinate. | |
| virtual void | initHeightForMap (void) |
| Init the camera height for the map at the current position. | |
| virtual void | moveCameraTo (const Coord3D *o, Int miliseconds, Int shutter, Bool orient, Real easeIn, Real easeOut) |
| virtual void | moveCameraAlongWaypointPath (Waypoint *pWay, Int frames, Int shutter, Bool orient, Real easeIn, Real easeOut) |
| virtual Bool | isCameraMovementFinished (void) |
| virtual Bool | isCameraMovementAtWaypointAlongPath (void) |
| virtual void | resetCamera (const Coord3D *location, Int frames, Real easeIn, Real easeOut) |
| Move camera to location, and reset to default angle & zoom. | |
| virtual void | rotateCamera (Real rotations, Int frames, Real easeIn, Real easeOut) |
| Rotate camera about current viewpoint. | |
| virtual void | rotateCameraTowardObject (ObjectID id, Int milliseconds, Int holdMilliseconds, Real easeIn, Real easeOut) |
| Rotate camera to face an object, and hold on it. | |
| virtual void | rotateCameraTowardPosition (const Coord3D *pLoc, Int milliseconds, Real easeIn, Real easeOut, Bool reverseRotation) |
| Rotate camera to face a location. | |
| virtual void | cameraModFreezeTime (void) |
| Freezes time during the next camera movement. | |
| virtual void | cameraModFreezeAngle (void) |
| Freezes time during the next camera movement. | |
| virtual Bool | isTimeFrozen (void) |
| Freezes time during the next camera movement. | |
| virtual void | cameraModFinalZoom (Real finalZoom, Real easeIn, Real easeOut) |
| Final zoom for current camera movement. | |
| virtual void | cameraModRollingAverage (Int framesToAverage) |
| Number of frames to average movement for current camera movement. | |
| virtual void | cameraModFinalTimeMultiplier (Int finalMultiplier) |
| Final time multiplier for current camera movement. | |
| virtual void | cameraModFinalPitch (Real finalPitch, Real easeIn, Real easeOut) |
| Final pitch for current camera movement. | |
| virtual void | cameraModLookToward (Coord3D *pLoc) |
| Sets a look at point during camera movement. | |
| virtual void | cameraModFinalLookToward (Coord3D *pLoc) |
| Sets a look at point during camera movement. | |
| virtual void | cameraModFinalMoveTo (Coord3D *pLoc) |
| Sets a final move to. | |
| virtual void | cameraEnableSlaveMode (const AsciiString &thingtemplateName, const AsciiString &boneName) |
| Sets a final move to. | |
| virtual void | cameraDisableSlaveMode (void) |
| virtual void | cameraEnableRealZoomMode (void) |
| virtual void | cameraDisableRealZoomMode (void) |
| virtual void | Add_Camera_Shake (const Coord3D &position, float radius, float duration, float power) |
| virtual Int | getTimeMultiplier (void) |
| virtual void | setTimeMultiplier (Int multiple) |
| Get the time multiplier. | |
| virtual void | setDefaultView (Real pitch, Real angle, Real maxHeight) |
| Set the time multiplier. | |
| virtual void | zoomCamera (Real finalZoom, Int milliseconds, Real easeIn, Real easeOut) |
| virtual void | pitchCamera (Real finalPitch, Int milliseconds, Real easeIn, Real easeOut) |
| virtual void | setHeightAboveGround (Real z) |
| virtual void | setZoom (Real z) |
| virtual void | setZoomToDefault (void) |
| Set zoom to default value. | |
| virtual void | setFieldOfView (Real angle) |
| Set the horizontal field of view angle. | |
| virtual WorldToScreenReturn | worldToScreenTriReturn (const Coord3D *w, ICoord2D *s) |
| Transform world coordinate "w" into screen coordinate "s". | |
| virtual void | screenToWorld (const ICoord2D *s, Coord3D *w) |
| Transform screen coordinate "s" into world coordinate "w". | |
| virtual void | screenToTerrain (const ICoord2D *screen, Coord3D *world) |
| transform screen coord to a point on the 3D terrain | |
| virtual void | screenToWorldAtZ (const ICoord2D *s, Coord3D *w, Real z) |
| transform screen point to world point at the specified world Z value | |
| CameraClass * | get3DCamera () const |
| virtual const Coord3D & | get3DCameraPosition () const |
| Returns the actual camera position. | |
| virtual void | setCameraLock (ObjectID id) |
| virtual void | setSnapMode (CameraLockType lockType, Real lockDist) |
| virtual void | shake (const Coord3D *epicenter, CameraShakeType shakeType) |
| Add an impulse force to shake the camera. | |
| virtual Real | getFXPitch (void) const |
| returns the FX pitch angle | |
| virtual Bool | setViewFilterMode (enum FilterModes filterMode) |
| Turns on viewport special effect (black & white mode) | |
| virtual Bool | setViewFilter (enum FilterTypes filter) |
| Turns on viewport special effect (black & white mode) | |
| virtual void | setViewFilterPos (const Coord3D *pos) |
| Passes a position to the special effect filter. | |
| virtual enum FilterModes | getViewFilterMode (void) |
| Turns on viewport special effect (black & white mode) | |
| virtual enum FilterTypes | getViewFilterType (void) |
| Turns on viewport special effect (black & white mode) | |
| virtual void | setFadeParameters (Int fadeFrames, Int direction) |
| virtual void | set3DWireFrameMode (Bool enable) |
| enables custom wireframe rendering of 3D viewport | |
| Bool | updateCameraMovements (void) |
| virtual void | forceCameraConstraintRecalc (void) |
| virtual void | setGuardBandBias (const Coord2D *gb) |
Public Member Functions inherited from View | |
| View (void) | |
| virtual | ~View (void) |
| virtual UnsignedInt | getID (void) |
| virtual void | setZoomLimited (Bool limit) |
| limit the zoom height | |
| virtual Bool | isZoomLimited (void) |
| get status of zoom limit | |
| virtual void | getScreenCornerWorldPointsAtZ (Coord3D *topLeft, Coord3D *topRight, Coord3D *bottomLeft, Coord3D *bottomRight, Real z) |
| virtual Int | getWidth (void) |
| virtual Int | getHeight (void) |
| virtual void | getOrigin (Int *x, Int *y) |
| Return location of top-left view corner on display. | |
| virtual Real | getAngle (void) |
| virtual Real | getPitch (void) |
| Return current camera pitch. | |
| virtual void | getPosition (Coord3D *pos) |
| Returns position camera is looking at (z will be zero) | |
| virtual Real | getZoom () |
| virtual Real | getHeightAboveGround () |
| virtual void | zoomIn (void) |
| Zoom in, closer to the ground, limit to min. | |
| virtual void | zoomOut (void) |
| Zoom out, farther away from the ground, limit to max. | |
| virtual Real | getMaxZoom (void) |
| return max zoom value | |
| virtual void | setOkToAdjustHeight (Bool val) |
| Set this to adjust camera height. | |
| virtual Real | getTerrainHeightUnderCamera () |
| virtual void | setTerrainHeightUnderCamera (Real z) |
| virtual Real | getCurrentHeightAboveGround () |
| virtual void | setCurrentHeightAboveGround (Real z) |
| virtual Real | getFieldOfView (void) |
| Get the horizontal field of view angle. | |
| Bool | worldToScreen (const Coord3D *w, ICoord2D *s) |
| Transform world coordinate "w" into screen coordinate "s". | |
| virtual void | getLocation (ViewLocation *location) |
| write the view's current location in to the view location object | |
| virtual void | setLocation (const ViewLocation *location) |
| set the view's current location from to the view location object | |
| virtual ObjectID | getCameraLock () const |
| virtual void | snapToCameraLock (void) |
| virtual Drawable * | getCameraLockDrawable () const |
| virtual void | setCameraLockDrawable (Drawable *drawable) |
| virtual void | setMouseLock (Bool mouseLocked) |
| lock/unlock the mouse input to the tactical view | |
| virtual Bool | isMouseLocked (void) |
| is the mouse input locked to the tactical view? | |
Public Member Functions inherited from Snapshot | |
| Snapshot (void) | |
| ~Snapshot (void) | |
Public Member Functions inherited from SubsystemInterface | |
| SubsystemInterface () | |
| virtual | ~SubsystemInterface () |
| virtual void | postProcessLoad () |
| void | UPDATE (void) |
| void | DRAW (void) |
| AsciiString | getName (void) |
| void | setName (AsciiString name) |
Additional Inherited Members | |
Public Types inherited from View | |
| enum | CameraShakeType { SHAKE_SUBTLE = 0 , SHAKE_NORMAL , SHAKE_STRONG , SHAKE_SEVERE , SHAKE_CINE_EXTREME , SHAKE_CINE_INSANE , SHAKE_COUNT } |
| Add an impulse force to shake the camera. More... | |
| enum | WorldToScreenReturn { WTS_INSIDE_FRUSTUM = 0 , WTS_OUTSIDE_FRUSTUM , WTS_INVALID , WTS_COUNT } |
| enum | CameraLockType { LOCK_FOLLOW , LOCK_TETHER } |
Protected Member Functions inherited from View | |
| virtual void | crc (Xfer *xfer) |
| run the "light" crc check on this data structure | |
| virtual void | xfer (Xfer *xfer) |
| virtual void | loadPostProcess (void) |
| void | setPosition (const Coord3D *pos) |
| const Coord3D * | getPosition (void) const |
| virtual View * | prependViewToList (View *list) |
| Prepend this view to the given list, return the new list. | |
| virtual View * | getNextView (void) |
| Return next view in the set. | |
Protected Attributes inherited from View | |
| View * | m_next |
| List links used by the Display class. | |
| UnsignedInt | m_id |
| Rhe ID of this view. | |
| Coord3D | m_pos |
| Position of this view, in world coordinates. | |
| Int | m_width |
| Int | m_height |
| Dimensions of the view. | |
| Int | m_originX |
| Int | m_originY |
| Location of top/left view corner. | |
| Real | m_angle |
| Angle at which view has been rotated about the Z axis. | |
| Real | m_pitchAngle |
| Rotation of view direction around horizontal (X) axis. | |
| Real | m_maxZoom |
| Largest zoom value (minimum actual zoom) | |
| Real | m_minZoom |
| Smallest zoom value (maximum actual zoom) | |
| Real | m_maxHeightAboveGround |
| Real | m_minHeightAboveGround |
| Real | m_zoom |
| Current zoom value. | |
| Real | m_heightAboveGround |
| User's desired height above ground. | |
| Bool | m_zoomLimited |
| Camera restricted in zoom height. | |
| Real | m_defaultAngle |
| Real | m_defaultPitchAngle |
| Real | m_currentHeightAboveGround |
| Cached value for debugging. | |
| Real | m_terrainHeightUnderCamera |
| Cached value for debugging. | |
| ObjectID | m_cameraLock |
| if nonzero, id of object that the camera should follow | |
| Drawable * | m_cameraLockDrawable |
| if nonzero, drawble of object that camera should follow. | |
| CameraLockType | m_lockType |
| are we following or just tethering? | |
| Real | m_lockDist |
| how far can we be when tethered? | |
| Real | m_FOV |
| the current field of view angle | |
| Bool | m_mouseLocked |
| is the mouse input locked to the tactical view? | |
| Bool | m_okToAdjustHeight |
| Should we attempt to adjust camera height? | |
| Bool | m_snapImmediate |
| Should we immediately snap to the object we're following? | |
| Coord2D | m_guardBandBias |
| Exttra beefy margins so huge thins can stay "on-screen". | |
Protected Attributes inherited from SubsystemInterface | |
| AsciiString | m_name |
Static Protected Attributes inherited from View | |
| static UnsignedInt | m_idNext = 1 |
| Used for allocating view ID's for all views. | |
W3DView implementation of the game view class. This allows us to create a "window" into the game world that can be sized and contains controls for manipulating the camera
| W3DView::W3DView | ( | ) |
Definition at line 159 of file W3DView.cpp.
| W3DView::~W3DView | ( | ) |
Definition at line 193 of file W3DView.cpp.
|
virtual |
Reimplemented from View.
Definition at line 3352 of file W3DView.cpp.
|
virtual |
Definition at line 3342 of file W3DView.cpp.
|
virtual |
Reimplemented from View.
Definition at line 3329 of file W3DView.cpp.
|
virtual |
Definition at line 3334 of file W3DView.cpp.
|
virtual |
|
virtual |
Sets a look at point during camera movement.
Sets the look toward point for the end of a camera movement.
Reimplemented from View.
Definition at line 2684 of file W3DView.cpp.
|
virtual |
Sets a final move to.
Sets the look toward point for the end of a camera movement.
Reimplemented from View.
Definition at line 2661 of file W3DView.cpp.
Final pitch for current camera movement.
Sets the final pitch for a camera movement.
Reimplemented from View.
Definition at line 2775 of file W3DView.cpp.
|
virtual |
Final time multiplier for current camera movement.
Sets the final time multiplier for a camera movement.
Reimplemented from View.
Definition at line 2740 of file W3DView.cpp.
Final zoom for current camera movement.
Sets the final zoom for a camera movement.
Reimplemented from View.
Definition at line 2561 of file W3DView.cpp.
|
virtual |
Freezes time during the next camera movement.
Sets the final zoom for a camera movement.
Reimplemented from View.
Definition at line 2588 of file W3DView.cpp.
|
inlinevirtual |
|
virtual |
Sets a look at point during camera movement.
Sets the look toward point for a camera movement.
Reimplemented from View.
Definition at line 2609 of file W3DView.cpp.
|
virtual |
Number of frames to average movement for current camera movement.
Sets the number of frames to average motion for a camera movement
Reimplemented from View.
Definition at line 2766 of file W3DView.cpp.
|
virtual |
draw this view
Reimplemented from SubsystemInterface.
Definition at line 1533 of file W3DView.cpp.
|
virtual |
draw this view
Draw member for the W3D window, this will literally draw the window for this view
Implements View.
Definition at line 1527 of file W3DView.cpp.
|
inlinevirtual |
|
virtual |
Implements View.
Definition at line 1851 of file W3DView.cpp.
|
inline |
|
virtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
|
virtual |
Init the camera height for the map at the current position.
Reimplemented from View.
Definition at line 2378 of file W3DView.cpp.
|
virtual |
Definition at line 2830 of file W3DView.cpp.
|
virtual |
Reimplemented from View.
Definition at line 2813 of file W3DView.cpp.
|
inlinevirtual |
|
virtual |
all drawables in the 2D screen region will call the 'callback'
all the drawables in the view, that fall within the 2D screen region will call the callback function. The number of drawables that passed the test are returned. Screen coordinates assumed in absolute values relative to full display resolution.
Implements View.
Definition at line 2091 of file W3DView.cpp.
|
virtual |
Center the view on the given coordinate.
Reimplemented from View.
Definition at line 2328 of file W3DView.cpp.
|
virtual |
Move camera along a waypoint path in an interesting fashion. Sets up parameters that get evaluated in draw().
Reimplemented from View.
Definition at line 2844 of file W3DView.cpp.
|
virtual |
Move camera to in an interesting fashion. Sets up parameters that get evaluated in draw().
Reimplemented from View.
Definition at line 2398 of file W3DView.cpp.
|
virtual |
pick drawable given the screen pixel coords. If force attack, picks bridges.
cast a ray from the screen coords into the scene and return a drawable there if present. Screen coordinates assumed in absolute values relative to full display resolution.
Implements View.
Definition at line 2207 of file W3DView.cpp.
Reimplemented from View.
Definition at line 2544 of file W3DView.cpp.
|
virtual |
Reimplemented from View.
Definition at line 680 of file W3DView.cpp.
|
virtual |
Move camera to location, and reset to default angle & zoom.
Move camera to a waypoint, resetting the default angle, pitch & zoom along the way..
Reimplemented from View.
Definition at line 2789 of file W3DView.cpp.
Rotate camera about current viewpoint.
Rotate the camera
Reimplemented from View.
Definition at line 2431 of file W3DView.cpp.
|
virtual |
Rotate camera to face an object, and hold on it.
Rotate the camera to follow a unit
Reimplemented from View.
Definition at line 2456 of file W3DView.cpp.
|
virtual |
Rotate camera to face a location.
Rotate camera to face a location
Reimplemented from View.
Definition at line 2484 of file W3DView.cpp.
transform screen coord to a point on the 3D terrain
convert a pixel (x,y) to a location in the world on the terrain. Screen coordinates assumed in absolute values relative to full display resolution.
Implements View.
Definition at line 2265 of file W3DView.cpp.
Transform screen coordinate "s" into world coordinate "w".
Using the W3D camera translate the screen coord to world coord
Implements View.
Definition at line 2071 of file W3DView.cpp.
transform screen point to world point at the specified world Z value
Transformt he screen pixel coord passed in, to a world coordinate at the specified z value
Implements View.
Definition at line 3311 of file W3DView.cpp.
|
virtual |
Shift the view by the given delta.
Scroll the view by the given delta in SCREEN COORDINATES, this interface assumes we will be scrolling along the X,Y plane
Reimplemented from View.
Definition at line 1803 of file W3DView.cpp.
|
virtual |
enables custom wireframe rendering of 3D viewport
Reimplemented from View.
Definition at line 1450 of file W3DView.cpp.
|
virtual |
Rotate the view around the up axis by the given angle.
Rotate the view around the up axis to the given angle.
Reimplemented from View.
Definition at line 1861 of file W3DView.cpp.
|
virtual |
Set the view angle back to default.
Set the view angle & pitch back to default
Reimplemented from View.
Definition at line 1901 of file W3DView.cpp.
|
virtual |
Reimplemented from View.
Definition at line 1781 of file W3DView.cpp.
Reimplemented from View.
Definition at line 1444 of file W3DView.cpp.
|
virtual |
Set the horizontal field of view angle.
Set the horizontal field of view angle
Reimplemented from View.
Definition at line 2005 of file W3DView.cpp.
|
inlinevirtual |
|
virtual |
Sets the height of the viewport, while maintaining original camera perspective.
Reimplemented from View.
Definition at line 204 of file W3DView.cpp.
|
virtual |
Reimplemented from View.
Definition at line 1926 of file W3DView.cpp.
Sets location of top-left view corner on display.
Sets location of top-left view corner on display
Reimplemented from View.
Definition at line 238 of file W3DView.cpp.
|
virtual |
Rotate the view around the horizontal axis to the given angle.
Rotate the view around the horizontal (X) axis to the given angle.
Reimplemented from View.
Definition at line 1883 of file W3DView.cpp.
|
virtual |
Reimplemented from View.
Definition at line 1793 of file W3DView.cpp.
|
inlinevirtual |
|
virtual |
Turns on viewport special effect (black & white mode)
Sets the view filter.
Reimplemented from View.
Definition at line 1483 of file W3DView.cpp.
|
virtual |
Turns on viewport special effect (black & white mode)
Sets the view filter mode.
Reimplemented from View.
Definition at line 1465 of file W3DView.cpp.
|
virtual |
Passes a position to the special effect filter.
Sets the view filter mode.
Reimplemented from View.
Definition at line 1458 of file W3DView.cpp.
|
virtual |
Sets the width of the viewport, while maintaining original camera perspective.
Reimplemented from View.
Definition at line 219 of file W3DView.cpp.
|
virtual |
Reimplemented from View.
Definition at line 1954 of file W3DView.cpp.
|
virtual |
|
virtual |
Add an impulse force to shake the camera.
Add an impulse force to shake the camera. The camera shake is a simple simulation of an oscillating spring/damper. The idea is that some sort of shock has "pushed" the camera once, as an impluse, after which the camera vibrates back to its rest position.
Reimplemented from View.
Definition at line 3248 of file W3DView.cpp.
|
virtual |
called once per frame to determine the final camera and object transforms
Implements SubsystemInterface.
Definition at line 1084 of file W3DView.cpp.
| Bool W3DView::updateCameraMovements | ( | void | ) |
Definition at line 1039 of file W3DView.cpp.
|
virtual |
called once per frame to determine the final camera and object transforms
This function performs all actions which affect the camera transform or 3D objects rendered in this frame.
MW: I moved this code out out W3DView::draw() so that we can get final camera and object positions before any rendering begins. This was necessary so that reflection textures (which update before the main rendering loop) could get a correct version of the scene. Without this change, the reflections were always 1 frame behind the non-reflected view.
Implements View.
Definition at line 1078 of file W3DView.cpp.
|
virtual |
Transform world coordinate "w" into screen coordinate "s".
Using the W3D camera translate the world coordinate to a screen coord. Screen coordinates returned in absolute values relative to full display resolution.
Returns if the point is on screen, off screen, or not transformable
Implements View.
Definition at line 2021 of file W3DView.cpp.
Reimplemented from View.
Definition at line 2528 of file W3DView.cpp.