本文整理汇总了C++中LLViewerTexture::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerTexture::getWidth方法的具体用法?C++ LLViewerTexture::getWidth怎么用?C++ LLViewerTexture::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLViewerTexture
的用法示例。
在下文中一共展示了LLViewerTexture::getWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBrightnessDarknessImage
// 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;
}
示例2: generateTexture
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();
//.........这里部分代码省略.........