void LLDrawPoolAvatar::beginRiggedSimple() { sDiffuseChannel = 0; if(!gPipeline.canUseVertexShaders()) { sVertexProgram = NULL; return; } sVertexProgram = &gObjectSimpleProgram[1<<SHD_ALPHA_MASK_BIT | LLPipeline::sUnderWaterRender<<SHD_WATER_BIT | 1<<SHD_NO_INDEX_BIT | (sShaderLevel>0)<<SHD_SKIN_BIT]; llassert_always(sVertexProgram->mProgramObject > 0); sDiffuseChannel = 0; sVertexProgram->bind(); }
void LLFloaterDayCycle::onRunAnimSky(void* userData) { // if no keys, do nothing if(sSliderToKey.size() == 0) { return; } LLMultiSliderCtrl* sldr; sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); llassert_always(sSliderToKey.size() == sldr->getValue().size()); LLMultiSliderCtrl* tSldr; tSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider"); // turn off linden time //LLWLParamManager::getInstance()->mAnimator.mUseLindenTime = false; // set the param manager's track to the new one LLWLParamManager::getInstance()->resetAnimator( tSldr->getCurSliderValue() / sHoursPerDay, true); llassert_always(LLWLParamManager::getInstance()->mAnimator.mTimeTrack.size() == sldr->getValue().size()); }
void LLTextureCache::ReadResponder::setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal) { if (mFormattedImage.notNull()) { llassert_always(mFormattedImage->getCodec() == imageformat); mFormattedImage->appendData(data, datasize); } else { mFormattedImage = LLImageFormatted::createFromType(imageformat); mFormattedImage->setData(data,datasize); } mImageSize = imagesize; mImageLocal = imagelocal; }
void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName) { LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); // make a slider const std::string& sldrName = kSldr->addSlider(time); if(sldrName == "") { return; } // set the key LLWLSkyKey newKey; newKey.presetName = presetName; newKey.time = kSldr->getCurSliderValue(); llassert_always(sldrName != LLStringUtil::null); // add to map sSliderToKey.insert(std::pair<std::string, LLWLSkyKey>(sldrName, newKey)); llassert_always(sSliderToKey.size() == kSldr->getValue().size()); }
bool AIHTTPHeaders::addHeader(std::string const& key, std::string const& value, op_type op) { if (!mContainer) { mContainer = new Container; } insert_t res = mContainer->mKeyValuePairs.insert(container_t::value_type(key, value)); bool key_already_exists = !res.second; if (key_already_exists) { llassert_always(op != new_header); if (op == replace_if_exists) res.first->second = value; } return key_already_exists; }
LLPanelPathfindingRebakeNavmesh::LLPanelPathfindingRebakeNavmesh() : LLPanel(), mCanRebakeRegion(FALSE), mRebakeNavMeshMode(kRebakeNavMesh_Default), mNavMeshRebakeButton(NULL), mNavMeshSendingButton(NULL), mNavMeshBakingButton(NULL), mNavMeshSlot(), mRegionCrossingSlot(), mAgentStateSlot() { // make sure we have the only instance of this class static bool b = true; llassert_always(b); b=false; }
LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 box_side) { LLMemType mt(LLMemType::MTYPE_PARTICLES); mVOPartGroupp = NULL; mUniformParticles = TRUE; mRegionp = LLWorld::getInstance()->getRegionFromPosAgent(center_agent); llassert_always(center_agent.isFinite()); if (!mRegionp) { //llwarns << "No region at position, using agent region!" << llendl; mRegionp = gAgent.getRegion(); } mCenterAgent = center_agent; mBoxRadius = F_SQRT3*box_side*0.5f; mVOPartGroupp = (LLVOPartGroup *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_PART_GROUP, getRegion()); mVOPartGroupp->setViewerPartGroup(this); mVOPartGroupp->setPositionAgent(getCenterAgent()); F32 scale = box_side * 0.5f; mVOPartGroupp->setScale(LLVector3(scale,scale,scale)); gPipeline.addObject(mVOPartGroupp); LLSpatialGroup* group = mVOPartGroupp->mDrawable->getSpatialGroup(); if (group != NULL) { LLVector3 center(group->mOctreeNode->getCenter()); LLVector3 size(group->mOctreeNode->getSize()); size += LLVector3(0.01f, 0.01f, 0.01f); mMinObjPos = center - size; mMaxObjPos = center + size; } else { // Not sure what else to set the obj bounds to when the drawable has no spatial group. LLVector3 extents(mBoxRadius, mBoxRadius, mBoxRadius); mMinObjPos = center_agent - extents; mMaxObjPos = center_agent + extents; } mSkippedTime = 0.f; static U32 id_seed = 0; mID = ++id_seed; }
void LLDrawPoolWLSky::renderStars(void) const { LLGLSPipelineSkyBox gls_sky; LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_ALPHA); // *NOTE: have to have bound the cloud noise texture already since register // combiners blending below requires something to be bound // and we might as well only bind once. gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gPipeline.disableLights(); /*if (!LLPipeline::sReflectionRender) { glPointSize(2.f); }*/ // *NOTE: we divide by two here and GL_ALPHA_SCALE by two below to avoid // clamping and allow the star_alpha param to brighten the stars. bool error; LLColor4 star_alpha(LLColor4::black); star_alpha.mV[3] = LLWLParamManager::instance()->mCurParams.getFloat("star_brightness", error) / 2.f; llassert_always(!error); // gl_FragColor.rgb = gl_Color.rgb; // gl_FragColor.a = gl_Color.a * star_alpha.a; //New gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getBloomTex()); gGL.pushMatrix(); glRotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f); gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR); gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT_X2, LLTexUnit::TBS_CONST_ALPHA, LLTexUnit::TBS_TEX_ALPHA); /*//Old gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT_X2, LLTexUnit::TBS_PREV_ALPHA, LLTexUnit::TBS_CONST_ALPHA); */ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, star_alpha.mV); gSky.mVOWLSkyp->drawStars(); gGL.popMatrix(); //New //glPointSize(1.f); // and disable the combiner states gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); }
//static S32 LLAPRFile::writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool) { apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY; if (offset < 0) { flags |= APR_APPEND; offset = 0; } //***************************************** apr_file_t* file_handle = open(filename, pool, flags); //***************************************** if (!file_handle) { return 0; } if (offset > 0) { offset = LLAPRFile::seek(file_handle, APR_SET, offset); } apr_size_t bytes_written; if (offset < 0) { bytes_written = 0; } else { bytes_written = nbytes ; apr_status_t s = apr_file_write(file_handle, buf, &bytes_written); if (s != APR_SUCCESS) { bytes_written = 0; } else { llassert_always(bytes_written <= 0x7fffffff); } } //***************************************** LLAPRFile::close(file_handle, pool); //***************************************** return (S32)bytes_written; }
// calls startWork, adds doWork() to queue void LLWorkerClass::addWork(S32 param, U32 priority) { mMutex.lock(); llassert_always(!(mWorkFlags & (WCF_WORKING|WCF_HAVE_WORK))); if (mRequestHandle != LLWorkerThread::nullHandle()) { llwarns << "LLWorkerClass attempt to add work with active worker!" << llendl; } #if _DEBUG // llinfos << "addWork: " << mWorkerClassName << " Param: " << param << llendl; #endif startWork(param); clearFlags(WCF_WORK_FINISHED|WCF_WORK_ABORTED); setFlags(WCF_HAVE_WORK); mRequestHandle = mWorkerThread->addWorkRequest(this, param, priority); mMutex.unlock(); }
JCAssetComparer::JCAssetComparer() : LLFloater() { llassert_always(sInstance == NULL); sInstance = this; subjectA.owner_id.setNull(); subjectA.desc = ""; subjectA.id.setNull(); subjectA.group_id.setNull(); subjectA.name = ""; subjectB.owner_id.setNull(); subjectB.desc = ""; subjectB.id.setNull(); subjectB.group_id.setNull(); subjectB.name = ""; }
S32 LLCurlRequest::getQueued() { llassert_always(mThreadID == LLThread::currentID()); S32 queued = 0; for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ) { curlmulti_set_t::iterator curiter = iter++; LLCurl::Multi* multi = *curiter; queued += multi->mQueued; if (multi->mPerformState != LLCurl::Multi::PERFORM_STATE_READY) { ++queued; } } return queued; }
void HttpReplyQueue::fetchAll(OpContainer & ops) { // Not valid putting something back on the queue... llassert_always(ops.empty()); { HttpScopedLock lock(mQueueMutex); if (! mQueue.empty()) { mQueue.swap(ops); } } // Caller also acquires the reference counts on each op. return; }
void LLDrawPoolAvatar::beginRiggedGlow() { sDiffuseChannel = 0; if(!gPipeline.canUseVertexShaders()) { sVertexProgram = NULL; return; } sVertexProgram = &gObjectEmissiveProgram[1<<SHD_ALPHA_MASK_BIT | LLPipeline::sUnderWaterRender<<SHD_WATER_BIT | 1<<SHD_NO_INDEX_BIT | (sShaderLevel>0)<<SHD_SKIN_BIT]; llassert_always(sVertexProgram->mProgramObject > 0); sVertexProgram->bind(); sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, LLPipeline::sRenderDeferred ? 2.2f : 1.1f); //F32 gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma"); //sVertexProgram->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f)); }
//virtual bool LLTextureCacheWorker::doWork(S32 param) { bool res = false; if (param == 0) // read { res = doRead(); } else if (param == 1) // write { res = doWrite(); } else { llassert_always(0); } return res; }
void LLCurl::Multi::cleanup(bool deleted) { if(!mCurlMultiHandle) { return ; //nothing to clean. } llassert_always(deleted || !mValid) ; LLMutexLock lock(mDeletionMutexp); // Clean up active for(easy_active_list_t::iterator iter = mEasyActiveList.begin(); iter != mEasyActiveList.end(); ++iter) { Easy* easy = *iter; check_curl_multi_code(curl_multi_remove_handle(mCurlMultiHandle, easy->getCurlHandle())); if(deleted) { easy->mResponder = NULL ; //avoid triggering mResponder. } delete easy; } mEasyActiveList.clear(); mEasyActiveMap.clear(); // Clean up freed for_each(mEasyFreeList.begin(), mEasyFreeList.end(), DeletePointer()); mEasyFreeList.clear(); check_curl_multi_code(LLCurl::deleteMultiHandle(mCurlMultiHandle)); mCurlMultiHandle = NULL ; delete mMutexp ; mMutexp = NULL ; delete mEasyMutexp ; mEasyMutexp = NULL ; mQueued = 0 ; mState = STATE_COMPLETED; --gCurlMultiCount; return ; }
void LLVOCache::removeCache() { llassert_always(mInitialized) ; if(mReadOnly) { llwarns << "Not clearing object cache: Cache is currently in read-only mode." << llendl; return ; } llinfos << "about to remove the object cache due to some error." << llendl ; std::string mask = "*"; llinfos << "Removing cache at " << mObjectCacheDirName << llendl; gDirUtilp->deleteFilesInDir(mObjectCacheDirName, mask); clearCacheInMemory() ; writeCacheHeader(); }
BOOL LLMediaRemoteCtrl::postBuild() { mControls = getChild<LLPanel>("media_controls"); llassert_always(mControls); childSetAction("media_play",LLOverlayBar::toggleMediaPlay,this); childSetAction("music_play",LLOverlayBar::toggleMusicPlay,this); childSetAction("media_stop",LLOverlayBar::mediaStop,this); childSetAction("music_stop",LLOverlayBar::toggleMusicPlay,this); childSetAction("media_pause",LLOverlayBar::toggleMediaPlay,this); childSetAction("music_pause",LLOverlayBar::toggleMusicPlay,this); childSetAction("expand", onClickExpandBtn, this); LLButton *pause = getChild<LLButton>("music_pause"); mCachedPauseTip = pause->getToolTip(); return TRUE; }
//static S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes) { apr_file_t* file_handle; LLScopedVolatileAPRFilePool pool; apr_status_t s = apr_file_open(&file_handle, filename.c_str(), APR_READ|APR_BINARY, APR_OS_DEFAULT, pool); if (s != APR_SUCCESS || !file_handle) { ll_apr_warn_status(s); LL_WARNS("APR") << " while attempting to open file \"" << filename << '"' << LL_ENDL; return 0; } S32 off; if (offset < 0) off = LLAPRFile::seek(file_handle, APR_END, 0); else off = LLAPRFile::seek(file_handle, APR_SET, offset); apr_size_t bytes_read; if (off < 0) { bytes_read = 0; } else { bytes_read = nbytes ; apr_status_t s = apr_file_read(file_handle, buf, &bytes_read); if (s != APR_SUCCESS) { LL_WARNS("APR") << " Attempting to read filename: " << filename << LL_ENDL; ll_apr_warn_status(s); bytes_read = 0; } else { llassert_always(bytes_read <= 0x7fffffff); } } apr_file_close(file_handle); return (S32)bytes_read; }
void LLFloaterDayCycle::onAddKey(void* userData) { LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( "WLKeyPresets"); LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); LLMultiSliderCtrl* tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLTimeSlider"); llassert_always(sSliderToKey.size() == kSldr->getValue().size()); // get the values std::string newPreset(comboBox->getSelectedValue().asString()); // add the slider key addSliderKey(tSldr->getCurSliderValue(), newPreset); syncTrack(); }
bool LLTextureCache::writeComplete(handle_t handle, bool abort) { lockWorkers(); handle_map_t::iterator iter = mWriters.find(handle); llassert_always(iter != mWriters.end()); LLTextureCacheWorker* worker = iter->second; if (worker->complete() || abort) { mWriters.erase(handle); unlockWorkers(); worker->scheduleDelete(); return true; } else { unlockWorkers(); return false; } }
//virtual void LLViewerOctreeEntryData::setOctreeEntry(LLViewerOctreeEntry* entry) { llassert_always(mEntry.isNull()); if(mEntry.notNull()) { return; } if(!entry) { mEntry = new LLViewerOctreeEntry(); } else { mEntry = entry; } mEntry->addData(this); }
// Note: call once per frame S32 LLCurlRequest::process() { llassert_always(mThreadID == LLThread::currentID()); S32 res = 0; for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ) { curlmulti_set_t::iterator curiter = iter++; LLCurl::Multi* multi = *curiter; S32 tres = multi->process(); res += tres; if (multi != mActiveMulti && tres == 0 && multi->mQueued == 0) { mMultiSet.erase(curiter); delete multi; } } return res; }
BOOL LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { setLastError("LLImageTGA trying to decode an image with no data!"); return FALSE; } // Copy everything after the header. raw_image->resize(getWidth(), getHeight(), getComponents()); if( (getComponents() != 1) && (getComponents() != 3) && (getComponents() != 4) ) { setLastError("TGA images with a number of components other than 1, 3, and 4 are not supported."); return FALSE; } if( mOriginRightBit ) { setLastError("TGA images with origin on right side are not supported."); return FALSE; } BOOL flipped = (mOriginTopBit != 0); BOOL rle_compressed = ((mImageType & 0x08) != 0); if( mColorMap ) { return decodeColorMap( raw_image, rle_compressed, flipped ); } else { return decodeTruecolor( raw_image, rle_compressed, flipped ); } }
LLFloaterAO::LLFloaterAO():LLFloater(std::string("floater_ao")) { llassert_always(sInstance == NULL); sInstance = this; LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_ao.xml"); sInstance->setVisible(FALSE); mTabContainer = getChild<LLTabContainer>("tabcontainer"); if (mAOAllAnims.empty()) // ao hasn't been loaded yet (login with ao off) do it now { LLUUID phoenix_category = JCLSLBridge::findCategoryByNameOrCreate(phoenix_category_name); if((LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) && gInventory.isCategoryComplete(phoenix_category)) { LLFloaterAO::init(); } } loadComboBoxes(); updateLayout(sInstance); }
U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries) { U32 num_entries = mHeaderEntriesInfo.mEntries; mHeaderIDMap.clear(); mTexturesSizeMap.clear(); mFreeList.clear(); mTexturesSizeTotal = 0; LLAPRFile* aprfile = openHeaderEntriesFile(false, (S32)sizeof(EntriesInfo)); for (U32 idx=0; idx<num_entries; idx++) { Entry entry; S32 bytes_read = aprfile->read((void*)(&entry), (S32)sizeof(Entry)); if (bytes_read < sizeof(Entry)) { llwarns << "Corrupted header entries, failed at " << idx << " / " << num_entries << llendl; closeHeaderEntriesFile(); purgeAllTextures(false); return 0; } entries.push_back(entry); // llinfos << "ENTRY: " << entry.mTime << " TEX: " << entry.mID << " IDX: " << idx << " Size: " << entry.mImageSize << llendl; if (entry.mImageSize < 0) { mFreeList.insert(idx); } else { mHeaderIDMap[entry.mID] = idx; if (entry.mBodySize > 0) { mTexturesSizeMap[entry.mID] = entry.mBodySize; mTexturesSizeTotal += entry.mBodySize; } llassert_always(entry.mImageSize == 0 || entry.mImageSize > entry.mBodySize); } } closeHeaderEntriesFile(); return num_entries; }
//static S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool) { //***************************************** apr_file_t* file_handle = open(filename, pool, APR_READ|APR_BINARY); //***************************************** if (!file_handle) { return 0; } llassert(offset >= 0); if (offset > 0) offset = LLAPRFile::seek(file_handle, APR_SET, offset); apr_size_t bytes_read; if (offset < 0) { bytes_read = 0; } else { bytes_read = nbytes ; apr_status_t s = apr_file_read(file_handle, buf, &bytes_read); if (s != APR_SUCCESS) { LL_WARNS("APR") << " Attempting to read filename: " << filename << LL_ENDL; ll_apr_warn_status(s); bytes_read = 0; } else { llassert_always(bytes_read <= 0x7fffffff); } } //***************************************** close(file_handle, pool) ; //***************************************** return (S32)bytes_read; }
// File I/O S32 LLAPRFile::read(void *buf, S32 nbytes) { if(!mFile) { LL_WARNS() << "apr mFile is removed by somebody else. Can not read." << LL_ENDL ; return 0; } apr_size_t sz = nbytes; apr_status_t s = apr_file_read(mFile, buf, &sz); if (s != APR_SUCCESS) { ll_apr_warn_status(s); return 0; } else { llassert_always(sz <= 0x7fffffff); return (S32)sz; } }
S32 LLAPRFile::write(const void *buf, S32 nbytes) { if(!mFile) { llwarns << "apr mFile is removed by somebody else. Can not write." << llendl ; return 0; } apr_size_t sz = nbytes; apr_status_t s = apr_file_write(mFile, buf, &sz); if (s != APR_SUCCESS) { ll_apr_warn_status(s); return 0; } else { llassert_always(sz <= 0x7fffffff); return (S32)sz; } }
// static void LLPanelLogin::setFields(const std::string& firstname, const std::string& lastname, const std::string& password, const LLSavedLogins& login_history) { if (!sInstance) { llwarns << "Attempted fillFields with no login view shown" << llendl; return; } LLComboBox* login_combo = sInstance->getChild<LLComboBox>("name_combo"); llassert_always(firstname.find(' ') == std::string::npos); login_combo->setLabel(nameJoin(firstname, lastname)); // Max "actual" password length is 16 characters. // Hex digests are always 32 characters. if (password.length() == 32) { // This is a MD5 hex digest of a password. // We don't actually use the password input field, // fill it with MAX_PASSWORD characters so we get a // nice row of asterixes. const std::string filler("123456789!123456"); sInstance->childSetText("password_edit", filler); sInstance->mIncomingPassword = filler; sInstance->mMungedPassword = password; } else { // this is a normal text password sInstance->childSetText("password_edit", password); sInstance->mIncomingPassword = password; LLMD5 pass((unsigned char *)password.c_str()); char munged_password[MD5HEX_STR_SIZE]; pass.hex_digest(munged_password); sInstance->mMungedPassword = munged_password; } }