本文整理汇总了C++中LLViewerTexture::createGLTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerTexture::createGLTexture方法的具体用法?C++ LLViewerTexture::createGLTexture怎么用?C++ LLViewerTexture::createGLTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLViewerTexture
的用法示例。
在下文中一共展示了LLViewerTexture::createGLTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateTexture
//.........这里部分代码省略.........
tex_x_ratiof = (F32)mWidth*mScale / (F32)tex_width;
tex_y_ratiof = (F32)mWidth*mScale / (F32)tex_height;
LLPointer<LLImageRaw> raw = new LLImageRaw(tex_width, tex_height, tex_comps);
U8 *rawp = raw->getData();
F32 tex_width_inv = 1.f/tex_width;
F32 tex_height_inv = 1.f/tex_height;
F32 st_x_stride, st_y_stride;
st_x_stride = ((F32)st_width / (F32)mTexScaleX)*((F32)mWidth / (F32)tex_width);
st_y_stride = ((F32)st_height / (F32)mTexScaleY)*((F32)mWidth / (F32)tex_height);
llassert(st_x_stride > 0.f);
llassert(st_y_stride > 0.f);
////////////////////////////////
//
// Iterate through the target texture, striding through the
// subtextures and interpolating appropriately.
//
//
F32 sti, stj;
S32 st_offset;
sti = (tex_x_begin * st_x_stride) - st_width*(llfloor((tex_x_begin * st_x_stride)/st_width));
stj = (tex_y_begin * st_y_stride) - st_height*(llfloor((tex_y_begin * st_y_stride)/st_height));
st_offset = (llfloor(stj * st_width) + llfloor(sti)) * st_comps;
for (S32 j = tex_y_begin; j < tex_y_end; j++)
{
U32 offset = j * tex_stride + tex_x_begin * tex_comps;
sti = (tex_x_begin * st_x_stride) - st_width*((U32)(tex_x_begin * st_x_stride)/st_width);
for (S32 i = tex_x_begin; i < tex_x_end; i++)
{
S32 tex0, tex1;
F32 composition = getValueScaled(i*tex_x_ratiof, j*tex_y_ratiof);
tex0 = llfloor( composition );
tex0 = llclamp(tex0, 0, 3);
composition -= tex0;
tex1 = tex0 + 1;
tex1 = llclamp(tex1, 0, 3);
F32 xy_int_i, xy_int_j;
xy_int_i = i * tex_width_inv;
xy_int_j = j * tex_height_inv;
st_offset = (lltrunc(sti) + lltrunc(stj)*st_width) * st_comps;
for (U32 k = 0; k < tex_comps; k++)
{
// Linearly interpolate based on composition.
if (st_offset >= st_data_size[tex0] || st_offset >= st_data_size[tex1])
{
// SJB: This shouldn't be happening, but does... Rounding error?
//llwarns << "offset 0 [" << tex0 << "] =" << st_offset << " >= size=" << st_data_size[tex0] << llendl;
//llwarns << "offset 1 [" << tex1 << "] =" << st_offset << " >= size=" << st_data_size[tex1] << llendl;
}
else
{
F32 a = *(st_data[tex0] + st_offset);
F32 b = *(st_data[tex1] + st_offset);
rawp[ offset ] = (U8)lltrunc( a + composition * (b - a) );
}
offset++;
st_offset++;
}
sti += st_x_stride;
if (sti >= st_width)
{
sti -= st_width;
}
}
stj += st_y_stride;
if (stj >= st_height)
{
stj -= st_height;
}
}
if (!texturep->hasGLTexture())
{
texturep->createGLTexture(0, raw);
}
texturep->setSubImage(raw, tex_x_begin, tex_y_begin, tex_x_end - tex_x_begin, tex_y_end - tex_y_begin);
LLSurface::sTextureUpdateTime += gen_timer.getElapsedTimeF32();
LLSurface::sTexelsUpdated += (tex_x_end - tex_x_begin) * (tex_y_end - tex_y_begin);
for (S32 i = 0; i < 4; i++)
{
// Un-boost detatil textures (will get re-boosted if rendering in high detail)
mDetailTextures[i]->setBoostLevel(LLViewerTexture::BOOST_NONE);
mDetailTextures[i]->setMinDiscardLevel(MAX_DISCARD_LEVEL + 1);
}
return TRUE;
}