//P = (4, -2, 1.5)
	  //    R1 = 60 about Z 
	  //    T1 = (2, 3, 4) //
	  //    R2 = -60 about X
	 //    T2 = (-1, 2, 5)

// Include all GLM core / GLSL features
#include "glm/glm.hpp" // vec2, vec3, mat4, radians
// Include all GLM extensions
#include "glm/ext.hpp" // perspective, translate, rotate
#include <iostream>
using namespace std;

int main(void)
{
	glm::vec4 p(4.0, -2.0, 1.5, 1.0);
	glm::vec3 eye(1, 1, 10);
	glm::vec3 target(0, 0, 0);
	glm::vec3 vY(0,1,0);
	glm::vec3 vfwd;
	glm::vec3 vup;
	glm::vec3 vside;
	glm::vec3 T;
	vfwd = glm::normalize(eye - target);
	vside = glm::normalize(glm::cross(-vfwd, vY));
	vup = glm::normalize(glm::cross(vside, -vfwd));
	T.x = glm::dot(vside, eye);
	T.y = glm::dot(vup, eye);
	T.z = glm::dot(-vfwd, eye);
	//create the camera matrix V
	glm::mat4 V = glm::mat4(vside.x,vup.x, -vfwd.x, 0.0, // note this is the leftmost column, not the top row
		vside.y, vup.y, -vfwd.y, 0.0,
		vside.z, vup.z, -vfwd.z, 0.0,
		-T.x, -T.y, -T.z, 1.0);

	glm::mat4 View = glm::lookAt(eye, target, vY);
	glm::vec4 pv = View * p;
	cout <<"(" << pv.x <<","<< pv.y <<","<< pv.z << ")" << endl;
	pv = V * p;
	cout << "(" << pv.x << "," << pv.y << "," << pv.z << ")" << endl;
	
	//glm::mat4 Proj = glm::perspective(glm::radians(60.f), 1.33f, 0.1f, 10.f);
	//glm::mat4 Translate1 = glm::translate(glm::mat4(1.f), glm::vec3(2.0f, 3.0f, 4.0f));
	//glm::mat4 Translate2 = glm::translate(glm::mat4(1.f), glm::vec3(-1.0f, 2.0f, 5.0f));
	//glm::mat4 Rotate1 = glm::rotate(glm::mat4(1.f), glm::radians(60.0f), glm::vec3(0, 0, 1));
	//glm::mat4 Rotate2 = glm::rotate(glm::mat4(1.f), glm::radians(-60.0f), glm::vec3(1, 0, 0));
	//glm::vec4 pcheck = Model * p;

	//glm::mat4 MV = View * Model;
	//cout << pd.x << endl;
	return 0;
}
//Try v=(1,2,3,1);  Translate by (3,1,5) then rotate about z-axis by 60 degrees