本文整理汇总了C++中LLViewerTexture类的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerTexture类的具体用法?C++ LLViewerTexture怎么用?C++ LLViewerTexture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLViewerTexture类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
LLUUID get(LLViewerObject* object, S32 te_index)
{
LLUUID id;
LLViewerTexture* image = object->getTEImage(te_index);
if (image) id = image->getID();
if (!id.isNull() && LLViewerMedia::textureHasMedia(id))
{
LLTextureEntry *te = object->getTE(te_index);
if (te)
{
LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL ;
if(!tex)
{
tex = LLViewerFetchedTexture::sDefaultImagep;
}
if (tex)
{
id = tex->getID();
}
}
}
return id;
}
示例2: getImageUUID
LLUUID LLViewerPartSource::getImageUUID() const
{
LLViewerTexture* imagep = mImagep;
if(imagep)
{
return imagep->getID();
}
return LLUUID::null;
}
示例3: LLAlphaObject
LLVOClouds::LLVOClouds(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
: LLAlphaObject(id, LL_VO_CLOUDS, regionp)
{
mCloudGroupp = NULL;
mbCanSelect = FALSE;
setNumTEs(1);
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(gCloudTextureID);
image->setBoostLevel(LLViewerTexture::BOOST_CLOUDS);
setTEImage(0, image);
}
示例4: while
void LLObjectBackup::exportNextTexture()
{
if (mTexturesList.empty())
{
llinfos << "Finished exporting textures." << llendl;
return;
}
LLUUID id;
std::list<LLUUID>::iterator iter;
iter = mTexturesList.begin();
while (1)
{
if (iter == mTexturesList.end())
{
mNextTextureReady = true;
return;
}
id = (*iter);
LLViewerTexture* imagep = LLViewerTextureManager::findTexture(id);
if (imagep != NULL)
{
S32 cur_discard = imagep->getDiscardLevel();
if (cur_discard > 0)
{
if (imagep->getBoostLevel() != LLViewerTexture::BOOST_PREVIEW)
{
// we want to force discard 0: this one does this.
imagep->setBoostLevel(LLViewerTexture::BOOST_PREVIEW);
}
}
else
{
break;
}
}
else
{
llwarns << "We *DON'T* have the texture " << llendl;
mNonExportedTextures |= TEXTURE_MISSING;
}
iter++;
}
mTexturesList.remove(id);
llinfos << "Requesting texture " << id << llendl;
LLImageJ2C* mFormattedImage = new LLImageJ2C;
CacheReadResponder* responder = new CacheReadResponder(id, mFormattedImage);
LLAppViewer::getTextureCache()->readFromCache(id, LLWorkerThread::PRIORITY_HIGH, 0, 999999, responder);
}
示例5: llassert
// Updates asset from the user's avatar
void LLWearable::readFromAvatar()
{
LLVOAvatar* avatar = gAgent.getAvatarObject();
llassert( avatar );
if( !avatar )
{
return;
}
mDefinitionVersion = LLWearable::sCurrentDefinitionVersion;
mVisualParamMap.clear();
for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
{
if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (param->isTweakable()) )
{
//pretty sure is right
if(param->getID() == 507)
avatar->setActualBoobGrav(param->getWeight());
/*if(param->getID() == 151)
avatar->setActualButtGrav(param->getWeight());
if(param->getID() == 157)
avatar->setActualFatGrav(param->getWeight());
*/
//if(param->getID() == 507)
//{
// llwarns << "current = " << avatar->getActualBoobGrav() << llendl;
// llwarns << "param weight = " << param->getWeight() << llendl;
//}
mVisualParamMap[param->getID()] = param->getWeight();
}
}
mTEMap.clear();
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
{
LLViewerTexture* image = avatar->getTEImage( te );
if( image )
{
mTEMap[te] = image->getID();
}
}
}
//if( gFloaterCustomize )
//{
// mDescription = gFloaterCustomize->getWearableDescription( mType );
//}
}
示例6: llassert
// Note: the caller SHOULD NOT keep the pointer that this function returns. It may be updated as more data arrives.
LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedTexture* src_image, U8 bump_code )
{
llassert( (bump_code == BE_BRIGHTNESS) || (bump_code == BE_DARKNESS) );
LLViewerTexture* bump = NULL;
bump_image_map_t* entries_list = NULL;
void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL;
switch( bump_code )
{
case BE_BRIGHTNESS:
entries_list = &mBrightnessEntries;
callback_func = LLBumpImageList::onSourceBrightnessLoaded;
break;
case BE_DARKNESS:
entries_list = &mDarknessEntries;
callback_func = LLBumpImageList::onSourceDarknessLoaded;
break;
default:
llassert(0);
return NULL;
}
bump_image_map_t::iterator iter = entries_list->find(src_image->getID());
if (iter != entries_list->end() && iter->second.notNull())
{
bump = iter->second;
}
else
{
LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
raw->clear(0x77, 0x77, 0xFF, 0xFF);
(*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE);
bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image
}
if (!src_image->hasCallbacks())
{ //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again
if (src_image->getWidth() != bump->getWidth() ||
src_image->getHeight() != bump->getHeight())// ||
//(LLPipeline::sRenderDeferred && bump->getComponents() != 4))
{
src_image->setBoostLevel(LLGLTexture::BOOST_BUMP) ;
src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
src_image->forceToSaveRawImage(0) ;
}
}
return bump;
}
示例7: updateImages
void LLBumpImageList::updateImages()
{
llpushcallstacks ;
for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); )
{
bump_image_map_t::iterator curiter = iter++;
LLViewerTexture* image = curiter->second;
if( image )
{
BOOL destroy = TRUE;
if( image->hasGLTexture())
{
if( image->getBoundRecently() )
{
destroy = FALSE;
}
else
{
image->destroyGLTexture();
}
}
if( destroy )
{
//llinfos << "*** Destroying bright " << (void*)image << llendl;
mBrightnessEntries.erase(curiter); // deletes the image thanks to reference counting
}
}
}
llpushcallstacks ;
for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); )
{
bump_image_map_t::iterator curiter = iter++;
LLViewerTexture* image = curiter->second;
if( image )
{
BOOL destroy = TRUE;
if( image->hasGLTexture())
{
if( image->getBoundRecently() )
{
destroy = FALSE;
}
else
{
image->destroyGLTexture();
}
}
if( destroy )
{
//llinfos << "*** Destroying dark " << (void*)image << llendl;;
mDarknessEntries.erase(curiter); // deletes the image thanks to reference counting
}
}
}
llpushcallstacks ;
}
示例8: handleMouseDown
BOOL LLToolTexEyedropper::handleMouseDown(S32 x, S32 y, MASK mask)
{
// this will affect framerate on mouse down
const LLPickInfo& pick = gViewerWindow->pickImmediate(x, y, FALSE);
LLViewerObject* hit_obj = pick.getObject();
if (hit_obj &&
!hit_obj->isAvatar())
{
if( (0 <= pick.mObjectFace) && (pick.mObjectFace < hit_obj->getNumTEs()) )
{
LLViewerTexture* image = hit_obj->getTEImage( pick.mObjectFace );
if( image )
{
if( mCallback )
{
mCallback( hit_obj->getID(), image->getID(), mCallbackUserData );
}
}
}
}
return TRUE;
}
示例9: stop_glerror
//.........这里部分代码省略.........
{
data_mask &= ~LLVertexBuffer::MAP_WEIGHT4;
}
U16 start = face->getGeomStart();
U16 end = start + face->getGeomCount()-1;
S32 offset = face->getIndicesStart();
U32 count = face->getIndicesCount();
/*if (glow)
{
gGL.diffuseColor4f(0,0,0,face->getTextureEntry()->getGlow());
}*/
const LLTextureEntry* te = face->getTextureEntry();
LLMaterial* mat = te->getMaterialParams().get();
if (mat && is_deferred_render)
{
gGL.getTexUnit(sDiffuseChannel)->bind(face->getTexture(LLRender::DIFFUSE_MAP));
gGL.getTexUnit(normal_channel)->bind(face->getTexture(LLRender::NORMAL_MAP));
gGL.getTexUnit(specular_channel)->bind(face->getTexture(LLRender::SPECULAR_MAP));
LLColor4 col = mat->getSpecularLightColor();
F32 spec = llmax(0.0001f, mat->getSpecularLightExponent() / 255.f);
F32 env = mat->getEnvironmentIntensity()/255.f;
if (mat->getSpecularID().isNull())
{
env = te->getShiny()*0.25f;
col.set(env,env,env,0);
spec = env;
}
BOOL fullbright = te->getFullbright();
sVertexProgram->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, fullbright ? 1.f : 0.f);
sVertexProgram->uniform4f(LLShaderMgr::SPECULAR_COLOR, col.mV[0], col.mV[1], col.mV[2], spec);
sVertexProgram->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, env);
if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
{
sVertexProgram->setMinimumAlpha(mat->getAlphaMaskCutoff()/255.f);
}
else
{
sVertexProgram->setMinimumAlpha(0.004f);
}
for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
{
LLViewerTexture* tex = face->getTexture(i);
if (tex)
{
tex->addTextureStats(avatar->getPixelArea());
}
}
}
else
{
gGL.getTexUnit(sDiffuseChannel)->bind(face->getTexture());
if(sVertexProgram)
{
if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
{
sVertexProgram->setMinimumAlpha(mat->getAlphaMaskCutoff()/255.f);
}
else
{
sVertexProgram->setMinimumAlpha(0.004f);
}
}
if (normal_channel > -1)
{
LLDrawPoolBump::bindBumpMap(face, normal_channel);
}
}
if (face->mTextureMatrix && vobj->mTexAnimMode)
{
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadMatrix(*face->mTextureMatrix);
buff->setBuffer(data_mask);
buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
}
else
{
buff->setBuffer(data_mask);
buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
}
gPipeline.addTrianglesDrawn(count, LLRender::TRIANGLES);
}
}
}
示例10: get
LLUUID get(LLViewerObject* object, S32 te)
{
LLViewerTexture* image = object->getTEImage(te);
return image ? image->getID() : LLUUID::null;
}
示例11: llassert
BOOL LLVLComposition::generateTexture(const F32 x, const F32 y,
const F32 width, const F32 height)
{
llassert(mSurfacep);
llassert(x >= 0.f);
llassert(y >= 0.f);
LLTimer gen_timer;
///////////////////////////
//
// Generate raw data arrays for surface textures
//
//
// These have already been validated by generateComposition.
U8* st_data[4];
S32 st_data_size[4]; // for debugging
for (S32 i = 0; i < 4; i++)
{
if (mRawImages[i].isNull())
{
// Read back a raw image for this discard level, if it exists
S32 min_dim = llmin(mDetailTextures[i]->getFullWidth(), mDetailTextures[i]->getFullHeight());
S32 ddiscard = 0;
while (min_dim > BASE_SIZE && ddiscard < MAX_DISCARD_LEVEL)
{
ddiscard++;
min_dim /= 2;
}
BOOL delete_raw = (mDetailTextures[i]->reloadRawImage(ddiscard) != NULL) ;
if(mDetailTextures[i]->getRawImageLevel() != ddiscard)//raw iamge is not ready, will enter here again later.
{
if(delete_raw)
{
mDetailTextures[i]->destroyRawImage() ;
}
lldebugs << "cached raw data for terrain detail texture is not ready yet: " << mDetailTextures[i]->getID() << llendl;
return FALSE;
}
mRawImages[i] = mDetailTextures[i]->getRawImage() ;
if(delete_raw)
{
mDetailTextures[i]->destroyRawImage() ;
}
if (mDetailTextures[i]->getWidth(ddiscard) != BASE_SIZE ||
mDetailTextures[i]->getHeight(ddiscard) != BASE_SIZE ||
mDetailTextures[i]->getComponents() != 3)
{
LLPointer<LLImageRaw> newraw = new LLImageRaw(BASE_SIZE, BASE_SIZE, 3);
newraw->composite(mRawImages[i]);
mRawImages[i] = newraw; // deletes old
}
}
st_data[i] = mRawImages[i]->getData();
st_data_size[i] = mRawImages[i]->getDataSize();
}
///////////////////////////////////////
//
// Generate and clamp x/y bounding box.
//
//
S32 x_begin, y_begin, x_end, y_end;
x_begin = (S32)(x * mScaleInv);
y_begin = (S32)(y * mScaleInv);
x_end = llround( (x + width) * mScaleInv );
y_end = llround( (y + width) * mScaleInv );
if (x_end > mWidth)
{
llwarns << "x end > width" << llendl;
x_end = mWidth;
}
if (y_end > mWidth)
{
llwarns << "y end > width" << llendl;
y_end = mWidth;
}
///////////////////////////////////////////
//
// Generate target texture information, stride ratios.
//
//
LLViewerTexture *texturep;
U32 tex_width, tex_height, tex_comps;
U32 tex_stride;
F32 tex_x_scalef, tex_y_scalef;
S32 tex_x_begin, tex_y_begin, tex_x_end, tex_y_end;
F32 tex_x_ratiof, tex_y_ratiof;
texturep = mSurfacep->getSTexture();
tex_width = texturep->getWidth();
//.........这里部分代码省略.........
示例12: while
void LLObjectBackup::exportNextTexture()
{
LLUUID id;
textures_set_t::iterator iter = mTexturesList.begin();
while (true)
{
if (mTexturesList.empty())
{
mCheckNextTexture = true;
LL_INFOS() << "Finished exporting textures." << LL_ENDL;
return;
}
if (iter == mTexturesList.end())
{
// Not yet ready, wait and re-check at next idle callback...
mCheckNextTexture = true;
return;
}
id = *iter++;
if (id.isNull())
{
// NULL texture id: just remove and ignore.
mTexturesList.erase(id);
LL_DEBUGS("ObjectBackup") << "Null texture UUID found, ignoring."
<< LL_ENDL;
continue;
}
LLViewerTexture* imagep = LLViewerTextureManager::findTexture(id);
if (imagep)
{
if (imagep->getDiscardLevel() > 0)
{
// Boost texture loading
imagep->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
LL_DEBUGS("ObjectBackup") << "Boosting texture: " << id
<< LL_ENDL;
LLViewerFetchedTexture* tex;
tex = LLViewerTextureManager::staticCastToFetchedTexture(imagep);
if (tex && tex->getDesiredDiscardLevel() > 0)
{
// Set min discard level to 0
tex->setMinDiscardLevel(0);
LL_DEBUGS("ObjectBackup") << "Min discard level set to 0 for texture: "
<< id << LL_ENDL;
}
}
else
{
// Texture is ready !
break;
}
}
else
{
LL_WARNS() << "We *DON'T* have the texture " << id << LL_ENDL;
mNonExportedTextures |= TEXTURE_MISSING;
mTexturesList.erase(id);
}
}
mTexturesList.erase(id);
LL_INFOS() << "Requesting texture " << id << " from cache." << LL_ENDL;
LLImageJ2C* mFormattedImage = new LLImageJ2C;
BackupCacheReadResponder* responder;
responder = new BackupCacheReadResponder(id, mFormattedImage);
LLAppViewer::getTextureCache()->readFromCache(id,
LLWorkerThread::PRIORITY_HIGH,
0, 999999, responder);
}