当前位置: 首页>>代码示例>>C++>>正文


C++ LLDrawable::getFace方法代码示例

本文整理汇总了C++中LLDrawable::getFace方法的典型用法代码示例。如果您正苦于以下问题:C++ LLDrawable::getFace方法的具体用法?C++ LLDrawable::getFace怎么用?C++ LLDrawable::getFace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLDrawable的用法示例。


在下文中一共展示了LLDrawable::getFace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
	}
}
开发者ID:dtshady,项目名称:SingularityViewer,代码行数:48,代码来源:llvopartgroup.cpp

示例2: updateRiggedFaceVertexBuffer

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);
	}
}
开发者ID:1234-,项目名称:SingularityViewer,代码行数:47,代码来源:lldrawpoolavatar.cpp

示例3: renderObjectsForSelect

U32 LLViewerObjectList::renderObjectsForSelect(LLCamera &camera, BOOL pick_parcel_wall, BOOL keep_pick_list)
{
	gRenderForSelect = TRUE;

	//	LLTimer pick_timer;
	if (!keep_pick_list)
	{
		LLViewerObject *objectp;
		S32 i;
		// Reset all of the GL names to zero.
		for (i = 0; i < mObjects.count(); i++)
		{
			objectp = mObjects[i];
			objectp->mGLName = 0;
		}

		mSelectPickList.clear();

		std::vector<LLDrawable*> pick_drawables;

		for (i = 0; i < LLPipeline::NUM_PARTITIONS-1; i++)
		{
			LLSpatialPartition* part = gPipeline.getSpatialPartition(i);
			if (part)
			{
				part->cull(camera, &pick_drawables, TRUE);
			}
		}

		for (std::vector<LLDrawable*>::iterator iter = pick_drawables.begin();
			iter != pick_drawables.end(); iter++)
		{
			LLDrawable* drawablep = *iter;
			if( !drawablep )
				continue;

			LLViewerObject* last_objectp = NULL;
			for (S32 face_num = 0; face_num < drawablep->getNumFaces(); face_num++)
			{
				LLViewerObject* objectp = drawablep->getFace(face_num)->getViewerObject();

				if (objectp && objectp != last_objectp)
				{
					mSelectPickList.insert(objectp);
					last_objectp = objectp;
				}
			}
		}

		LLHUDText::addPickable(mSelectPickList);

		for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
			iter != LLCharacter::sInstances.end(); ++iter)
		{
			objectp = (LLVOAvatar*) *iter;
			if (!objectp->isDead())
			{
				if (objectp->mDrawable.notNull() && objectp->mDrawable->isVisible())
				{
					mSelectPickList.insert(objectp);
				}
			}
		}

		// add all hud objects to pick list
		LLVOAvatar* avatarp = gAgent.getAvatarObject();
		if (avatarp)
		{
			LLViewerJointAttachment* attachmentp;
			for (attachmentp = avatarp->mAttachmentPoints.getFirstData();
				attachmentp;
				attachmentp = avatarp->mAttachmentPoints.getNextData())
			{
				if (attachmentp->getIsHUDAttachment())
				{
					LLViewerObject* objectp = attachmentp->getObject();
					if (objectp)
					{
						mSelectPickList.insert(objectp);		
						for (U32 i = 0; i < objectp->mChildList.size(); i++)
						{
							LLViewerObject* childp = objectp->mChildList[i];
							if (childp)
							{
								mSelectPickList.insert(childp);
							}
						}
					}
				}
			}
		}
		
		S32 num_pickables = (S32)mSelectPickList.size() + LLHUDIcon::getNumInstances();

		if (num_pickables != 0)
		{
			S32 step = (0x000fffff - GL_NAME_INDEX_OFFSET) / num_pickables;

			std::set<LLViewerObject*>::iterator pick_it;
			i = 0;
//.........这里部分代码省略.........
开发者ID:Boy,项目名称:netbook,代码行数:101,代码来源:llviewerobjectlist.cpp

示例4: getGeometry

void LLVOClouds::getGeometry(S32 idx,
								LLStrider<LLVector4a>& verticesp,
								LLStrider<LLVector3>& normalsp, 
								LLStrider<LLVector2>& texcoordsp,
								LLStrider<LLColor4U>& colorsp, 
								LLStrider<U16>& indicesp)
{

	if (idx >= mCloudGroupp->getNumPuffs())
	{
		return;
	}

	LLDrawable* drawable = mDrawable;
	LLFace *facep = drawable->getFace(idx);

	if (!facep->hasGeometry())
	{
		return;
	}
	

	const LLCloudPuff &puff = mCloudGroupp->getPuff(idx);

	LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
	LLColor4U color;
	color.setVec(float_color);
	facep->setFaceColor(float_color);
	
	U32 vert_offset = facep->getGeomIndex();
		
	LLVector4a part_pos_agent;
	part_pos_agent.load3(facep->mCenterLocal.mV);	
	LLVector4a at;
	at.load3(LLViewerCamera::getInstance()->getAtAxis().mV);
	LLVector4a up(0, 0, 1);
	LLVector4a right;

	right.setCross3(at, up);
	right.normalize3fast();
	up.setCross3(right, at);
	up.normalize3fast();
	right.mul(0.5f*CLOUD_PUFF_WIDTH);
	up.mul(0.5f*CLOUD_PUFF_HEIGHT);
		

	LLVector3 normal(0.f,0.f,-1.f);

	//HACK -- the verticesp->mV[3] = 0.f here are to set the texture index to 0 (particles don't use texture batching, maybe they should)
	// this works because there is actually a 4th float stored after the vertex position which is used as a texture index
	// also, somebody please VECTORIZE THIS

	LLVector4a ppapu;
	LLVector4a ppamu;
	
	ppapu.setAdd(part_pos_agent, up);
	ppamu.setSub(part_pos_agent, up);
	
	verticesp->setSub(ppapu, right);
	(*verticesp++).getF32ptr()[3] = 0.f;
	verticesp->setSub(ppamu, right);
	(*verticesp++).getF32ptr()[3] = 0.f;
	verticesp->setAdd(ppapu, right);
	(*verticesp++).getF32ptr()[3] = 0.f;
	verticesp->setAdd(ppamu, right);
	(*verticesp++).getF32ptr()[3] = 0.f;

	// *verticesp++ = puff_pos_agent - right + up;
	// *verticesp++ = puff_pos_agent - right - up;
	// *verticesp++ = puff_pos_agent + right + up;
	// *verticesp++ = puff_pos_agent + right - up;

	*colorsp++ = color;
	*colorsp++ = color;
	*colorsp++ = color;
	*colorsp++ = color;

	*texcoordsp++ = LLVector2(0.f, 1.f);
	*texcoordsp++ = LLVector2(0.f, 0.f);
	*texcoordsp++ = LLVector2(1.f, 1.f);
	*texcoordsp++ = LLVector2(1.f, 0.f);

	*normalsp++   = normal;
	*normalsp++   = normal;
	*normalsp++   = normal;
	*normalsp++   = normal;

	*indicesp++ = vert_offset + 0;
	*indicesp++ = vert_offset + 1;
	*indicesp++ = vert_offset + 2;

	*indicesp++ = vert_offset + 1;
	*indicesp++ = vert_offset + 3;
	*indicesp++ = vert_offset + 2;
}
开发者ID:IamusNavarathna,项目名称:SingularityViewer,代码行数:95,代码来源:llvoclouds.cpp

示例5: generatePickList

void LLViewerObjectList::generatePickList(LLCamera &camera)
{
		LLViewerObject *objectp;
		S32 i;
		// Reset all of the GL names to zero.
		for (i = 0; i < mObjects.count(); i++)
		{
			objectp = mObjects[i];
			objectp->mGLName = 0;
		}

		mSelectPickList.clear();

		std::vector<LLDrawable*> pick_drawables;

		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
		{
			LLViewerRegion* region = *iter;
			for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
			{
				LLSpatialPartition* part = region->getSpatialPartition(i);
				if (part)
				{	
					part->cull(camera, &pick_drawables, TRUE);
				}
			}
		}

		for (std::vector<LLDrawable*>::iterator iter = pick_drawables.begin();
			iter != pick_drawables.end(); iter++)
		{
			LLDrawable* drawablep = *iter;
			if( !drawablep )
				continue;

			LLViewerObject* last_objectp = NULL;
			for (S32 face_num = 0; face_num < drawablep->getNumFaces(); face_num++)
			{
				LLViewerObject* objectp = drawablep->getFace(face_num)->getViewerObject();

				if (objectp && objectp != last_objectp)
				{
					mSelectPickList.insert(objectp);
					last_objectp = objectp;
				}
			}
		}

		LLHUDText::addPickable(mSelectPickList);

		for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
			iter != LLCharacter::sInstances.end(); ++iter)
		{
			objectp = (LLVOAvatar*) *iter;
			if (!objectp->isDead())
			{
				if (objectp->mDrawable.notNull() && objectp->mDrawable->isVisible())
				{
					mSelectPickList.insert(objectp);
				}
			}
		}

		// add all hud objects to pick list
		LLVOAvatar* avatarp = gAgent.getAvatarObject();
		if (avatarp)
		{
			for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
				 iter != avatarp->mAttachmentPoints.end(); )
			{
				LLVOAvatar::attachment_map_t::iterator curiter = iter++;
				LLViewerJointAttachment* attachmentp = curiter->second;
				if (attachmentp->getIsHUDAttachment())
				{
					LLViewerObject* objectp = attachmentp->getObject();
					if (objectp)
					{
						mSelectPickList.insert(objectp);		
						LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
						for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
							 iter != child_list.end(); iter++)
						{
							LLViewerObject* childp = *iter;
							if (childp)
							{
								mSelectPickList.insert(childp);
							}
						}
					}
				}
			}
		}
		
		S32 num_pickables = (S32)mSelectPickList.size() + LLHUDIcon::getNumInstances();

		if (num_pickables != 0)
		{
			S32 step = (0x000fffff - GL_NAME_INDEX_OFFSET) / num_pickables;

//.........这里部分代码省略.........
开发者ID:kow,项目名称:pleiaviewer,代码行数:101,代码来源:llviewerobjectlist.cpp

示例6: 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;
}
开发者ID:Xara,项目名称:kris-clone,代码行数:90,代码来源:llvoclouds.cpp

示例7: getGeometry

void LLVOClouds::getGeometry(S32 te, 
							LLStrider<LLVector3>& verticesp, 
							LLStrider<LLVector3>& normalsp, 
							LLStrider<LLVector2>& texcoordsp, 
							LLStrider<LLColor4U>& colorsp, 
							LLStrider<U32>& 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();
	LLColor4U color(255, 255, 255, (U8) (puff.getAlpha()*255));
	facep->setFaceColor(LLColor4(color));
		
	
	if (isParticle())
	{
		*verticesp++ = facep->mCenterLocal;
		*texcoordsp++ = LLVector2(0.5f, 0.5f);
		*colorsp++ = color;
		*normalsp++ = normal;
		*indicesp++ = facep->getGeomIndex();
	}
	else
	{
		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 = gCamera->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++  = vtx[0];
		*verticesp++  = vtx[1];
		*verticesp++  = vtx[2];
		*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;
	}
}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:95,代码来源:llvoclouds.cpp


注:本文中的LLDrawable::getFace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。