/* ** Command & Conquer Generals(tm) ** Copyright 2025 Electronic Arts Inc. ** ** This program is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program. If not, see . */ //////////////////////////////////////////////////////////////////////////////// // // // (c) 2001-2003 Electronic Arts Inc. // // // //////////////////////////////////////////////////////////////////////////////// // FILE: W3DView.h //////////////////////////////////////////////////////////////////////////////// // // W3D implementation of the game view window. View windows are literally // a window into the game world that have width, height, and camera // controls for what to look at // // Author: Colin Day, April 2001 // /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once #ifndef __W3DVIEW_H_ #define __W3DVIEW_H_ // SYSTEM INCLUDES //////////////////////////////////////////////////////////////////////////////// // USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// #include "Common/STLTypedefs.h" #include "GameClient/View.h" #include "WW3D2/Camera.h" // FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// class Drawable; /////////////////////////////////////////////////////////////////////////////////////////////////// enum {MAX_WAYPOINTS=25}; // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ typedef struct { Int numWaypoints; Coord3D waypoints[MAX_WAYPOINTS+2]; // We pad first & last for interpolation. Real waySegLength[MAX_WAYPOINTS+2]; // Length of each segment; Real cameraAngle[MAX_WAYPOINTS+2]; // Camera Angle; Real cameraFXPitch[MAX_WAYPOINTS+2]; // Camera Pitch; Real cameraZoom[MAX_WAYPOINTS+2]; // Camera Zoom; Int timeMultiplier[MAX_WAYPOINTS+2]; // Time speedup factor. Real groundHeight[MAX_WAYPOINTS+1]; // Ground height. Int totalTimeMilliseconds; // Num of ms to do this movement. Int elapsedTimeMilliseconds; // Time since start. Real totalDistance; // Total length of paths. Real curSegDistance; // How far we are along the current seg. Int shutter; Int curSegment; // The current segment. Int curShutter; // The current shutter. Int rollingAverageFrames; // Number of frames to roll. } TMoveAlongWaypointPathInfo; // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ typedef struct { Int numFrames; ///< Number of frames to rotate. Int curFrame; ///< Current frame. Real angle; Real startZoom; Real endZoom; Real startPitch; Real endPitch; Int startTimeMultiplier; Int endTimeMultiplier; ObjectID targetObjectID; ///< Target if we are tracking an object instead of just rotating Coord3D targetObjectPos; ///< Target's position (so we can stay looking at that spot if he dies) Bool trackObject; ///< Are we tracking an object or just rotating? Int numHoldFrames; ///< Number of frames to hold the camera before finishing the movement } TRotateCameraInfo; // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ typedef struct { Int numFrames; ///< Number of frames to pitch. Int curFrame; ///< Current frame. Real angle; Real startPitch; Real endPitch; Int startTimeMultiplier; Int endTimeMultiplier; } TPitchCameraInfo; // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ typedef struct { Int numFrames; ///< Number of frames to zoom. Int curFrame; ///< Current frame. Real startZoom; Real endZoom; Int startTimeMultiplier; Int endTimeMultiplier; } TZoomCameraInfo; // ------------------------------------------------------------------------------------------------ /** 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 */ // ------------------------------------------------------------------------------------------------ class W3DView : public View, public SubsystemInterface { public: 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); ///x; m_guardBandBias.y = gb->y; } private: CameraClass *m_3DCamera; ///< camera representation for 3D scene CameraClass *m_2DCamera; ///< camera for UI overlayed on top of 3D scene enum FilterModes m_viewFilterMode; enum FilterTypes m_viewFilter; Bool m_isWireFrameEnabled; Bool m_nextWireFrameEnabled; ///< used to delay wireframe changes by 1 frame (needed for transitions). Coord2D m_shakeOffset; ///< the offset to add to the camera position Real m_shakeAngleCos; ///< the cosine of the orientation of the oscillation Real m_shakeAngleSin; ///< the sine of the orientation of the oscillation Real m_shakeIntensity; ///< the intensity of the oscillation TRotateCameraInfo m_rcInfo; Bool m_doingRotateCamera; ///< True if we are doing a camera rotate. TPitchCameraInfo m_pcInfo; Bool m_doingPitchCamera; TZoomCameraInfo m_zcInfo; Bool m_doingZoomCamera; Bool m_doingScriptedCameraLock; ///< True if we are following a unit via script Real m_FXPitch; ///< Camera effects pitch. 0 = flat, infinite = look down, 1 = normal. TMoveAlongWaypointPathInfo m_mcwpInfo; ///< Move camera along waypoint path info. Bool m_doingMoveCameraOnWaypointPath; ///< If true, moving camera along waypoint path. Bool m_freezeTimeForCameraMovement; Int m_timeMultiplier; ///< Time speedup multiplier. Bool m_cameraHasMovedSinceRequest; ///< If true, throw out all saved locations VecPosRequests m_locationRequests; ///< These are cached. New requests are added here Coord3D m_cameraOffset; ///< offset for camera from view center Coord3D m_previousLookAtPosition; ///< offset for camera from view center Coord2D m_scrollAmount; ///< scroll speed Real m_scrollAmountCutoff; ///< scroll speed at which we do not adjust height Real m_groundLevel; ///< height of ground. Region2D m_cameraConstraint; ///< m_pos should be constrained to be within this area Bool m_cameraConstraintValid; ///< if f, recalc cam constraints void setCameraTransform( void ); ///< set the transform matrix of m_3DCamera, based on m_pos & m_angle void buildCameraTransform( Matrix3D *transform ) ; ///< calculate (but do not set) the transform matrix of m_3DCamera, based on m_pos & m_angle void calcCameraConstraints() ; ///< recalc m_cameraConstraint void moveAlongWaypointPath(Int milliseconds); ///< Move camera along path. void getPickRay(const ICoord2D *screen, Vector3 *rayStart, Vector3 *rayEnd); ///