void init(){ glClearColor(0.1f, 0.1f, 0.1f, 1.0f); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); qtor(Rotate, current); }
void init(){ glClearColor(0.1f, 0.1f, 0.1f, 1.0f); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnable(GL_COLOR_MATERIAL); glCullFace(GL_BACK); glShadeModel(GL_SMOOTH ); glEnable(GL_NORMALIZE ); qtor(Rotate, current); #ifdef _APPLE display_dlist_sphere = glGenLists(1); GLUquadricObj *sphere; glNewList(display_dlist_sphere, GL_COMPILE); sphere = gluNewQuadric(); /* glColor4f(0.,0.,1.,1.); */ /* gluSphere(sphere, 1.f, 20, 20); */ /* glutSolidTeapot(); */ gluDeleteQuadric(sphere); mydisplay_setMaterial(ms_gold); glutSolidSphere(1.,20,20); glEndList(); display_dlist_wirecube = glGenLists(2); /* GLUquadricObj *wirecube; */ glNewList(display_dlist_wirecube, GL_COMPILE); /* wirecube = gluNewQuadric(); */ /* gluSphere(sphere, 1.f, 20, 20); */ /* glutWireTeapot(1); */ mydisplay_setMaterial(ms_emerald); /* glColor4f(1.0,0.0,0.0,1.); */ glutWireCube(1); /* gluDeleteQuadric(wirecube); */ glEndList(); #endif // _APPLE /* GLfloat ambientLight[] = {0.3f, 0.3f, 0.3f, 1.0f}; */ /* glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientLight); */ /* GLfloat lightColor[] = {0.7f, 0.7f, 0.7f, 1.0f}; */ /* glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor); */ /* glLightfv(GL_LIGHT0, GL_POSITION, light0_pos); */ }
void MMD_Bone::draw() { // 回転行列はクォータニオンとして与えられるので、回転行列に変換する qtor(rot_mat, quot); glTranslatef(tx, ty, tz); glMultMatrixf(rot_mat); // glutSolidCone(底面の半径,円錐の高さ,円の分割数,高さの分割数) glutSolidCone(0.5f, 2.2f, 10, 1); }
void OnMouseMove( int x, int y ){ double dx = (x - MouseX) * 1.333 / WIDTH; double dy = (y - MouseY) * 1.000 / HEIGHT; double len = sqrt( dx*dx + dy*dy ); if( len ){ double radian = len * PI; double thita = sin( radian ) / len; Quataion qutAfter = { cos(radian), dy*thta, dx*thta, 0.0 }; target = qutAfter * current; qtor( rotate, tagete ); } }
void mousemove(int x, int y) { double dx = (x - Mouse_X) * 1.33/glwidth; double dy = (y - Mouse_Y) * 1.0/glheight; double length = sqrt(dx * dx + dy * dy); if (length != 0.0) { double radian = length * PI; double theta = sin(radian) / length; struct Quaternion after={ cos(radian), dy * theta, dx * theta, 0.0}; Target = Qproduct (after,current); after = Target; qtor(Rotate, Target); } }