AppWindow::AppWindow ( const char* label, int x, int y, int w, int h ) : GlutWindow ( label, x, y, w, h ) { addMenuEntry ( "Option 0", evOption0 ); addMenuEntry ( "Option 1", evOption1 ); _viewaxis = true; _fovy = GS_TORAD(60.0f); _rotx = gspi/8.0f; _roty = gspi/4.0f; _w = w; _h = h; rt = 0.25f; rb = 0.25f; numfaces = 16; textureChoice = false; blendFactor = 0.75f; _lasttime = gs_time(); _animateinc = 0.1f; _animate = true; _normals = false; _flatn = true; _phong = false; initPrograms (); initTextures (); }
void AppWindow::glutIdle() { double curtime = gs_time(); if (curtime - lasttime > .01f && animate) { if (_wingsflyR >= 45 || _wingsflyR <= -45) { _animinc *= -1; } _wingsflyR += _animinc; _wingsflyL += _animinc; _backR += _animinc; _backL += _animinc; lasttime = curtime; if (resetanim == true) { if (_wingsflyR == 0) { animate = false; } } sunxc++; sunxz++; if (sunxc == 360) { sunxc = 0; sunxz = 0; } //std::cout << "_wingsfly: " << _wingsflyR << std::endl; } if (curtime - lasttime2 > .01f && sunanim) { sunxc++; sunxz++; lasttime = curtime; if (sunxc == 360) { sunxc = 0; sunxz = 0; } //std::cout << "_wingsfly: " << _wingsflyR << std::endl; } redraw(); }