本文整理汇总了C++中BoxVolume::getCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ BoxVolume::getCenter方法的具体用法?C++ BoxVolume::getCenter怎么用?C++ BoxVolume::getCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoxVolume
的用法示例。
在下文中一共展示了BoxVolume::getCenter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: circumscribe
OSG_BEGIN_NAMESPACE
#if 0
/*! Return a sphere containing a given box */
void SphereVolume::circumscribe(const BoxVolume &box)
{
float radius = 0.5 * (box.getMax() - box.getMin()).length();
Vec3f center;
box.getCenter(center);
setValue(center, radius);
}
示例2: selectedNodeChanged
void selectedNodeChanged(void)
{
mgr->setHighlight(SelectedNode);
//Update Details Panel
if(SelectedNode == NULL)
{
NodeNameValueLabel->setText("");
NodeCoreTypeValueLabel->setText("");
NodeMinValueLabel->setText("");
NodeMaxValueLabel->setText("");
NodeCenterValueLabel->setText("");
NodeTriCountValueLabel->setText("");
NodeTravMaskValueLabel->setText("");
NodeOcclusionMaskValueLabel->setText("");
NodeActiveValueLabel->setText("");
}
else
{
const Char8 *NodeName = getName(SelectedNode);
if(NodeName == NULL)
{
NodeNameValueLabel->setText("Unnamed Node");
}
else
{
NodeNameValueLabel->setText(NodeName);
}
NodeCoreTypeValueLabel->setText(SelectedNode->getCore()->getType().getCName());
BoxVolume DyVol;
SelectedNode->getWorldVolume(DyVol);
Pnt3f Min,Max,Center;
DyVol.getBounds(Min,Max);
DyVol.getCenter(Center);
std::string TempText("");
TempText = boost::lexical_cast<std::string>(Min.x()) + ", " +boost::lexical_cast<std::string>(Min.x()) + ", " + boost::lexical_cast<std::string>(Min.x());
NodeMinValueLabel->setText(TempText);
TempText = boost::lexical_cast<std::string>(Max.x()) + ", " +boost::lexical_cast<std::string>(Max.x()) + ", " + boost::lexical_cast<std::string>(Max.x());
NodeMaxValueLabel->setText(TempText);
TempText = boost::lexical_cast<std::string>(Center.x()) + ", " +boost::lexical_cast<std::string>(Center.x()) + ", " + boost::lexical_cast<std::string>(Center.x());
NodeCenterValueLabel->setText(TempText);
//GeometryPrimitivesCounter PrimCounter;
//PrimCounter(SelectedNode);
//NodeTriCountValueLabel->setText(boost::lexical_cast<std::string>(PrimCounter.getTriCount()));
//NodeTravMaskValueLabel->setText(boost::lexical_cast<std::string>(SelectedNode->getTravMask()));
//NodeOcclusionMaskValueLabel->setText(boost::lexical_cast<std::string>(SelectedNode->getOcclusionMask()));
//NodeActiveValueLabel->setText(boost::lexical_cast<std::string>(SelectedNode->getActive()));
}
}
示例3: renderEnter
ActionBase::ResultE CubeMapGenerator::renderEnter(Action *action)
{
static Matrix transforms[] =
{
Matrix( 1, 0, 0, 0,
0, -1, 0, 0,
0, 0, -1, 0,
0, 0, 0, 1),
Matrix(-1, 0, 0, 0,
0, -1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1),
Matrix( 1, 0, 0, 0,
0, 0, -1, 0,
0, 1, 0, 0,
0, 0, 0, 1),
Matrix( 1, 0, 0, 0,
0, 0, 1, 0,
0, -1, 0, 0,
0, 0, 0, 1),
Matrix( 0, 0, -1, 0,
0, -1, 0, 0,
-1, 0, 0, 0,
0, 0, 0, 1),
Matrix( 0, 0, 1, 0,
0, -1, 0, 0,
1, 0, 0, 0,
0, 0, 0, 1)
};
RenderAction *a = dynamic_cast<RenderAction *>(action);
Action::ResultE returnValue = Action::Continue;
Background *pBack = a->getBackground();
Viewport *pPort = a->getViewport();
Node *pActNode = a->getActNode();
CubeMapGeneratorStageData *pData =
a->getData<CubeMapGeneratorStageData *>(_iDataSlotId);
if(pData == NULL)
{
pData = this->initData(a);
}
TraversalValidator::ValidationStatus eStatus = this->validateOnEnter(a);
if(eStatus == TraversalValidator::Run)
{
this->beginPartitionGroup(a);
{
FrameBufferObject *pTarget = this->getRenderTarget();
if(pTarget == NULL)
{
pTarget = pData->getRenderTarget();
}
Pnt3f oOrigin;
if(this->getOriginMode() == CubeMapGenerator::UseStoredValue)
{
oOrigin = this->getOrigin();
}
else if(this->getOriginMode() == CubeMapGenerator::UseBeacon)
{
fprintf(stderr, "CubemapGen::UseBeacon NYI\n");
}
else if(this->getOriginMode() ==
CubeMapGenerator::UseCurrentVolumeCenter)
{
BoxVolume oWorldVol;
commitChanges();
pActNode->updateVolume();
pActNode->getWorldVolume(oWorldVol);
oWorldVol.getCenter(oOrigin);
}
else if(this->getOriginMode() ==
CubeMapGenerator::UseParentsVolumeCenter)
{
fprintf(stderr, "CubemapGen::UseParentsCenter NYI\n");
}
Camera *pCam = pData->getCamera();
pActNode->setTravMask(0);
for(UInt32 i = 0; i < 6; ++i)
//.........这里部分代码省略.........
示例4: selectedNodeChanged
void selectedNodeChanged(void)
{
_mgr->setHighlight(_SelectedNode);
//Update Details Panel
if(_SelectedNode == NULL)
{
_NodeNameValueLabel->setText("");
_NodeCoreTypeValueLabel->setText("");
_NodeMinValueLabel->setText("");
_NodeMaxValueLabel->setText("");
_NodeCenterValueLabel->setText("");
_NodeTriCountValueLabel->setText("");
_NodeTravMaskValueLabel->setText("");
}
else
{
const Char8 *NodeName = getName(_SelectedNode);
if(NodeName == NULL)
{
_NodeNameValueLabel->setText("Unnamed Node");
}
else
{
_NodeNameValueLabel->setText(NodeName);
}
_NodeCoreTypeValueLabel->setText(_SelectedNode->getCore()->getType().getCName());
BoxVolume DyVol;
_SelectedNode->getWorldVolume(DyVol);
Pnt3f Min,Max,Center;
DyVol.getBounds(Min,Max);
DyVol.getCenter(Center);
std::string TempText("");
TempText = boost::lexical_cast<std::string>(Min.x())
+ ", " +boost::lexical_cast<std::string>(Min.x())
+ ", " + boost::lexical_cast<std::string>(Min.x());
_NodeMinValueLabel->setText(TempText);
TempText = boost::lexical_cast<std::string>(Max.x())
+ ", " +boost::lexical_cast<std::string>(Max.x())
+ ", " + boost::lexical_cast<std::string>(Max.x());
_NodeMaxValueLabel->setText(TempText);
TempText = boost::lexical_cast<std::string>(Center.x())
+ ", " +boost::lexical_cast<std::string>(Center.x())
+ ", " + boost::lexical_cast<std::string>(Center.x());
_NodeCenterValueLabel->setText(TempText);
_NodeTravMaskValueLabel->setText(boost::lexical_cast<std::string>(_SelectedNode->getTravMask()));
//Tri Cound
TriCountGraphOpRefPtr TheTriGraphOp = TriCountGraphOp::create();
TheTriGraphOp->traverse(_SelectedNode);
_NodeTriCountValueLabel->setText(boost::lexical_cast<std::string>(TheTriGraphOp->getNumTri()));
}
}