本文整理汇总了C++中SimpleTimer::Elapsed方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleTimer::Elapsed方法的具体用法?C++ SimpleTimer::Elapsed怎么用?C++ SimpleTimer::Elapsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleTimer
的用法示例。
在下文中一共展示了SimpleTimer::Elapsed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddItems
UndoCommandPtr Selection::AddItems(const OS_ObjectDumbPtr &items, const SelectionChangingSignature::Delegate& emitterChanging, const SelectionChangedSignature::Delegate& emitterChanged)
{
if ( items.Empty() )
{
return NULL;
}
EDITOR_SCENE_SCOPE_TIMER( ("") );
SimpleTimer timer;
std::vector<Reflect::Object*> added;
OS_ObjectDumbPtr temp = m_Items;
OS_ObjectDumbPtr::Iterator itr = items.Begin();
OS_ObjectDumbPtr::Iterator end = items.End();
for ( ; itr != end; ++itr )
{
if ( temp.Append(*itr) )
{
added.push_back(*itr);
}
}
UndoCommandPtr command;
if ( !temp.Empty() )
{
SelectionChangingArgs args ( temp );
m_SelectionChanging.RaiseWithEmitter( args, emitterChanging );
if ( !args.m_Veto )
{
command = new SelectionChangeCommand( this );
std::vector<Reflect::Object*>::iterator itr = added.begin();
std::vector<Reflect::Object*>::iterator end = added.end();
for ( ; itr != end; ++itr )
{
SceneNode *pSceneNode = Reflect::SafeCast<SceneNode>(*itr);
if (pSceneNode)
{
pSceneNode->SetSelected(true);
}
}
m_Items = temp;
m_SelectionChanged.RaiseWithEmitter(m_Items, emitterChanged);
}
}
Log::Profile( TXT( "Selection AddItems took %fms\n" ), timer.Elapsed());
return command;
}
示例2: Refresh
void Selection::Refresh()
{
EDITOR_SCENE_SCOPE_TIMER( ("") );
SimpleTimer timer;
m_SelectionChanging.Raise(m_Items);
// do nothing
m_SelectionChanged.Raise(m_Items);
Log::Profile( TXT( "Selection Refresh took %fms\n" ), timer.Elapsed());
}
示例3: CreateMultipleObjects
void CreateTool::CreateMultipleObjects( bool stamp )
{
HELIUM_EDITOR_SCENE_SCOPE_TIMER( "Place Multiple Instances At Location" );
if ( m_InstanceRadius <= 0.0f )
{
return;
}
if ( m_InstanceOffsets.empty() || m_InstanceUpdateOffsets )
{
m_InstanceOffsets.clear();
SetupInstanceOffsets( m_InstanceRadius, m_InstanceOffsets );
m_InstanceUpdateOffsets = false;
}
float32_t maxTime = 100.0f;
SimpleTimer instanceTimer;
Vector3 instanceNormalOffset = m_InstanceNormal.Normalize() * 2.0f * s_PaintRadius;
while ( m_InstanceOffsets.size() && ( stamp || ( instanceTimer.Elapsed() < maxTime ) ) )
{
V_Vector3::iterator itr = m_InstanceOffsets.begin();
Matrix4 instanceTransform;
instanceTransform.t = Vector4( *itr );
instanceTransform *= Matrix4( AngleAxis::Rotation( Editor::SideVector, m_InstanceNormal ) );
instanceTransform.t += Vector4( m_InstanceTranslation );
Vector3 point = Vector3( instanceTransform.t.x, instanceTransform.t.y, instanceTransform.t.z );
LinePickVisitor pick( m_Scene->GetViewport()->GetCamera(), Line( point + instanceNormalOffset, point - instanceNormalOffset ) );
Vector3 instanceTranslation;
Vector3 instanceNormal;
if ( DetermineTranslationAndNormal( pick, instanceTranslation, instanceNormal ) )
{
point = Vector3( instanceTranslation.x - m_InstanceTranslation.x, instanceTranslation.y - m_InstanceTranslation.y, instanceTranslation.z - m_InstanceTranslation.z );
if ( point.Length() <= s_PaintRadius )
{
CreateSingleObject( instanceTranslation, instanceNormal, true );
}
}
m_InstanceOffsets.erase( itr );
}
}
示例4: Clear
UndoCommandPtr Selection::Clear(const SelectionChangingSignature::Delegate& emitterChanging, const SelectionChangedSignature::Delegate& emitterChanged)
{
if (m_Items.Empty())
{
return NULL;
}
EDITOR_SCENE_SCOPE_TIMER( ("") );
SimpleTimer timer;
UndoCommandPtr command;
OS_ObjectDumbPtr empty;
SelectionChangingArgs args ( empty );
m_SelectionChanging.RaiseWithEmitter( args, emitterChanging );
if ( !args.m_Veto )
{
command = new SelectionChangeCommand( this );
OS_ObjectDumbPtr::Iterator itr = m_Items.Begin();
OS_ObjectDumbPtr::Iterator end = m_Items.End();
for ( ; itr != end; ++itr )
{
SceneNode *pSceneNode = Reflect::SafeCast<SceneNode>(*itr);
if (pSceneNode)
{
pSceneNode->SetSelected(false);
}
}
m_Items.Clear();
m_SelectionChanged.RaiseWithEmitter(m_Items, emitterChanged);
}
Log::Profile( TXT( "Selection Clear took %fms\n" ), timer.Elapsed());
return command;
}
示例5: TrackEverything
void Tracker::TrackEverything()
{
HELIUM_ASSERT( m_Project );
m_StopTracking = false;
m_InitialIndexingCompleted = false;
m_IndexingFailed = false;
#pragma TODO("Create default tables/migrate db")
std::set< Helium::Path > assetFiles;
while ( !m_StopTracking )
{
Log::Print( m_InitialIndexingCompleted ? Log::Levels::Verbose : Log::Levels::Default,
m_InitialIndexingCompleted ? TXT("Tracker: Looking for new or updated files...\n") : TXT("Tracker: Finding asset files...\n" ));
// find all the files in the project
{
SimpleTimer timer;
Helium::Directory directory( m_Project->a_Path.Get().Directory() );
directory.GetFiles( assetFiles, true );
Log::Print( m_InitialIndexingCompleted ? Log::Levels::Verbose : Log::Levels::Default, TXT("Tracker: File reslover database lookup took %.2fms\n"), timer.Elapsed() );
}
// for each file
m_CurrentProgress = 0;
m_Total = (uint32_t)assetFiles.size();
SimpleTimer timer;
Log::Print( m_InitialIndexingCompleted ? Log::Levels::Verbose : Log::Levels::Default, TXT("Tracker: Scanning %d asset file(s) for changes...\n"), (uint32_t)assetFiles.size() );
for( std::set< Helium::Path >::const_iterator assetFileItr = assetFiles.begin(), assetFileItrEnd = assetFiles.end();
!m_StopTracking && assetFileItr != assetFileItrEnd; ++assetFileItr )
{
Log::Listener listener ( ~Log::Streams::Error );
++m_CurrentProgress;
// see if the file has changed
// insert/update the file: path, timestamp, etc...
const Helium::Path& assetFilePath = (*assetFileItr);
#pragma TODO( "Make a configurable list of places to ignore" )
// skip files in the meta directory
if ( assetFilePath.IsUnder( m_Project->a_Path.Get().Directory() + TXT( ".Helium/" ) ) )
{
continue;
}
// start transaction
#pragma TODO("Start transaction")
try
{
#pragma TODO("Select tracked from from db, delete db obj if the real file has changed more recently")
if ( WildcardMatch( TXT( "Helium*" ), assetFilePath.Extension().c_str() ) )
{
#ifdef ASSET_REFACTOR
const Asset::AssetClassPtr assetClass = Asset::AssetClass::LoadAssetClass( assetFilePath );
if ( assetClass.ReferencesObject() )
{
// get file's properties
Helium::SearchableProperties fileProperties;
assetClass->GatherSearchableProperties( &fileProperties );
for( std::multimap< tstring, tstring >::const_iterator filePropertiesItr = fileProperties.GetStringProperties().begin(), filePropertiesItrEnd = fileProperties.GetStringProperties().end(); filePropertiesItr != filePropertiesItrEnd; ++filePropertiesItr )
{
//TrackedProperty
TrackedProperty prop( *m_TrackerDB );
prop.mName = filePropertiesItr->first;
prop.update();
assetTrackedFile.properties().link( prop, filePropertiesItr->second );
}
// get file's dependencies
std::set< Helium::Path > fileReferences;
assetClass->GetFileReferences( fileReferences );
for( std::set< Helium::Path >::const_iterator fileRefsItr = fileReferences.begin(), fileRefsItrEnd = fileReferences.end(); fileRefsItr != fileRefsItrEnd; ++fileRefsItr )
{
// see if the file has changed
const Helium::Path& fileRefPath = (*fileRefsItr);
TrackedFile fileRefTrackedFile( *m_TrackerDB );
fileRefTrackedFile.mPath = fileRefPath.Get();
fileRefTrackedFile.update();
assetTrackedFile.fileReferences().link( fileRefTrackedFile );
}
}
#endif
}
#pragma TODO("Clear broken flag in the tracked file object")
}
catch ( const Helium::Exception& e )
{
Log::Error( TXT( "Exception in Tracker thread: %s" ), e.What() );
#pragma TODO("Set the broken flag in the tracked file object")
}
catch ( ... )
{
//.........这里部分代码省略.........