本文整理匯總了C++中Interval::End方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::End方法的具體用法?C++ Interval::End怎麽用?C++ Interval::End使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Interval
的用法示例。
在下文中一共展示了Interval::End方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: getTransformAnimation
void AnimExportUtil::getTransformAnimation( INode* node, Interval animRange, Vector<math::Matrix4x4>* anim )
{
require( animRange.Start() <= animRange.End() );
anim->clear();
TimeValue dt = SGEXPORT_TICKS_PER_SAMPLE;
for ( TimeValue t = animRange.Start() ; t <= animRange.End() ; t += dt )
{
Matrix4x4 tm = TmUtil::getModelToParentLH( node, t );
anim->add( tm );
}
require( anim->size() > 0 );
}
示例2: resamplePositionAnimation
void AnimExportUtil::resamplePositionAnimation( const Vector<Matrix4x4>& tm, Interval animRange, KeyFrameContainer* pos )
{
// find out maximum acceptable error
float maxErrPercent = MAX_POSITION_RESAMPLING_ERROR;
float defr = 1e9f;
Vector3 minbox( defr, defr, defr );
Vector3 maxbox(-defr,-defr,-defr );
for ( int k = 0 ; k < tm.size() ; k += 2 )
{
Vector3 pos = tm[k].translation();
minbox = pos.minElements( minbox );
maxbox = pos.maxElements( maxbox );
}
float maxErr = (minbox-maxbox).length()/100.f * maxErrPercent;
if ( maxErr < 1e-6f )
maxErr = 1e-6f;
int firstFrame = animRange.Start() / SGEXPORT_TICKS_PER_SAMPLE;
require( firstFrame >= 0 && firstFrame < tm.size() );
AnimExportUtil::addPositionKey( *pos, tm[firstFrame], TicksToSec(animRange.Start()) );
AnimExportUtil::addPositionKey( *pos, tm.lastElement(), TicksToSec(animRange.End()) );
Debug::println( "max position error = {0}", maxErr );
resamplePositionKeys( *pos, animRange, maxErr, tm );
if ( pos->keys() == 2 && isEqualValue(pos->getKey(0),pos->getKey(1),3) )
pos->removeKey( 1 );
}
示例3: s
void GR2ImportImpl::ImportAnimations()
{
if (info.Animations.size() == 0 || !enableAnimation)
return;
ClearAnimation();
//for (int anim=0, nanim=info.Animations.size(); anim<nanim; ++anim)
//{
// Animation& anim = (*info.Animations[anim]);
//}
Interval range; range.SetInstant(0);
float time = FrameToTime(0);
for (int ianim=0, nanim=info.Animations.size(); ianim<nanim; ++ianim)
{
Animation& anim = (*info.Animations[ianim]);
TimeValue animEnd = TimeToFrame(time + anim.Duration);
if (animEnd > range.End())
range.SetEnd(animEnd);
// Build Default Time
int nkeys = anim.Duration / anim.TimeStep;
GR2Array<granny_real32> defaultKeys(nkeys);
granny_real32 curtime = 0.0f;
for (int ikeys=0; ikeys<nkeys; ++ikeys, curtime += anim.TimeStep)
defaultKeys[ikeys] = curtime;
for (int grp=0, ngrp=anim.TrackGroups.size(); grp<ngrp; ++grp)
{
TrackGroup& group = (*anim.TrackGroups[grp]);
if (INode *root = o->gi->GetINodeByName(group.Name))
{
Point3 s( group.InitialPlacement.Scale.m[0][0]
, group.InitialPlacement.Scale.m[1][1]
, group.InitialPlacement.Scale.m[2][2] );
for (int itrack=0, ntrack=group.TransformTracks.size(); itrack<ntrack; ++itrack)
{
TransformTrack& track = group.TransformTracks[itrack];
if (INode *node = o->gi->GetINodeByName(track.Name))
{
if (Control *c = node->GetTMController())
{
DWORD flags=INHERIT_ALL;
c->SetInheritanceFlags(INHERIT_ALL,FALSE);
ImportPosition(c, track, time, defaultKeys);
ImportRotation(c, track, time, defaultKeys);
ImportScale(c, track, time, defaultKeys);
}
}
}
Matrix3 rot(true); group.InitialPlacement.Rotation.MakeMatrix(rot);
Matrix3 m = TransMatrix(group.InitialPlacement.Origin) * Inverse(rot) * ScaleMatrix( s );
PosRotScaleNode(root, m);
// TODO: Move to initial transform
}
}
}
o->gi->SetAnimRange(range);
}
示例4: showExportOptions
//---------------------------------------------------------------
bool DocumentExporter::showExportOptions(bool suppressPrompts)
{
if (!suppressPrompts)
{
// Prompt the user with our dialogbox, and get all the options.
// The user may cancel the export at this point.
if (!mOptions.ShowDialog())
return false;
}
else
{
mOptions.LoadOptions();
if (!mOptions.getSampleAnimation())
{
Interval animRange = GetCOREInterface()->GetAnimRange();
int sceneStart = animRange.Start();
int sceneEnd = animRange.End();
mOptions.setAnimBounds(sceneStart, sceneEnd);
}
}
// Set relative/absolute export
// colladaDocument->GetFileManager()->SetForceAbsoluteFlag(!options->ExportRelativePaths());
return true;
}
示例5: ExportDlgProc
// Dialog proc
static INT_PTR CALLBACK ExportDlgProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam)
{
Interval animRange;
ISpinnerControl *spin;
AscOut *exp = (AscOut*)GetWindowLongPtr(hWnd,GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
exp = (AscOut*)lParam;
SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam);
CenterWindow(hWnd, GetParent(hWnd));
// Setup the spinner controls for the floating point precision
spin = GetISpinner(GetDlgItem(hWnd, IDC_PREC_SPIN));
spin->LinkToEdit(GetDlgItem(hWnd,IDC_PREC), EDITTYPE_INT );
spin->SetLimits(1, 10, TRUE);
spin->SetScale(1.0f);
spin->SetValue(exp->GetPrecision() ,FALSE);
ReleaseISpinner(spin);
// Setup the spinner control for the static frame#
// We take the frame 0 as the default value
animRange = exp->GetInterface()->GetAnimRange();
spin = GetISpinner(GetDlgItem(hWnd, IDC_STATIC_FRAME_SPIN));
spin->LinkToEdit(GetDlgItem(hWnd,IDC_STATIC_FRAME), EDITTYPE_INT );
spin->SetLimits(animRange.Start() / GetTicksPerFrame(), animRange.End() / GetTicksPerFrame(), TRUE);
spin->SetScale(1.0f);
spin->SetValue(0, FALSE);
ReleaseISpinner(spin);
break;
case CC_SPINNER_CHANGE:
spin = (ISpinnerControl*)lParam;
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
spin = GetISpinner(GetDlgItem(hWnd, IDC_PREC_SPIN));
exp->SetPrecision(spin->GetIVal());
ReleaseISpinner(spin);
spin = GetISpinner(GetDlgItem(hWnd, IDC_STATIC_FRAME_SPIN));
exp->SetStaticFrame(spin->GetIVal() * GetTicksPerFrame());
ReleaseISpinner(spin);
EndDialog(hWnd, 1);
break;
case IDCANCEL:
EndDialog(hWnd, 0);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
示例6: Union
Interval Interval::Union(const Interval &i) const {
Interval ret;
ret.m_start = std::min(Start(), i.Start());
ret.m_end = std::max(End(), i.End());
return ret;
}
示例7: addScaleAnimation
void AnimExportUtil::addScaleAnimation( const Vector<Matrix4x4>& tm, Interval animRange, KeyFrameContainer* scale )
{
int firstFrame = animRange.Start() / SGEXPORT_TICKS_PER_SAMPLE;
for ( TimeValue ticks = animRange.Start() ; ticks <= animRange.End() ; ticks += SGEXPORT_TICKS_PER_SAMPLE )
{
require( firstFrame >= 0 && firstFrame < tm.size() );
AnimExportUtil::addScaleKey( *scale, tm[firstFrame++], TicksToSec(ticks) );
}
}
示例8: addFloatAnimation
void AnimExportUtil::addFloatAnimation( const util::Vector<float>& frames, Interval animRange, KeyFrameContainer* anim, float maxErr )
{
int firstFrame = animRange.Start() / SGEXPORT_TICKS_PER_SAMPLE;
for ( TimeValue ticks = animRange.Start() ; ticks <= animRange.End() ; ticks += SGEXPORT_TICKS_PER_SAMPLE )
{
require( firstFrame >= 0 && firstFrame < frames.size() );
anim->insertKey( KeyFrame(TicksToSec(ticks),INTERP_TYPE,&frames[firstFrame++],1) );
}
}
示例9: resampleFloatAnimation
void AnimExportUtil::resampleFloatAnimation( const util::Vector<float>& frames, Interval animRange, KeyFrameContainer* anim, float maxErr )
{
int firstFrame = animRange.Start() / SGEXPORT_TICKS_PER_SAMPLE;
require( firstFrame >= 0 && firstFrame < frames.size() );
anim->insertKey( KeyFrame(TicksToSec(animRange.Start()),INTERP_TYPE,&frames[firstFrame],1) );
anim->insertKey( KeyFrame(TicksToSec(animRange.End()),INTERP_TYPE,&frames.lastElement(),1) );
resampleFloatKeys( *anim, animRange, maxErr, frames );
if ( anim->keys() == 2 && isEqualValue(anim->getKey(0),anim->getKey(1),3) )
anim->removeKey( 1 );
}
示例10: SampleNodeMotion
// SAMPLENODEMOTION
// top level function for sampling all the motion on a single node
plSampleVec * SampleNodeMotion(INode* node, INode* parent, int sampleRate, Interface *theInterface)
{
Interval interval = theInterface->GetAnimRange();
TimeValue start = interval.Start(); // in ticks
TimeValue end = interval.End();
sampleRate *= GetTicksPerFrame(); // convert sample rate to ticks
return SampleNodeMotion(node, parent, sampleRate, start, end);
}
示例11: Move
void ValuesTable::Move(const Interval &in) {
if (in.End() < 0 || in.Start() >= (int)m_values.size()) {
m_values.resize(0);
m_values.resize(in.End() - in.Start() + 1);
return;
}
while ((in.End() + 1) < (int)m_values.size())
PopBack();
for (int i = 0; i < in.Start(); ++i)
PopFront();
for (int i = 0; i > in.Start(); --i)
PushFront();
for (int i = m_values.size(); i <= in.End() - in.Start(); ++i)
PushBack();
}
示例12: SetStates
void RandKeysUtil::SetStates()
{
if (doTime) {
iPosTime->Enable();
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_POSTIMELABEL),TRUE);
iNegTime->Enable();
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_NEGTIMELABEL),TRUE);
} else {
iPosTime->Disable();
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_POSTIMELABEL),FALSE);
iNegTime->Disable();
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_NEGTIMELABEL),FALSE);
}
if (doVal) {
iPosVal->Enable();
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_POSVALLABEL),TRUE);
iNegVal->Enable();
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_NEGVALLABEL),TRUE);
} else {
iPosVal->Disable();
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_POSVALLABEL),FALSE);
iNegVal->Disable();
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_NEGVALLABEL),FALSE);
}
switch (iu->GetMajorMode()) {
case TVMODE_EDITKEYS:
case TVMODE_EDITFCURVE:
SetDlgItemText(hWnd,IDC_RANDKEYS_TEXT,
GetString(IDS_RANDKEYS_KEYTEXT));
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_APPLY),TRUE);
break;
case TVMODE_EDITTIME: {
Interval iv = iu->GetTimeSelection();
TSTR buf, start, end;
TimeToString(iv.Start(),start);
TimeToString(iv.End(),end);
buf.printf(GetString(IDS_RANDKEYS_TIMETEXT),start,end);
SetDlgItemText(hWnd,IDC_RANDKEYS_TEXT,buf);
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_APPLY),TRUE);
break;
}
case TVMODE_EDITRANGES:
case TVMODE_POSRANGES:
SetDlgItemText(hWnd,IDC_RANDKEYS_TEXT,_T(""));
EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_APPLY),FALSE);
break;
}
}
示例13: resampleRotationAnimation
void AnimExportUtil::resampleRotationAnimation( const Vector<Matrix4x4>& tm, Interval animRange, KeyFrameContainer* rot )
{
float maxErr = Math::toRadians(MAX_ROTATION_RESAMPLING_ERROR);
int firstFrame = animRange.Start() / SGEXPORT_TICKS_PER_SAMPLE;
require( firstFrame >= 0 && firstFrame < tm.size() );
AnimExportUtil::addRotationKey( *rot, tm[firstFrame], TicksToSec(animRange.Start()) );
AnimExportUtil::addRotationKey( *rot, tm.lastElement(), TicksToSec(animRange.End()) );
Debug::println( "max rotation error = {0} degrees", Math::toDegrees(maxErr) );
resampleRotationKeys( *rot, animRange, maxErr, tm );
if ( rot->keys() == 2 && isEqualValue(rot->getKey(0),rot->getKey(1),4) )
rot->removeKey( 1 );
}
示例14: resampleScaleAnimation
void AnimExportUtil::resampleScaleAnimation( const Vector<Matrix4x4>& tm, Interval animRange, KeyFrameContainer* scale )
{
float maxErrPercent = MAX_SCALE_RESAMPLING_ERROR;
int firstFrame = animRange.Start() / SGEXPORT_TICKS_PER_SAMPLE;
require( firstFrame >= 0 && firstFrame < tm.size() );
AnimExportUtil::addScaleKey( *scale, tm[firstFrame], TicksToSec(animRange.Start()) );
AnimExportUtil::addScaleKey( *scale, tm.lastElement(), TicksToSec(animRange.End()) );
Debug::println( "max scale error = {0}%", maxErrPercent );
resampleScaleKeys( *scale, animRange, maxErrPercent/100.f, tm );
if ( scale->keys() == 2 && isEqualValue(scale->getKey(0),scale->getKey(1),3) )
scale->removeKey( 1 );
}
示例15: resampleFloatKeys
/**
* Resamples animation until maximum error is smaller than specified value.
* @param maxErr Maximum absolute error
*/
static void resampleFloatKeys( KeyFrameContainer& anim, Interval range, float maxErr, const Vector<float>& frames )
{
TimeValue dticks = SGEXPORT_TICKS_PER_SAMPLE;
int frame = range.Start() / dticks;
require( frame >= 0 && frame < frames.size() );
TimeValue rangeLen = (range.Duration()/SGEXPORT_TICKS_PER_SAMPLE)*SGEXPORT_TICKS_PER_SAMPLE;
for ( TimeValue ticks = range.Start() ; ticks < range.End() ; ticks += dticks )
{
if ( ticks > range.End() )
ticks = range.End();
// find out error (distance) between real and sampled animation
require( frame >= 0 && frame < frames.size() );
float realValue = frames[frame++];
float sampledValue = 0.f;
anim.getValue( TicksToSec(ticks), &sampledValue, 1 );
float err = Math::abs( realValue - sampledValue );
// sample more accurately if needed
if ( err > maxErr && rangeLen > dticks )
{
TimeValue halfRange = alignTicks( (range.End() + range.Start())/2 );
anim.insertKey( KeyFrame( TicksToSec(halfRange), INTERP_TYPE, &frames[halfRange/dticks], 1 ) );
if ( ticks <= halfRange )
resampleFloatKeys( anim, Interval(range.Start(),halfRange), maxErr, frames );
else
resampleFloatKeys( anim, Interval(halfRange,range.End()), maxErr, frames );
}
if ( ticks == range.End() )
break;
}
}