本文整理汇总了C++中LLFrameTimer::getElapsedTimeF32方法的典型用法代码示例。如果您正苦于以下问题:C++ LLFrameTimer::getElapsedTimeF32方法的具体用法?C++ LLFrameTimer::getElapsedTimeF32怎么用?C++ LLFrameTimer::getElapsedTimeF32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLFrameTimer
的用法示例。
在下文中一共展示了LLFrameTimer::getElapsedTimeF32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display_stats
// Write some stats to llinfos
void display_stats()
{
if (gNoRender || !gViewerWindow->mWindow->getVisible() || !gFocusMgr.getAppHasFocus())
{
// Do not keep FPS statistics while yielding cooperatively
// (i;e. when not running as foreground window)
gRecentFrameCount = 0;
gRecentFPSTime.reset();
}
F32 fps_log_freq = gSavedSettings.getF32("FPSLogFrequency");
if (fps_log_freq > 0.f && gRecentFPSTime.getElapsedTimeF32() >= fps_log_freq)
{
F32 fps = gRecentFrameCount / fps_log_freq;
llinfos << llformat("FPS: %.02f", fps) << llendl;
gRecentFrameCount = 0;
gRecentFPSTime.reset();
}
F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency");
if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq)
{
gMemoryAllocated = getCurrentRSS();
U32 memory = (U32)(gMemoryAllocated / (1024*1024));
llinfos << llformat("MEMORY: %d MB", memory) << llendl;
gRecentMemoryTime.reset();
}
}
示例2: display_stats
// Write some stats to llinfos
void display_stats()
{
if (gNoRender || !gViewerWindow->getWindow()->getVisible() || !gFocusMgr.getAppHasFocus())
{
// Do not keep FPS statistics while yielding cooperatively
// (i;e. when not running as foreground window)
gRecentFrameCount = 0;
gRecentFPSTime.reset();
}
F32 fps_log_freq = gSavedSettings.getF32("FPSLogFrequency");
if (fps_log_freq > 0.f && gRecentFPSTime.getElapsedTimeF32() >= fps_log_freq)
{
F32 fps = gRecentFrameCount / fps_log_freq;
llinfos << llformat("FPS: %.02f", fps) << llendl;
llinfos << llformat("VBO: %d glVBO: %d", LLVertexBuffer::sCount, LLVertexBuffer::sGLCount) << llendl;
#ifdef LL_OCTREE_STATS
OctreeStats::getInstance()->dump();
#endif
gRecentFrameCount = 0;
gRecentFPSTime.reset();
}
F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency");
if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq)
{
gMemoryAllocated = LLMemory::getCurrentRSS();
U32 memory = (U32)(gMemoryAllocated / (1024*1024));
llinfos << llformat("MEMORY: %d MB", memory) << llendl;
llinfos << "THREADS: "<< LLThread::getCount() << llendl;
llinfos << "MALLOC: " << SGMemStat::getPrintableStat() <<llendl;
LLMemory::logMemoryInfo(TRUE) ;
gRecentMemoryTime.reset();
}
}
示例3: beamColorFromData
LLColor4U lggBeamMaps::beamColorFromData(lggBeamsColors data)
{
F32 r, g, b;
LLColor4 output;
LLColor4U toReturn;
F32 timeinc = timer.getElapsedTimeF32()*0.3f*((data.rotateSpeed+.01f)) * (360/(data.endHue-data.startHue));
S32 diference = llround(data.endHue - data.startHue);
if(diference == 360 || diference == 720)
{
//full rainbow
//liner one
hslToRgb(fmod(timeinc,1.0f), 1.0f, 0.5f, r, g, b);
}else
{
F32 variance = ((data.endHue/360.0f)-(data.startHue/360.0f))/2.0f;
hslToRgb((data.startHue/360.0f) + variance + (sinf(timeinc)*(variance)), 1.0f, 0.5f, r, g, b);
}
output.set(r, g, b);
toReturn.setVecScaleClamp(output);
return toReturn;
}
示例4: display_stats
// Write some stats to llinfos
void display_stats()
{
F32 fps_log_freq = gSavedSettings.getF32("FPSLogFrequency");
if (fps_log_freq > 0.f && gRecentFPSTime.getElapsedTimeF32() >= fps_log_freq)
{
F32 fps = gRecentFrameCount / fps_log_freq;
llinfos << llformat("FPS: %.02f", fps) << llendl;
gRecentFrameCount = 0;
gRecentFPSTime.reset();
}
F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency");
if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq)
{
gMemoryAllocated = getCurrentRSS();
U32 memory = (U32)(gMemoryAllocated / (1024*1024));
llinfos << llformat("MEMORY: %d MB", memory) << llendl;
gRecentMemoryTime.reset();
}
}
示例5: updateDebugSettings
//static
void LLVOCacheEntry::updateDebugSettings()
{
static LLFrameTimer timer;
if(timer.getElapsedTimeF32() < 1.0f) //update frequency once per second.
{
return;
}
timer.reset();
//the number of frames invisible objects stay in memory
static LLCachedControl<U32> inv_obj_time(gSavedSettings,"NonvisibleObjectsInMemoryTime");
sMinFrameRange = inv_obj_time - 1; //make 0 to be the maximum
//min radius: all objects within this radius remain loaded in memory
static LLCachedControl<F32> min_radius(gSavedSettings,"SceneLoadMinRadius");
sNearRadius = llmin((F32)min_radius, gAgentCamera.mDrawDistance); //can not exceed the draw distance
sNearRadius = llmax(sNearRadius, 1.f); //minimum value is 1.0m
//objects within the view frustum whose visible area is greater than this threshold will be loaded
static LLCachedControl<F32> front_pixel_threshold(gSavedSettings,"SceneLoadFrontPixelThreshold");
sFrontPixelThreshold = front_pixel_threshold;
//objects out of the view frustum whose visible area is greater than this threshold will remain loaded
static LLCachedControl<F32> rear_pixel_threshold(gSavedSettings,"SceneLoadRearPixelThreshold");
sRearPixelThreshold = rear_pixel_threshold;
sRearPixelThreshold = llmax(sRearPixelThreshold, sFrontPixelThreshold); //can not be smaller than sFrontPixelThreshold.
// a percentage of draw distance beyond which all objects outside of view frustum will be unloaded, regardless of pixel threshold
static LLCachedControl<F32> rear_max_radius_frac(gSavedSettings,"SceneLoadRearMaxRadiusFraction");
sRearFarRadius = llmax(rear_max_radius_frac * gAgentCamera.mDrawDistance / 100.f, 1.0f); //minimum value is 1.0m
sRearFarRadius = llmax(sRearFarRadius, (F32)min_radius); //can not be less than "SceneLoadMinRadius".
sRearFarRadius = llmin(sRearFarRadius, gAgentCamera.mDrawDistance); //can not be more than the draw distance.
//make the above parameters adaptive to memory usage
//starts to put restrictions from low_mem_bound_MB, apply tightest restrictions when hits high_mem_bound_MB
static LLCachedControl<U32> low_mem_bound_MB(gSavedSettings,"SceneLoadLowMemoryBound");
static LLCachedControl<U32> high_mem_bound_MB(gSavedSettings,"SceneLoadHighMemoryBound");
LLMemory::updateMemoryInfo() ;
U32 allocated_mem = LLMemory::getAllocatedMemKB().value();
allocated_mem /= 1024; //convert to MB.
if(allocated_mem < low_mem_bound_MB)
{
return;
}
F32 adjust_factor = llmax(0.f, (F32)(high_mem_bound_MB - allocated_mem) / (high_mem_bound_MB - low_mem_bound_MB));
sRearFarRadius = llmin(adjust_factor * sRearFarRadius, 96.f); //[0.f, 96.f]
sMinFrameRange = (U32)llclamp(adjust_factor * sMinFrameRange, 10.f, 64.f); //[10, 64]
sNearRadius = llmax(adjust_factor * sNearRadius, 1.0f);
}
示例6: draw
//.........这里部分代码省略.........
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
// Draw water
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, ABOVE_WATERLINE_ALPHA / 255.f);
{
if (regionp->getLand().getWaterTexture())
{
gGL.getTexUnit(0)->bind(regionp->getLand().getWaterTexture());
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
}
}
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
// Redraw object layer periodically
if (mUpdateNow || (map_timer.getElapsedTimeF32() > 0.5f))
{
mUpdateNow = false;
// Locate the centre of the object layer, accounting for panning
LLVector3 new_center = globalPosToView(gAgentCamera.getCameraPositionGlobal(), rotate_map);
new_center.mV[VX] -= mCurPanX;
new_center.mV[VY] -= mCurPanY;
new_center.mV[VZ] = 0.f;
mObjectImageCenterGlobal = viewPosToGlobal(llround(new_center.mV[VX]), llround(new_center.mV[VY]), rotate_map);
// Create the base texture.
U8 *default_texture = mObjectRawImagep->getData();
memset( default_texture, 0, mObjectImagep->getWidth() * mObjectImagep->getHeight() * mObjectImagep->getComponents() );
// Draw buildings
gObjectList.renderObjectsForMap(*this);
mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight());
map_timer.reset();
}
LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
map_center_agent -= gAgentCamera.getCameraPositionAgent();
map_center_agent.mV[0] *= mScale/LLWorld::getInstance()->getRegionWidthInMeters();
map_center_agent.mV[1] *= mScale/LLWorld::getInstance()->getRegionWidthInMeters();
gGL.getTexUnit(0)->bind(mObjectImagep);
F32 image_half_width = 0.5f*mObjectMapPixels;
F32 image_half_height = 0.5f*mObjectMapPixels;
gGL.begin(LLRender::QUADS);
示例7: display
//.........这里部分代码省略.........
LLAppViewer::instance()->pingMainloopTimeout("Display:TextureStats");
gFrameStats.start(LLFrameStats::UPDATE_TEX_STATS);
stop_glerror();
LLImageGL::updateStats(gFrameTimeSeconds);
LLVOAvatar::sRenderName = gSavedSettings.getS32("RenderName");
LLVOAvatar::sRenderGroupTitles = !gSavedSettings.getBOOL("RenderHideGroupTitleAll");
gPipeline.mBackfaceCull = TRUE;
gFrameCount++;
gRecentFrameCount++;
if (gFocusMgr.getAppHasFocus())
{
gForegroundFrameCount++;
}
//////////////////////////////////////////////////////////
//
// Display start screen if we're teleporting, and skip render
//
if (gTeleportDisplay)
{
LLAppViewer::instance()->pingMainloopTimeout("Display:Teleport");
const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived.
S32 attach_count = 0;
if (gAgent.getAvatarObject())
{
attach_count = gAgent.getAvatarObject()->getAttachmentCount();
}
F32 teleport_save_time = TELEPORT_EXPIRY + TELEPORT_EXPIRY_PER_ATTACHMENT * attach_count;
F32 teleport_elapsed = gTeleportDisplayTimer.getElapsedTimeF32();
F32 teleport_percent = teleport_elapsed * (100.f / teleport_save_time);
if( (gAgent.getTeleportState() != LLAgent::TELEPORT_START) && (teleport_percent > 100.f) )
{
// Give up. Don't keep the UI locked forever.
gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
gAgent.setTeleportMessage(std::string());
}
const std::string& message = gAgent.getTeleportMessage();
switch( gAgent.getTeleportState() )
{
case LLAgent::TELEPORT_START:
// Transition to REQUESTED. Viewer has sent some kind
// of TeleportRequest to the source simulator
gTeleportDisplayTimer.reset();
gViewerWindow->setShowProgress(TRUE);
gViewerWindow->setProgressPercent(0);
gAgent.setTeleportState( LLAgent::TELEPORT_REQUESTED );
gAgent.setTeleportMessage(
LLAgent::sTeleportProgressMessages["requesting"]);
break;
case LLAgent::TELEPORT_REQUESTED:
// Waiting for source simulator to respond
gViewerWindow->setProgressPercent( llmin(teleport_percent, 37.5f) );
gViewerWindow->setProgressString(message);
break;
case LLAgent::TELEPORT_MOVING:
// Viewer has received destination location from source simulator
gViewerWindow->setProgressPercent( llmin(teleport_percent, 75.f) );
gViewerWindow->setProgressString(message);
示例8: draw
//.........这里部分代码省略.........
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
// Draw water
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, ABOVE_WATERLINE_ALPHA / 255.f);
{
if (regionp->getLand().getWaterTexture())
{
gGL.getTexUnit(0)->bind(regionp->getLand().getWaterTexture());
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
}
}
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
LLVector3d old_center = mObjectImageCenterGlobal;
LLVector3d new_center = gAgent.getCameraPositionGlobal();
new_center.mdV[0] = (5.f/mObjectMapTPM)*floor(0.2f*mObjectMapTPM*new_center.mdV[0]);
new_center.mdV[1] = (5.f/mObjectMapTPM)*floor(0.2f*mObjectMapTPM*new_center.mdV[1]);
new_center.mdV[2] = 0.f;
if (mUpdateNow || (map_timer.getElapsedTimeF32() > 0.5f))
{
mUpdateNow = FALSE;
mObjectImageCenterGlobal = new_center;
// Center moved enough.
// Create the base texture.
U8 *default_texture = mObjectRawImagep->getData();
memset( default_texture, 0, mObjectImagep->getWidth() * mObjectImagep->getHeight() * mObjectImagep->getComponents() );
// Draw buildings
gObjectList.renderObjectsForMap(*this);
mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight());
map_timer.reset();
}
LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
map_center_agent -= gAgent.getCameraPositionAgent();
map_center_agent.mV[VX] *= mScale/region_width;
map_center_agent.mV[VY] *= mScale/region_width;
gGL.getTexUnit(0)->bind(mObjectImagep);
F32 image_half_width = 0.5f*mObjectMapPixels;
F32 image_half_height = 0.5f*mObjectMapPixels;
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, map_center_agent.mV[VY] - image_half_height);
gGL.texCoord2f(1.f, 0.f);
示例9: update_statistics
void update_statistics(U32 frame_count)
{
gTotalWorldBytes += gVLManager.getTotalBytes();
gTotalObjectBytes += gObjectBits / 8;
// make sure we have a valid time delta for this frame
if (gFrameIntervalSeconds > 0.f)
{
if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK)
{
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_MOUSELOOK_SECONDS, gFrameIntervalSeconds);
}
else if (gAgent.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
{
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_AVATAR_EDIT_SECONDS, gFrameIntervalSeconds);
}
else if (gFloaterTools && gFloaterTools->getVisible())
{
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TOOLBOX_SECONDS, gFrameIntervalSeconds);
}
}
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable"));
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_LIGHTING_DETAIL, (F64)gSavedSettings.getS32("RenderLightingDetail"));
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_DRAW_DIST, (F64)gSavedSettings.getF32("RenderFarClip"));
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CHAT_BUBBLES, (F64)gSavedSettings.getBOOL("UseChatBubbles"));
#if 0 // 1.9.2
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_OBJECTS, (F64)gSavedSettings.getS32("VertexShaderLevelObject"));
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_AVATAR, (F64)gSavedSettings.getBOOL("VertexShaderLevelAvatar"));
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_ENVIRONMENT, (F64)gSavedSettings.getBOOL("VertexShaderLevelEnvironment"));
#endif
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_FRAME_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_FRAME));
F64 idle_secs = gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_IDLE);
F64 network_secs = gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_NETWORK);
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_UPDATE_SECS, idle_secs - network_secs);
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_NETWORK_SECS, network_secs);
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_IMAGE_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_IMAGE_UPDATE));
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_REBUILD_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_STATESORT ));
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_RENDER_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_RENDER_GEOMETRY));
LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());
if (cdp)
{
LLViewerStats::getInstance()->mSimPingStat.addValue(cdp->getPingDelay());
gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1);
gSimPingCount++;
}
else
{
LLViewerStats::getInstance()->mSimPingStat.addValue(10000);
}
LLViewerStats::getInstance()->mFPSStat.addValue(1);
F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits());
LLViewerStats::getInstance()->mLayersKBitStat.addValue(layer_bits/1024.f);
LLViewerStats::getInstance()->mObjectKBitStat.addValue(gObjectBits/1024.f);
LLViewerStats::getInstance()->mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending());
LLViewerStats::getInstance()->mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f);
gTransferManager.resetTransferBitsIn(LLTCT_ASSET);
if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)
{
gDebugTimers[0].pause();
}
else
{
gDebugTimers[0].unpause();
}
{
static F32 visible_avatar_frames = 0.f;
static F32 avg_visible_avatars = 0;
F32 visible_avatars = (F32)LLVOAvatar::sNumVisibleAvatars;
if (visible_avatars > 0.f)
{
visible_avatar_frames = 1.f;
avg_visible_avatars = (avg_visible_avatars * (F32)(visible_avatar_frames - 1.f) + visible_avatars) / visible_avatar_frames;
}
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_VISIBLE_AVATARS, (F64)avg_visible_avatars);
}
LLWorld::getInstance()->updateNetStats();
LLWorld::getInstance()->requestCacheMisses();
// Reset all of these values.
gVLManager.resetBitCounts();
gObjectBits = 0;
// gDecodedBits = 0;
// Only update texture stats ones per second so that they are less noisy
{
static const F32 texture_stats_freq = 1.f;
static LLFrameTimer texture_stats_timer;
if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq)
{
LLViewerStats::getInstance()->mTextureKBitStat.addValue(LLViewerImageList::sTextureBits/1024.f);
LLViewerStats::getInstance()->mTexturePacketsStat.addValue(LLViewerImageList::sTexturePackets);
gTotalTextureBytes += LLViewerImageList::sTextureBits / 8;
LLViewerImageList::sTextureBits = 0;
LLViewerImageList::sTexturePackets = 0;
texture_stats_timer.reset();
}
//.........这里部分代码省略.........
示例10: display
//.........这里部分代码省略.........
LLAppViewer::instance()->pingMainloopTimeout("Display:TextureStats");
gFrameStats.start(LLFrameStats::UPDATE_TEX_STATS);
stop_glerror();
LLImageGL::updateStats(gFrameTimeSeconds);
LLVOAvatar::sRenderName = gSavedSettings.getS32("RenderName");
LLVOAvatar::sRenderGroupTitles = !gSavedSettings.getBOOL("RenderHideGroupTitleAll");
gPipeline.mBackfaceCull = TRUE;
gFrameCount++;
gRecentFrameCount++;
if (gFocusMgr.getAppHasFocus())
{
gForegroundFrameCount++;
}
//////////////////////////////////////////////////////////
//
// Display start screen if we're teleporting, and skip render
//
if (gTeleportDisplay)
{
LLAppViewer::instance()->pingMainloopTimeout("Display:Teleport");
const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived.
S32 attach_count = 0;
if (isAgentAvatarValid())
{
attach_count = gAgentAvatarp->getAttachmentCount();
}
F32 teleport_save_time = TELEPORT_EXPIRY + TELEPORT_EXPIRY_PER_ATTACHMENT * attach_count;
F32 teleport_elapsed = gTeleportDisplayTimer.getElapsedTimeF32();
F32 teleport_percent = teleport_elapsed * (100.f / teleport_save_time);
if( (gAgent.getTeleportState() != LLAgent::TELEPORT_START) && (teleport_percent > 100.f) )
{
// Give up. Don't keep the UI locked forever.
gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
gAgent.setTeleportMessage(std::string());
}
static const LLCachedControl<bool> hide_tp_screen("AscentDisableTeleportScreens",false);
const std::string& message = gAgent.getTeleportMessage();
switch( gAgent.getTeleportState() )
{
case LLAgent::TELEPORT_PENDING:
gTeleportDisplayTimer.reset();
if(!hide_tp_screen)
gViewerWindow->setShowProgress(TRUE);
gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f));
gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["pending"]);
gViewerWindow->setProgressString(LLAgent::sTeleportProgressMessages["pending"]);
break;
case LLAgent::TELEPORT_START:
// Transition to REQUESTED. Viewer has sent some kind
// of TeleportRequest to the source simulator
gTeleportDisplayTimer.reset();
if(!hide_tp_screen)
gViewerWindow->setShowProgress(TRUE);
gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f));
gAgent.setTeleportState( LLAgent::TELEPORT_REQUESTED );
gAgent.setTeleportMessage(
LLAgent::sTeleportProgressMessages["requesting"]);
gViewerWindow->setProgressString(LLAgent::sTeleportProgressMessages["requesting"]);
示例11: draw
//.........这里部分代码省略.........
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
// Draw water
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, ABOVE_WATERLINE_ALPHA / 255.f);
{
if (regionp->getLand().getWaterTexture())
{
gGL.getTexUnit(0)->bind(regionp->getLand().getWaterTexture());
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
}
}
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
// Redraw object layer periodically
if (mUpdateNow || (map_timer.getElapsedTimeF32() > 0.5f))
{
mUpdateNow = FALSE;
// Locate the centre of the object layer, accounting for panning
LLVector3 new_center = globalPosToView(gAgent.getCameraPositionGlobal(), rotate_map);
new_center.mV[0] -= mCurPanX;
new_center.mV[1] -= mCurPanY;
new_center.mV[2] = 0.f;
mObjectImageCenterGlobal = viewPosToGlobal(llround(new_center.mV[0]), llround(new_center.mV[1]), rotate_map);
// Create the base texture.
U8 *default_texture = mObjectRawImagep->getData();
memset( default_texture, 0, mObjectImagep->getWidth() * mObjectImagep->getHeight() * mObjectImagep->getComponents() );
// Draw buildings
//gObjectList.renderObjectsForMap(*this);
LLCachedControl<bool> mm_fastminimap(gSavedSettings, "mm_fastminimap");
if (!mm_fastminimap)
{
gObjectList.renderObjectsForMap(*this);
mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight());
}
mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight());
map_timer.reset();
}
LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
map_center_agent -= gAgent.getCameraPositionAgent();
map_center_agent.mV[VX] *= mScale/region_width;
map_center_agent.mV[VY] *= mScale/region_width;
示例12: send_stats
/*
* The sim-side LLSD is in newsim/llagentinfo.cpp:forwardViewerStats.
*
* There's also a compatibility shim for the old fixed-format sim
* stats in newsim/llagentinfo.cpp:processViewerStats.
*
* If you move stats around here, make the corresponding changes in
* those locations, too.
*/
void send_stats()
{
// IW 9/23/02 I elected not to move this into LLViewerStats
// because it depends on too many viewer.cpp globals.
// Someday we may want to merge all our stats into a central place
// but that day is not today.
// Only send stats if the agent is connected to a region.
if (!gAgent.getRegion() || gNoRender)
{
return;
}
LLSD body;
std::string url = gAgent.getRegion()->getCapability("ViewerStats");
if (url.empty()) {
LL_WARNS() << "Could not get ViewerStats capability" << LL_ENDL;
return;
}
body["session_id"] = gAgentSessionID;
LLSD &agent = body["agent"];
time_t ltime;
time(<ime);
F32 run_time = F32(LLFrameTimer::getElapsedSeconds());
agent["start_time"] = S32(ltime - S32(run_time));
// The first stat set must have a 0 run time if it doesn't actually
// contain useful data in terms of FPS, etc. We use half the
// SEND_STATS_PERIOD seconds as the point at which these statistics become
// valid. Data warehouse uses a 0 value here to easily discard these
// records with non-useful FPS values etc.
if (run_time < (SEND_STATS_PERIOD / 2))
{
agent["run_time"] = 0.0f;
}
else
{
agent["run_time"] = run_time;
}
// send fps only for time app spends in foreground
agent["fps"] = (F32)gForegroundFrameCount / gForegroundTime.getElapsedTimeF32();
agent["version"] = gCurrentVersion;
std::string language = LLUI::getLanguage();
agent["language"] = language;
agent["sim_fps"] = ((F32) gFrameCount - gSimFrames) /
(F32) (gRenderStartTime.getElapsedTimeF32() - gSimLastTime);
gSimLastTime = gRenderStartTime.getElapsedTimeF32();
gSimFrames = (F32) gFrameCount;
agent["agents_in_view"] = LLVOAvatar::sNumVisibleAvatars;
agent["ping"] = gAvgSimPing;
agent["meters_traveled"] = gAgent.getDistanceTraveled();
agent["regions_visited"] = gAgent.getRegionsVisited();
agent["mem_use"] = LLMemory::getCurrentRSS() / 1024.0;
LLSD &system = body["system"];
system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB();
system["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
system["cpu"] = gSysCPU.getCPUString();
unsigned char MACAddress[MAC_ADDRESS_BYTES];
LLUUID::getNodeID(MACAddress);
std::string macAddressString = llformat("%02x-%02x-%02x-%02x-%02x-%02x",
MACAddress[0],MACAddress[1],MACAddress[2],
MACAddress[3],MACAddress[4],MACAddress[5]);
system["mac_address"] = macAddressString;
system["serial_number"] = LLAppViewer::instance()->getSerialNumber();
std::string gpu_desc = llformat(
"%-6s Class %d ",
gGLManager.mGLVendorShort.substr(0,6).c_str(),
(S32)LLFeatureManager::getInstance()->getGPUClass())
+ LLFeatureManager::getInstance()->getGPUString();
system["gpu"] = gpu_desc;
system["gpu_class"] = (S32)LLFeatureManager::getInstance()->getGPUClass();
system["gpu_vendor"] = gGLManager.mGLVendorShort;
system["gpu_version"] = gGLManager.mDriverVersionVendorString;
system["opengl_version"] = gGLManager.mGLVersionString;
LLSD &download = body["downloads"];
download["world_kbytes"] = gTotalWorldBytes / 1024.0;
download["object_kbytes"] = gTotalObjectBytes / 1024.0;
//.........这里部分代码省略.........
示例13: update_statistics
void update_statistics()
{
gTotalWorldBytes += gVLManager.getTotalBytes();
gTotalObjectBytes += gObjectBits / 8;
LLViewerStats& stats = LLViewerStats::instance();
// make sure we have a valid time delta for this frame
if (gFrameIntervalSeconds > 0.f)
{
if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
{
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_MOUSELOOK_SECONDS, gFrameIntervalSeconds);
}
else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
{
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_AVATAR_EDIT_SECONDS, gFrameIntervalSeconds);
}
else if (gFloaterTools && gFloaterTools->getVisible())
{
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TOOLBOX_SECONDS, gFrameIntervalSeconds);
}
}
stats.setStat(LLViewerStats::ST_ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable"));
stats.setStat(LLViewerStats::ST_LIGHTING_DETAIL, (F64)gPipeline.getLightingDetail());
stats.setStat(LLViewerStats::ST_DRAW_DIST, (F64)gSavedSettings.getF32("RenderFarClip"));
stats.setStat(LLViewerStats::ST_CHAT_BUBBLES, (F64)gSavedSettings.getBOOL("UseChatBubbles"));
#if 0 // 1.9.2
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_OBJECTS, (F64)gSavedSettings.getS32("VertexShaderLevelObject"));
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_AVATAR, (F64)gSavedSettings.getBOOL("VertexShaderLevelAvatar"));
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_ENVIRONMENT, (F64)gSavedSettings.getBOOL("VertexShaderLevelEnvironment"));
#endif
stats.setStat(LLViewerStats::ST_FRAME_SECS, gDebugView->mFastTimerView->getTime("Frame"));
F64 idle_secs = gDebugView->mFastTimerView->getTime("Idle");
F64 network_secs = gDebugView->mFastTimerView->getTime("Network");
stats.setStat(LLViewerStats::ST_UPDATE_SECS, idle_secs - network_secs);
stats.setStat(LLViewerStats::ST_NETWORK_SECS, network_secs);
stats.setStat(LLViewerStats::ST_IMAGE_SECS, gDebugView->mFastTimerView->getTime("Update Images"));
stats.setStat(LLViewerStats::ST_REBUILD_SECS, gDebugView->mFastTimerView->getTime("Sort Draw State"));
stats.setStat(LLViewerStats::ST_RENDER_SECS, gDebugView->mFastTimerView->getTime("Geometry"));
LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());
if (cdp)
{
stats.mSimPingStat.addValue(cdp->getPingDelay());
gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1);
gSimPingCount++;
}
else
{
stats.mSimPingStat.addValue(10000);
}
stats.mFPSStat.addValue(1);
F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits());
stats.mLayersKBitStat.addValue(layer_bits/1024.f);
stats.mObjectKBitStat.addValue(gObjectBits/1024.f);
stats.mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending());
stats.mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f);
gTransferManager.resetTransferBitsIn(LLTCT_ASSET);
if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)
{
gTextureTimer.pause();
}
else
{
gTextureTimer.unpause();
}
{
static F32 visible_avatar_frames = 0.f;
static F32 avg_visible_avatars = 0;
F32 visible_avatars = (F32)LLVOAvatar::sNumVisibleAvatars;
if (visible_avatars > 0.f)
{
visible_avatar_frames = 1.f;
avg_visible_avatars = (avg_visible_avatars * (F32)(visible_avatar_frames - 1.f) + visible_avatars) / visible_avatar_frames;
}
stats.setStat(LLViewerStats::ST_VISIBLE_AVATARS, (F64)avg_visible_avatars);
}
LLWorld::getInstance()->updateNetStats();
LLWorld::getInstance()->requestCacheMisses();
// Reset all of these values.
gVLManager.resetBitCounts();
gObjectBits = 0;
// gDecodedBits = 0;
// Only update texture stats periodically so that they are less noisy
{
static const F32 texture_stats_freq = 0.25f;
static LLFrameTimer texture_stats_timer;
if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq)
{
stats.mHTTPTextureKBitStat.addValue(AICurlInterface::getHTTPBandwidth()/125.f);
stats.mUDPTextureKBitStat.addValue(LLViewerTextureList::sTextureBits/1024.f);
stats.mTexturePacketsStat.addValue(LLViewerTextureList::sTexturePackets);
gTotalTextureBytes += LLViewerTextureList::sTextureBits / 8;
LLViewerTextureList::sTextureBits = 0;
//.........这里部分代码省略.........
示例14: draw
//.........这里部分代码省略.........
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
// Draw water
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, ABOVE_WATERLINE_ALPHA / 255.f);
{
if (regionp->getLand().getWaterTexture())
{
gGL.getTexUnit(0)->bind(regionp->getLand().getWaterTexture());
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
}
}
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
// Redraw object layer periodically
if (mUpdateNow || (map_timer.getElapsedTimeF32() > 0.5f))
{
mUpdateNow = false;
// Locate the centre of the object layer, accounting for panning
LLVector3 new_center = globalPosToView(gAgentCamera.getCameraPositionGlobal());
new_center.mV[VX] -= mCurPan.mV[VX];
new_center.mV[VY] -= mCurPan.mV[VY];
new_center.mV[VZ] = 0.f;
mObjectImageCenterGlobal = viewPosToGlobal(llfloor(new_center.mV[VX]), llfloor(new_center.mV[VY]));
// Create the base texture.
U8 *default_texture = mObjectRawImagep->getData();
memset( default_texture, 0, mObjectImagep->getWidth() * mObjectImagep->getHeight() * mObjectImagep->getComponents() );
// Draw objects
gObjectList.renderObjectsForMap(*this);
mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight());
map_timer.reset();
}
LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
LLVector3 camera_position = gAgentCamera.getCameraPositionAgent();
map_center_agent -= camera_position;
map_center_agent.mV[VX] *= mScale/region_width;
map_center_agent.mV[VY] *= mScale/region_width;
gGL.getTexUnit(0)->bind(mObjectImagep);
F32 image_half_width = 0.5f*mObjectMapPixels;
F32 image_half_height = 0.5f*mObjectMapPixels;
示例15: draw
//.........这里部分代码省略.........
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
// Draw water
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, ABOVE_WATERLINE_ALPHA / 255.f);
{
if (regionp->getLand().getWaterTexture())
{
gGL.getTexUnit(0)->bind(regionp->getLand().getWaterTexture());
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
}
}
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
LLVector3d old_center = mObjectImageCenterGlobal;
LLVector3d new_center = gAgent.getCameraPositionGlobal();
new_center.mdV[0] = (5.f/mObjectMapTPM)*floor(0.2f*mObjectMapTPM*new_center.mdV[0]);
new_center.mdV[1] = (5.f/mObjectMapTPM)*floor(0.2f*mObjectMapTPM*new_center.mdV[1]);
new_center.mdV[2] = 0.f;
if (mUpdateNow || (map_timer.getElapsedTimeF32() > 0.5f))
{
mUpdateNow = FALSE;
mObjectImageCenterGlobal = new_center;
// Center moved enough.
// Create the base texture.
U8 *default_texture = mObjectRawImagep->getData();
memset( default_texture, 0, mObjectImagep->getWidth() * mObjectImagep->getHeight() * mObjectImagep->getComponents() );
// Draw buildings
gObjectList.renderObjectsForMap(*this);
mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight());
map_timer.reset();
}
LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
map_center_agent -= gAgent.getCameraPositionAgent();
map_center_agent.mV[VX] *= mScale/region_width;
map_center_agent.mV[VY] *= mScale/region_width;
gGL.getTexUnit(0)->bind(mObjectImagep);
F32 image_half_width = 0.5f*mObjectMapPixels;
F32 image_half_height = 0.5f*mObjectMapPixels;
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, map_center_agent.mV[VY] - image_half_height);
gGL.texCoord2f(1.f, 0.f);