本文整理汇总了C++中LLDrawable类的典型用法代码示例。如果您正苦于以下问题:C++ LLDrawable类的具体用法?C++ LLDrawable怎么用?C++ LLDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLDrawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cleanupReferences
void LLSpatialBridge::cleanupReferences()
{
LLDrawable::cleanupReferences();
if (mDrawable)
{
/*
DON'T DO THIS -- this should happen through octree destruction
mDrawable->setSpatialGroup(NULL);
if (mDrawable->getVObj())
{
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
if (drawable)
{
drawable->setSpatialGroup(NULL);
}
}
}*/
LLDrawable* drawablep = mDrawable;
mDrawable = NULL;
drawablep->setSpatialBridge(NULL);
}
}
示例2: apply
virtual bool apply(LLViewerObject* vobjp)
{
LLDrawable* drawable = vobjp->mDrawable;
if (!drawable || vobjp->getPCode() != LL_PCODE_VOLUME || vobjp->isAttachment())
{
return true;
}
S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
switch (result)
{
case 0:
LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
break;
case 1:
// check vertices
if (!LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
{
LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
}
break;
default:
break;
}
return true;
}
示例3: markDead
void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)
{
if (mDrawable == NULL)
{
markDead();
return;
}
LLCamera camera = transformCamera(camera_in);
mDrawable->updateDistance(camera, force_update);
if (mDrawable->getVObj())
{
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
if (!drawable)
{
continue;
}
if (!drawable->isAvatar())
{
drawable->updateDistance(camera, force_update);
}
}
}
}
示例4: markDead
void LLSpatialBridge::updateDistance(LLCamera& camera_in)
{
if (mDrawable == NULL)
{
markDead();
return;
}
LLCamera camera = transformCamera(camera_in);
mDrawable->updateDistance(camera);
if (mDrawable->getVObj())
{
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
if (!drawable)
{
llwarns << "Corrupt drawable found while updating spatial bridge distance." << llendl;
continue;
}
if (!drawable->isAvatar())
{
drawable->updateDistance(camera);
}
}
}
}
示例5: cleanupReferences
void LLSpatialBridge::cleanupReferences()
{
LLDrawable::cleanupReferences();
if (mDrawable)
{
mDrawable->setSpatialGroup(NULL);
if (mDrawable->getVObj())
{
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
if (drawable)
{
drawable->setSpatialGroup(NULL);
}
}
}
LLDrawable* drawablep = mDrawable;
mDrawable = NULL;
drawablep->setSpatialBridge(NULL);
}
}
示例6: LL_ERRS
void LLDrawable::makeActive()
{
#if !LL_RELEASE_FOR_DOWNLOAD
if (mVObjp.notNull())
{
U32 pcode = mVObjp->getPCode();
if (pcode == LLViewerObject::LL_VO_WATER ||
pcode == LLViewerObject::LL_VO_VOID_WATER ||
pcode == LLViewerObject::LL_VO_SURFACE_PATCH ||
pcode == LLViewerObject::LL_VO_PART_GROUP ||
pcode == LLViewerObject::LL_VO_HUD_PART_GROUP ||
#if ENABLE_CLASSIC_CLOUDS
pcode == LLViewerObject::LL_VO_CLOUDS ||
#endif
pcode == LLViewerObject::LL_VO_GROUND ||
pcode == LLViewerObject::LL_VO_SKY)
{
LL_ERRS() << "Static viewer object has active drawable!" << LL_ENDL;
}
}
#endif
if (!isState(ACTIVE)) // && mGeneration > 0)
{
setState(ACTIVE);
//parent must be made active first
if (!isRoot() && !mParent->isActive())
{
mParent->makeActive();
//NOTE: linked set will now NEVER become static
mParent->setState(LLDrawable::ACTIVE_CHILD);
}
//all child objects must also be active
llassert_always(mVObjp);
LLViewerObject::const_child_list_t& child_list = mVObjp->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
if (drawable)
{
drawable->makeActive();
}
}
if (mVObjp->getPCode() == LL_PCODE_VOLUME)
{
gPipeline.markRebuild(this, LLDrawable::REBUILD_VOLUME, TRUE);
}
updatePartition();
}
llassert(isAvatar() || isRoot() || mParent->isActive());
}
示例7: markDead
void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)
{
if (mDrawable == NULL)
{
markDead();
return;
}
if (gShiftFrame)
{
return;
}
if (mDrawable->getVObj())
{
if (mDrawable->getVObj()->isAttachment())
{
LLDrawable* parent = mDrawable->getParent();
if (parent)
{
LLViewerObject *obj = parent->getVObj();
if (obj && obj->isAvatar() && ((LLVOAvatar*)obj)->isImpostor())
{
return;
}
}
else
{
static const LLCachedControl<bool> draw_orphans("ShyotlDrawOrphanAttachments",false);
if(!draw_orphans)
return;
}
}
LLCamera camera = transformCamera(camera_in);
mDrawable->updateDistance(camera, force_update);
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
if (!drawable)
{
continue;
}
if (!drawable->isAvatar())
{
drawable->updateDistance(camera, force_update);
}
}
}
}
示例8: color
void LLDrawPoolTree::renderForSelect()
{
if (mDrawFace.empty())
{
return;
}
LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f);
LLGLSObjectSelectAlpha gls_alpha;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.setSceneBlendType(LLRender::BT_REPLACE);
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA);
if (gSavedSettings.getBOOL("RenderAnimateTrees"))
{
renderTree(TRUE);
}
else
{
gGL.getTexUnit(sDiffTex)->bind(mTexturep);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace *face = *iter;
LLDrawable *drawablep = face->getDrawable();
if (drawablep->isDead() || face->mVertexBuffer.isNull())
{
continue;
}
// Render each of the trees
LLVOTree *treep = (LLVOTree *)drawablep->getVObj().get();
LLColor4U color(255,255,255,255);
if (treep->mGLName != 0)
{
S32 name = treep->mGLName;
color = LLColor4U((U8)(name >> 16), (U8)(name >> 8), (U8)name, 255);
LLFacePool::LLOverrideFaceColor col(this, color);
face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0);
gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()/3);
}
}
}
示例9: llassert
void LLDrawPoolTerrain::renderOwnership()
{
LLGLSPipelineAlpha gls_pipeline_alpha;
llassert(!mDrawFace.empty());
// Each terrain pool is associated with a single region.
// We need to peek back into the viewer's data to find out
// which ownership overlay texture to use.
LLFace *facep = mDrawFace[0];
LLDrawable *drawablep = facep->getDrawable();
const LLViewerObject *objectp = drawablep->getVObj();
const LLVOSurfacePatch *vo_surface_patchp = (LLVOSurfacePatch *)objectp;
LLSurfacePatch *surface_patchp = vo_surface_patchp->getPatch();
LLSurface *surfacep = surface_patchp->getSurface();
LLViewerRegion *regionp = surfacep->getRegion();
LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay();
LLImageGL *texturep = overlayp->getTexture();
glEnableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
LLViewerImage::bindTexture(texturep);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// *NOTE: Because the region is 256 meters wide, but has 257 pixels, the
// texture coordinates for pixel 256x256 is not 1,1. This makes the
// ownership map not line up with the selection. We address this with
// a texture matrix multiply.
glMatrixMode(GL_TEXTURE);
glPushMatrix();
const F32 TEXTURE_FUDGE = 257.f / 256.f;
glScalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f );
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace *facep = *iter;
facep->renderIndexed(LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD);
}
glMatrixMode(GL_TEXTURE);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
// Restore non Texture Unit specific defaults
glDisableClientState(GL_NORMAL_ARRAY);
}
示例10: t
void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar)
{
LLFastTimer t(FTM_RIGGED_VBO);
//update rigged vertex buffers
for (U32 type = 0; type < NUM_RIGGED_PASSES; ++type)
{
for (U32 i = 0; i < mRiggedFace[type].size(); ++i)
{
LLFace* face = mRiggedFace[type][i];
LLDrawable* drawable = face->getDrawable();
if (!drawable)
{
continue;
}
LLVOVolume* vobj = drawable->getVOVolume();
if (!vobj)
{
continue;
}
LLVolume* volume = vobj->getVolume();
S32 te = face->getTEOffset();
if (!volume || volume->getNumVolumeFaces() <= te)
{
continue;
}
LLUUID mesh_id = volume->getParams().getSculptID();
if (mesh_id.isNull())
{
continue;
}
const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, vobj);
if (!skin)
{
continue;
}
stop_glerror();
const LLVolumeFace& vol_face = volume->getVolumeFace(te);
updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face);
}
}
}
示例11: rebuild
//static
void LLManip::rebuild(LLViewerObject* vobj)
{
LLDrawable* drawablep = vobj->mDrawable;
if (drawablep && drawablep->getVOVolume())
{
gPipeline.markRebuild(drawablep,LLDrawable::REBUILD_VOLUME, TRUE);
drawablep->setState(LLDrawable::MOVE_UNDAMPED); // force to UNDAMPED
drawablep->updateMove();
LLSpatialGroup* group = drawablep->getSpatialGroup();
if (group)
{
group->dirtyGeom();
}
}
}
示例12: rebuild
//static
void LLManip::rebuild(LLViewerObject* vobj)
{
LLDrawable* drawablep = vobj->mDrawable;
if (drawablep && drawablep->getVOVolume())
{
gPipeline.markRebuild(drawablep,LLDrawable::REBUILD_VOLUME, TRUE);
drawablep->setState(LLDrawable::MOVE_UNDAMPED); // force to UNDAMPED
drawablep->updateMove();
LLSpatialGroup* group = drawablep->getSpatialGroup();
if (group)
{
group->dirtyGeom();
gPipeline.markRebuild(group, TRUE);
}
LLViewerObject::const_child_list_t& child_list = vobj->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(), endIter = child_list.end();
iter != endIter; ++iter)
{
LLViewerObject* child = *iter;
rebuild(child);
}
}
}
示例13: addGeometryCount
void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count)
{
group->mBufferUsage = mBufferUsage;
mFaceList.clear();
LLViewerCamera* camera = LLViewerCamera::getInstance();
for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
{
LLDrawable* drawablep = *i;
if (drawablep->isDead())
{
continue;
}
LLAlphaObject* obj = (LLAlphaObject*) drawablep->getVObj().get();
obj->mDepth = 0.f;
if (drawablep->isAnimating())
{
group->mBufferUsage = GL_STREAM_DRAW_ARB;
}
U32 count = 0;
for (S32 j = 0; j < drawablep->getNumFaces(); ++j)
{
drawablep->updateFaceSize(j);
LLFace* facep = drawablep->getFace(j);
if ( !facep || !facep->hasGeometry())
{
continue;
}
count++;
facep->mDistance = (facep->mCenterLocal - camera->getOrigin()) * camera->getAtAxis();
obj->mDepth += facep->mDistance;
mFaceList.push_back(facep);
vertex_count += facep->getGeomCount();
index_count += facep->getIndicesCount();
llassert(facep->getIndicesCount() < 65536);
}
obj->mDepth /= count;
}
}
示例14: getRiggedGeometry
void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* face, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face)
{
LLVector4a* weight = vol_face.mWeights;
if (!weight)
{
return;
}
LLPointer<LLVertexBuffer> buffer = face->getVertexBuffer();
LLDrawable* drawable = face->getDrawable();
U32 data_mask = face->getRiggedVertexBufferDataMask();
if (buffer.isNull() ||
buffer->getTypeMask() != data_mask ||
buffer->getNumVerts() != vol_face.mNumVertices ||
buffer->getNumIndices() != vol_face.mNumIndices ||
(drawable && drawable->isState(LLDrawable::REBUILD_ALL)))
{
if (drawable && drawable->isState(LLDrawable::REBUILD_ALL))
{ //rebuild EVERY face in the drawable, not just this one, to avoid missing drawable wide rebuild issues
for (S32 i = 0; i < drawable->getNumFaces(); ++i)
{
LLFace* facep = drawable->getFace(i);
U32 face_data_mask = facep->getRiggedVertexBufferDataMask();
if (face_data_mask)
{
LLPointer<LLVertexBuffer> cur_buffer = facep->getVertexBuffer();
const LLVolumeFace& cur_vol_face = volume->getVolumeFace(i);
getRiggedGeometry(facep, cur_buffer, face_data_mask, skin, volume, cur_vol_face);
}
}
drawable->clearState(LLDrawable::REBUILD_ALL);
buffer = face->getVertexBuffer();
}
else
{ //just rebuild this face
getRiggedGeometry(face, buffer, data_mask, skin, volume, vol_face);
}
}
if (sShaderLevel <= 0 && face->mLastSkinTime < avatar->getLastSkinTime())
{
avatar->updateSoftwareSkinnedVertices(skin, weight, vol_face, buffer);
}
}
示例15: getGeometry
void LLVOClouds::getGeometry(S32 te,
LLStrider<LLVector3>& verticesp,
LLStrider<LLVector3>& normalsp,
LLStrider<LLVector2>& texcoordsp,
LLStrider<LLColor4U>& colorsp,
LLStrider<U16>& indicesp)
{
if (te >= mCloudGroupp->getNumPuffs())
{
return;
}
LLDrawable* drawable = mDrawable;
LLFace *facep = drawable->getFace(te);
if (!facep->hasGeometry())
{
return;
}
LLVector3 normal(0.f,0.f,-1.f);
const LLCloudPuff &puff = mCloudGroupp->getPuff(te);
S32 index_offset = facep->getGeomIndex();
LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
LLColor4U color;
color.setVec(float_color);
facep->setFaceColor(float_color);
LLVector3 up;
LLVector3 right;
LLVector3 at;
const LLVector3& puff_pos_agent = facep->mCenterLocal;
LLVector2 uvs[4];
uvs[0].setVec(0.f, 1.f);
uvs[1].setVec(0.f, 0.f);
uvs[2].setVec(1.f, 1.f);
uvs[3].setVec(1.f, 0.f);
LLVector3 vtx[4];
at = LLViewerCamera::getInstance()->getAtAxis();
right = at % LLVector3(0.f, 0.f, 1.f);
right.normVec();
up = right % at;
up.normVec();
right *= 0.5f*CLOUD_PUFF_WIDTH;
up *= 0.5f*CLOUD_PUFF_HEIGHT;;
*colorsp++ = color;
*colorsp++ = color;
*colorsp++ = color;
*colorsp++ = color;
vtx[0] = puff_pos_agent - right + up;
vtx[1] = puff_pos_agent - right - up;
vtx[2] = puff_pos_agent + right + up;
vtx[3] = puff_pos_agent + right - up;
verticesp->mV[3] = 0.f;
*verticesp++ = vtx[0];
verticesp->mV[3] = 0.f;
*verticesp++ = vtx[1];
verticesp->mV[3] = 0.f;
*verticesp++ = vtx[2];
verticesp->mV[3] = 0.f;
*verticesp++ = vtx[3];
*texcoordsp++ = uvs[0];
*texcoordsp++ = uvs[1];
*texcoordsp++ = uvs[2];
*texcoordsp++ = uvs[3];
*normalsp++ = normal;
*normalsp++ = normal;
*normalsp++ = normal;
*normalsp++ = normal;
*indicesp++ = index_offset + 0;
*indicesp++ = index_offset + 1;
*indicesp++ = index_offset + 2;
*indicesp++ = index_offset + 1;
*indicesp++ = index_offset + 3;
*indicesp++ = index_offset + 2;
}