void View::keyPressEvent(QKeyEvent *e) { const qreal c_keyFactor = 2.0; switch(e->key()) { case Qt::Key_Space: setAnimated( !isAnimated() ); break; case Qt::Key_Up : if(e->modifiers() & Qt::ControlModifier ) setRoll( roll() + c_keyFactor ); else setRotate( rotate() + QVector3D(-c_keyFactor , 0, 0) ); break; case Qt::Key_Down : if(e->modifiers() & Qt::ControlModifier ) setRoll( roll() - c_keyFactor ); else setRotate( rotate() + QVector3D(c_keyFactor , 0, 0) ); break; case Qt::Key_Left : setRotate( rotate() + QVector3D(0 , 0, -c_keyFactor) ); break; case Qt::Key_Right: setRotate( rotate() + QVector3D(0 , 0, c_keyFactor) ); break; case Qt::Key_Plus : setScale( scale() * 1.2 ); break; case Qt::Key_Minus: setScale( scale() / 1.2 ); break; case Qt::Key_A : if(e->modifiers() & Qt::ControlModifier ) toggleVisualHint( VH_ShowAxis); break; case Qt::Key_P : if(e->modifiers() & Qt::ControlModifier ) toggleVisualHint( VH_ShowPlane); break; default: break; } }
void Player::changeOrientation() { if(m_orientation == BACK) { m_orientation = AHEAD; setRotate(0, glm::vec3(0.0, 0.0, 1.0)); } else { m_orientation = BACK; setRotate(PI, glm::vec3(0.0, 0.0, 1.0)); } }
void Transformable::setRotate( f32 angle, vec3f v ) { setRotate(angle, v.x, v.y, v.z); }
TransformNode::TransformNode(Renderer& rend) : SceneNode(rend) { setTranslate(0, 0, 0); setRotate(0, 0, 0); setScale(1, 1, 1); }
/** * This makes a step, this will be called procedurally * to make several steps for each set of steps **/ Object* makeStep( float height, float angle, float xTrans, float zTrans ) { Object *step = mkObject( "step.jpg", "stepsScene.vert", "stepsScene.frag" ); // add the data to the object addVerticies( step, getSquareVerticies(), getSquareNorms(), getSquareConnectData(), getSquareNumVert(), getSquareNumVert(), getSquareUVs() ); // setup my buffers for this object setupGLBuffers( step ); float xDisp = 1.5 * cos( angle * 3.14159 / 180 ); float zDisp = -1.5 * sin( angle * 3.14159 / 180 ); GLfloat translation[] = { xDisp + xTrans, height, zDisp + zTrans}; setTrans( step->shader, translation ); // The scale for the step // it is 1x.25x.25 GLfloat scale[] = {.75, .25, .25}; setScale( step->shader, scale ); GLfloat rotate[] = {0, angle, 0}; setRotate( step->shader, rotate ); return step; }
void Camera::animate() { if(m_animatedRotation.isNull() || m_isFreeMode) return; setRotate( rotate() - m_animatedRotation ); }
void Camera::setOrientation(const glm::vec3& orientation) { glm::vec3 unit = glm::normalize(orientation); float longitude = 0.0f; float latitude = acos(unit[1]); if(unit[2] == 0) { if(unit[0] < 0) longitude = PI/2; else longitude = -PI/2; } else longitude = atan(unit[0] / unit[2]); setRotate(latitude, glm::vec3(1.0f, 0.0f, 0.0f)); setRotate(longitude, glm::vec3(0.0f, 1.0f, 0.0f)); }
void flag::drawObject() { GLenum errCode; const GLubyte *errString; //glPushMatrix(); //glLoadIdentity(); setTranslate(); setRotate(); if(colorMode == _glColor) { glEnable(GL_COLOR_MATERIAL); setColor(); } else { glDisable(GL_COLOR_MATERIAL); } setScale(); //qDebug() << "Drawing object\n"; glBindTexture(GL_TEXTURE_2D,textureId); if ((errCode = glGetError()) != GL_NO_ERROR) { errString = gluErrorString(errCode); qDebug() << "OpenGL Error: 8" << errCode; } setMaterial(); if ((errCode = glGetError()) != GL_NO_ERROR) { errString = gluErrorString(errCode); qDebug() << "OpenGL Error: 9" << errCode; } glBegin(GL_TRIANGLES); for(int i = 0; i < vertices.size();i++) { glNormal3f(normals.at(i).x(), normals.at(i).y(), normals.at(i).z()); glTexCoord2f(textures.at(i).x(), textures.at(i).y()); glVertex3f(vertices.at(i).x(), vertices.at(i).y(), vertices.at(i).z()); } glEnd(); if ((errCode = glGetError()) != GL_NO_ERROR) { errString = gluErrorString(errCode); qDebug() << "OpenGL Error: 10" << errCode; } glBindTexture(GL_TEXTURE_2D,0); if ((errCode = glGetError()) != GL_NO_ERROR) { errString = gluErrorString(errCode); qDebug() << "OpenGL Error: 11" << errCode; } //glPopMatrix(); if(debug) { debug = false; } }
void GLWidget::paintGL() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glLoadIdentity(); Draw_Arrows(); //FillTorus(0.12,8,1.0,25); setRotate(); Draw(); //glCallList(theTorus); swapBuffers(); }
void QDBase::setDjVuImage(const GP<DjVuImage> & _dimg, int do_redraw) { DEBUG_MSG("QDBase::setDjVuImage(): setting new DjVu image\n"); eraseMapAreas(true, false); anno=0; cmd_mode_force=-1; if (dimg) rectDocument.clear(); else { // Just in case if any derived class has already preset position of // the rectDocument (in accordance with the saved_data) rectDocument.xmax=rectDocument.xmin; rectDocument.ymax=rectDocument.ymin; } dimg=_dimg; image_size_known=0; QDBase::imageUpdated(); // If the current resolution is due to ANTa chunk only, reset it if (zoom_src==SRC_ANT) setZoom(prefs.nDefaultZoom, 0, SRC_ANT); if (mode_src==SRC_ANT) setMode(IDC_DISPLAY_COLOR, 0, SRC_ANT); if (rotate_src==SRC_ANT) setRotate(IDC_ROTATE_0, 0, SRC_ANT); decodeAnno(false); // No redraw layout(0); // Disallow redraw setRotate(cmd_rotate, 0, rotate_src); // perform rotation if (do_redraw) redraw(); }
void GLWidget::Draw() { setRotate(); GLfloat length = 2.0; int i,j,k; glPushMatrix(); for( i = -1; i <= 1; i++) for( j = -1; j <= 1; j++) for( k = -1; k <= 1; k++) { glPushMatrix(); glTranslatef(length*i*1.05,length*j*1.05,length*k*1.05); cube(length); glPopMatrix(); } glPopMatrix(); swapBuffers(); ///////////////////////////////// /* glPushMatrix(); glBegin( GL_QUADS ); glColor3f( 0.0, 1.0, 0.0 ); glVertex3f( 1.0, 1.0, -1.0 ); glVertex3f( -1.0, 1.0, -1.0 ); glVertex3f( -1.0, 1.0, 1.0 ); glVertex3f( 1.0, 1.0, 1.0 );glColor3f( 1.0, 0.5, 0.0 ); glVertex3f( 1.0, -1.0, 1.0 ); glVertex3f( -1.0, -1.0, 1.0 ); glVertex3f( -1.0, -1.0, -1.0 ); glVertex3f( 1.0, -1.0, -1.0 );glColor3f( 1.0, 0.0, 0.0 ); glVertex3f( 1.0, 1.0, 1.0 ); glVertex3f( -1.0, 1.0, 1.0 ); glVertex3f( -1.0, -1.0, 1.0 ); glVertex3f( 1.0, -1.0, 1.0 );glColor3f( 1.0, 1.0, 0.0 ); glVertex3f( 1.0, -1.0, -1.0 ); glVertex3f( -1.0, -1.0, -1.0 ); glVertex3f( -1.0, 1.0, -1.0 ); glVertex3f( 1.0, 1.0, -1.0 );glColor3f( 0.0, 0.0, 1.0 ); glVertex3f( -1.0, 1.0, 1.0 ); glVertex3f( -1.0, 1.0, -1.0 ); glVertex3f( -1.0, -1.0, -1.0 ); glVertex3f( -1.0, -1.0, 1.0 );glColor3f( 1.0, 0.0, 1.0 ); glVertex3f( 1.0, 1.0, -1.0 ); glVertex3f( 1.0, 1.0, 1.0 ); glVertex3f( 1.0, -1.0, 1.0 ); glVertex3f( 1.0, -1.0, -1.0 ); glEnd(); glPopMatrix(); */ }
RotateControlet::RotateControlet( const string& name, const Ogre::Vector3& pos,//旋转中心点 const Ogre::Vector3& axis, //旋转轴 const Ogre::Real raduis, //半径 RotateNotifyEvent func, Ogre::Real scale ): RigidControlet(name,scale), mRaduis(raduis){ setRotate( pos,axis,raduis,scale ); mNotify = func; }
void GLWidget::Draw() { setRotate(); glColor3f(1.0f,1.0f,1.0f); glEnable(GL_LIGHTING); glColor3f(0.0,0.0,1.0); glutSolidSphere(0.5,64,64); //glutWireSphere(0.25,128,128); glDisable(GL_LIGHTING); glDisable(GL_BLEND); }
void TImageSnapshot::showParams() { QImage tempImg = wgt->image; if (manipulatorIsClosed) { manip = new ImageManipulator(QList<QVariant>() << imageParams.brightness << imageParams.contrast << wgt->imageTransform.rotate + serverValues[0] << imageParams.gamma << picMode->getLBorder() << picMode->getRBorder() << wgt->imageTransform.horFlip << wgt->imageTransform.verFlip << wgt->imageTransform.imageScale << picMode->_maxContrast << _timer << picMode->getPictureMode() << wgt->imageTransform.fullPictureMode << wgt->moveX << wgt->moveY << dimX / picMode->getDelimitr() << dimY, val16, tempImg); manip->setAttribute(Qt::WA_DeleteOnClose); manipulatorIsClosed = false; manip->setModal(true); connect(manip, SIGNAL(destroyed()), this, SLOT(manipDestroed())); connect(manip, SIGNAL(setBr(QVariant)), this, SLOT(setBrightness(QVariant))); connect(manip, SIGNAL(setCon(QVariant)), this, SLOT(setContrast(QVariant))); connect(manip, SIGNAL(setGm(QVariant)), this, SLOT(setGamma(QVariant))); connect(manip, SIGNAL(setLBorder(unsigned short)), this, SLOT(setLBorder(unsigned short))); connect(manip, SIGNAL(setRBorder(unsigned short)), this, SLOT(setRBorder(unsigned short))); connect(manip, SIGNAL(sendRotationVal(QVariant)), this, SLOT(setRotate(QVariant))); connect(manip, SIGNAL(sendHorFlipVal(QVariant)), this, SLOT(setHFlip(QVariant))); connect(manip, SIGNAL(sendVerFlipVal(QVariant)), this, SLOT(setVFlip(QVariant))); //connect(manip, SIGNAL(changeFormatOfColor(int)), this, SLOT(setImageType(int))); connect(manip, SIGNAL(changePictureModeSignal(int)), this, SLOT(setImageType(int))); connect(manip, SIGNAL(setTime(int)), this, SLOT(sendTimer(int))); connect(manip, SIGNAL(setScaleSignal(double)), this, SLOT(setScale(double))); connect(manip, SIGNAL(fullScreenMode(bool)), this, SLOT(setFullscreenMode(bool))); connect(manip, SIGNAL(getDataHistogram()), this, SLOT(drawHistogram())); connect(manip, SIGNAL(chPicX(int)), wgt, SLOT(setMoveX(int))); connect(manip, SIGNAL(chPicY(int)), wgt, SLOT(setMoveY(int))); connect(wgt, SIGNAL(showPictureSize(int, int, int, int)), manip, SLOT(setShowPicSize(int, int, int, int))); setImage(wgt->image); manip->show(); } }
void GLWidget::VolumeFog() { glLoadIdentity(); setRotate(); glEnable(GL_FOG); glBegin(GL_QUADS); //后墙 glFogCoordfEXT(0.0f); glVertex3f(-2.5f,-2.5f,-6.0f); glFogCoordfEXT(0.0f); glVertex3f( 2.5f,-2.5f,-6.0f); glFogCoordfEXT(0.0f); glVertex3f( 2.5f, 2.5f,-6.0f); glFogCoordfEXT(0.0f); glVertex3f(-2.5f, 2.5f,-6.0f); glEnd(); glBegin(GL_QUADS); // 地面 glFogCoordfEXT(0.0f); glVertex3f(-2.5f,-2.5f,-6.0f); glFogCoordfEXT(0.0f); glVertex3f( 2.5f,-2.5f,-6.0f); glFogCoordfEXT(1.0f); glVertex3f( 2.5f,-2.5f, 6.0f); glFogCoordfEXT(1.0f); glVertex3f(-2.5f,-2.5f, 6.0f); glEnd(); glBegin(GL_QUADS); // 天花板 glFogCoordfEXT(0.0f); glVertex3f(-2.5f, 2.5f,-6.0f); glFogCoordfEXT(0.0f); glVertex3f( 2.5f, 2.5f,-6.0f); glFogCoordfEXT(1.0f); glVertex3f( 2.5f, 2.5f, 6.0f); glFogCoordfEXT(1.0f); glVertex3f(-2.5f, 2.5f, 6.0f); glEnd(); glBegin(GL_QUADS); // 右墙 glFogCoordfEXT(1.0f); glVertex3f( 2.5f,-2.5f, 6.0f); glFogCoordfEXT(1.0f); glVertex3f( 2.5f, 2.5f, 6.0f); glFogCoordfEXT(0.0f); glVertex3f( 2.5f, 2.5f,-6.0f); glFogCoordfEXT(0.0f); glVertex3f( 2.5f,-2.5f,-6.0f); glEnd(); glBegin(GL_QUADS); // 左墙 glFogCoordfEXT(1.0f); glVertex3f(-2.5f,-2.5f, 6.0f); glFogCoordfEXT(1.0f); glVertex3f(-2.5f, 2.5f, 6.0f); glFogCoordfEXT(0.0f); glVertex3f(-2.5f, 2.5f,-6.0f); glFogCoordfEXT(0.0f); glVertex3f(-2.5f,-2.5f,-6.0f); glEnd(); glBegin(GL_QUADS); //前墙 glFogCoordfEXT(1.0f); glVertex3f(-2.5f,-2.5f, 6.0f); glFogCoordfEXT(1.0f); glVertex3f( 2.5f,-2.5f, 6.0f); glFogCoordfEXT(1.0f); glVertex3f( 2.5f, 2.5f, 6.0f); glFogCoordfEXT(1.0f); glVertex3f(-2.5f, 2.5f, 6.0f); glEnd(); glDisable(GL_FOG); }
QgsMarkerLineSymbolLayerV2Widget::QgsMarkerLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { mLayer = NULL; setupUi( this ); connect( spinInterval, SIGNAL( valueChanged( double ) ), this, SLOT( setInterval( double ) ) ); connect( chkRotateMarker, SIGNAL( clicked() ), this, SLOT( setRotate() ) ); connect( spinOffset, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) ); connect( radInterval, SIGNAL( clicked() ), this, SLOT( setPlacement() ) ); connect( radVertex, SIGNAL( clicked() ), this, SLOT( setPlacement() ) ); connect( radVertexLast, SIGNAL( clicked() ), this, SLOT( setPlacement() ) ); connect( radVertexFirst, SIGNAL( clicked() ), this, SLOT( setPlacement() ) ); connect( radCentralPoint, SIGNAL( clicked() ), this, SLOT( setPlacement() ) ); }
void GLWidget::drawPar() { glLoadIdentity(); setRotate(); for( int i = 0; i < MAX_PARTICLES; i++ ) { if( PP[i].isActive) { float x = PP[i].x; float y = PP[i].y; float z = PP[i].z + zoom; glColor4f(PP[i].r,PP[i].g,PP[i].b,PP[i].life); glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(1,1); glVertex3f(x+0.5f,y+0.5f,z); glTexCoord2d(0,1); glVertex3f(x-0.5f,y+0.5f,z); glTexCoord2d(1,0); glVertex3f(x+0.5f,y-0.5f,z); glTexCoord2d(0,0); glVertex3f(x-0.5f,y-0.5f,z); glEnd(); PP[i].x+=PP[i].xi/(slowdown*1000); // 更新X坐标的位置 PP[i].y+=PP[i].yi/(slowdown*1000); // 更新Y坐标的位置 PP[i].z+=PP[i].zi/(slowdown*1000); // 更新Z坐标的位置 PP[i].xi+=PP[i].xg; // 更新X轴方向速度大小 PP[i].yi+=PP[i].yg; // 更新Y轴方向速度大小 PP[i].zi+=PP[i].zg; // 更新Z轴方向速度大小 PP[i].life-=PP[i].fade; if( PP[i].life < 0.0f) { PP[i].life=1.0f; // 产生一个新的粒子 PP[i].fade=float(rand()%100)/1000.0f+0.003f; // 随机生成衰减速率 PP[i].x=0.0f; // 新粒子出现在屏幕的中央 PP[i].y=0.0f; PP[i].z=0.0f; PP[i].xi=xSpeed+float((rand()%60)-32.0f); // 随机生成粒子速度 PP[i].yi=ySpeed+float((rand()%60)-30.0f); PP[i].zi=float((rand()%60)-30.0f); PP[i].r=colors[col][0]; // 设置粒子颜色 PP[i].g=colors[col][1]; PP[i].b=colors[col][2]; } } } }
void View::mouseMoveEvent(QMouseEvent *event) { if(m_isTouchEvent) return; const qreal c_mouseFactor = 0.2; QPoint newPos = event->pos(); if((event->buttons() & Qt::LeftButton) && (event->modifiers() & Qt::ControlModifier)) { QPoint center(width()/2, height()/2); QLineF oldLine( center, m_mousePos); QLineF newLine( center, newPos); qreal angle = oldLine.angleTo(newLine); if(angle > 180.0) angle = angle - 360.0; setRoll( roll() + angle*c_mouseFactor*2 ); } else if(event->buttons() & Qt::LeftButton) { QVector3D diffRotate = QVector3D(newPos.y() - m_mousePos.y(), 0, newPos.x() - m_mousePos.x()) * c_mouseFactor; setRotate( rotate() + diffRotate ); const qreal c_treshold = 15.0; const qreal c_speedFactor = 0.5; if(diffRotate.lengthSquared() > c_treshold) camera()->setAnimatedRotation( -diffRotate*c_speedFactor ); else camera()->setAnimatedRotation( QVector3D() ); } else if((event->buttons() & Qt::MidButton) && isFreeMode()) { QVector3D diffShift = c_mouseFactor* QVector3D(newPos.x() - m_mousePos.x(), newPos.y() - m_mousePos.y(), 0 );//newPos.x() - m_mousePos.x()) * c_mouseFactor; shift(diffShift); } m_mousePos = newPos; }
/** * Make a cylinder **/ Object* mkCylinder( float xTrans, float zTrans ) { Object *cylinder = mkObject( "pillar.jpg", "stepsScene.vert", "stepsScene.frag" ); // add the data to the object addVerticies( cylinder, getCylinderVerticies(), getCylinderNorms(), getCylinderConnectData(), getCylinderNumVert(), getCylinderNumVert(), getCylinderUVs() ); // setup my buffers for this object setupGLBuffers( cylinder ); GLfloat translation[] = { xTrans, 40, zTrans }; setTrans( cylinder->shader, translation ); GLfloat scale[] = {2.5, 2.5, 80}; setScale( cylinder->shader, scale ); GLfloat rotate[] = {90, 0, 90}; setRotate( cylinder->shader, rotate ); return cylinder; }
/** * Make a square **/ Object* mkLanding( float height, float angle, float xTrans, float zTrans ) { Object *landing = mkObject( "step.jpg", "stepsScene.vert", "stepsScene.frag" ); // add the data to the object addVerticies( landing, getSquareVerticies(), getSquareNorms(), getSquareConnectData(), getSquareNumVert(), getSquareNumVert(), getSquareUVs() ); // setup my buffers for this object setupGLBuffers( landing ); GLfloat translation[] = { xTrans, height, zTrans }; setTrans( landing->shader, translation ); GLfloat scale[] = {2, .25, 1}; setScale( landing->shader, scale ); GLfloat rotate[] = {0, angle, 0}; setRotate( landing->shader, rotate ); return landing; }
bool Player::moveTo(const e_dir direction, gdl::Clock const &clock) { glm::vec3 possibleTranslate = _directionVector[direction] * static_cast<float>(clock.getElapsed()) * _speed; e_dir directionTmp; _hasToStop = true; if (!_isAnim && (_isAnim = true)) _model->setCurrentSubAnim("move", false); if (checkCollision(_position + possibleTranslate)) { _lastTranslate = translate(possibleTranslate); } else if ((directionTmp = checkAutoMove(direction)) != NONE) { possibleTranslate = _directionVector[directionTmp] * static_cast<float>(clock.getElapsed()) * _speed; if (checkCollision(_position + possibleTranslate)) _lastTranslate = translate(possibleTranslate); } setRotate(_rotationVector[direction]); checkPlayerDeath(); return true; }
int InitCocircWeightsParams::initialize_base() { aspect = 1.0; // circular (not line oriented) sigma = 0.8; rMax = 1.4; strength = 1.0; r2Max = rMax * rMax; numFlanks = 1; shift = 0.0f; setRotate(0.0f); // rotate so that axis isn't aligned //setDeltaThetaMax(2.0f * PI); // max orientation in units of PI setThetaMax(1.0f); // max orientation in units of PI sigma_cocirc = PI / 2.0; sigma_kurve = 1.0; // fraction of delta_radius_curvature // sigma_chord = % of PI * R, where R == radius of curvature (1/curvature) // sigma_chord = 0.5; setDeltaThetaMax(PI / 2.0); cocirc_self = (pre != post); // from pv_common.h // // DK (1.0/(6*(NK-1))) /*1/(sqrt(DX*DX+DY*DY)*(NK-1))*/ // change in curvature delta_radius_curvature = 1.0; // 1 = minimum radius of curvature //why are these hard coded in!!!: min_weight = 0.0f; // read in as param POS_KURVE_FLAG = false; // handle pos and neg curvature separately SADDLE_FLAG = false; // handle saddle points separately return 1; }
void QDBase::processAnno(bool allow_redraw) // Will process DjVuAnno structure, which should have already // been created by decodeAnno() or anybody else. { DEBUG_MSG("QDBase::processAnno(): processing...\n"); DEBUG_MAKE_INDENT(3); G_TRY { eraseMapAreas(false, allow_redraw); if (!dimg || !anno || !anno->ant) return; DjVuANT * ant=anno->ant; int do_redraw=0, do_layout=0; if (!ignore_ant_mode_zoom) { switch(ant->mode) { case DjVuANT::MODE_COLOR: setMode(IDC_DISPLAY_COLOR, 0, SRC_ANT); do_redraw=1; break; case DjVuANT::MODE_FORE: setMode(IDC_DISPLAY_FOREGROUND, 0, SRC_ANT); do_redraw=1; break; case DjVuANT::MODE_BACK: setMode(IDC_DISPLAY_BACKGROUND, 0, SRC_ANT); do_redraw=1; break; case DjVuANT::MODE_BW: setMode(IDC_DISPLAY_BLACKWHITE, 0, SRC_ANT); do_redraw=1; break; default: break; } switch(ant->zoom) { case DjVuANT::ZOOM_STRETCH: setZoom(IDC_ZOOM_STRETCH, 0, SRC_ANT); do_layout=1; break; case DjVuANT::ZOOM_ONE2ONE: setZoom(IDC_ZOOM_ONE2ONE, 0, SRC_ANT); do_layout=1; break; case DjVuANT::ZOOM_WIDTH: setZoom(IDC_ZOOM_WIDTH, 0, SRC_ANT); do_layout=1; break; case DjVuANT::ZOOM_PAGE: setZoom(IDC_ZOOM_PAGE, 0, SRC_ANT); do_layout=1; break; default: if (ant->zoom!=DjVuANT::ZOOM_UNSPEC) { setZoom(IDC_ZOOM_MIN+ant->zoom, 0, SRC_ANT); do_layout=1; } } static int orient2cmd[] = { IDC_ROTATE_0, IDC_ROTATE_90, IDC_ROTATE_180, IDC_ROTATE_270 }; int rotation = orient2cmd[dimg->get_rotate() & 3]; setRotate(rotation,0,SRC_ANT); } u_int32 bg_color=ant->bg_color; if (bg_color==0xffffffff) bg_color=0xffffff; if (bg_color!=back_color) { do_redraw=1; setBackgroundColor(bg_color, false); // Don't redraw } if ((ant->hor_align!=DjVuANT::ALIGN_CENTER && ant->hor_align!=DjVuANT::ALIGN_UNSPEC) || (ant->ver_align!=DjVuANT::ALIGN_CENTER && ant->ver_align!=DjVuANT::ALIGN_UNSPEC)) do_layout=1; createMapAreas(false); do_redraw=1; if (do_layout) layout(0); // Disallow redraw if (allow_redraw && (do_layout || do_redraw)) redraw(); } G_CATCH(exc) { showError(this, exc); } G_ENDCATCH; }
void ossimMatrix4x4::makeRotate( const ossim::Quaternion& quat) { setIdentity(); setRotate(quat); }
void VMesh::draw() { if(!has_mesh) return; MStatus status; MFnMesh meshFn(pgrow, &status ); MItMeshVertex vertIter(pgrow, &status); MPoint S; MVector N, tang, ttang, binormal, dir, hair_up; MColor Cscale, Cerect, Crotate, Ccurl; float rot; MATRIX44F hair_space; MString setScale("fb_scale"); MString setErect("fb_erect"); MString setRotate("fb_rotate"); MString setCurl("fb_curl"); MIntArray conn_face; glBegin(GL_LINES); for( int i=0; !vertIter.isDone(); vertIter.next(), i++ ) { //S = vertIter.position(MSpace::kWorld); //glVertex3f(S.x, S.y, S.z); vertIter.getNormal(N, MSpace::kWorld); N.normalize(); vertIter.getColor(Cscale, &setScale); vertIter.getColor(Cerect, &setErect); vertIter.getColor(Crotate, &setRotate); vertIter.getColor(Ccurl, &setCurl); vertIter.getConnectedFaces(conn_face); tang = MVector(0,0,0); for(int j=0; j<conn_face.length(); j++) { meshFn.getFaceVertexTangent (conn_face[j], i, ttang, MSpace::kWorld); ttang.normalize(); tang += ttang; } tang /= conn_face.length(); conn_face.clear(); tang.normalize(); tang = N^tang; tang.normalize(); binormal = N^tang; if(Crotate.r<0.5) { rot = (0.5 - Crotate.r)*2; tang = tang + (binormal-tang)*rot; tang.normalize(); binormal = N^tang; } else { rot = (Crotate.r-0.5)*2; tang = tang + (binormal*-1-tang)*rot; tang.normalize(); binormal = N^tang; } dir = tang + (N - tang)*Cerect.r; dir.normalize(); //S = S+dir*Cscale.r*m_scale; //glVertex3f(S.x, S.y, S.z); hair_up = dir^binormal; hair_space.setIdentity(); hair_space.setOrientations(XYZ(binormal.x, binormal.y, binormal.z), XYZ(hair_up.x, hair_up.y, hair_up.z), XYZ(dir.x, dir.y, dir.z)); S = vertIter.position(MSpace::kWorld); hair_space.setTranslation(XYZ(S.x, S.y, S.z)); fb->create(Cscale.r*m_scale, 0, Cscale.r*m_scale*(Ccurl.r-0.5)*2); XYZ pw; for(int j=0; j<NUMBENDSEG; j++) { fb->getPoint(j, pw); hair_space.transform(pw); glVertex3f(pw.x, pw.y, pw.z); fb->getPoint(j+1, pw); hair_space.transform(pw); glVertex3f(pw.x, pw.y, pw.z); } } glEnd(); }
//--------------------------------------------------------------------- void Overlay::rotate(const Radian& angle) { setRotate(mRotate + angle); }
Node* StageSelect::getItemNode(int i) { auto item = Node::create(); Sprite* item_bk = nullptr; if(i<=fake_overstage) item_bk = Sprite::createWithSpriteFrameName("bt_mission_0.png"); else item_bk = Sprite::createWithSpriteFrameName("bt_mission_1.png"); item->setAnchorPoint(Point::ANCHOR_MIDDLE); item_bk->setPosition(Point(_cellSize.width/2,_cellSize.height/2)); item_bk->setTag(20); item->addChild(item_bk); auto item_hl = Sprite::createWithSpriteFrameName("bt_mission_3.png"); item_hl->setAnchorPoint(Point::ANCHOR_MIDDLE); item_hl->setPosition(Point(_cellSize.width/2,_cellSize.height/2)); item_hl->setTag(30); item_hl->setVisible(false); item->addChild(item_hl); if(i == _selectItem) item_hl->setVisible(true); else item_hl->setVisible(false); if(_noTouch && i==_selectItem) item_hl->setVisible(true); std::string stage_text_str = s_gameStrings.mainMenu->stagetext + " - " + Value(i+1).asString(); auto stage_text = TextSprite::create(stage_text_str,GameConfig::defaultFontName,GameConfig::defaultFontSize); if(i<fake_overstage) stage_text->setColor(Color3B(230,230,230)); else stage_text->setColor(Color3B(80,80,80)); if (_noTouch && i == _selectItem) { stage_text->setColor(DIY_COLOR_BLUE5); } stage_text->setAnchorPoint(Point::ANCHOR_MIDDLE); stage_text->setPosition(Point(_cellSize.width/2,_cellSize.height/2)); stage_text->setTag(40); item->addChild(stage_text); auto sp_new = Sprite::createWithSpriteFrameName("icon_new.png"); sp_new->setAnchorPoint(Point::ANCHOR_MIDDLE); sp_new->setPosition(Point(_cellSize.width/2+150,_cellSize.height/2)); sp_new->setTag(50); sp_new->setVisible(false); item->addChild(sp_new); if (fake_overstage == i && s_playerConfig.overstage<50) { sp_new->setVisible(true); } auto ball = RotateBall::createWithIdx(i); ball->setAnchorPoint(Point::ANCHOR_MIDDLE); ball->setPosition(100, 50); ball->setTag(60); item->addChild(ball); ball->setRotate(true); auto ball_mask = Sprite::createWithSpriteFrameName("icon_planet_mask.png"); ball_mask->setOpacity(120); ball_mask->setScale(0.8f); ball_mask->setAnchorPoint(Point::ANCHOR_MIDDLE); ball_mask->setPosition(100, 50); ball_mask->setTag(70); item->addChild(ball_mask); if(i<=fake_overstage) ball_mask->setVisible(false); else ball_mask->setVisible(true); return item; }
Quaternion::Quaternion( F32 angle1, const Vector3& axis1, F32 angle2, const Vector3& axis2, F32 angle3, const Vector3& axis3) { setRotate(angle1,axis1,angle2,axis2,angle3,axis3); }
Quaternion::Quaternion( F32 angle, const Vector3& axis) { setRotate(angle,axis); }
VOID Quaternion::setRotate( F32 angle, const Vector3& vec ) { setRotate( angle, vec[0], vec[1], vec[2] ); }