//Copyright (C) 2007 SiegeLord
//See ReadMe.txt and License.txt for copying information

#pragma once

struct SCamera
{
	//state variables
	float x;
	float y;
	float theta;
	float zoom;

	float zoom_desired;

	float y_v;
	float theta_v;

	transform2d trans;

	//relatively fixed thingamagings
	float y_a;
	float theta_a;
	float y_da;
	float theta_da;
	float y_target_v;
	float theta_target_v;

	float zoom_min;
	float zoom_max;
	float zoom_a;

	float y_max;
	float y_min;

	SCamera()
	{
		x = 0.0f;
		y = 0.0f;
		theta = 0.0f;

		y_v = 0.0f;
		y_a = 500.0f;
		y_da = 500.0f;
		y_target_v = 200.0f;

		theta_v = 0.0f;
		theta_a = 2.0f;
		theta_da = 4.0f;
		theta_target_v = 0.3f;

		y_max = 1000.0f;
		y_min = 0.0f;
		zoom = 1.0f;
		zoom_desired = 1.0f;
		zoom_min = 0.5f;
		zoom_max = 2.0f;
		zoom_a = 3.0f;
	}
};

extern SCamera g_strCamera;

void InitCamera(float radius, float init_theta, float min_radius, float max_radius);

void UpdateCameraPosition();
//call this every step
void HandleCamera();

//get the world coordinates of the mouse
vector2d GetWorldMousePos();
//convers a world vector into the view coordinates(basically a manual multiplication of the projection matrix)
//make sure that handlecamera has been called before using this
void TransformWorldToView(vector2d* vec);

//draws the orbit of the camera
void DrawCameraOrbit();

void UpdateSoundParams(SSound* sound, const vector2d& position);
