#ifndef __CAM_BASE_H__
#define __CAM_BASE_H__
 
extern char cLastCutAngleSens;
extern char cJustBetterPos;
 
/*
 *************************************************************************************************
 *************************************************************************************************
 *************************************************************************************************
 *************************************************************************************************
 */
 
/*
 *	Structure to update position of camera.
 *	The fileds of that structure are passed to meca parsing.
 */
typedef struct CAM_tdstComputedPosition_
{
	MTH3D_tdstVector				stTarget;
	MTH3D_tdstVector				stMovePos;
	MTH3D_tdstVector				stRefAxisZ;
	MTH_tdxReal						xLinearSpeed;
	MTH_tdxReal						xAngularSpeed;
	MTH_tdxReal						xTargetSpeed;
} CAM_tdstComputedPosition;
 
/*
 *	Structure to use for update actions of camera.
 */
typedef struct CAM_tdstUpdateCamera_
{
	DNM_tdstReport					*p_stReport;
	DNM_tdstDynamics				*p_stDynamics;			
 
	MS_tdxHandleToCineinfo			hCineinfo;				
	MS_tdxHandleToInternalCineinfo	hCineinfoWork;
	MS_tdxHandleToInternalCineinfo	hCineinfoCurrent;
	MS_tdxHandleToInternalCineinfo	hCineinfoInit;		
	MS_tdxHandleToInternalCineinfo	hCineinfoVisibility;
 
	HIE_tdxHandleToSuperObject		hSuperObjCamera;		
 
	MTH3D_tdstVector				stCurrentCameraPos;		
	MTH3D_tdstVector				stWantedCameraPos;		
	MTH3D_tdstVector				stRealWantedCameraPos;		
 
	MTH3D_tdstVector				stTargetedPersoRealPos;	
	MTH3D_tdstVector				stTargetedPersoPos;		
	MTH3D_tdstVector				stSecondTargetedPersoRealPos;
	MTH3D_tdstVector				stSecondTargetedPersoPos;
 
	char							cHasCutAlpha;
	MTH_tdxReal						xAngleAlphaCut;
	MTH_tdxReal						xAngleDeltaAlphaCut;
 
	char							cTgtPersoIsMovingAbsolute;
	MTH3D_tdstVector				stTgtPersoMoveAbsolute;
	char							cTgtPersoIsMovingRelative;
	MTH3D_tdstVector				stTgtPersoMoveRelative;
 
	CAM_tdstComputedPosition		stCptPos;				
} CAM_tdstUpdateCamera;
 
/*
 *************************************************************************************************
 *************************************************************************************************
 *************************************************************************************************
 *************************************************************************************************
 */
 
#define CONSTANT_CUT_COL		(CAM_g_stCameraConstants.wFlags & 0x0001)
#define CONSTANT_RESETTEMP		(CAM_g_stCameraConstants.wFlags & 0x0002)
#define CONSTANT_FORCEBESTPOS	(CAM_g_stCameraConstants.wFlags & 0x0004)
#define CONSTANT_NOVISPROJ		(CAM_g_stCameraConstants.wFlags & 0x0008)
#define CONSTANT_NORMALIFJOIN	(CAM_g_stCameraConstants.wFlags & 0x0010)
#define CONSTANT_NOBETTERPOS	(CAM_g_stCameraConstants.wFlags & 0x0020)
#define CONSTANT_NODISTVIS		(CAM_g_stCameraConstants.wFlags & 0x0040)
 
/*
 *************************************************************************************************
 *************************************************************************************************
 *************************************************************************************************
 *************************************************************************************************
 */
 
 
extern void			CAM_fn_vComputeRefAxis(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern void			CAM_fn_vComputeTargetedPersoPos(CAM_tdstUpdateCamera *, HIE_tdxHandleToSuperObject, MTH3D_tdstVector *, MTH3D_tdstVector *);
extern void			CAM_fn_vComputeReferencePoint(CAM_tdstUpdateCamera *);
 
extern void			CAM_fn_vDynChangeTarget(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern void			CAM_fn_vComputeTarget(CAM_tdstUpdateCamera *);
 
extern void			CAM_fn_vBoundAngleWithTolerance(CAM_tdstUpdateCamera *, MTH_tdxReal *, MTH_tdxReal *, MTH_tdxReal *, MTH_tdxReal, MTH_tdxReal);
extern void			CAM_fn_vComputeCameraAxisAngles(CAM_tdstUpdateCamera *,	MTH3D_tdstVector *,	MTH3D_tdstVector *,	MTH_tdxReal *, MTH_tdxReal *);
extern void			CAM_fn_vRotateCameraAxis( MTH3D_tdstVector *, MTH_tdxReal, MTH_tdxReal, MTH3D_tdstVector *);
extern void			CAM_fn_vComputeRealWantedPos(CAM_tdstUpdateCamera *);
extern char			CAM_fn_cDynChangeTheta(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern void			CAM_fn_vTakeCareOfCameraAltitude(MS_tdxHandleToCineinfo, MTH3D_tdstVector *);
extern void			CAM_fn_vComputeMovePos(CAM_tdstUpdateCamera *);
extern void			CAM_fn_vComputeMovePosWithDynTheta(CAM_tdstUpdateCamera *);
 
extern void			CAM_fn_vComputeSpeed(CAM_tdstUpdateCamera *);
 
extern void			CAM_fn_vConstraintMoveAfterVisFailure(CAM_tdstUpdateCamera *);
extern void			CAM_fn_vConstraintMove(CAM_tdstUpdateCamera *);
 
extern void			CAM_fn_vUpdateGeneralCamera(CAM_tdstUpdateCamera *);
 
#endif /* __CAM_BASE_H__ */
