本文整理汇总了C++中nlmisc::CAABBox::getMax方法的典型用法代码示例。如果您正苦于以下问题:C++ CAABBox::getMax方法的具体用法?C++ CAABBox::getMax怎么用?C++ CAABBox::getMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nlmisc::CAABBox
的用法示例。
在下文中一共展示了CAABBox::getMax方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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);
}
示例3: 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;
}
示例4:
// ***************************************************************************
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;
}
示例5: 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;
}