Jump to content

[SOLVED] Very slow billboards repositioning in UNIGINE 2.7


photo

Recommended Posts

After migrating to version 2.7 repositioning of billboards in my application has drastically slowed done. Actually it's about 20 times slower than in version 2.6.1.1.

Here is the code

    start = std::chrono::high_resolution_clock::now ();

    for ( int id = 0; id < pBillboadrs->getNumBillboards (); id++ )
    {
        double dRadius = fFarClipping-150.0;
        int iStarID = mapBillboardID2StarID[id];
        double x, y, z;
        y = dRadius * StarSky[iStarID].ObservParam.Alt.cos () * StarSky[iStarID].ObservParam.Az.cos ();
        x = dRadius * StarSky[iStarID].ObservParam.Alt.cos () * StarSky[iStarID].ObservParam.Az.sin ();
        z = dRadius * StarSky[iStarID].ObservParam.Alt.sin ();
        Math::vec3 position ( x, y, z );
        pBillboadrs->setBillboardPosition ( id, position );
    }

    end = std::chrono::high_resolution_clock::now ();
    auto lag = std::chrono::duration<double, std::ratio<1, 1>> ( end - start );

    char str[128];
    sprintf_s ( str, 128, "StarSky: 'setBillboardPosition' for %i billboards in %f seconds\n", pBillboadrs->getNumBillboards (), lag.count () );
    Log::message ( str );

Number of billboards is 7987.

Loop execution time is 0,082163 seconds for version 2.6.1.1 and 1,46314 seconds for vesion 2.7.

All math in loop is OK. If I comment line with setBillboardPosition the loop is very fast in all versions.

The same problem is with billboards size change. Simular code for changing size has become very slow.

Link to comment
  • 1 month later...
  • silent changed the title to [SOLVED] Very slow billboards repositioning in UNIGINE 2.7
×
×
  • Create New...