
///////////////////////////////////////////////////////////////////////////////
//
// File   : AVP_Human_CameraHandler.cpp
// Author : Chris Wallace
// Date   : 5-Feb-2007
//
// Copyright (C) 2007 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// Include files...
////////////////////////////////////////////////////////////////////////////////

#include "Core/Asura.h"

// This file's header...
#include "AVP_Human_CameraHandler.h"

// Asura independent header-files...
#include "Core/Asura_Timers.h"

// Game independent header-files...
#include "Blueprint/AVP_Blueprint_HashIDs.h"
#include "Entity/PhysicalObject/Actor/Vertebrates/Human/AVP_ClientActor_Human.h"


////////////////////////////////////////////////////////////////////////////////
// Constant declarations...
////////////////////////////////////////////////////////////////////////////////

AVP_Actor_CameraProperties g_xCameraPropertiesHuman =
{
	0.2f,										// camera radius
	0.02f,										// pull-back speed

	0.55f,										// third person offset distance
	1.5f,										// the distance below which the offset is reduced
	Asura_Maths::DegToRad(85.0f),				// third person FOV
	0.5f,										// duration from third to first
	0.5f,										// duration from first to third
	8.0f,										// character turn speed when changing to first person camera

	3.5f,										// maximum angular velocity of the camera when rotating around the player
	0.1f,										// time taken for the angular velocity to half

	0.27f,										// half player width used for LOS corner tests
	1.001f,										// extra factor to ensure moving camera around corner

	Asura_Vector_3(0.0f, -2.1f, -0.1f),			// offset for the back of the head
	2.0f,										// distance before character starts to fade out

	3.2f,										// distance for camera to follow player inside
	4.5f,										// distance for camera to follow player outside
	3.0f,										// distance for camera to move back from player in open space
	3.0f,										// distance above which the camera looks at the player
	5.0f,										// distance for the grapple LOS tests to determine the camera move direction

	0.5f,										// factor for camera to follow player inside
	0.5f,										// factor for camera to follow player outside
	3.0f,										// factor for smoothing character height
	1.5f,										// factor for smoothing camera height
	7.0f,										// factor for moving the camera around walls
	7.0f,										// factor for moving the camera behind the player when lock is held
	0.2f,										// factor for moving the camera behind the player automatically after inactive period

	1.0f,										// duration to change from outside to inside camera
	1.0f,										// duration to change from inside to outside camera
	0.1f,										// duration after which the camera gives up moving behind walls and is placed in front
/*
		{											// outside camera
			0.0f,												// threshold
				Asura_Vector_3(0.0f, -2.0f, -9.0f),					// displacement (x component is to the right of the player)
				Asura_Euler_3(0.0f, 0.0f, 0.0f),					// rotation (y component is clock-wise from above)
				2.0f,												// displacement duration
				2.0f,												// rotation duration
		},
		{											// inside camera
			0.0f,												// ..
				Asura_Vector_3(0.8f, -0.5f, -2.5f),					// ...
				Asura_Euler_3(0.0f, 0.0f, 0.0f),
				2.0f,
				2.0f,
			},
			{											// grapple camera (left side; right is the mirror image of this)
				0.0f,
					Asura_Vector_3(-1.5f, 0.7f, 0.5f),	
					Asura_Euler_3(0.0f, Asura_Maths::Deg90, 0.0f),
					1.7f,
					1.7f,
			},
			{											// two-step grapple camera - step 1
				0.0f,
					Asura_Vector_3(0.0f, -0.5f, -2.5f),
					Asura_Euler_3(0.0f, 0.0f, 0.0f),
					1.0f,
					0.5f,
				},
				{											// two-step grapple camera - step 2
					0.5f,
						Asura_Vector_3(-1.5f, 0.7f, 0.5f),	
						Asura_Euler_3(0.0f, Asura_Maths::Deg90, 0.0f),
						1.7f,
						2.5f,
				},
				{
					0.0f,									// locked camera outside (left side)
						Asura_Vector_3(-10.0f, -1.5f, -0.5f),
						Asura_Euler_3(0.0f, Asura_Maths::DegToRad(50.0f), 0.0f),	// clock-wise from above
						1.0f,
						1.0f,
					},
					{
						0.0f,									// locked camera inside (left side)
							Asura_Vector_3(-5.0f, -0.7f, -1.7f),
							Asura_Euler_3(0.0f, Asura_Maths::DegToRad(50.0f), 0.0f),	// clock-wise from above
							1.0f,
							1.0f,
					},
*/
};

////////////////////////////////////////////////////////////////////////////////
// Static variable declarations...
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
// Private functions...
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
// Protected functions...
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
// Public functions...
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// Function     : AVP_Human_CameraHandler::AVP_Human_CameraHandler
// Author       : Chris Wallace
// Date         : 5-Feb-2007
////////////////////////////////////////////////////////////////////////////////

AVP_Human_CameraHandler::AVP_Human_CameraHandler (const Asura_Guid uOwnerGuid)
: PARENT(uOwnerGuid, g_xCameraPropertiesHuman)
{
}

/// End of function 'AVP_Human_CameraHandler::AVP_Human_CameraHandler'. ///

bool AVP_Human_CameraHandler::CanZoomOut(void)
{
	if(AVP_CAMERA_NUM_ZOOM_LEVELS >= 1)
	{
		return (m_uZoomLevel > 1);
	}
	else
	{
		return (m_uZoomLevel > 0);
	}
}

/// End of file. ///
