mirror of
https://github.com/tribes2/engine.git
synced 2026-01-20 19:54:46 +00:00
116 lines
3 KiB
C++
116 lines
3 KiB
C++
//-----------------------------------------------------------------------------
|
|
// V12 Engine
|
|
//
|
|
// Copyright (c) 2001 GarageGames.Com
|
|
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#ifndef _CAMERA_H_
|
|
#define _CAMERA_H_
|
|
|
|
#ifndef _SHAPEBASE_H_
|
|
#include "game/shapeBase.h"
|
|
#endif
|
|
|
|
//----------------------------------------------------------------------------
|
|
struct CameraData: public ShapeBaseData {
|
|
typedef ShapeBaseData Parent;
|
|
|
|
//
|
|
DECLARE_CONOBJECT(CameraData);
|
|
static void consoleInit();
|
|
static void initPersistFields();
|
|
virtual void packData(BitStream* stream);
|
|
virtual void unpackData(BitStream* stream);
|
|
};
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
class Camera: public ShapeBase
|
|
{
|
|
typedef ShapeBase Parent;
|
|
|
|
enum MaskBits {
|
|
MoveMask = Parent::NextFreeMask,
|
|
NextFreeMask = Parent::NextFreeMask << 1
|
|
};
|
|
|
|
struct StateDelta {
|
|
Point3F pos;
|
|
Point3F rot;
|
|
VectorF posVec;
|
|
VectorF rotVec;
|
|
};
|
|
Point3F mRot;
|
|
StateDelta delta;
|
|
|
|
static F32 mMovementSpeed;
|
|
|
|
void setPosition(const Point3F& pos,const Point3F& viewRot);
|
|
|
|
SimObjectPtr<GameBase> mOrbitObject;
|
|
F32 mMinOrbitDist;
|
|
F32 mMaxOrbitDist;
|
|
F32 mCurOrbitDist;
|
|
Point3F mPosition;
|
|
bool mObservingClientObject;
|
|
|
|
enum
|
|
{
|
|
StationaryMode = 0,
|
|
|
|
FreeRotateMode = 1,
|
|
FlyMode = 2,
|
|
OrbitObjectMode = 3,
|
|
OrbitPointMode = 4,
|
|
|
|
CameraFirstMode = 0,
|
|
CameraLastMode = 4
|
|
};
|
|
int mode;
|
|
void setPosition(const Point3F& pos,const Point3F& viewRot, MatrixF *mat);
|
|
void setTransform(const MatrixF& mat);
|
|
F32 getCameraFov();
|
|
F32 getDefaultCameraFov();
|
|
bool isValidCameraFov(F32 fov);
|
|
void setCameraFov(F32 fov);
|
|
|
|
F32 getDamageFlash() const;
|
|
F32 getWhiteOut() const;
|
|
|
|
public:
|
|
DECLARE_CONOBJECT(Camera);
|
|
|
|
Camera();
|
|
~Camera();
|
|
static void initPersistFields();
|
|
static void consoleInit();
|
|
|
|
void onEditorEnable();
|
|
void onEditorDisable();
|
|
|
|
bool onAdd();
|
|
void onRemove();
|
|
void renderImage(SceneState* state, SceneRenderImage*);
|
|
void processTick(const Move*);
|
|
void interpolateTick(F32 dt);
|
|
void getCameraTransform(F32* pos,MatrixF* mat);
|
|
|
|
bool writePacketData(GameConnection *connection, BitStream *stream);
|
|
void readPacketData(GameConnection *connection, BitStream *stream);
|
|
U32 packUpdate(NetConnection *, U32 mask, BitStream *stream);
|
|
void unpackUpdate(NetConnection *, BitStream *stream);
|
|
Point3F &getPosition();
|
|
void setFlyMode();
|
|
void setOrbitMode(GameBase *obj, Point3F &pos, AngAxisF &rot,
|
|
F32 minDist, F32 maxDist, F32 curDist, bool ownClientObject);
|
|
void validateEyePoint(F32 pos, MatrixF *mat);
|
|
void onDeleteNotify(SimObject *obj);
|
|
|
|
GameBase * getOrbitObject() { return(mOrbitObject); }
|
|
bool isObservingClientObject() { return(mObservingClientObject); }
|
|
};
|
|
|
|
|
|
#endif
|