本文整理汇总了C++中LLFrameTimer::getElapsedTimeAndResetF32方法的典型用法代码示例。如果您正苦于以下问题:C++ LLFrameTimer::getElapsedTimeAndResetF32方法的具体用法?C++ LLFrameTimer::getElapsedTimeAndResetF32怎么用?C++ LLFrameTimer::getElapsedTimeAndResetF32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLFrameTimer
的用法示例。
在下文中一共展示了LLFrameTimer::getElapsedTimeAndResetF32方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printTotals
// Print this:
// { 'meta':
// { 'elapsed_time':r3600.000 }
// 'stats':
// [ {'location':'location_1', 'mesg':'mesg_1', 'success':i10, 'fail':i0},
// {'location':'location_1', 'mesg':'mesg_2', 'success':i10, 'fail':i0},
// {'location':'location_2', 'mesg':'mesg_3', 'success':i10, 'fail':i0} ] }
void LLMetricsImpl::printTotals(LLSD metadata)
{
F32 elapsed_time = mLastPrintTimer.getElapsedTimeAndResetF32();
metadata["elapsed_time"] = elapsed_time;
LLSD out_sd = LLSD::emptyMap();
out_sd["meta"] = metadata;
LLSD stats = LLSD::emptyArray();
LLSD::map_const_iterator loc_it = mMetricsMap.beginMap();
LLSD::map_const_iterator loc_end = mMetricsMap.endMap();
for ( ; loc_it != loc_end; ++loc_it)
{
const std::string& location = (*loc_it).first;
const LLSD& loc_map = (*loc_it).second;
LLSD::map_const_iterator mesg_it = loc_map.beginMap();
LLSD::map_const_iterator mesg_end = loc_map.endMap();
for ( ; mesg_it != mesg_end; ++mesg_it)
{
const std::string& mesg = (*mesg_it).first;
const LLSD& mesg_map = (*mesg_it).second;
LLSD entry = LLSD::emptyMap();
entry["location"] = location;
entry["mesg"] = mesg;
entry["success"] = mesg_map["success"];
entry["fail"] = mesg_map["fail"];
stats.append(entry);
}
}
out_sd["stats"] = stats;
llinfos << "LLMETRICS: AGGREGATE: " << LLSDOStreamer<LLSDNotationFormatter>(out_sd) << llendl;
}
示例2: updateSimulation
void LLViewerPartSim::updateSimulation()
{
LLMemType mt(LLMemType::MTYPE_PARTICLES);
static LLFrameTimer update_timer;
const F32 dt = llmin(update_timer.getElapsedTimeAndResetF32(), 0.1f);
if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
{
return;
}
LLFastTimer ftm(LLFastTimer::FTM_SIMULATE_PARTICLES);
// Start at a random particle system so the same
// particle system doesn't always get first pick at the
// particles. Theoretically we'd want to do this in distance
// order or something, but sorting particle sources will be a big
// pain.
S32 i;
S32 count = (S32) mViewerPartSources.size();
S32 start = (S32)ll_frand((F32)count);
S32 dir = 1;
S32 deldir = 0;
if (ll_frand() > 0.5f)
{
dir = -1;
deldir = -1;
}
S32 num_updates = 0;
for (i = start; num_updates < count;)
{
if (i >= count)
{
i = 0;
}
if (i < 0)
{
i = count - 1;
}
if (!mViewerPartSources[i]->isDead())
{
BOOL upd = TRUE;
if (!LLPipeline::sRenderAttachedParticles)
{
LLViewerObject* vobj = mViewerPartSources[i]->mSourceObjectp;
if (vobj && (vobj->getPCode() == LL_PCODE_VOLUME))
{
LLVOVolume* vvo = (LLVOVolume *)vobj;
if (vvo && vvo->isAttachment())
{
upd = FALSE;
}
}
}
if (upd)
{
mViewerPartSources[i]->update(dt);
}
}
if (mViewerPartSources[i]->isDead())
{
mViewerPartSources.erase(mViewerPartSources.begin() + i);
count--;
i+=deldir;
}
else
{
i += dir;
}
num_updates++;
}
count = (S32) mViewerPartGroups.size();
for (i = 0; i < count; i++)
{
LLViewerObject* vobj = mViewerPartGroups[i]->mVOPartGroupp;
S32 visirate = 1;
if (vobj)
{
LLSpatialGroup* group = vobj->mDrawable->getSpatialGroup();
if (group && !group->isVisible()) // && !group->isState(LLSpatialGroup::OBJECT_DIRTY))
{
visirate = 8;
}
}
if ((LLDrawable::getCurrentFrame()+mViewerPartGroups[i]->mID)%visirate == 0)
{
if (vobj)
{
gPipeline.markRebuild(vobj->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
}
mViewerPartGroups[i]->updateParticles(dt * visirate);
//.........这里部分代码省略.........
示例3: blend
void LLDrawPoolTerrain::renderFull4TUShader()
{
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
if (gPipeline.getLightingDetail() >= 2)
{
glEnableClientState(GL_COLOR_ARRAY);
}
glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
// Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition();
LLViewerImage *detail_texture0p = compp->mDetailTextures[0];
LLViewerImage *detail_texture1p = compp->mDetailTextures[1];
LLViewerImage *detail_texture2p = compp->mDetailTextures[2];
LLViewerImage *detail_texture3p = compp->mDetailTextures[3];
static F32 dp = 0.f;
static LLFrameTimer timer;
dp += timer.getElapsedTimeAndResetF32();
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
LLVector4 tp0, tp1;
tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
//----------------------------------------------------------------------------
// Pass 1/1
//
// Stage 0: detail texture 0
//
S32 detailTex0 = gTerrainProgram.enableTexture(LLShaderMgr::TERRAIN_DETAIL0);
S32 detailTex1 = gTerrainProgram.enableTexture(LLShaderMgr::TERRAIN_DETAIL1);
S32 rampTex = gTerrainProgram.enableTexture(LLShaderMgr::TERRAIN_ALPHARAMP);
LLViewerImage::bindTexture(detail_texture0p,detailTex0);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glActiveTextureARB(GL_TEXTURE0_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
//
// Stage 1: Generate alpha ramp for detail0/detail1 transition
//
LLViewerImage::bindTexture(m2DAlphaRampImagep,rampTex);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
//
// Stage 2: Interpolate detail1 with existing based on ramp
//
LLViewerImage::bindTexture(detail_texture1p,detailTex1);
glClientActiveTextureARB(GL_TEXTURE2_ARB);
glActiveTextureARB(GL_TEXTURE2_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
//
// Stage 3: Modulate with primary color for lighting
//
//LLViewerImage::bindTexture(detail_texture1p,3); // bind any texture
//glEnable(GL_TEXTURE_2D); // Texture unit 3
glClientActiveTextureARB(GL_TEXTURE3_ARB);
glActiveTextureARB(GL_TEXTURE3_ARB);
// GL_BLEND disabled by default
drawLoop();
//----------------------------------------------------------------------------
// Second pass
//
// Stage 0: Write detail3 into base
//
LLViewerImage::bindTexture(detail_texture2p,detailTex0);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
//.........这里部分代码省略.........