本文整理汇总了C++中Interpolator::AddKey方法的典型用法代码示例。如果您正苦于以下问题:C++ Interpolator::AddKey方法的具体用法?C++ Interpolator::AddKey怎么用?C++ Interpolator::AddKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interpolator
的用法示例。
在下文中一共展示了Interpolator::AddKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutoKeyChanComb
void RecorderDlg::AutoKeyChanComb(int comb)
{
VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
if (!vr_frame)
return;
if (!m_view)
{
if (vr_frame && vr_frame->GetView(0))
m_view = vr_frame->GetView(0);
else
return;
}
DataManager* mgr = vr_frame->GetDataManager();
if (!mgr)
return;
Interpolator *interpolator = vr_frame->GetInterpolator();
if (!interpolator)
return;
wxString str = m_duration_text->GetValue();
double duration;
str.ToDouble(&duration);
KeyCode keycode;
FlKeyBoolean* flkeyB = 0;
double t = interpolator->GetLastT();
t = t<0.0?0.0:t;
if (t>0.0) t += duration;
int i;
int numChan = m_view->GetAllVolumeNum();
vector<bool> chan_mask;
//initiate mask
for (i=0; i<numChan; i++)
{
if (i < comb)
chan_mask.push_back(true);
else
chan_mask.push_back(false);
}
do
{
interpolator->Begin(t);
//for all volumes
for (i=0; i<m_view->GetAllVolumeNum(); i++)
{
VolumeData* vd = m_view->GetAllVolumeData(i);
keycode.l0 = 1;
keycode.l0_name = m_view->GetName();
keycode.l1 = 2;
keycode.l1_name = vd->GetName();
//display only
keycode.l2 = 0;
keycode.l2_name = "display";
flkeyB = new FlKeyBoolean(keycode, chan_mask[i]);
interpolator->AddKey(flkeyB);
}
interpolator->End();
t += duration;
} while (GetMask(chan_mask));
m_keylist->Update();
}
示例2: InsertKey
void RecorderDlg::InsertKey(int index, double duration, int interpolation)
{
VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
if (!vr_frame)
return;
if (!m_view)
{
if (vr_frame && vr_frame->GetView(0))
m_view = vr_frame->GetView(0);
else
return;
}
DataManager* mgr = vr_frame->GetDataManager();
if (!mgr)
return;
Interpolator *interpolator = vr_frame->GetInterpolator();
if (!interpolator)
return;
KeyCode keycode;
FlKeyDouble* flkey = 0;
FlKeyQuaternion* flkeyQ = 0;
FlKeyBoolean* flkeyB = 0;
FlKeyInt* flkeyI = 0;
double t = interpolator->GetLastT();
t = t<0.0?0.0:t+duration;
interpolator->Begin(t);
//for all volumes
for (int i=0; i<mgr->GetVolumeNum() ; i++)
{
VolumeData* vd = mgr->GetVolumeData(i);
keycode.l0 = 1;
keycode.l0_name = m_view->GetName();
keycode.l1 = 2;
keycode.l1_name = vd->GetName();
//display
keycode.l2 = 0;
keycode.l2_name = "display";
flkeyB = new FlKeyBoolean(keycode, vd->GetDisp());
interpolator->AddKey(flkeyB);
//clipping planes
vector<Plane*> * planes = vd->GetVR()->get_planes();
if (!planes)
continue;
if (planes->size() != 6)
continue;
Plane* plane = 0;
double abcd[4];
//x1
plane = (*planes)[0];
plane->get_copy(abcd);
keycode.l2 = 0;
keycode.l2_name = "x1_val";
flkey = new FlKeyDouble(keycode, abs(abcd[3]));
interpolator->AddKey(flkey);
//x2
plane = (*planes)[1];
plane->get_copy(abcd);
keycode.l2 = 0;
keycode.l2_name = "x2_val";
flkey = new FlKeyDouble(keycode, abs(abcd[3]));
interpolator->AddKey(flkey);
//y1
plane = (*planes)[2];
plane->get_copy(abcd);
keycode.l2 = 0;
keycode.l2_name = "y1_val";
flkey = new FlKeyDouble(keycode, abs(abcd[3]));
interpolator->AddKey(flkey);
//y2
plane = (*planes)[3];
plane->get_copy(abcd);
keycode.l2 = 0;
keycode.l2_name = "y2_val";
flkey = new FlKeyDouble(keycode, abs(abcd[3]));
interpolator->AddKey(flkey);
//z1
plane = (*planes)[4];
plane->get_copy(abcd);
keycode.l2 = 0;
keycode.l2_name = "z1_val";
flkey = new FlKeyDouble(keycode, abs(abcd[3]));
interpolator->AddKey(flkey);
//z2
plane = (*planes)[5];
plane->get_copy(abcd);
keycode.l2 = 0;
keycode.l2_name = "z2_val";
flkey = new FlKeyDouble(keycode, abs(abcd[3]));
interpolator->AddKey(flkey);
}
//for the view
keycode.l0 = 1;
keycode.l0_name = m_view->GetName();
keycode.l1 = 1;
keycode.l1_name = m_view->GetName();
//rotation
//.........这里部分代码省略.........