Beispiel #1
0
//----------------------------------------------------------------------------
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();
}
Beispiel #2
0
//----------------------------------------------------------------------------
void IntersectTriangleCylinder::OnIdle ()
{
    MeasureTime();

    if (MoveCamera())
    {
        mCuller.ComputeVisibleSet(mScene);
    }

    if (MoveObject())
    {
        mScene->Update();
        mCuller.ComputeVisibleSet(mScene);
        TestIntersection();
    }

    if (mRenderer->PreDraw())
    {
        mRenderer->ClearBuffers();
        mRenderer->Draw(mCuller.GetVisibleSet());
        //DrawFrameRate(8, GetHeight()-8, mTextColor);
        mRenderer->PostDraw();
        mRenderer->DisplayColorBuffer();
    }

    UpdateFrameCount();
}
Beispiel #3
0
//----------------------------------------------------------------------------
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();
}
Beispiel #4
0
//----------------------------------------------------------------------------
void ConvexHull3D::OnIdle ()
{
    MeasureTime();

    if (MoveCamera())
    {
        mCuller.ComputeVisibleSet(mScene);
    }

    if (MoveObject())
    {
        mScene->Update();
        mCuller.ComputeVisibleSet(mScene);
    }

    if (mRenderer->PreDraw())
    {
        mRenderer->ClearBuffers();
        mRenderer->Draw(mCuller.GetVisibleSet());
        mRenderer->Draw(8, 16, mTextColor, mHeader);
        mRenderer->Draw(8, GetHeight()-8, mTextColor, mFooter);
        mRenderer->PostDraw();
        mRenderer->DisplayColorBuffer();
    }

    UpdateFrameCount();
}
//----------------------------------------------------------------------------
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();
}
Beispiel #6
0
//----------------------------------------------------------------------------
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();
}
Beispiel #7
0
//----------------------------------------------------------------------------
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();
}
Beispiel #8
0
//----------------------------------------------------------------------------
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();
}
Beispiel #9
0
//----------------------------------------------------------------------------
void Skinning::OnIdle ()
{
    MeasureTime();

    UpdateConstants((float)GetTimeInSeconds());

    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();
}
//----------------------------------------------------------------------------
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();
}
//----------------------------------------------------------------------------
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();
}
//----------------------------------------------------------------------------
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();
}
//----------------------------------------------------------------------------
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();
}
Beispiel #14
0
//----------------------------------------------------------------------------
void CollisionsMovingSpheres::OnIdle ()
{
    MeasureTime();

    if (MoveCamera())
    {
        mCuller.ComputeVisibleSet(mScene);
    }

    if (MoveObject())
    {
        mScene->Update();
        mCuller.ComputeVisibleSet(mScene);
    }

#ifndef SINGLE_STEP
    UpdateSpheres();
#endif

    if (mRenderer->PreDraw())
    {
        mRenderer->ClearBuffers();
        mRenderer->Draw(mCuller.GetVisibleSet());
        DrawFrameRate(8, GetHeight()-8, mTextColor);
        mRenderer->PostDraw();
        mRenderer->DisplayColorBuffer();
    }

    UpdateFrameCount();
}
Beispiel #15
0
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);
}
Beispiel #16
0
//----------------------------------------------------------------------------
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();
}
//----------------------------------------------------------------------------
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();
}
Beispiel #18
0
//----------------------------------------------------------------------------
void PolygonOffsets::OnIdle ()
{
    MeasureTime();

    if (MoveCamera())
    {
        mCuller.ComputeVisibleSet(mScene);
    }

    if (MoveObject())
    {
        mScene->Update();
        mCuller.ComputeVisibleSet(mScene);
    }

    if (mRenderer->PreDraw())
    {
        mRenderer->ClearBuffers();
        mRenderer->Draw(mCuller.GetVisibleSet());
        mRenderer->Draw(8, 16, mTextColor,
            "Press UP/DOWN arrows. "
            "The left box flickers, the right does not");
        DrawFrameRate(8, GetHeight()-8, mTextColor);
        mRenderer->PostDraw();
        mRenderer->DisplayColorBuffer();
    }

    UpdateFrameCount();
}
//----------------------------------------------------------------------------
void BouncingTetrahedra::OnIdle ()
{
    MeasureTime();
    PhysicsTick();
    GraphicsTick();
    UpdateFrameCount();
}
//----------------------------------------------------------------------------
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();
}
Beispiel #21
0
void LayerConv::CalcWeights(Layer *prev_layer, int passnum) {
  StartTimer();

  if (passnum < 2) return;
  Mat weights_der;
  if (passnum == 2) {
    weights_der.attach(weights_.der());
  } else if (passnum == 3) {
    weights_der.attach(weights_.der2());    
  }
  #if COMP_REGIME != 2
    std::vector< std::vector<Mat> > prev_activ, filters_der, deriv;
    InitMaps(prev_layer->activ_mat_, prev_layer->mapsize_, prev_activ); 
    InitMaps(weights_der, filtersize_, filters_der);
    InitMaps(deriv_mat_, mapsize_, deriv);
    size_t i,j;
    int k;
    //#pragma omp parallel{ //for num_threads(12) private(fil_der)
    for (i = 0; i < outputmaps_; ++i) {
      for (j = 0; j < prev_layer->outputmaps_; ++j) {

        Mat fil_der(filtersize_);
        fil_der.assign(0);      
        #if COMP_REGIME == 1
        #endif
        for (k = 0; k < batchsize_; ++k) {
          Mat ker_mat(filtersize_);
          Filter(prev_activ[k][j], deriv[k][i], padding_, false, ker_mat);      
          #if COMP_REGIME == 1
            //#pragma omp critical
          #endif
          fil_der += ker_mat; 
                   
        }
        filters_der[i][j] = fil_der;        
      }        
    }    
  #else // GPU    
    WeightActs(prev_layer->activ_mat_, deriv_mat_, weights_der,
               prev_layer->mapsize_, filtersize_[0], 
               padding_[0], sum_width_, !unshared_);        
  #endif
  weights_der /= (ftype) batchsize_;
  weights_der.Validate();
  if (passnum == 2) {
    mexAssert(deriv_mat_.order() == false, "deriv_mat_.order() should be false");
    if (!unshared_) {
      deriv_mat_.reshape(batchsize_ * deriv_mat_.size2() / outputmaps_, outputmaps_);
      Sum(deriv_mat_, biases_.der(), 1);
      deriv_mat_.reshape(batchsize_, deriv_mat_.size1() * outputmaps_ / batchsize_);        
    } else {
      Sum(deriv_mat_, biases_.der(), 1);      
    }
    (biases_.der() /= (ftype) batchsize_) *= bias_coef_;
    biases_.der().Validate();
  }
  MeasureTime("CalcWeights Conv Layer",2);
}
Beispiel #22
0
        void Run()
        {
            std::cout << std::endl << "run performance tests ..." << std::endl;

            //commands->SetRenderTarget(*context);

            MeasureTime(
                ( "MIP-map generation of " + std::to_string(config.numTextures) + " textures with size " +
                  std::to_string(config.textureSize) + " and " + std::to_string(config.arrayLayers) + " array layers" ),
                std::bind(&PerformanceTest::TestMIPMapGeneration, this)
            );
            MeasureTime(
                ( "MIP-map generation of " + std::to_string(config.numTextures) + " textures with size " +
                  std::to_string(config.textureSize) + " and only first " + std::to_string(config.numMipMaps) + " MIP-maps of first array layer" ),
                std::bind(&PerformanceTest::TestSubMIPMapGeneration, this)
            );

            //context->Present();
        }
