• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ nlmisc::CAABBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中nlmisc::CAABBox的典型用法代码示例。如果您正苦于以下问题:C++ CAABBox类的具体用法?C++ CAABBox怎么用?C++ CAABBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: drawBBox

// *********************************************************************************************************
void CDisplayerVisualEntity::drawBBox(const NLMISC::CMatrix &modelMatrix, const NLMISC::CAABBox &bbox, NLMISC::CRGBA colOverZ, NLMISC::CRGBA colUnderZ)
{
	//H_AUTO(R2_CDisplayerVisualEntity_drawBBox)
	//nlwarning("bbox = (%f, %f, %f) - (%f, %f, %f), color = (%d, %d, %d, %d)", bbox.getMin().x, bbox.getMin().y, bbox.getMin().z,
	//												bbox.getMax().x, bbox.getMax().y, bbox.getMax().z, (int) colOverZ.R, (int) colOverZ.G, (int) colOverZ.B, (int) colOverZ.A);
	// for z-precision, work with camera at (0, 0, 0)
	static volatile bool fixMatrixPos = false;
	CMatrix oldViewMatrix = Driver->getViewMatrix();
	Driver->setModelMatrix(modelMatrix);
	CMatrix viewMat = oldViewMatrix;
	if (fixMatrixPos)
	{
		viewMat.setPos(CVector::Null);
	}
	Driver->setViewMatrix(viewMat);
	// draw below zbuffer
	UMaterial::ZFunc oldZfunc = GenericMat.getZFunc();
	bool oldZWrite = GenericMat.getZWrite();
	GenericMat.setZFunc(UMaterial::greater);
	GenericMat.setZWrite(false);
	::drawBox(bbox.getMin(),   bbox.getMax(), colUnderZ );
	GenericMat.setZFunc(oldZfunc);
	GenericMat.setZWrite(oldZWrite);
	::drawBox(bbox.getMin(),   bbox.getMax(), colOverZ);
	Driver->setViewMatrix(oldViewMatrix);
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:27,代码来源:displayer_visual_entity.cpp


示例2: sizeof

// ***************************************************************************
void	CVisualCollisionMesh::CStaticGrid::create(uint nbQuads, uint nbElts, const NLMISC::CAABBox &gridBBox)
{
	/* ***********************************************
	 *	WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance
	 *	It can be loaded/called through CAsyncFileManager for instance
	 * ***********************************************/

	nlassert(nbQuads>0 && isPowerOf2(nbQuads));

	// init the grid
	_GridSize= nbQuads;
	_GridSizePower= getPowerOf2(nbQuads);
	_Grid.resize(_GridSize*_GridSize);
	// start with 0 elt in each case
	memset(_Grid.getPtr(), 0, _Grid.size() * sizeof(CCase));

	// init the Elt Build
	_EltBuild.resize(nbElts);

	// total size is 0
	_GridDataSize= 0;

	// bbox init
	_GridPos= gridBBox.getMin();
	_GridScale= gridBBox.getSize();
	_GridScale.x= _GridSize / _GridScale.x;
	_GridScale.y= _GridSize / _GridScale.y;

	// reset intersection data
	_ItSession= 0;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:32,代码来源:visual_collision_mesh.cpp


示例3:

// ***************************************************************************
void		CQuadGridClipClusterQTreeNode::insertModel(const NLMISC::CAABBox &worldBBox, uint distSetup, CTransformShape *model)
{
	// if leaf node, insert the model in the list
	if( LeafNode )
	{
		if(Empty)
		{
			Empty= false;
			BBox= worldBBox;
		}
		else
		{
			// extend the bbox with 2 corners of the incoming bbox (sufficient for an AABBox).
			BBox.extend( worldBBox.getCenter() + worldBBox.getHalfSize() );
			BBox.extend( worldBBox.getCenter() - worldBBox.getHalfSize() );
		}

		// insert in list
		ListNode.insertModel(distSetup, model);
	}
	// else, recurs insert in branch
	else
	{
		// choose what son according to pivot.
		CQuadGridClipClusterQTreeNode	*selectSon;
		if( worldBBox.getCenter().y<PivotBBox.getCenter().y )
		{
			if( worldBBox.getCenter().x<PivotBBox.getCenter().x )
				selectSon= Sons[NL3D_QCC_LEFT_DOWN];
			else
				selectSon= Sons[NL3D_QCC_RIGHT_DOWN];
		}
		else
		{
			if( worldBBox.getCenter().x<PivotBBox.getCenter().x )
				selectSon= Sons[NL3D_QCC_LEFT_UP];
			else
				selectSon= Sons[NL3D_QCC_RIGHT_UP];
		}

		// insert in this cluster
		selectSon->insertModel(worldBBox, distSetup, model);

		// extend my boox according to this son cluster.
		if(Empty)
		{
			Empty= false;
			BBox= selectSon->BBox;
		}
		else
		{
			// extend the bbox with 2 corners of the son bbox (sufficient for an AABBox).
			BBox.extend( selectSon->BBox.getCenter() + selectSon->BBox.getHalfSize() );
			BBox.extend( selectSon->BBox.getCenter() - selectSon->BBox.getHalfSize() );
		}
	}

	// update bboxExt
	BBoxExt= BBox;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:61,代码来源:quad_grid_clip_cluster.cpp


示例4: getSelectBox

// *********************************************************************************************************
NLMISC::CAABBox CDisplayerVisualEntity::getSelectBox() const
{
	//H_AUTO(R2_NLMISC_CAABBox )
	if (!_Entity)
	{
		if (_PlaceHolder)
		{
			return _PlaceHolder->getSelectBox();
		}
		return CDisplayerVisual::getSelectBox();
	}
	if (getSelectionType() == ISelectableObject::LocalSelectBox ||
		getSelectionType() == ISelectableObject::GroundProjected
	   )
	{
		if (_Entity->isAsyncLoading())
		{
			NLMISC::CAABBox result;
			result.setCenter(CVector::Null);
			result.setHalfSize(CVector::Null);
			return result;
		}
		return getEditor().getLocalSelectBox(*_Entity);
	}
	else
	{
		return getEditor().getSelectBox(*_Entity);
	}
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:30,代码来源:displayer_visual_entity.cpp


示例5: updatePrecomputedBBoxParams

void CParticleSystemPage::updatePrecomputedBBoxParams()
{
    NLMISC::CAABBox b;
    _Node->getPSPointer()->computeBBox(b);
    _ui.xDoubleSpinBox->setValue(b.getHalfSize().x);
    _ui.yDoubleSpinBox->setValue(b.getHalfSize().y);
    _ui.zDoubleSpinBox->setValue(b.getHalfSize().z);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:8,代码来源:particle_system_page.cpp


示例6: decBbox

void CParticleSystemPage::decBbox()
{
    NLMISC::CAABBox b;
    _Node->getPSPointer()->computeBBox(b);
    b.setHalfSize(0.9f * b.getHalfSize());
    _Node->getPSPointer()->setPrecomputedBBox(b);
    updatePrecomputedBBoxParams();
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:8,代码来源:particle_system_page.cpp


示例7: drawBBox

// *********************************************************************************************************
void CDisplayerVisualShape::drawBBox(NLMISC::CRGBA color) const
{
	//H_AUTO(R2_CDisplayerVisualShape_drawBBox)
	if (getRotateInProgress()) return; // no drawn while drawing (bbox moved one frame too late, must solve this)
	NLMISC::CAABBox bbox;
	_Instance.getShapeAABBox(bbox);
	Driver->setModelMatrix(_BBoxMatrix);
	::drawBox(bbox.getMin(),     bbox.getMax(), color);
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:10,代码来源:displayer_visual_shape.cpp


示例8: getSelectBox

// *********************************************************************************************************
NLMISC::CAABBox CDisplayerVisualShape::getSelectBox() const
{
	//H_AUTO(R2_CDisplayerVisualShape_getSelectBox)
	if (_Instance.empty()) return CDisplayerVisual::getSelectBox();
	// TODO nico : cache the bbox
	NLMISC::CAABBox bbox;
	_Instance.getShapeAABBox(bbox);
	bbox.setMinMax(_Scale * bbox.getMin(), _Scale * bbox.getMax());
	return bbox;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:11,代码来源:displayer_visual_shape.cpp


示例9: setZBbox

void CParticleSystemPage::setZBbox(double value)
{
    NLMISC::CAABBox b;
    _Node->getPSPointer()->computeBBox(b);
    NLMISC::CVector h;
    h.x = b.getHalfSize().x;
    h.y = b.getHalfSize().y;
    h.z = value;
    b.setHalfSize(h);
    _Node->getPSPointer()->setPrecomputedBBox(b);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:11,代码来源:particle_system_page.cpp


示例10:

// ***************************************************************************
void		CTransformShape::getAABBox(NLMISC::CAABBox &bbox) const
{
	if(Shape)
	{
		Shape->getAABBox(bbox);
	}
	else
	{
		bbox.setCenter(CVector::Null);
		bbox.setHalfSize(CVector::Null);
	}
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:13,代码来源:transform_shape.cpp


示例11:

// ***************************************************************************
uint	CVisualCollisionMesh::CStaticGrid::select(const NLMISC::CAABBox &bbox, std::vector<uint16> &res)
{
	/* ***********************************************
	 *	WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance
	 *	It can be loaded/called through CAsyncFileManager for instance
	 * ***********************************************/

	// increment the intersection session
	_ItSession++;
	// enlarge the result array as needed
	if(res.size()<_Sessions.size())
		res.resize(_Sessions.size());
	// the number of selected element
	uint	numSel= 0;

	// compute the 2D bbox
	CVector	minp= bbox.getMin() - _GridPos;
	CVector	maxp= bbox.getMax() - _GridPos;
	sint	xmin= (sint)floorf(minp.x*_GridScale.x);
	sint	ymin= (sint)floorf(minp.y*_GridScale.y);
	sint	xmax= (sint)ceilf(maxp.x*_GridScale.x);
	sint	ymax= (sint)ceilf(maxp.y*_GridScale.y);
	clamp(xmin, 0, (sint)_GridSize-1);
	clamp(ymin, 0, (sint)_GridSize-1);
	clamp(xmax, xmin+1, (sint)_GridSize);
	clamp(ymax, ymin+1, (sint)_GridSize);

	// for each case touched, increment NumElts
	for(uint y=ymin;y<(uint)ymax;y++)
	{
		for(uint x=xmin;x<(uint)xmax;x++)
		{
			CCase	&gcase= _Grid[(y<<_GridSizePower)+x];
			// for each element in this case
			for(uint i= gcase.Start;i<gcase.Start + gcase.NumElts;i++)
			{
				uint	elt= _GridData[i];

				// if not alread inserted in the dest
				if(_Sessions[elt]!=_ItSession)
				{
					// mark as intersected
					_Sessions[elt]= _ItSession;
					// append
					res[numSel++]= elt;
				}
			}
		}
	}

	// return the number of selected elements
	return numSel;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:54,代码来源:visual_collision_mesh.cpp


示例12:

///===========================================================================
void	CParticleSystemShape::getAABBox(NLMISC::CAABBox &bbox) const
{
	if (!_UsePrecomputedBBox)
	{
		bbox.setCenter(NLMISC::CVector::Null);
		bbox.setHalfSize(NLMISC::CVector(1, 1, 1));
	}
	else
	{
		bbox = _PrecomputedBBox;
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:13,代码来源:particle_system_shape.cpp


示例13: isInProjection

// *********************************************************************************************************
bool CDisplayerVisualEntity::isInProjection(const NLMISC::CVector2f &pos) const
{
	//H_AUTO(R2_CDisplayerVisualEntity_isInProjection)
	if (getActualSelectionDisplayMode() == CircleSelection) return false;
	nlassert(getSelectionType() == LocalSelectBox || getSelectionType() == GroundProjected);
	CVector localPos = getInvertedMatrix() * pos;
	NLMISC::CAABBox selectBox = getSelectBox();
	CVector pmin = selectBox.getMin();
	CVector pmax = selectBox.getMax();
	if (localPos.x < pmin.x || localPos.x > pmax.x ||
		localPos.y < pmin.y || localPos.y > pmax.y) return false;
	return true;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:14,代码来源:displayer_visual_entity.cpp


示例14: evalIconInScenePos

// *********************************************************************************************************
void CDisplayerVisual::evalIconInScenePos(NLMISC::CVector &dest) const
{
	//H_AUTO(R2_CDisplayerVisual_evalIconInScenePos)
	NLMISC::CAABBox selectBox = getSelectBox();
	float radius = std::max(selectBox.getHalfSize().x, selectBox.getHalfSize().y);
	// use middle front of bbox for icon pos
	NLMISC::CVector result = getWorldPos().asVector() - radius * MainCam.getMatrix().getJ() + selectBox.getHalfSize().z * CVector::K;
	static volatile bool wantAssert = true;
	if (!isValidDouble(result.x) || !isValidDouble(result.y) ||!isValidDouble(result.z))
	{
		nlassert(!wantAssert);
		return;
	}
	dest = result;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:16,代码来源:displayer_visual.cpp


示例15:

//============================================
void	CWaveMakerShape::getAABBox(NLMISC::CAABBox &bbox) const
{
	// its just a point
	bbox.setCenter(NLMISC::CVector::Null);
	bbox.setHalfSize(NLMISC::CVector::Null);
}
开发者ID:mixxit,项目名称:solinia,代码行数:7,代码来源:water_shape.cpp


示例16: main


//.........这里部分代码省略.........
					for (x=firstX; x<=lastX; x++)
					{
						

						// Progress
						progress ("Build bounding boxes", (float)(x+y*lastX)/(float)(lastX*lastY));

						// Make a zone file name
						string zoneName;
						getZoneNameByCoord (x, y, zoneName);

						// Open the file
						CIFile file;
						if (file.open (dir+zoneName+ext))
						{							
							// The zone
							CZone zone;

							try
							{
								// Serial the zone
								file.serial (zone);

								/// get bbox from the ig of this zone
								CLightingBBox igBBox;								
								if (computeDependenciesWithIgs)
								{
									computeZoneIGBBox(zoneName.c_str(), igBBox, shapeMap, villagesBBox);
								}								
								// Create a zone descriptor
								

								
								NLMISC::CAABBox zoneBox;
								zoneBox.setCenter(zone.getZoneBB().getCenter());
								zoneBox.setHalfSize(zone.getZoneBB().getHalfSize());

								CLightingBBox zoneLBox;
								zoneLBox.OccludingBox = zoneLBox.ReceivingBox = zoneBox; // can't be void
								zoneLBox.makeUnion(igBBox);								
								nlassert(!zoneLBox.ReceivingBox.IsVoid);
								//
								CZoneDescriptorBB zoneDesc;
								zoneDesc.X=x;
								zoneDesc.Y=y;
								zoneDesc.BBox=zoneLBox.ReceivingBox.Box;
								//
								if (!zoneLBox.OccludingBox.IsVoid)
								{
									quadGrid.insert (zoneLBox.ReceivingBox.Box.getMin(), zoneLBox.ReceivingBox.Box.getMax(), zoneDesc);
								}
																								
								// Insert in the dependencies
								// Index 
								uint index=(x-firstX)+(y-firstY)*(lastX-firstX+1);
								

								// Loaded
								dependencies[index].Loaded=true;
								dependencies[index].X=x;
								dependencies[index].Y=y;
								dependencies[index].BBox=zoneLBox.OccludingBox.Box;

								// ZMin
								float newZ=zoneLBox.ReceivingBox.Box.getMin().z;
								if (newZ<minZ)
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:67,代码来源:zone_dependencies.cpp


示例17:

//***************************************************************************************************************
void				CFlareShape::getAABBox(NLMISC::CAABBox &bbox) const
{
	// the flare himself is a point
	bbox.setCenter(CVector::Null);
	bbox.setHalfSize(CVector::Null);
}
开发者ID:mixxit,项目名称:solinia,代码行数:7,代码来源:flare_shape.cpp


示例18: if


//.........这里部分代码省略.........
				std::vector<NLMISC::CVector>       FXVertices;  // Used only if the obj is a fx. It contains the corners of the bbox.
				bool  buildMeshBBox = true;

				/** If it is a mesh, we build its bbox and transform in world
				  * If it is a FX, we read its bbox from its shape
				  * If we can't read it, we use the bbox of the fx helper in max
				  */
				Object *obj = pNode->EvalWorldState(tvTime).obj;
				// Check if there is an object
				if (obj)
				{
					Class_ID  clid = obj->ClassID();
					// is the object a particle system ?					
					if (clid.PartA() == NEL_PARTICLE_SYSTEM_CLASS_ID)
					{
						// build the shape from the file name
						std::string objName = CExportNel::getNelObjectName(*pNode); 						
						if (!objName.empty())
						{											
							NL3D::CShapeStream ss;
							NLMISC::CIFile iF;
							if (iF.open(objName.c_str()))
							{
								try
								{								
									iF.serial(ss);
									NL3D::CParticleSystemShape *pss = dynamic_cast<NL3D::CParticleSystemShape *>(ss.getShapePointer());
									if (!pss)
									{
										nlwarning("ERROR: Node %s shape is not a FX", CExportNel::getName(*pNode).c_str());
									}
									else
									{									
										NLMISC::CAABBox bbox;
										pss->getAABBox(bbox);
										// transform in world
										Matrix3 xForm = pNode->GetNodeTM(tvTime);
										NLMISC::CMatrix nelXForm;
										CExportNel::convertMatrix(nelXForm, xForm);									
										bbox = NLMISC::CAABBox::transformAABBox(nelXForm, bbox);
										// store vertices of the bbox in the list
										FXVertices.reserve(8);
										for(uint k = 0; k < 8; ++k)
										{
											FXVertices.push_back(CVector(((k & 1) ? 1 : -1) * bbox.getHalfSize().x + bbox.getCenter().x,
																		 ((k & 2) ? 1 : -1) * bbox.getHalfSize().y + bbox.getCenter().y,
																		 ((k & 4) ? 1 : -1) * bbox.getHalfSize().z + bbox.getCenter().z));
										}
										//
										testVertices = &FXVertices;
										buildMeshBBox = false;
									}
									delete ss.getShapePointer();
								}
								catch (NLMISC::Exception &e)
								{
									nlwarning(e.what());									
								}
							}							
							if (buildMeshBBox)
							{
								nlwarning("ERROR: Can't get bbox of a particle system from its shape, using helper bbox instead");
							}
						}
					}
				}
开发者ID:mixxit,项目名称:solinia,代码行数:67,代码来源:export_scene.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ nlmisc::CBitMemStream类代码示例发布时间:2022-05-31
下一篇:
C++ nlgeorges::UFormElm类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap