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


C++ CAABBox::getMin方法代码示例

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


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

示例4: 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

示例5:

// ***************************************************************************
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

示例6: 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


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