Beispiel #23
0
//----------------------------------------------------------------------------
void BouncingBall::OnIdle ()
{
    MeasureTime();

#ifndef SINGLE_STEP
    PhysicsTick();
#endif

    GraphicsTick();

    UpdateFrameCount();
}
//----------------------------------------------------------------------------
void WireMeshWindow::OnIdle()
{
    MeasureTime();
    MoveCamera();

    mEngine->ClearBuffers();
    mEngine->Draw(mMesh);
    DrawFrameRate(8, mYSize-8, mTextColor);
    mEngine->DisplayColorBuffer(0);

    UpdateFrameCount();
}
Beispiel #25
0
void LayerFull::Backward(Layer *prev_layer) {
  StartTimer();
  prev_layer->deriv_mat_.resize(prev_layer->batchsize_, prev_layer->length_);
  Prod(deriv_mat_, false, weights_.get(), false, prev_layer->deriv_mat_);  
  if (prev_layer->type_ == "f") {
    LayerFull *layerfull = static_cast<LayerFull*>(prev_layer);
    if (layerfull->dropout_ > 0) {
      layerfull->deriv_mat_ *= layerfull->dropmat_;
    }  
  }
  prev_layer->deriv_mat_.Validate();
  MeasureTime("Backwards Full Layer",4);
}
Beispiel #26
0
void LayerFull::Forward(Layer *prev_layer, int passnum) {
  StartTimer();
  batchsize_ = prev_layer->batchsize_;
  if (passnum == 3) {
    Swap(activ_mat_, first_mat_);    
  }
  activ_mat_.resize(batchsize_, length_);
  Prod(prev_layer->activ_mat_, false, weights_.get(), true, activ_mat_);    
  if (passnum == 0 || passnum == 1) {
    activ_mat_.AddVect(biases_.get(), 1);            
  }    
  if (dropout_ > 0) { // dropout
    if (passnum == 1) {
      dropmat_.resize(batchsize_, length_);
      dropmat_.rand();
      dropmat_.CondAssign(dropmat_, false, dropout_, 0);
      dropmat_.CondAssign(dropmat_, true, 0, 1);
      activ_mat_ *= dropmat_;
    } else if (passnum == 3) {
      activ_mat_ *= dropmat_;
    } else if (passnum == 0) {
      activ_mat_ *= (1 - dropout_);      
    }    
  }
  activ_mat_.Validate();
  /*
  if (print == 1) {
  mexPrintMsg("FULL");    
  Mat m;
  m.attach(activ_mat_);
  mexPrintMsg("s1", m.size1());    
  mexPrintMsg("s2", m.size2()); 
  mexPrintMsg("totalsum", m.sum());    
  Mat versum = Sum(m, 1);
  for (int i = 0; i < 5; ++i) {
    mexPrintMsg("versum", versum(0, i));    
  }
  Mat horsum = Sum(m, 2);
  for (int i = 0; i < 5; ++i) {
    mexPrintMsg("horsum", horsum(i, 0));    
  }  
  for (int i = 0; i < 5; ++i) {
    mexPrintMsg("Horizontal", m(0, i));    
  }
  for (int i = 0; i < 5; ++i) {
    mexPrintMsg("Vertical", m(i, 0));    
  }
  }*/
  MeasureTime("Forwards Full Layer",3);
}
//----------------------------------------------------------------------------
void GpuGaussianBlur3::OnIdle ()
{
    MeasureTime();

    if (mRenderer->PreDraw())
    {
        mIP->ExecuteStep(mRenderer, true);
        DrawFrameRate(8, GetHeight()-8, mTextColor);
        mRenderer->PostDraw();
        mRenderer->DisplayColorBuffer();
    }

    UpdateFrameCount();
}
//----------------------------------------------------------------------------
void GpuFluids2D::OnIdle ()
{
    MeasureTime();

    if (mRenderer->PreDraw())
    {
        mSmoke->DoSimulationStep();

        DrawFrameRate(8, GetHeight()-8, mTextColor);
        mRenderer->PostDraw();
        mRenderer->DisplayColorBuffer();
    }

    UpdateFrameCount();
}
//----------------------------------------------------------------------------
void HelixTubeSurface::OnIdle ()
{
    MeasureTime();

    if (mRenderer->PreDraw())
    {
        mRenderer->ClearBuffers();
        mRenderer->Draw(mCuller.GetVisibleSet());
        DrawFrameRate(8, GetHeight()-8, mTextColor);
        mRenderer->PostDraw();
        mRenderer->DisplayColorBuffer();
    }

    UpdateFrameCount();
}
Beispiel #30
0
void TestWithRoots(int type, vector<double>roots)
{
	Polynomial& p = CreatePolynomial(type);
	Polynomial& p2 = CreatePolynomial(type);
	p.SetValue(0, 1);
	for(auto r: roots)
	{
		p2.SetValue(1, 1);
		p2.SetValue(0, -r);
		p *= p2;
		//p.Print();
	}
	MeasureTime(p);
	cout << "----" << endl;
}