static void DoPushPopTest(void) { GLfloat xTranslate = 0.0; if (multTex) { SelectTexture(1); } glTranslatef(-4.0, 0.0, 0.0); DrawSquare(); glPushAttrib(GL_TEXTURE_BIT); if (multTex) { SelectTexture(2); } glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, clamp); glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, clamp); glTranslatef(2.0, 0.0, 0.0); DrawSquare(); glPopAttrib(); glTranslatef(2.0, 0.0, 0.0); DrawSquare(); glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, clamp); glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, clamp); glTranslatef(2.0, 0.0, 0.0); DrawSquare(); }
DialogObject::DialogObject(QWidget *parent) : QDialog(parent), ui(new Ui::DialogObject), dialogItem(this) { ui->setupUi(this); ui->dialog->setEnabled(false); for (short i = 0 ; i < 4 ; ++i) ui->type->addItem(objectTypes[i]); connect(ui->interactionTalkTo, SIGNAL(toggled(bool)), ui->dialog, SLOT(setEnabled(bool))); connect(ui->type, SIGNAL(currentIndexChanged(QString)), this, SLOT(UpdateType(QString))); connect(this, SIGNAL(accepted()), this, SLOT(Apply())); connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(Reset())); connect(ui->itemList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(ItemAdd())); connect(ui->inventory, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OpenItemDialog())); connect(&dialogItem, SIGNAL(accepted()), this, SLOT(ItemSave())); connect(ui->toolSelectCharsheet, SIGNAL(clicked()), this, SLOT(SelectCharsheet())); connect(ui->toolSelectScript, SIGNAL(clicked()), this, SLOT(SelectScript())); connect(ui->toolSelectDialog, SIGNAL(clicked()), this, SLOT(SelectDialog())); connect(ui->modelPick, SIGNAL(clicked()), this, SLOT(SelectModel())); connect(ui->texturePick, SIGNAL(clicked()), this, SLOT(SelectTexture())); }
void CAnimatedSprite::Update (Uint32 inCurTicks) { // update as a normal sprite CSprite::Update (inCurTicks); // but change the texture when the time has come if (inCurTicks > mLastUpdateTicks + 1000 / mFps) { mLastUpdateTicks = inCurTicks; SelectTexture (mCurrentTextureIndex + 1); } }
CAnimatedSprite::CAnimatedSprite (CStagePtr inStage, const std::vector<std::string> &inFileNames, const SDL_Rect *inClipRect) : CSprite (inStage, nullptr, inClipRect), mLastUpdateTicks (0), mCurrentTextureIndex (0) { for (unsigned int i = 0; i < inFileNames.size(); i++) { CTexturePtr texture = mStage->CreateTexture (inFileNames[i]); if (texture) mTextures.push_back (texture); } SelectTexture (0); }
static void DrawSquares(void) { GLint i; GLfloat xTranslate = 0.0; glTranslatef(-2.0, 0.0, 0.0); for (i = 0; i < 3; i++) { if (multTex) { SelectTexture(i); } DrawSquare(); glTranslatef(2.0, 0.0, 0.0); } }
static void DrawCube(void) { GLint i; for (i = 0; i < 6; i++) { if (multTex) { SelectTexture(i); } glBegin(GL_POLYGON); glNormal3fv(n[i]); glTexCoord2fv(t[i][0]); glVertex3fv(c[i][0]); glNormal3fv(n[i]); glTexCoord2fv(t[i][1]); glVertex3fv(c[i][1]); glNormal3fv(n[i]); glTexCoord2fv(t[i][2]); glVertex3fv(c[i][2]); glNormal3fv(n[i]); glTexCoord2fv(t[i][3]); glVertex3fv(c[i][3]); glEnd(); } }
void CTextureTool::OnSelect2nd () { SelectTexture (IDC_TEXTURE_2ND, false); }
void CTextureTool::OnSelect1st () { SelectTexture (IDC_TEXTURE_1ST, true); }
//----------------------------------------------------------------------------- // Purpose: // Input : *pOnlyFace - //----------------------------------------------------------------------------- void CFaceEditMaterialPage::UpdateDialogData( CMapFace *pOnlyFace ) { BOOL bFirst; int nFaceAlignCount; int nWorldAlignCount; float fshiftX = NOT_INIT; float fshiftY = NOT_INIT; float fscaleX = NOT_INIT; float fscaleY = NOT_INIT; float frotate = NOT_INIT; //float fsmooth = NOT_INIT; int material = NOT_INIT; int nLightmapScale = NOT_INIT; CString strTexture; bFirst = TRUE; nFaceAlignCount = 0; nWorldAlignCount = 0; CFaceEditSheet *pSheet = ( CFaceEditSheet* )GetParent(); int faceCount = pSheet->GetFaceListCount(); for( int i = 0; i < faceCount || pOnlyFace; i++ ) { CMapFace *pFace; if( pOnlyFace ) { pFace = pOnlyFace; } else { pFace = pSheet->GetFaceListDataFace( i ); } TEXTURE &t = pFace->texture; // // Gather statistics about the texture alignment of all the selected faces. // This is used later to set the state of the alignment checkboxes. // int nAlignment = pFace->GetTextureAlignment(); if (nAlignment & TEXTURE_ALIGN_FACE) { nFaceAlignCount++; } if (nAlignment & TEXTURE_ALIGN_WORLD) { nWorldAlignCount++; } // // First update - copy first face's stuff into edit fields. // if (bFirst) { fshiftX = t.UAxis[3]; fshiftY = t.VAxis[3]; fscaleX = t.scale[0]; fscaleY = t.scale[1]; frotate = t.rotate; material = t.material; strTexture = t.texture; nLightmapScale = t.nLightmapScale; // // Get the face's orientation. This is used by Apply to make intelligent decisions. // m_eOrientation = pFace->GetOrientation(); Assert(m_eOrientation != FACE_ORIENTATION_INVALID); // // Set the appropriate checkbox state for the face attributes. // m_FaceContents = t.q2contents; m_FaceSurface = t.q2surface; for (int nItem = 0; nItem < sizeof(FaceAttributes) / sizeof(FaceAttributes[0]); nItem++) { int nSet = ((*FaceAttributes[nItem].puAttribute & FaceAttributes[nItem].uFlag) != 0); CButton *pButton = (CButton *)GetDlgItem(FaceAttributes[nItem].uControlID); if (pButton != NULL) { pButton->SetCheck(nSet); } } bFirst = FALSE; if (pOnlyFace) // use one face - now break { break; } } else { // update fields with face's data if (t.UAxis[3] != fshiftX) { fshiftX = NOT_INIT; } if (t.VAxis[3] != fshiftY) { fshiftY = NOT_INIT; } if (t.scale[0] != fscaleX) { fscaleX = NOT_INIT; } if (t.scale[1] != fscaleY) { fscaleY = NOT_INIT; } if (t.rotate != frotate) { frotate = NOT_INIT; } if (t.material != material) { material = NOT_INIT; } if (t.nLightmapScale != nLightmapScale) { nLightmapScale = NOT_INIT; } if (!strTexture.IsEmpty() && strTexture != t.texture) { strTexture = ""; } // // Update the checkbox state for the face attributes. If any of this face's // attributes are different from the current checkbox state, set the checkbox // to the undefined state. // m_FaceContents = t.q2contents; m_FaceSurface = t.q2surface; for (int nItem = 0; nItem < sizeof(FaceAttributes) / sizeof(FaceAttributes[0]); nItem++) { int nSet = ((*FaceAttributes[nItem].puAttribute & FaceAttributes[nItem].uFlag) != 0); CButton *pButton = (CButton *)GetDlgItem(FaceAttributes[nItem].uControlID); if (pButton != NULL) { if (pButton->GetCheck() != nSet) { pButton->SetButtonStyle(BS_AUTO3STATE); pButton->SetCheck(2); } } } } } // // Set the state of the face alignment checkbox. // CButton *pFaceAlign = (CButton *)GetDlgItem(IDC_ALIGN_FACE); if (nFaceAlignCount == 0) { pFaceAlign->SetCheck(0); } else if (nFaceAlignCount == faceCount) { pFaceAlign->SetCheck(1); } else { pFaceAlign->SetCheck(2); } // // Set the state of the world alignment checkbox. // CButton *pWorldAlign = (CButton *)GetDlgItem(IDC_ALIGN_WORLD); if (nWorldAlignCount == 0) { pWorldAlign->SetCheck(0); } else if (nWorldAlignCount == faceCount) { pWorldAlign->SetCheck(1); } else { pWorldAlign->SetCheck(2); } // // Set up fields. // FloatToSpin(fshiftX, (CSpinButtonCtrl*)GetDlgItem(IDC_SPINSHIFTX), FALSE); FloatToSpin(fshiftY, (CSpinButtonCtrl*)GetDlgItem(IDC_SPINSHIFTY), FALSE); IntegerToSpin(nLightmapScale, (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_LIGHTMAP_SCALE)); FloatToWnd(fscaleX, &m_scaleX); FloatToWnd(fscaleY, &m_scaleY); FloatToSpin(frotate, (CSpinButtonCtrl*)GetDlgItem(IDC_SPINROTATE), TRUE); if (!strTexture.IsEmpty()) { SelectTexture( strTexture ); } else { // make empty m_TextureList.SetCurSel( -1 ); } // // if no faces selected -- get selection from texture bar // if( faceCount == 0 ) { CString strTexName = GetDefaultTextureName(); SelectTexture( strTexName ); } // // Call ctexturebar implementation because OUR implementation sets the // q2 checkboxes, which flashes the screen a bit (cuz we change them // again three lines down.) // UpdateTexture(); // Update the smoothing group data. if ( GetMaterialPageTool() == MATERIALPAGETOOL_SMOOTHING_GROUP ) { m_FaceSmoothDlg.UpdateControls(); } }