到https://jsyeh.org/3dcg10/
把 data, indows下載下來
Step01-1
打開Projection.exe
gluLookAt()的9個參數
前3個是eye眼睛的座標(從哪裡看)
中間3個是center的座標(看哪裡)
最後3個則是up向量
視角改變 eye
中心改變 center
橫拍直拍 up
有了這9個參數 你就可以決定攝影機是怎麼拍攝的
Step01-2
gluPerspective()裡面的參數:fovy:field of view (y方向) 視野的角度
aspect:aspect ratio 長寬比
week15-2_lookat
函式reshape(), display()
Final_Project
加上
glRotatef(angle[2],0,0,1);
glRotatef(angle[3],0,0,1);
加上
glRotatef(angle[2],0,0,1);
glRotatef(angle[3],0,0,1);
motion.txt
if(key=='s')
{
if(fout==NULL) fout = fopen("motion.txt","w");
for (int i=0;i<20;i++)
{
fprintf(fout, "%.2f ", angle[i]);
fprintf(fout, "%.2f ", angle2[i]);
}
fprintf(fout,"\n");
printf("寫了1行\n");
}
if(key=='r')
{
if(fin==NULL) fin = fopen("motion.txt","r");
for (int i=0;i<20;i++)
{
fscanf(fin, "%f", &angle[i]);
fscanf(fin, "%f", &angle2[i]);
}
glutPostRedisplay();
}
按s可以儲存動作 按r可以執行剛剛儲存的動作 (motion.txt)
沒有留言:
張貼留言