本文整理汇总了C++中common::Timer::Stop方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::Stop方法的具体用法?C++ Timer::Stop怎么用?C++ Timer::Stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Timer
的用法示例。
在下文中一共展示了Timer::Stop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BVHTest
void BVHTest()
{
Common::Timer timer;
Random rand = Random(1);
#define NUM_INSERTIONS 100000
Box* pBoxes = (Box*)_aligned_malloc(NUM_INSERTIONS * sizeof(Box), 16);
for (int i = 0; i < NUM_INSERTIONS; i++)
{
Vector pos = rand.GetFloat3();
pos *= 100.0f;
pBoxes[i] = Box(pos - Vector(0.5f, 0.5f, 0.5), pos + Vector(0.5f, 0.5f, 0.5));
}
Util::BVH bvh;
timer.Start();
for (int i = 0; i < NUM_INSERTIONS; i++)
{
bvh.Insert(pBoxes[i], (void*)i);
}
double buildTime = timer.Stop();
Box testBox = Box(Vector(50, 50, 50), Vector(60, 60, 60));
//__asm int 3;
}
示例2: RerecordingStop
// Reset the frame counter
void RerecordingStop()
{
// Write the final time and Stop the timer
ReRecTimer.Stop();
// Update status bar
WriteStatus();
}
示例3: WinMain
//.........这里部分代码省略.........
// Set focus
g_pScene->SetFocusSegment(pSegments[0][0]);
#endif
/*
for (int i = -4; i<4; i++)
{
for (int j = -10; j<10; j++)
{
for (int k = -4; k<4; k++)
{
Entity* pCube = g_pScene->CreateEntity();
pCube->SetPosition(0.75f * Vector(i,j,k));
MeshComponent* pMesh = new MeshComponent(pCube);
pMesh->SetMeshResource("cube.nfm");
BodyComponent* pBody = new BodyComponent(pCube);
pBody->SetMass(1.0f);
pBody->EnablePhysics((CollisionShape*)Engine_GetResource(Mesh::COLLISION_SHAPE, "shape_box"));
}
}
}
//set ambient & background color
envDesc.m_AmbientLight = Vector(0.001f, 0.001f, 0.001f, 0.0f);
envDesc.m_BackgroundColor = Vector(0.0f, 0.0f, 0.0f, 0.0f);
g_pScene->SetEnvironment(&envDesc);
// SUNLIGHT
Entity* pDirLightEnt = g_pScene->CreateEntity();
XOrientation orient;
orient.x = Vector(0.0f, -0.0f, -0.0f, 0.0f);
orient.z = Vector(-0.5f, -1.1f, 1.2f, 0.0f);
orient.y = Vector(0.0f, 1.0f, 0.0f, 0.0f);
pDirLightEnt->SetOrientation(&orient);
DirLightDesc dirLight;
dirLight.m_Far = 100.0f;
dirLight.m_Splits = 4;
dirLight.m_LightDist = 1000.0f;
LightComponent* pDirLight = new LightComponent(pDirLightEnt);
pDirLight->SetDirLight(&dirLight);
pDirLight->SetColor(Float3(2.2, 2, 1.8));
pDirLight->SetShadowMap(1024);
pFirstWindow->cameraEntity->SetPosition(Vector(0.0f, 1.6f, -20.0f, 0.0f));
*/
// message loop
DrawRequest drawRequests[2];
Common::Timer timer;
timer.Start();
while (!pWindow->isClosed())
{
//measure delta time
g_DeltaTime = (float)timer.Stop();
timer.Start();
UpdateRequest updateReq;
updateReq.pScene = g_pScene;
updateReq.deltaTime = g_DeltaTime;
pWindow->processMessages();
pWindow->UpdateCamera();
drawRequests[0].deltaTime = g_DeltaTime;
drawRequests[0].pView = pWindow->view;
drawRequests[1].deltaTime = g_DeltaTime;
drawRequests[1].pView = g_pSecondaryCameraView;
EngineAdvance(drawRequests, 2, &updateReq, 1);
ProcessSceneEvents();
// print focus segment name
wchar_t str[128];
Segment* pFocus = g_pScene->GetFocusSegment();
swprintf(str, L"NFEngine Demo (%S) - focus: %S", PLATFORM_STR,
(pFocus != 0) ? pFocus->GetName() : "NONE");
pWindow->setTitle(str);
}
// for testing purposes
Common::FileOutputStream test_stream("test.xml");
g_pScene->Serialize(&test_stream, SerializationFormat::Xml, false);
EngineDeleteScene(g_pScene);
delete pWindow;
EngineRelease();
//detect memory leaks
#ifdef _DEBUG
_CrtDumpMemoryLeaks();
#endif
return 0;
}