本文整理汇总了C++中MeasureTime函数的典型用法代码示例。如果您正苦于以下问题:C++ MeasureTime函数的具体用法?C++ MeasureTime怎么用?C++ MeasureTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MeasureTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MeasureTime
//----------------------------------------------------------------------------
void BlendedAnimations::OnIdle ()
{
MeasureTime();
if (MoveObject())
{
mScene->Update(mAnimTime);
}
Update();
if (mRenderer->PreDraw())
{
mRenderer->ClearBuffers();
mRenderer->Draw(mVisibleSet);
mRenderer->Draw(8, 16, mTextColor,
"Press UP-ARROW to transition from idle to walk.");
mRenderer->Draw(8, 40, mTextColor,
"Press SHIFT-UP-ARROW to transition from walk to run.");
char message[128];
sprintf(message, "time = %6.4lf", mAnimTime);
mRenderer->Draw(128, GetHeight()-8, mTextColor, message);
DrawFrameRate(8, GetHeight()-8, mTextColor);
mRenderer->PostDraw();
mRenderer->DisplayColorBuffer();
}
UpdateFrameCount();
}
示例2: MeasureTime
//----------------------------------------------------------------------------
void Delaunay3D::OnIdle ()
{
MeasureTime();
if (MoveCamera())
{
mCuller.ComputeVisibleSet(mScene);
}
if (MoveObject())
{
mScene->Update();
mCuller.ComputeVisibleSet(mScene);
}
if (mRenderer->PreDraw())
{
mRenderer->ClearBuffers();
mRenderer->Draw(mCuller.GetVisibleSet());
mRenderer->PostDraw();
mRenderer->DisplayColorBuffer();
}
UpdateFrameCount();
}
示例3: MeasureTime
//----------------------------------------------------------------------------
void WrigglingSnake::OnIdle ()
{
MeasureTime();
MoveCamera();
if (MoveObject())
{
mScene->Update();
}
#ifndef SINGLE_STEP
ModifyCurve();
#endif
mCuller.ComputeVisibleSet(mScene);
if (mRenderer->PreDraw())
{
mRenderer->ClearBuffers();
mRenderer->Draw(mCuller.GetVisibleSet());
DrawFrameRate(8, GetHeight()-8, mTextColor);
mRenderer->PostDraw();
mRenderer->DisplayColorBuffer();
}
UpdateFrameCount();
}
示例4: MeasureTime
//----------------------------------------------------------------------------
void VolumeTextures::OnIdle ()
{
MeasureTime();
if (MoveCamera())
{
mCuller.ComputeVisibleSet(mScene);
}
if (MoveObject())
{
mScene->Update();
mCuller.ComputeVisibleSet(mScene);
}
if (mRenderer->PreDraw())
{
mRenderer->ClearBuffers();
mRenderer->Draw(mCuller.GetVisibleSet());
DrawFrameRate(8, GetHeight()-8, mTextColor);
mRenderer->PostDraw();
mRenderer->DisplayColorBuffer();
}
UpdateFrameCount();
}
示例5: MeasureTime
//----------------------------------------------------------------------------
void GelatinCube::OnIdle ()
{
MeasureTime();
bool bNeedSort = MoveCamera();
if ( MoveObject() )
{
m_spkScene->UpdateGS(0.0f);
bNeedSort = true;
}
if ( bNeedSort )
m_spkBox->SortFaces(ms_spkCamera->GetDirection());
#ifndef SINGLE_STEP
DoPhysical();
#endif
ms_spkRenderer->ClearBuffers();
if ( ms_spkRenderer->BeginScene() )
{
ms_spkRenderer->Draw(m_spkScene);
DrawFrameRate(8,GetHeight()-8,ColorRGB::WHITE);
ms_spkRenderer->EndScene();
}
ms_spkRenderer->DisplayBackBuffer();
UpdateClicks();
}
示例6: MeasureTime
//----------------------------------------------------------------------------
void PlanarShadows::OnIdle ()
{
MeasureTime();
if (MoveCamera())
{
mSceneCuller.ComputeVisibleSet(mScene);
mBipedCuller.ComputeVisibleSet(mBiped);
}
if (MoveObject())
{
mScene->Update();
mBiped->Update(mUpdateTime);
mSceneCuller.ComputeVisibleSet(mScene);
mBipedCuller.ComputeVisibleSet(mBiped);
}
if (mRenderer->PreDraw())
{
mRenderer->ClearBuffers();
mRenderer->Draw(mSceneCuller.GetVisibleSet());
mRenderer->Draw(mBipedCuller.GetVisibleSet(), mPSEffect);
DrawFrameRate(8, GetHeight()-8, mTextColor);
mRenderer->PostDraw();
mRenderer->DisplayColorBuffer();
}
UpdateFrameCount();
}
示例7: MeasureTime
//----------------------------------------------------------------------------
void DynamicShader::OnIdle()
{
MeasureTime();
if( MoveCamera() )
{
m_Culler.ComputeUnculledSet(m_spScene);
}
//m_spScene->UpdateGS(SESystem::SE_GetTime()); // inefficient
m_spController->Update(SESystem::SE_GetTime());
if( MoveObject() )
{
m_spScene->UpdateGS();
m_Culler.ComputeUnculledSet(m_spScene);
}
m_pRenderer->ClearBuffers();
if( m_pRenderer->BeginScene() )
{
m_pRenderer->DrawScene(m_Culler.GetVisibleSet());
DrawFrameRate(8, GetHeight()-8, SEColorRGBA::SE_RGBA_WHITE);
m_pRenderer->EndScene();
}
m_pRenderer->DisplayBackBuffer();
UpdateFrameCount();
}
示例8: MeasureTime
//----------------------------------------------------------------------------
void DefaultShader::OnIdle()
{
// Rotate the box.
SEMatrix3f mat3fRot;
mat3fRot.FromEulerAnglesXYZ(-0.02f, 0.02f, -0.02f);
m_spMesh->Local.SetRotate(m_spMesh->Local.GetRotate()*mat3fRot);
m_spMesh->UpdateGS();
MeasureTime();
if( MoveCamera() )
{
m_Culler.ComputeUnculledSet(m_spScene);
}
if( MoveObject() )
{
m_spScene->UpdateGS();
m_Culler.ComputeUnculledSet(m_spScene);
}
m_pRenderer->ClearBuffers();
if( m_pRenderer->BeginScene() )
{
m_pRenderer->DrawScene(m_Culler.GetVisibleSet());
m_pRenderer->EndScene();
}
m_pRenderer->DisplayBackBuffer();
UpdateFrameCount();
}
示例9: MeasureTime
//----------------------------------------------------------------------------
void NonlocalBlowup::OnIdle ()
{
MeasureTime();
if (MoveCamera())
{
mCuller.ComputeVisibleSet(mScene);
}
if (MoveObject())
{
mScene->Update();
mCuller.ComputeVisibleSet(mScene);
}
if (mRenderer->PreDraw())
{
mRenderer->ClearBuffers();
mRenderer->Draw(mCuller.GetVisibleSet());
mRenderer->PostDraw();
if (mTakeSnapshot)
{
GetSnapshot();
mTakeSnapshot = false;
}
mRenderer->DisplayColorBuffer();
}
#ifndef SINGLE_STEP
ExecuteSolver();
#endif
UpdateFrameCount();
}
示例10: MeasureTime
//----------------------------------------------------------------------------
void StructuredBuffersWindow::OnIdle()
{
MeasureTime();
MoveCamera();
memset(mDrawnPixels->GetData(), 0, mDrawnPixels->GetNumBytes());
mEngine->CopyCpuToGpu(mDrawnPixels);
mEngine->ClearBuffers();
mEngine->Draw(mSquare);
mEngine->CopyGpuToCpu(mDrawnPixels);
Vector4<float>* src = mDrawnPixels->Get<Vector4<float>>();
unsigned int* trg = mDrawnPixelsTexture->Get<unsigned int>();
for (int i = 0; i < mXSize*mYSize; ++i)
{
unsigned int r = static_cast<unsigned char>(255.0f*src[i][0]);
unsigned int g = static_cast<unsigned char>(255.0f*src[i][1]);
unsigned int b = static_cast<unsigned char>(255.0f*src[i][2]);
trg[i] = r | (g << 8) | (b << 16) | (0xFF << 24);
}
WICFileIO::SaveToPNG("DrawnPixels.png", mDrawnPixelsTexture);
DrawFrameRate(8, mYSize - 8, mTextColor);
mEngine->DisplayColorBuffer(0);
UpdateFrameCount();
}
示例11: StartTimer
void LayerConv::Backward(Layer *prev_layer) {
StartTimer();
prev_layer->deriv_mat_.resize(prev_layer->batchsize_, prev_layer->length_);
#if COMP_REGIME != 2
std::vector< std::vector<Mat> > prev_deriv, filters, deriv;
InitMaps(prev_layer->deriv_mat_, prev_layer->mapsize_, prev_deriv);
InitMaps(weights_.get(), filtersize_, filters);
InitMaps(deriv_mat_, mapsize_, deriv);
std::vector<size_t> padding_der(numdim_);
for (size_t i = 0; i < numdim_; ++i) {
padding_der[i] = filtersize_[i] - 1 - padding_[i];
}
prev_layer->deriv_mat_.assign(0);
#if COMP_REGIME == 1
#pragma omp parallel for num_threads(12) schedule(static,10)
#endif
for (int k = 0; k < batchsize_; ++k) {
#if COMP_REGIME == 1
//#pragma omp parallel for
#endif
for (size_t i = 0; i < outputmaps_; ++i) {
for (size_t j = 0; j < prev_layer->outputmaps_; ++j) {
Mat der_mat(prev_layer->mapsize_);
Filter(deriv[k][i], filters[i][j], padding_der, true, der_mat);
prev_deriv[k][j] += der_mat;
}
}
}
#else // GPU
ImgActs(deriv_mat_, weights_.get(), prev_layer->deriv_mat_,
prev_layer->mapsize_, filtersize_[0], padding_[0], !unshared_);
#endif
prev_layer->deriv_mat_.Validate();
MeasureTime("Backwards Conv Layer",1);
}
示例12: MeasureTime
//----------------------------------------------------------------------------
void Lighting2::OnIdle()
{
// Lights motion.
static double dCurTime = 0.0f;
static double dLastTime = 0.0f;
static float fAngel0 = 0.0f;
static float fAngel1 = SEMathf::PI;
static float fRadius0 = 4.0f;
static float fRadius1 = 4.0f;
dCurTime = SESystem::SE_GetTime();
if( dCurTime - dLastTime > 0.0001f )
{
dLastTime = dCurTime;
fAngel0 += 0.04f;
fAngel1 -= 0.04f;
SEMatrix3f mat3fRot;
mat3fRot.FromEulerAnglesXYZ(0.0f, -0.04f, 0.0f);
m_spLight0Node->Local.SetRotate(m_spLight0Node->Local.GetRotate()
*mat3fRot);
float fX = fRadius0*SEMathf::Cos(fAngel0);
float fZ = fRadius0*SEMathf::Sin(fAngel0);
m_spLight0Node->Local.SetTranslate(SEVector3f(fX, m_fLight0Height,
fZ));
m_spLight0Node->UpdateGS();
mat3fRot.FromEulerAnglesXYZ(0.0f, 0.04f, 0.0f);
m_spLight1Node->Local.SetRotate(m_spLight1Node->Local.GetRotate()
*mat3fRot);
fX = fRadius1*SEMathf::Cos(fAngel1);
fZ = fRadius1*SEMathf::Sin(fAngel1);
m_spLight1Node->Local.SetTranslate(SEVector3f(fX, m_fLight1Height,
fZ));
m_spLight1Node->UpdateGS();
}
MeasureTime();
if( MoveCamera() )
{
m_Culler.ComputeUnculledSet(m_spScene);
}
if( MoveObject() )
{
m_spScene->UpdateGS();
m_Culler.ComputeUnculledSet(m_spScene);
}
m_pRenderer->ClearBuffers();
if( m_pRenderer->BeginScene() )
{
m_pRenderer->DrawScene(m_Culler.GetVisibleSet());
DrawFrameRate(8, GetHeight()-8, SEColorRGBA::SE_RGBA_WHITE);
m_pRenderer->EndScene();
}
m_pRenderer->DisplayBackBuffer();
UpdateFrameCount();
}
示例13: MeasureTime
//----------------------------------------------------------------------------
void PerformanceAMDWindow::OnIdle()
{
MeasureTime();
MoveCamera();
UpdateConstants();
mEngine->ClearBuffers();
mPerformance.Profile([this]()
{
mEngine->Execute(mGenerateTexture, mNumXGroups, mNumYGroups, 1);
mEngine->Draw(mTriangles);
});
// Compute the average measurements. GetAverage allows you to access
// the measurements during application run time. SaveAverage calls
// GetAverage and writes the results to a spreadsheet.
std::vector<std::vector<AMDPerformance::Measurement>> measurements;
if (mPerformance.GetNumProfileCalls() == 16)
{
mPerformance.GetAverage(measurements);
mPerformance.SaveAverage("ProfileResults.csv");
}
DrawFrameRate(8, mYSize - 8, mTextColor);
mEngine->DisplayColorBuffer(0);
UpdateFrameCount();
}
示例14: MeasureTime
//----------------------------------------------------------------------------
void BouncingTetrahedra::OnIdle ()
{
MeasureTime();
PhysicsTick();
GraphicsTick();
UpdateFrameCount();
}
示例15: MeasureTime
//----------------------------------------------------------------------------
void ClodMeshes::OnIdle ()
{
MeasureTime();
if (MoveCamera())
{
mCuller.ComputeVisibleSet(mScene);
}
if (MoveObject())
{
mScene->Update();
mCuller.ComputeVisibleSet(mScene);
}
if (mRenderer->PreDraw())
{
mRenderer->ClearBuffers();
mRenderer->Draw(mCuller.GetVisibleSet());
DrawFrameRate(8, GetHeight()-8, mTextColor);
#ifdef USE_CLOD_MESH
char message[256];
sprintf(message, "triangles0: %4d triangles1: %4d",
mClod[0]->GetNumTriangles(), mClod[1]->GetNumTriangles());
mRenderer->Draw(128, GetHeight()-8, mTextColor, message);
#endif
mRenderer->PostDraw();
mRenderer->DisplayColorBuffer();
}
UpdateFrameCount();
}