當前位置: 首頁>>代碼示例>>C++>>正文


C++ Interval::Start方法代碼示例

本文整理匯總了C++中Interval::Start方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::Start方法的具體用法?C++ Interval::Start怎麽用?C++ Interval::Start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Interval的用法示例。


在下文中一共展示了Interval::Start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: 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 );
}
開發者ID:TheRyaz,項目名稱:c_reading,代碼行數:26,代碼來源:AnimExportUtil.cpp

示例2: 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;
	}
}
開發者ID:TheRyaz,項目名稱:c_reading,代碼行數:39,代碼來源:AnimExportUtil.cpp

示例3: 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) );
	}
}
開發者ID:TheRyaz,項目名稱:c_reading,代碼行數:9,代碼來源:AnimExportUtil.cpp

示例4: 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) );
	}
}
開發者ID:TheRyaz,項目名稱:c_reading,代碼行數:9,代碼來源:AnimExportUtil.cpp

示例5: TrackPropDlgProc

INT_PTR CALLBACK TrackPropDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
	BlockControl *blk = (BlockControl*)GetWindowLongPtr(hWnd,GWLP_USERDATA);

	ISpinnerControl *spin;
	static TSTR zero = FormatUniverseValue(0.0f);
	Rect rect;

	switch (msg) {
	case WM_INITDIALOG:
		{
		blk = (BlockControl*)lParam;
		SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam);

		Interval range = GetCOREInterface()->GetAnimRange();

		
		spin = GetISpinner(GetDlgItem(hWnd,IDC_STARTSPIN));
		spin->SetLimits(-999999.0f,9999999.0f, FALSE);
		spin->SetAutoScale();
		spin->LinkToEdit(GetDlgItem(hWnd,IDC_START), EDITTYPE_INT);
		spin->SetValue(range.Start()/GetTicksPerFrame(),FALSE);
		ReleaseISpinner(spin);

		blk->propStart = range.Start()/GetTicksPerFrame();
		CenterWindow(hWnd,GetParent(hWnd));
		break;
		}
		
	case CC_SPINNER_CHANGE:
		spin = (ISpinnerControl*)lParam;
		switch (LOWORD(wParam)) {
		case IDC_STARTSPIN: blk->propStart = spin->GetIVal(); break;
		}
		break;



	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDOK:
			{
			EndDialog(hWnd,1);
			blk->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);

			break;
			}
		case IDCANCEL:
			EndDialog(hWnd,0);
			break;
		}
		break;

	default:
		return FALSE;
	}
	return TRUE;
}
開發者ID:2asoft,項目名稱:xray,代碼行數:57,代碼來源:blockcontrol.cpp

示例6: 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 );
}
開發者ID:TheRyaz,項目名稱:c_reading,代碼行數:10,代碼來源:AnimExportUtil.cpp

示例7: 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 );
}
開發者ID:TheRyaz,項目名稱:c_reading,代碼行數:12,代碼來源:AnimExportUtil.cpp

示例8: 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 );
}
開發者ID:TheRyaz,項目名稱:c_reading,代碼行數:12,代碼來源:AnimExportUtil.cpp

示例9: 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 );
}
開發者ID:TheRyaz,項目名稱:c_reading,代碼行數:14,代碼來源:AnimExportUtil.cpp

示例10: 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;
	}
開發者ID:AsherBond,項目名稱:MondocosmOS,代碼行數:27,代碼來源:COLLADAMaxDocumentExporter.cpp

示例11: 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;
}       
開發者ID:DimondTheCat,項目名稱:xray,代碼行數:60,代碼來源:ascout.cpp

示例12: 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;
}
開發者ID:cyclefusion,項目名稱:szarp,代碼行數:8,代碼來源:draw.cpp

示例13: resampleRotationKeys

/** 
 * Resamples animation until maximum error is smaller than specified angle (radians). 
 * @param maxErr Maximum absolute error (radians).
 */
static void resampleRotationKeys( KeyFrameContainer& anim, Interval range, float maxErr, const Vector<Matrix4x4>& tm )
{
	TimeValue dticks = SGEXPORT_TICKS_PER_SAMPLE;
	int frame = range.Start() / dticks;
	require( frame >= 0 && frame < tm.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 < tm.size() );
		const Matrix4x4& m = tm[frame++];
		Matrix3x3 ref = m.rotation().orthonormalize();
		float q[4];
		anim.getValue( TicksToSec(ticks), q, 4 );
		Matrix3x3 cmp( Quaternion(q[0],q[1],q[2],q[3]) );
		float xang = Math::abs( Math::acos( clamp(cmp.getColumn(0).dot(ref.getColumn(0)), -1.f, 1.f) ) );
		float yang = Math::abs( Math::acos( clamp(cmp.getColumn(1).dot(ref.getColumn(1)), -1.f, 1.f) ) );
		float zang = Math::abs( Math::acos( clamp(cmp.getColumn(2).dot(ref.getColumn(2)), -1.f, 1.f) ) );
		float err = xang;
		if ( yang > err )
			err = yang;
		if ( zang > err )
			err = zang;

		// sample more accurately if needed
		if ( err > maxErr && rangeLen > dticks )
		{
			TimeValue halfRange = alignTicks( (range.End() + range.Start())/2 );
			AnimExportUtil::addRotationKey( anim, tm[halfRange/dticks], TicksToSec(halfRange) );
			if ( ticks <= halfRange )
				resampleRotationKeys( anim, Interval(range.Start(),halfRange), maxErr, tm );
			else
				resampleRotationKeys( anim, Interval(halfRange,range.End()), maxErr, tm );
		}

		if ( ticks == range.End() )
			break;
	}
}
開發者ID:TheRyaz,項目名稱:c_reading,代碼行數:47,代碼來源:AnimExportUtil.cpp

示例14: BeginCapture

void FloatMC::BeginCapture(Interval record,TimeValue sampSize)
	{
	// Set the base point to the controller value at the start time.
	cont->GetValue(record.Start(),&base,FOREVER,CTRL_ABSOLUTE);	

	// Allocate a data buffer
	sampleCount = record.Duration()/sampSize + 1;
	data = new float[sampleCount];
	for (int i=0; i<sampleCount; i++) data[i] = 0.0f;
	}
開發者ID:2asoft,項目名稱:xray,代碼行數:10,代碼來源:floatmc.cpp

示例15: 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);
}
開發者ID:Asteral,項目名稱:Plasma,代碼行數:12,代碼來源:plBipedKiller.cpp


注:本文中的Interval::Start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。