#include#include #include "glut.h" /* 3D-CGを変更する際の移動量 */ #define movesize 0.01 #define rotatesize 10 #define KEEP 1 /* 運動を表す文字定数 */ #define UP 2 #define DOWN 3 #define RIGHT 4 #define LEFT 5 #define FORWARD 6 #define BACK 7 #define ROTX 8 #define ROT_X 9 #define ROTY 10 #define ROT_Y 11 #define ROTZ 12 #define ROT_Z 13 /* 3D_CGの変更および描画を行なう関数 */ void change_model(int motion, int premotion) { int c; c = motion; if (c == KEEP) c = premotion; /* 認識結果が */ switch (c) { case UP : glTranslatef(0.0, movesize, 0.0); /* +y方向への並進運動 */ break; case DOWN : glTranslatef(0.0, -movesize, 0.0); /* -y方向への並進運動 */ break; case RIGHT : glTranslatef(movesize, 0.0, 0.0); /* +x方向への並進運動 */ break; case LEFT : glTranslatef(-movesize, 0.0, 0.0); /* -x方向への並進運動 */ break; case FORWARD : glTranslatef(0.0, 0.0, movesize*2); /* +z方向への並進運動 */ break; case BACK : glTranslatef(0.0, 0.0, -movesize*2); /* -z方向への並進運動 */ break; case ROTX : glRotatef(rotatesize, 1.0, 0.0, 0.0); /* +x軸回りの回転運動 */ break; case ROT_X : glRotatef(-rotatesize, 1.0, 0.0, 0.0); /* -x軸回りの回転運動 */ break; case ROTY : glRotatef(rotatesize, 0.0, 1.0, 0.0); /* +y軸回りの回転運動 */ break; case ROT_Y : glRotatef(-rotatesize, 0.0, 1.0, 0.0); /* -y軸回りの回転運動 */ break; case ROTZ : glRotatef(rotatesize, 0.0, 0.0, 1.0); /* +z軸回りの回転運動 */ break; case ROT_Z : glRotatef(-rotatesize, 0.0, 0.0, 1.0); /* -z軸回りの回転運動 */ break; default : break; } /* glBegin(GL_LINES); glVertex2f(-2.0,2.0); glVertex2f(-2.0,1.0); glEnd(); glEnable(GL_LINE_STIPPLE); glLineStipple(1, 0x0101); glBegin(GL_LINES); glVertex2f(-2.0,1.0); glVertex2f(-1.0,1.0); glEnd(); glLineStipple(1,0x00FF); glBegin(GL_LINES); glVertex2f(-2.0,1.0); glVertex2f(-2.5,0.5); glEnd();*/ glutSolidCube(0.7); glPushMatrix(); glTranslatef(0.5,0.0,0.0); glutWireCube(0.2); glPopMatrix(); }
programのページへ戻る