CEL

Public API Reference

propclass/newcamera.h

00001 /*
00002     Crystal Space Entity Layer
00003     Copyright (C) 2001 by Jorrit Tyberghein
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CEL_PF_NEW_CAMERA__
00021 #define __CEL_PF_NEW_CAMERA__
00022 
00023 #include "cstypes.h"
00024 #include "iutil/comp.h"
00025 #include "iutil/eventh.h"
00026 #include "csutil/scf.h"
00027 #include "csutil/weakref.h"
00028 #include "csutil/weakrefarr.h"
00029 #include "csutil/refarr.h"
00030 #include "physicallayer/propclas.h"
00031 #include "physicallayer/propfact.h"
00032 #include "physicallayer/facttmpl.h"
00033 #include "celtool/stdpcimp.h"
00034 #include "celtool/stdparams.h"
00035 #include "celtool/camera.h"
00036 #include "propclass/region.h"
00037 #include "propclass/mesh.h"
00038 
00039 struct iCelEntity;
00040 struct iObjectRegistry;
00041 struct iGraphics3D;
00042 struct iEngine;
00043 struct iVirtualClock;
00044 struct iKeyboardDriver;
00045 struct iMouseDriver;
00046 struct iCollideSystem;
00047 struct iView;
00048 class csView;
00049 class celPcNewCamera;
00050 class csReversibleTransform;
00051 struct csOrthoTransform;
00052 struct iPcZoneManager;
00053 
00054 struct iPcNewCamera;
00055 
00056 struct iCelCameraMode : public virtual iBase
00057 {
00058   SCF_INTERFACE (iCelCameraMode, 0, 0, 1);
00059 
00064   virtual void SetParentCamera (iPcNewCamera * camera) = 0;
00065 
00071   virtual bool UseSpringPos () const = 0;
00072 
00078   virtual bool UseSpringTarget () const = 0;
00079 
00085   virtual bool UseSpringUp () const = 0;
00086 
00092   virtual bool AllowCollisionDetection () const = 0;
00093 
00099   virtual bool DrawAttachedMesh () const = 0;
00100 
00105   virtual float GetSpringCoefficient () const = 0;
00106 
00111   virtual const csVector3 &GetPosition () const = 0;
00112 
00117   virtual const csVector3 &GetTarget () const = 0;
00118 
00123   virtual const csVector3 &GetUp () const = 0;
00124 
00130   virtual bool DecideCameraState () = 0;
00131 };
00132 
00133 struct iTrackCameraMode : public virtual iCelCameraMode
00134 {
00135   SCF_INTERFACE (iTrackCameraMode, 0, 0, 1);
00136 
00141   virtual bool ResetCamera () = 0;
00142 
00143   enum TargetState
00144   {
00145     TARGET_BASE,
00146     TARGET_OBJ,
00147     TARGET_NONE
00148   };
00149 
00154   virtual bool SetTargetEntity (const char* name) = 0;
00155 
00162   virtual void SetTargetState (TargetState targetstate) = 0;
00163 
00168   virtual void SetTargetYOffset (float targetyoffset) = 0;
00169 };
00170 
00174 struct iPcNewCamera : public virtual iPcCamera
00175 {
00176   SCF_INTERFACE (iPcNewCamera, 0, 0, 3);
00177 
00182   virtual const csVector3 &GetBasePos () const = 0;
00183 
00188   virtual const csVector3 &GetBaseDir () const = 0;
00189 
00194   virtual const csVector3 &GetBaseUp () const = 0;
00195 
00200   virtual const csReversibleTransform &GetBaseTrans () const = 0;
00201 
00206   virtual const csVector3 &GetPos () const = 0;
00207 
00212   virtual const csVector3 &GetTarget () const = 0;
00213 
00218   virtual const csVector3 &GetUp () const = 0;
00219 
00226   virtual void SetPositionOffset (const csVector3 & offset) = 0;
00227 
00233   virtual bool DetectCollisions () const = 0;
00234 
00240   virtual void SetCollisionDetection (bool detectCollisions) = 0;
00241 
00246   virtual void SetCollisionSpringCoefficient (float springCoef) = 0;
00247 
00252   virtual float GetCollisionSpringCoefficient () const = 0;
00253 
00259   virtual bool InCameraTransition () const = 0;
00260 
00266   virtual void SetTransitionSpringCoefficient (float springCoef) = 0;
00267 
00273   virtual float GetTransitionSpringCoefficient () const = 0;
00274 
00284   virtual void SetTransitionCutoffDistance (float cutOffPosDist,
00285         float cutOffTargetDist) = 0;
00286 
00292   virtual float GetTransitionCutoffPosDistance () const = 0;
00293 
00299   virtual float GetTransitionCutoffTargetDistance () const = 0;
00300 
00306   virtual size_t AttachCameraMode (iCelCameraMode* mode) = 0;
00307 
00308   enum CEL_CAMERA_MODE
00309   {
00310     CCM_FIRST_PERSON,
00311     CCM_THIRD_PERSON,
00312     CCM_LARA_TRACK,
00313     CCM_COUNT
00314   };
00315 
00321   virtual size_t AttachCameraMode (CEL_CAMERA_MODE modetype) = 0;
00322 
00327   virtual size_t GetCurrentCameraModeIndex () const = 0;
00328 
00333   virtual iCelCameraMode* GetCurrentCameraMode () = 0;
00334 
00340   virtual bool SetCurrentCameraMode (size_t modeIndex) = 0;
00341 
00345   virtual void NextCameraMode () = 0;
00346 
00350   virtual void PrevCameraMode () = 0;
00351 
00355   virtual void Draw () = 0;
00356 
00362   virtual const csOrthoTransform &GetTransform () = 0;
00363 
00369   virtual iCelCameraMode* GetCameraMode (int idx = -1) = 0;
00370 
00371   template <typename T>
00372   csPtr<T> QueryModeInterface (int idx = -1)
00373   {
00374     iBase* cmode = GetCameraMode (idx);
00375     if (!cmode)
00376       return 0;
00377     return scfQueryInterface<T> (cmode);
00378   }
00379 };
00380 
00381 #endif // __CEL_PF_NEW_CAMERA__

Generated for CEL: Crystal Entity Layer 1.2 by doxygen 1.4.7