本文整理汇总了C++中Fmatrix::setXYZi方法的典型用法代码示例。如果您正苦于以下问题:C++ Fmatrix::setXYZi方法的具体用法?C++ Fmatrix::setXYZi怎么用?C++ Fmatrix::setXYZi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fmatrix
的用法示例。
在下文中一共展示了Fmatrix::setXYZi方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShapeRotate
void CBone::ShapeRotate(const Fvector& _amount)
{
Fvector amount=_amount;
Fmatrix _IT;_IT.invert(_LTransform());
if (Tools->GetSettings(etfCSParent)) _IT.transform_dir(amount);
switch (shape.type){
case SBoneShape::stBox:{
Fmatrix R;
R.setXYZi(amount.x,amount.y,amount.z);
shape.box.transform(shape.box,R);
}break;
case SBoneShape::stSphere: break;
case SBoneShape::stCylinder:{
Fmatrix R;
R.setXYZi(amount.x,amount.y,amount.z);
R.transform_dir(shape.cylinder.m_direction);
}break;
}
}
示例2: ExportBreakableObjects
bool ESceneObjectTool::ExportBreakableObjects(SExportStreams* F)
{
bool bResult = true;
CGeomPartExtractor* extractor=0;
Fbox bb;
if (!GetBox(bb)) return false;
extractor = xr_new<CGeomPartExtractor>();
extractor->Initialize(bb,EPS_L,2);
UI->SetStatus ("Export breakable objects...");
// collect verts&&faces
{
SPBItem* pb = UI->ProgressStart(m_Objects.size(),"Prepare geometry...");
for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++){
pb->Inc();
CSceneObject* obj = dynamic_cast<CSceneObject*>(*it); VERIFY(obj);
if (obj->IsStatic()){
CEditableObject *O = obj->GetReference();
const Fmatrix& T = obj->_Transform();
for(EditMeshIt M=O->FirstMesh();M!=O->LastMesh();M++)
if (!build_mesh (T,*M,extractor,SGameMtl::flBreakable,FALSE)){bResult=false;break;}
}
}
UI->ProgressEnd(pb);
}
if (!extractor->Process()) bResult = false;
// export parts
if (bResult){
SBPartVec& parts = extractor->GetParts();
SPBItem* pb = UI->ProgressStart(parts.size(),"Export Parts...");
for (SBPartVecIt p_it=parts.begin(); p_it!=parts.end(); p_it++){
pb->Inc();
SBPart* P = *p_it;
if (P->Valid()){
// export visual
AnsiString sn = AnsiString().sprintf("meshes\\brkbl#%d.ogf",(p_it-parts.begin()));
xr_string fn = Scene->LevelPath()+sn.c_str();
IWriter* W = FS.w_open(fn.c_str()); R_ASSERT(W);
if (!P->Export(*W,1)){
ELog.DlgMsg (mtError,"Invalid breakable object.");
bResult = false;
break;
}
FS.w_close (W);
// export spawn object
{
AnsiString entity_ref = "breakable_object";
ISE_Abstract* m_Data = create_entity(entity_ref.c_str()); VERIFY(m_Data);
CSE_Visual* m_Visual = m_Data->visual(); VERIFY(m_Visual);
// set params
m_Data->set_name (entity_ref.c_str());
m_Data->set_name_replace (sn.c_str());
m_Data->position().set (P->m_RefOffset);
m_Data->angle().set (P->m_RefRotate);
m_Visual->set_visual (sn.c_str(),false);
if (s_draw_dbg){
Fmatrix MX;
MX.setXYZi (P->m_RefRotate);
MX.translate_over (P->m_RefOffset);
Fvector DR = {0,0,1};
MX.transform_dir (DR);
Tools->m_DebugDraw.AppendLine(P->m_RefOffset,Fvector().mad(P->m_RefOffset,MX.k,1.f),0xFF0000FF,false,false);
}
NET_Packet Packet;
m_Data->Spawn_Write (Packet,TRUE);
F->spawn.stream.open_chunk (F->spawn.chunk++);
F->spawn.stream.w (Packet.B.data,Packet.B.count);
F->spawn.stream.close_chunk ();
destroy_entity (m_Data);
}
}else{
ELog.Msg(mtError,"Can't export invalid part #%d",p_it-parts.begin());
}
}
UI->ProgressEnd(pb);
}
// clean up
xr_delete(extractor);
return bResult;
}
示例3: ProcessCam
BOOL CDemoPlay::ProcessCam(SCamEffectorInfo& info)
{
// skeep a few frames before counting
if (Device.dwPrecacheFrame) return TRUE;
if (stat_started)
{
//g_SASH.DisplayFrame(Device.fTimeGlobal);
}
else
{
//g_SASH.StartBenchmark();
stat_Start();
}
// Per-frame statistics
{
stat_table.push_back (stat_Timer_frame.GetElapsed_sec());
stat_Timer_frame.Start ();
}
// Process motion
if (m_pMotion)
{
Fvector R;
Fmatrix mRotate;
m_pMotion->_Evaluate (m_MParam->Frame(),info.p,R);
m_MParam->Update (Device.fTimeDelta,1.f,true);
fLifeTime -= Device.fTimeDelta;
if (m_MParam->bWrapped) { stat_Stop(); stat_Start(); }
mRotate.setXYZi (R.x,R.y,R.z);
info.d.set (mRotate.k);
info.n.set (mRotate.j);
}
else
{
if (seq.empty()) {
g_pGameLevel->Cameras().RemoveCamEffector(cefDemo);
return TRUE;
}
fStartTime += Device.fTimeDelta;
float ip;
float p = fStartTime/fSpeed;
float t = modff(p, &ip);
int frame = iFloor(ip);
VERIFY (t>=0);
if (frame>=m_count)
{
dwCyclesLeft -- ;
if (0==dwCyclesLeft) return FALSE;
fStartTime = 0 ;
// just continue
// stat_Stop ();
// stat_Start ();
}
int f1=frame; FIX(f1);
int f2=f1+1; FIX(f2);
int f3=f2+1; FIX(f3);
int f4=f3+1; FIX(f4);
Fmatrix *m1,*m2,*m3,*m4;
Fvector v[4];
m1 = (Fmatrix *) &seq[f1];
m2 = (Fmatrix *) &seq[f2];
m3 = (Fmatrix *) &seq[f3];
m4 = (Fmatrix *) &seq[f4];
for (int i=0; i<4; i++) {
v[0].x = m1->m[i][0]; v[0].y = m1->m[i][1]; v[0].z = m1->m[i][2];
v[1].x = m2->m[i][0]; v[1].y = m2->m[i][1]; v[1].z = m2->m[i][2];
v[2].x = m3->m[i][0]; v[2].y = m3->m[i][1]; v[2].z = m3->m[i][2];
v[3].x = m4->m[i][0]; v[3].y = m4->m[i][1]; v[3].z = m4->m[i][2];
spline1 ( t, &(v[0]), (Fvector *) &(Device.mView.m[i][0]) );
}
Fmatrix mInvCamera;
mInvCamera.invert(Device.mView);
info.n.set( mInvCamera._21, mInvCamera._22, mInvCamera._23 );
info.d.set( mInvCamera._31, mInvCamera._32, mInvCamera._33 );
info.p.set( mInvCamera._41, mInvCamera._42, mInvCamera._43 );
fLifeTime-=Device.fTimeDelta;
}
return TRUE;
}