Eigen::Matrix4fget_model_matrix(floatrotation_angle){//初始化一个4*4的单位矩阵Eigen::Matrix4fmodel=Eigen::Matrix4f::Identity();floatradian=rotation_angle/180.f*MY_PI;// TODO: Implement this function// Create the model matrix for rotating the triangle around the Z axis.// Then return it.model<<cos(radian),-sin(radian),0,0,sin(radian),cos(radian),0,0,0,0,1,0,0,0,0,1;returnmodel;}
Eigen::Matrix4fget_projection_matrix(floateye_fov,floataspect_ratio,floatzNear,floatzFar){// Students will implement this functionEigen::Matrix4fprojection=Eigen::Matrix4f::Identity();// TODO: Implement this function// Create the projection matrix for the given parameters.// Then return it.projection(0,0)=1/(aspect_ratio*tan(eye_fov/180.0f*MY_PI/2));projection(1,1)=1/(tan(eye_fov/180.0f*MY_PI/2));projection(2,2)=(zNear+zFar)/(zNear-zFar);projection(2,3)=2*zNear*zFar/(zNear-zFar);projection(3,2)=-1;projection(3,3)=0;projection(0,3)=0;projection(1,3)=0;returnprojection;}