void OutBuilding::draw(D3DXVECTOR3 mEyePos, Light mLights[], int mLightType){ mfxLayer0Var->SetResource(mLayer0); mfxLayer1Var->SetResource(mLayer1); mfxLayer2Var->SetResource(mLayer2); mfxBlendMapVar->SetResource(mBlendMap); mfxSpecMapVar->SetResource(mSpecMap); md3dDevice->IASetInputLayout(InputLayout::PosNormalTex); md3dDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST); mfxSpecMapVar->SetResource(mSpecMap); mfxEyePosVar->SetRawValue(&mEyePos, 0, sizeof(D3DXVECTOR3)); mfxLightVar->SetRawValue(&mLights[mLightType], 0, sizeof(Light)); mfxLightType->SetInt(mLightType); setTrans(); D3DXMATRIX mView = GetCamera().view(); D3DXMATRIX mProj = GetCamera().proj(); D3DXMATRIX WVP = world*mView*mProj; mfxWVPVar->SetMatrix((float*)&WVP); mfxWorldVar->SetMatrix((float*)&world); UINT stride = sizeof(VertexPNT); UINT offset = 0; D3D10_TECHNIQUE_DESC techDesc; mTech->GetDesc( &techDesc ); for(UINT p = 0; p < techDesc.Passes; ++p){ mTech->GetPassByIndex( p )->Apply(0); md3dDevice->IASetVertexBuffers(0, 1, &mVB, &stride, &offset); md3dDevice->IASetIndexBuffer( mIB, DXGI_FORMAT_R32_UINT, 0 ); md3dDevice->DrawIndexed(mNumIndices, 0,0); } }
/** * 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; }
GameObject GameObject::operator=(GameObject _g) { setTrans(_g.getTrans()); setDir(_g.getDir()); setVel(_g.getVel()); setName(_g.getName()); setDescr(_g.getDescr()); setColRad(_g.getColRad()); setModel(_g.getModel()); return *this; }
int main(){ int n, m, i, N; char s[100]; matrix origin[10000], trans[10000], multi[10000]; scanf("%d %d ", &n, &m); i = 0; while(gets(s)){ if(s[0]==NULL) break; sscanf(s, " (%d:%d)=%d", &origin[i].row, &origin[i].col, &origin[i].val); i++; } setTrans(origin, trans, i); N = setMulti(origin, trans, multi, n, m, i); showMatrix(multi, n, n, N); return 0; }
bool Image::loadFromManager() { if (mMgr != nullptr) { Image::Ptr img = mMgr->getImage(mSource); if (img != nullptr) { setTexture(img->getTexture()); setFormat(img->getFormat()); setSource(img->getSource()); setTrans(img->getTrans()); setSize(img->getSize()); return true; } } return false; }
/** Actually rewind to the specified state. */ void KartRewinder::rewindToState(BareNetworkString *buffer) { // 1) Physics values: transform and velocities // ------------------------------------------- btTransform t; t.setOrigin(buffer->getVec3()); t.setRotation(buffer->getQuat()); btRigidBody *body = getBody(); body->setLinearVelocity(buffer->getVec3()); body->setAngularVelocity(buffer->getVec3()); // This function also reads the velocity, so it must be called // after the velocities are set body->proceedToTransform(t); // Update kart transform in case that there are access to its value // before Moveable::update() is called (which updates the transform) setTrans(t); m_has_started = buffer->getUInt8()!=0; // necessary for startup speed boost m_vehicle->setMinSpeed(buffer->getFloat()); float time_rot = buffer->getFloat(); // Set timed rotation divides by time_rot m_vehicle->setTimedRotation(time_rot, time_rot*buffer->getVec3()); // 2) Steering and other controls // ------------------------------ getControls().rewindTo(buffer); getController()->rewindTo(buffer); // 3) Attachment // ------------- getAttachment()->rewindTo(buffer); // 4) Powerup // ---------- getPowerup()->rewindTo(buffer); // 5) Max speed info // ------------------ m_max_speed->rewindTo(buffer); m_max_speed->update(0); // 6) Skidding // ----------- m_skidding->rewindTo(buffer); return; } // rewindToState
/** * 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; }
// ---------------------------------------------------------------------------- void Flyable::restoreState(BareNetworkString *buffer, int count) { btTransform t; Vec3 lv, av; CompressNetworkBody::decompress(buffer, &t, &lv, &av); if (!hasAnimation()) { m_body->setWorldTransform(t); m_motion_state->setWorldTransform(t); m_body->setInterpolationWorldTransform(t); m_body->setLinearVelocity(lv); m_body->setAngularVelocity(av); m_body->setInterpolationLinearVelocity(lv); m_body->setInterpolationAngularVelocity(av); setTrans(t); } m_ticks_since_thrown = buffer->getUInt16(); m_has_server_state = true; } // restoreState
/** * 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; }
//====================================================================== void TMComposer::SetPosition(const Point3f& pos) { setTrans(m_local_tm,Vec3f(pos)); m_build_world=true; }
void OutBuilding::Translate(float x, float y, float z){ pos.x = x; pos.y = y; pos.z = z; setTrans(); }
INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) { switch (Message) { case WM_INITDIALOG : { initDialog(); goToCenter(); return TRUE; } case WM_ACTIVATE : { UINT posBeg; UINT posEnd; ::SendMessage(_hParentHandle, HEXM_GETSEL, (WPARAM)&posBeg, (LPARAM)&posEnd); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_IN_SEL), ((posBeg == posEnd)?FALSE:TRUE)); /* change language */ NLChangeDialog(_hInst, _nppData._nppHandle, _hSelf, _T("FindReplace")); break; } case WM_COMMAND : { switch (LOWORD(wParam)) { case IDOK : { onFind(FALSE); return TRUE; } case IDC_REPLACE: { onReplace(); break; } case IDC_COUNT : { processAll(COUNT); break; } case IDC_REPLACEALL : { HWND hSci = getCurrentHScintilla(); ScintillaMsg(hSci, SCI_BEGINUNDOACTION); processAll(REPLACE_ALL); ScintillaMsg(hSci, SCI_ENDUNDOACTION); return TRUE; } case IDC_COMBO_DATATYPE: { if (HIWORD(wParam) == CBN_SELCHANGE) changeCoding(); break; } case IDC_CHECK_TRANSPARENT : { setTrans(); break; } case IDC_RADIO_DIRUP : case IDC_RADIO_DIRDOWN : { _whichDirection = isChecked(IDC_RADIO_DIRDOWN); return TRUE; } case IDC_CHECK_MATCHCASE : { _isMatchCase = isChecked(IDC_CHECK_MATCHCASE); return TRUE; } case IDC_CHECK_WRAP : { _isWrap = isChecked(IDC_CHECK_WRAP); return TRUE; } case IDC_CHECK_IN_SEL : { _isInSel = isChecked(IDC_CHECK_IN_SEL); return TRUE; } case IDCANCEL : { display(FALSE); ::SetFocus(_hParentHandle); break; } default : break; } break; } case WM_NOTIFY: { NMHDR nmhdr = *((LPNMHDR)lParam); if ((nmhdr.idFrom == IDC_SWITCH) && (nmhdr.code == TCN_SELCHANGE)) { _findReplace = TabCtrl_GetCurSel(::GetDlgItem(_hSelf, IDC_SWITCH)); updateDialog(); } break; } case WM_HSCROLL : { if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_SLIDER_PERCENTAGE)) { setTrans(); } return TRUE; } } return FALSE; }
void FindReplaceDlg::initDialog(void) { TCITEM item; TCHAR txtTab[32]; item.mask = TCIF_TEXT; if (NLGetText(_hInst, _hParent, _T("Find"), txtTab, sizeof(txtTab) / sizeof(TCHAR)) == FALSE) _tcscpy(txtTab, _T("Find")); item.pszText = txtTab; item.cchTextMax = (int)_tcslen(txtTab); ::SendDlgItemMessage(_hSelf, IDC_SWITCH, TCM_INSERTITEM, 0, (LPARAM)&item); if (NLGetText(_hInst, _hParent, _T("Replace"), txtTab, sizeof(txtTab) / sizeof(TCHAR)) == FALSE) _tcscpy(txtTab, _T("Replace")); item.pszText = txtTab; item.cchTextMax = (int)_tcslen(txtTab); ::SendDlgItemMessage(_hSelf, IDC_SWITCH, TCM_INSERTITEM, 1, (LPARAM)&item); /* init comboboxes */ _pFindCombo = new MultiTypeCombo; _pReplaceCombo = new MultiTypeCombo; _pFindCombo->init(_hParent, ::GetDlgItem(_hSelf, IDC_COMBO_FIND)); _pReplaceCombo->init(_hParent, ::GetDlgItem(_hSelf, IDC_COMBO_REPLACE)); /* set default coding */ _currDataType = HEX_CODE_HEX; _pFindCombo->setCodingType(_currDataType); _pReplaceCombo->setCodingType(_currDataType); /* set data types */ ::SendDlgItemMessage(_hSelf, IDC_COMBO_DATATYPE, CB_SETMINVISIBLE, HEX_CODE_MAX, 0); ::SendDlgItemMessage(_hSelf, IDC_COMBO_DATATYPE, CB_INSERTSTRING, HEX_CODE_HEX, (LPARAM)strCode[HEX_CODE_HEX]); ::SendDlgItemMessage(_hSelf, IDC_COMBO_DATATYPE, CB_INSERTSTRING, HEX_CODE_ASCI, (LPARAM)strCode[HEX_CODE_ASCI]); ::SendDlgItemMessage(_hSelf, IDC_COMBO_DATATYPE, CB_INSERTSTRING, HEX_CODE_UNI, (LPARAM)strCode[HEX_CODE_UNI]); ::SendDlgItemMessage(_hSelf, IDC_COMBO_DATATYPE, CB_SETCURSEL, _currDataType, 0); /* set radios */ ::SendDlgItemMessage(_hSelf, IDC_RADIO_DIRDOWN, BM_SETCHECK, BST_CHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_BOTTOM, BM_SETCHECK, BST_CHECKED, 0); /* set wrap */ ::SendDlgItemMessage(_hSelf, IDC_CHECK_WRAP, BM_SETCHECK, BST_CHECKED, 0); /* is transparent mode available? */ HMODULE hUser32 = ::GetModuleHandle(_T("User32")); if (hUser32) { /* set transparency */ ::SendDlgItemMessage(_hSelf, IDC_SLIDER_PERCENTAGE, TBM_SETRANGE, FALSE, MAKELONG(20, 225)); ::SendDlgItemMessage(_hSelf, IDC_SLIDER_PERCENTAGE, TBM_SETPOS, TRUE, 200); _transFuncAddr = (WNDPROC)GetProcAddress(hUser32, "SetLayeredWindowAttributes"); setTrans(); } else { ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_TRANSPARENT), SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_SLIDER_PERCENTAGE), SW_HIDE); } changeCoding(); }
void ofxObject::updateMessages() { for(unsigned int i=0; i < messages.size(); i++){ if(messages[i]->isEnabled){ //grab commonly needed values float startTime = messages[i]->startTime + messages[i]->startDelay; float endTime = messages[i]->getFinishTime(); float duration = messages[i]->duration; float time = ofxMessage::interpolateTime(messages[i]->interpolation, (curTime - startTime)/duration); float t = time; float x,y,z,w; //printf("t_%02d = %f\n", i, t); //adjust t for palindrome looping if(messages[i]->playMode == OF_LOOP_PALINDROME_PLAY){ if(messages[i]->loopDirection) t = 1.0 - time; } //translation__________________________________________________________ if(messages[i]->id == OF_TRANSLATE){ if(curTime >= startTime){ if(!messages[i]->isRunning){ //set start values once ofVec3f *vec = (ofVec3f *)messages[i]->baseStartVals; if(vec){ if(vec->x == OF_RELATIVE_VAL) x = xyz.x; else x = vec->x; if(vec->y == OF_RELATIVE_VAL) y = xyz.y; else y = vec->y; if(vec->z == OF_RELATIVE_VAL) z = xyz.z; else z = vec->z; messages[i]->setStartVals(x,y,z); //printf("message start vals = %f, %f, %f\n", x,y,z); } //set end values once ofVec3f *vecEnd = (ofVec3f *)messages[i]->baseEndVals; if(vecEnd){ if(vecEnd->x == OF_RELATIVE_VAL) x = xyz.x; else x = vecEnd->x; if(vecEnd->y == OF_RELATIVE_VAL) y = xyz.y; else y = vecEnd->y; if(vecEnd->z == OF_RELATIVE_VAL) z = xyz.z; else z = vecEnd->z; messages[i]->setEndVals(x,y,z); //printf("message end vals = %f, %f, %f\n", x,y,z); } /* printf("translate start Vals = %f, %f, %f\n", x,y,z); printf("translate end Vals = %f, %f, %f\n", ((ofVec3f *)messages[i]->vals)->x, ((ofVec3f *)messages[i]->vals)->y, ((ofVec3f *)messages[i]->vals)->z); */ messages[i]->isRunning = true; } //update value if(messages[i]->path == OF_LINEAR_PATH){ setTrans((1-t)*((ofVec3f *)messages[i]->startVals)->x + t*((ofVec3f *)messages[i]->endVals)->x, (1-t)*((ofVec3f *)messages[i]->startVals)->y + t*((ofVec3f *)messages[i]->endVals)->y, (1-t)*((ofVec3f *)messages[i]->startVals)->z + t*((ofVec3f *)messages[i]->endVals)->z); }else if(messages[i]->path == OF_BEZIER_PATH){ ofVec4f trans = ofxMessage::bezier(t, messages[i]->pathPoints); setTrans(trans.x, trans.y, trans.z); }else if(messages[i]->path == OF_SPLINE_PATH){ ofVec4f trans = ofxMessage::spline(t, messages[i]->pathPoints); setTrans(trans.x, trans.y, trans.z); } } } //rotation_____________________________________________________________ else if(messages[i]->id == OF_ROTATE){ if(curTime >= startTime){ if(!messages[i]->isRunning){ //set start values once ofVec3f *vec = (ofVec3f *)messages[i]->baseStartVals; if(vec){ if(vec->x == OF_RELATIVE_VAL) x = xyzRot.x; else x = vec->x; if(vec->y == OF_RELATIVE_VAL) y = xyzRot.y; else y = vec->y; if(vec->z == OF_RELATIVE_VAL) z = xyzRot.z; else z = vec->z; messages[i]->setStartVals(x, y, z); } //set end values once ofVec3f *vecEnd = (ofVec3f *)messages[i]->baseEndVals; if(vecEnd){ if(vecEnd->x == OF_RELATIVE_VAL) x = xyzRot.x; else x = vecEnd->x; if(vecEnd->y == OF_RELATIVE_VAL) y = xyzRot.y; else y = vecEnd->y; if(vecEnd->z == OF_RELATIVE_VAL) z = xyzRot.z; else z = vecEnd->z; messages[i]->setEndVals(x,y,z); } messages[i]->isRunning = true; } //update value if(messages[i]->path == OF_LINEAR_PATH){ setRot((1-t)*((ofVec3f *)messages[i]->startVals)->x + t*((ofVec3f *)messages[i]->endVals)->x, (1-t)*((ofVec3f *)messages[i]->startVals)->y + t*((ofVec3f *)messages[i]->endVals)->y, (1-t)*((ofVec3f *)messages[i]->startVals)->z + t*((ofVec3f *)messages[i]->endVals)->z); }else if(messages[i]->path == OF_BEZIER_PATH){ ofVec4f rot = ofxMessage::bezier(t, messages[i]->pathPoints); setRot(rot.x, rot.y, rot.z); }else if(messages[i]->path == OF_SPLINE_PATH){ ofVec4f rot = ofxMessage::spline(t, messages[i]->pathPoints); setRot(rot.x, rot.y, rot.z); } } } //scaling_______________________________________________________________ else if(messages[i]->id == OF_SCALE){ //printf("startTime = %f\n", startTime); if(curTime >= startTime){ //printf("doing message %f\n", curTime); if(!messages[i]->isRunning){ //set start values once float *v = (float *)messages[i]->baseStartVals; if(v){ if(v[0] == OF_RELATIVE_VAL) x = scale.x; else x = v[0]; messages[i]->setStartVals(x); } //set end values once float *vEnd = (float *)messages[i]->baseEndVals; if(vEnd){ if(vEnd[0] == OF_RELATIVE_VAL) x = scale.x; else x = vEnd[0]; messages[i]->setEndVals(x); } messages[i]->isRunning = true; } //update value if(messages[i]->path == OF_LINEAR_PATH){ setScale((1-t)*((float *)messages[i]->startVals)[0] + t*((float *)messages[i]->endVals)[0]); }else if(messages[i]->path == OF_BEZIER_PATH){ ofVec4f s = ofxMessage::bezier(t, messages[i]->pathPoints); setScale(s.x); }else if(messages[i]->path == OF_SPLINE_PATH){ ofVec4f s = ofxMessage::spline(t, messages[i]->pathPoints); setScale(s.x); } } } //scaling in 3 dimensions differently ___________________________________ else if(messages[i]->id == OF_SCALE3){ if(curTime >= startTime){ if(!messages[i]->isRunning){ //set start avlues once ofVec3f *vec = (ofVec3f *)messages[i]->baseStartVals; if(vec){ if(vec->x == OF_RELATIVE_VAL) x = scale.x; else x = vec->x; if(vec->y == OF_RELATIVE_VAL) y = scale.y; else y = vec->y; if(vec->z == OF_RELATIVE_VAL) z = scale.z; else z = vec->z; messages[i]->setStartVals(x, y, z); } //set end values once ofVec3f *vecEnd = (ofVec3f *)messages[i]->baseEndVals; if(vecEnd){ if(vecEnd->x == OF_RELATIVE_VAL) x = scale.x; else x = vecEnd->x; if(vecEnd->y == OF_RELATIVE_VAL) y = scale.y; else y = vecEnd->y; if(vecEnd->z == OF_RELATIVE_VAL) z = scale.z; else z = vecEnd->z; messages[i]->setEndVals(x,y,z); } messages[i]->isRunning = true; } //update value if(messages[i]->path == OF_LINEAR_PATH){ setScale((1-t)*((ofVec3f *)messages[i]->startVals)->x + t*((ofVec3f *)messages[i]->endVals)->x, (1-t)*((ofVec3f *)messages[i]->startVals)->y + t*((ofVec3f *)messages[i]->endVals)->y, (1-t)*((ofVec3f *)messages[i]->startVals)->z + t*((ofVec3f *)messages[i]->endVals)->z); }else if(messages[i]->path == OF_BEZIER_PATH){ ofVec4f s = ofxMessage::bezier(t, messages[i]->pathPoints); setScale(s.x, s.y, s.z); }else if(messages[i]->path == OF_SPLINE_PATH){ ofVec4f s = ofxMessage::spline(t, messages[i]->pathPoints); setScale(s.x, s.y, s.z); } } } //color _________________________________________________________________ else if(messages[i]->id == OF_SETCOLOR){ if(curTime >= startTime){ if(!messages[i]->isRunning){ //set start values once ofVec3f *vec = (ofVec3f *)messages[i]->baseStartVals; if(vec){ if(vec->x == OF_RELATIVE_VAL) x = material->getColorVec4f().x; else x = vec->x; if(vec->y == OF_RELATIVE_VAL) y = material->getColorVec4f().y; else y = vec->y; if(vec->z == OF_RELATIVE_VAL) z = material->getColorVec4f().z; else z = vec->z; messages[i]->setStartVals(x, y, z); } //set end values once ofVec3f *vecEnd = (ofVec3f *)messages[i]->baseEndVals; if(vecEnd){ if(vecEnd->x == OF_RELATIVE_VAL) x = material->getColorVec4f().x; else x = vecEnd->x; if(vecEnd->y == OF_RELATIVE_VAL) y = material->getColorVec4f().y; else y = vecEnd->y; if(vecEnd->z == OF_RELATIVE_VAL) z = material->getColorVec4f().z; else z = vecEnd->z; messages[i]->setEndVals(x,y,z); } //printf("color startvals = %f, %f , %f\n", x,y,z); messages[i]->isRunning = true; } //update value if(messages[i]->path == OF_LINEAR_PATH){ setColor((1-t)*((ofVec3f *)messages[i]->startVals)->x + t*((ofVec3f *)messages[i]->endVals)->x, (1-t)*((ofVec3f *)messages[i]->startVals)->y + t*((ofVec3f *)messages[i]->endVals)->y, (1-t)*((ofVec3f *)messages[i]->startVals)->z + t*((ofVec3f *)messages[i]->endVals)->z); }else if(messages[i]->path == OF_BEZIER_PATH){ ofVec4f c = ofxMessage::bezier(t, messages[i]->pathPoints); setColor(c.x, c.y, c.z); }else if(messages[i]->path == OF_SPLINE_PATH){ ofVec4f c = ofxMessage::spline(t, messages[i]->pathPoints); setColor(c.x, c.y, c.z); } } } // color with alpha channel else if(messages[i]->id == OF_SETCOLOR4){ if(curTime >= startTime){ if(!messages[i]->isRunning){ //set start values once ofVec4f *vec = (ofVec4f *)messages[i]->baseStartVals; if(vec){ if(vec->x == OF_RELATIVE_VAL) x = material->getColorVec4f().x; else x = vec->x; if(vec->y == OF_RELATIVE_VAL) y = material->getColorVec4f().y; else y = vec->y; if(vec->z == OF_RELATIVE_VAL) z = material->getColorVec4f().z; else z = vec->z; if(vec->w == OF_RELATIVE_VAL) w = material->getColorVec4f().w; else w = vec->w; messages[i]->setStartVals(x, y, z, w); } //set end values once ofVec4f *vecEnd = (ofVec4f *)messages[i]->baseEndVals; if(vecEnd){ if(vecEnd->x == OF_RELATIVE_VAL) x = material->getColorVec4f().x; else x = vecEnd->x; if(vecEnd->y == OF_RELATIVE_VAL) y = material->getColorVec4f().y; else y = vecEnd->y; if(vecEnd->z == OF_RELATIVE_VAL) z = material->getColorVec4f().z; else z = vecEnd->z; if(vecEnd->w == OF_RELATIVE_VAL) w = material->getColorVec4f().w; else w = vecEnd->w; messages[i]->setEndVals(x,y,z,w); } //printf("color startvals = %f, %f , %f\n", x,y,z); messages[i]->isRunning = true; } //update value if(messages[i]->path == OF_LINEAR_PATH){ setColor((1-t)*((ofVec4f *)messages[i]->startVals)->x + t*((ofVec4f *)messages[i]->endVals)->x, (1-t)*((ofVec4f *)messages[i]->startVals)->y + t*((ofVec4f *)messages[i]->endVals)->y, (1-t)*((ofVec4f *)messages[i]->startVals)->z + t*((ofVec4f *)messages[i]->endVals)->z, (1-t)*((ofVec4f *)messages[i]->startVals)->w + t*((ofVec4f *)messages[i]->endVals)->w); }else if(messages[i]->path == OF_BEZIER_PATH){ ofVec4f c = ofxMessage::bezier(t, messages[i]->pathPoints); setColor(c.x, c.y, c.z, c.w); }else if(messages[i]->path == OF_SPLINE_PATH){ ofVec4f c = ofxMessage::spline(t, messages[i]->pathPoints); setColor(c.x, c.y, c.z, c.w); } } } //alpha__________________________________________________________________ else if(messages[i]->id == OF_SETALPHA){ if(curTime >= startTime){ if(!messages[i]->isRunning){ //set start values once float *v = (float *)messages[i]->baseStartVals; if(v){ if(v[0] == OF_RELATIVE_VAL) x = material->getColorVec4f().w; else x = v[0]; messages[i]->setStartVals(x); } //set end values once float *vEnd = (float *)messages[i]->baseEndVals; if(vEnd){ if(vEnd[0] == OF_RELATIVE_VAL) x = material->getColorVec4f().w; else x = vEnd[0]; messages[i]->setEndVals(x); } messages[i]->isRunning = true; } //update value if(messages[i]->path == OF_LINEAR_PATH){ setAlpha((1-t)*((float *)messages[i]->startVals)[0] + t*((float *)messages[i]->endVals)[0]); }else if(messages[i]->path == OF_BEZIER_PATH){ ofVec4f s = ofxMessage::bezier(t, messages[i]->pathPoints); setAlpha(s.x); }else if(messages[i]->path == OF_SPLINE_PATH){ ofVec4f s = ofxMessage::spline(t, messages[i]->pathPoints); setAlpha(s.x); } } } //show____________________________________________________________________ else if(messages[i]->id == OF_SHOW){ if(curTime >= startTime){ show(); messages[i]->isEnabled = false; } } //hide____________________________________________________________________ else if(messages[i]->id == OF_HIDE){ if(curTime >= startTime){ hide(); messages[i]->isEnabled = false; } } //function________________________________________________________________ else if(messages[i]->id == OF_FUNCTION){ if(curTime >= startTime){ messages[i]->functionPtr(messages[i]->startVals); messages[i]->isEnabled = false; } } //cleanup messages _____________________________________________________________________________________ //if the message is done and no longer needed, delete it if(time == 1.0){ //only delete it when it's reached completion messages[i]->isEnabled = false; messages[i]->isRunning = false; if(messages[i]->autoDelete){ deleteMessage(messages[i]); } if(i < messages.size()){ //just in case a message just got deleted above //handle special looping behaviors if(messages[i]->playMode == OF_LOOP_PLAY){ messages[i]->isEnabled = true; messages[i]->isRunning = false; messages[i]->setStartTime(curTime); } else if(messages[i]->playMode == OF_LOOP_PALINDROME_PLAY){ messages[i]->loopDirection = !messages[i]->loopDirection; messages[i]->isEnabled = true; messages[i]->isRunning = false; messages[i]->setStartTime(curTime); } } } } } }