void CCar::cb_Steer (CBoneInstance* B) { VERIFY2(fsimilar(DET(B->mTransform),1.f,DET_CHECK_EPS),"Bones receive returns 0 matrix"); CCar* C = static_cast<CCar*>(B->callback_param()); Fmatrix m; m.rotateZ(C->m_steer_angle); B->mTransform.mulB_43 (m); #ifdef DEBUG if( !fsimilar(DET(B->mTransform),1.f,DET_CHECK_EPS) ){ Log("RotatingZ angle=",C->m_steer_angle); VERIFY2(0,"Bones callback returns BAD!!! matrix"); } #endif }
void __fastcall TUI_ControlAIMapNodeRotate::Move(TShiftState _Shift) { if (_Shift.Contains(ssLeft)){ float amount = -UI->m_DeltaCpH.x * UI->m_MouseSR; if( Tools->GetSettings(etfASnap) ) CHECK_SNAP(m_fRotateSnapAngle,amount,Tools->m_RotateSnapAngle); Fmatrix R; if (fis_zero(m_RotateVector.x)) R.rotateZ(amount); else R.rotateX(amount); AINodeVec& lst = ((ESceneAIMapTool*)parent_tool)->Nodes(); for(AINodeIt _F = lst.begin();_F!=lst.end();_F++) if((*_F)->flags.is(SAINode::flSelected)){ Fvector new_n; R.transform_dir(new_n,(*_F)->Plane.n); if (Fvector().set(0,1,0).dotproduct(new_n)>0.02f){ (*_F)->Plane.build((*_F)->Pos,new_n); } } } }
void CMatrix::Calculate() { if (dwFrame==Device.dwFrame) return; dwFrame = Device.dwFrame; // Switch on mode switch (dwMode) { case modeProgrammable: case modeDetail: return; case modeTCM: { Fmatrix T; float sU=1,sV=1,t=Device.fTimeGlobal; tc_trans (xform,.5f,.5f); if (tcm&tcmRotate) { T.rotateZ (rotate.Calculate(t)*t); xform.mulA_43 (T); } if (tcm&tcmScale) { sU = scaleU.Calculate(t); sV = scaleV.Calculate(t); T.scale (sU,sV,1); xform.mulA_43 (T); } if (tcm&tcmScroll) { float u = scrollU.Calculate(t)*t; float v = scrollV.Calculate(t)*t; u*=sU; v*=sV; tc_trans (T, u, v ); xform.mulA_43 (T); } tc_trans (T, -0.5f, -0.5f ); xform.mulB_43 (T); } return; case modeS_refl: { float Ux= .5f*Device.mView._11, Uy= .5f*Device.mView._21, Uz= .5f*Device.mView._31, Uw = .5f; float Vx=-.5f*Device.mView._12, Vy=-.5f*Device.mView._22, Vz=-.5f*Device.mView._32, Vw = .5f; xform._11=Ux; xform._12=Vx; xform._13=0; xform._14=0; xform._21=Uy; xform._22=Vy; xform._23=0; xform._24=0; xform._31=Uz; xform._32=Vz; xform._33=0; xform._34=0; xform._41=Uw; xform._42=Vw; xform._43=0; xform._44=0; } return; case modeC_refl: { Fmatrix M = Device.mView; M._41 = 0.f; M._42 = 0.f; M._43 = 0.f; xform.invert(M); } return; default: return; } }