iengine/camera.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

iengine/camera.h
Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 1998-2001 by Jorrit Tyberghein
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public
    00015     License along with this library; if not, write to the Free
    00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00017 */
    00018
    00019 #ifndef __CS_IENGINE_CAMERA_H__
    00020 #define __CS_IENGINE_CAMERA_H__
    00021
    00030 #include "csgeom/matrix4.h"
    00031 #include "csutil/scf.h"
    00032 #include "csgeom/matrix4.h"
    00033
    00034 #define CS_VEC_FORWARD   csVector3(0,0,1)
    00035 #define CS_VEC_BACKWARD  csVector3(0,0,-1)
    00036 #define CS_VEC_RIGHT     csVector3(1,0,0)
    00037 #define CS_VEC_LEFT      csVector3(-1,0,0)
    00038 #define CS_VEC_UP        csVector3(0,1,0)
    00039 #define CS_VEC_DOWN      csVector3(0,-1,0)
    00040
    00041 #define CS_VEC_ROT_RIGHT  csVector3(0,1,0)
    00042 #define CS_VEC_ROT_LEFT   csVector3(0,-1,0)
    00043 #define CS_VEC_TILT_RIGHT (-csVector3(0,0,1))
    00044 #define CS_VEC_TILT_LEFT  (-csVector3(0,0,-1))
    00045 #define CS_VEC_TILT_UP    (-csVector3(1,0,0))
    00046 #define CS_VEC_TILT_DOWN  (-csVector3(-1,0,0))
    00047
    00048 class csOrthoTransform;
    00049 class csPlane3;
    00050 class csVector2;
    00051 class csVector3;
    00052
    00053 struct iSector;
    00054 struct iCamera;
    00055 struct iSceneNode;
    00056
    00064 struct iCameraListener : public virtual iBase
    00065 {
    00066   SCF_INTERFACE (iCameraListener, 0, 0, 1);
    00067
    00069   virtual void NewSector (iCamera* camera, iSector* sector) = 0;
    00070
    00072   virtual void CameraMoved (iCamera* camera) = 0;
    00073 };
    00074
    00075 #include "csutil/deprecated_warn_off.h"
    00076
    00084 struct CS_DEPRECATED_TYPE_MSG("Use iCameraListener instead")
    00085 iCameraSectorListener : public iCameraListener
    00086 {
    00087   SCF_INTERFACE (iCameraSectorListener, 1, 0, 0);
    00088
    00090   virtual void NewSector (iCamera* camera, iSector* sector) = 0;
    00091
    00092   // Make it compile.
    00093   void CameraMoved (iCamera* camera) {}
    00094 };
    00095
    00096 #include "csutil/deprecated_warn_on.h"
    00097
    00130 struct iCamera : public virtual iBase
    00131 {
    00132   SCF_INTERFACE(iCamera, 3,0,0);
    00137   virtual csPtr<iCamera> Clone () const = 0;
    00138
    00144   virtual iSceneNode* QuerySceneNode () = 0;
    00145
    00150   CS_DEPRECATED_METHOD_MSG("Use iPerspectiveCamera instead")
    00151   virtual int GetFOV () const = 0;
    00156   CS_DEPRECATED_METHOD_MSG("Use iPerspectiveCamera instead")
    00157   virtual float GetInvFOV () const = 0;
    00162   CS_DEPRECATED_METHOD_MSG("Use iPerspectiveCamera instead")
    00163   virtual float GetFOVAngle () const = 0;
    00164
    00170   CS_DEPRECATED_METHOD_MSG("Use iPerspectiveCamera instead")
    00171   virtual void SetFOV (int fov, int width) = 0;
    00177   CS_DEPRECATED_METHOD_MSG("Use iPerspectiveCamera instead")
    00178   virtual void SetFOVAngle (float fov, int width) = 0;
    00179
    00185   CS_DEPRECATED_METHOD_MSG("Use iPerspectiveCamera instead")
    00186   virtual float GetShiftX () const = 0;
    00192   CS_DEPRECATED_METHOD_MSG("Use iPerspectiveCamera instead")
    00193   virtual float GetShiftY () const = 0;
    00199   CS_DEPRECATED_METHOD_MSG("Use iPerspectiveCamera instead")
    00200   virtual void SetPerspectiveCenter (float x, float y) = 0;
    00201
    00210   virtual csOrthoTransform& GetTransform () = 0;
    00211
    00213   virtual const csOrthoTransform& GetTransform () const = 0;
    00214
    00219   virtual void SetTransform (const csOrthoTransform& tr) = 0;
    00220
    00225   virtual void MoveWorld (const csVector3& v, bool cd = true) = 0;
    00230   virtual void Move (const csVector3& v, bool cd = true) = 0;
    00238   virtual void MoveWorldUnrestricted (const csVector3& v) = 0;
    00246   virtual void MoveUnrestricted (const csVector3& v) = 0;
    00247
    00249   virtual iSector* GetSector () const = 0;
    00251   virtual void SetSector (iSector*) = 0;
    00252
    00257   CS_DEPRECATED_METHOD_MSG("Don't use it anymore")
    00258   virtual void Correct (int n) = 0;
    00259
    00261   virtual bool IsMirrored () const = 0;
    00263   virtual void SetMirrored (bool m) = 0;
    00264
    00271   virtual csPlane3* GetFarPlane () const = 0;
    00272
    00281   virtual void SetFarPlane (csPlane3* fp) = 0;
    00282
    00289   virtual long GetCameraNumber () const = 0;
    00290
    00292   virtual csVector2 Perspective (const csVector3& v) const = 0;
    00294   virtual csVector3 InvPerspective (const csVector2& p, float z) const = 0;
    00295
    00303   virtual void OnlyPortals (bool hop) = 0;
    00304
    00306   virtual bool GetOnlyPortals () = 0;
    00307
    00308 #include "csutil/deprecated_warn_off.h"
    00309
    00311   CS_DEPRECATED_METHOD_MSG("Use iCameraListener instead")
    00312   virtual void AddCameraSectorListener (iCameraSectorListener* listener) = 0;
    00314   CS_DEPRECATED_METHOD_MSG("Use iCameraListener instead")
    00315   virtual void RemoveCameraSectorListener (iCameraSectorListener* listener) = 0;
    00316
    00317 #include "csutil/deprecated_warn_on.h"
    00318
    00320   virtual void AddCameraListener (iCameraListener* listener) = 0;
    00322   virtual void RemoveCameraListener (iCameraListener* listener) = 0;
    00323
    00325   virtual const CS::Math::Matrix4& GetProjectionMatrix () = 0;
    00326
    00331   virtual const csPlane3* GetVisibleVolume (uint32& mask) = 0;
    00332
    00334   virtual void SetViewportSize (int width, int height) = 0;
    00335
    00337   virtual const CS::Math::Matrix4& GetInvProjectionMatrix () = 0;
    00338 };
    00339
    00350 struct iPerspectiveCamera : public virtual iBase
    00351 {
    00352   SCF_INTERFACE(iPerspectiveCamera, 1, 0, 1);
    00353
    00355   virtual iCamera* GetCamera() = 0;
    00356
    00358   virtual float GetFOV () const = 0;
    00360   virtual float GetInvFOV () const = 0;
    00362   virtual float GetFOVAngle () const = 0;
    00367   virtual void SetFOV (float fov, float width) = 0;
    00368
    00373   virtual void SetFOVAngle (float fov, float width) = 0;
    00374
    00379   virtual float GetShiftX () const = 0;
    00384   virtual float GetShiftY () const = 0;
    00389   virtual void SetPerspectiveCenter (float x, float y) = 0;
    00390
    00402   virtual float GetNearClipDistance() const = 0;
    00408   virtual void SetNearClipDistance (float dist) = 0;
    00409 };
    00410
    00421 struct iCustomMatrixCamera : public virtual iBase
    00422 {
    00423   SCF_INTERFACE(iCustomMatrixCamera, 1, 0, 0);
    00424
    00426   virtual iCamera* GetCamera() = 0;
    00427
    00429   virtual void SetProjectionMatrix (const CS::Math::Matrix4& mat) = 0;
    00430 };
    00431
    00434 #endif // __CS_IENGINE_CAMERA_H__
    00435