本文整理汇总了C++中ogre::AxisAlignedBox::scale方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBox::scale方法的具体用法?C++ AxisAlignedBox::scale怎么用?C++ AxisAlignedBox::scale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::AxisAlignedBox
的用法示例。
在下文中一共展示了AxisAlignedBox::scale方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAABB
//-------------------------------------------------------------------------------
Ogre::AxisAlignedBox CParticleEditor::getAABB()
{
if(mEntityHandle)
return mEntityHandle->getBoundingBox();
if(mParticleHandle)
{
Ogre::AxisAlignedBox box = mParticleHandle->getBoundingBox();
box.scale(mScale->get());
return box;
}
else
return Ogre::AxisAlignedBox::BOX_NULL;
}
示例2: GetWorldSize
QVector3D EC_Mesh::GetWorldSize() const
{
QVector3D size(0,0,0);
if (!entity_ || !adjustment_node_ || !placeable_)
return size;
// Get mesh bounds and scale it to the scene node
EC_Placeable* placeable = checked_static_cast<EC_Placeable*>(placeable_.get());
Ogre::AxisAlignedBox bbox = entity_->getMesh()->getBounds();
bbox.scale(adjustment_node_->getScale());
// Get size and take placeable scale into consideration to get real naali inworld size
const Ogre::Vector3& bbsize = bbox.getSize();
const Vector3df &placeable_scale = placeable->GetScale();
// Swap y and z to make it align with other naali vectors
size = QVector3D(bbsize.x*placeable_scale.x, bbsize.z*placeable_scale.z, bbsize.y*placeable_scale.y);
return size;
}
示例3: GetWorldSize
QVector3D EC_Mesh::GetWorldSize() const
{
QVector3D size(0,0,0);
if (!entity_ || !adjustment_node_ || !placeable_)
return size;
// Get mesh bounds and scale it to the scene node
EC_Placeable* placeable = checked_static_cast<EC_Placeable*>(placeable_.get());
Ogre::AxisAlignedBox bbox = entity_->getMesh()->getBounds();
///\bug Rewrite this code to properly take the world transform into account. -jj.
bbox.scale(adjustment_node_->getScale());
// Get size and take placeable scale into consideration to get real in-world size
const Ogre::Vector3& bbsize = bbox.getSize();
const float3 &placeable_scale = placeable->WorldScale();
// Swap y and z to make it align with other vectors
size = QVector3D(bbsize.x*placeable_scale.x, bbsize.y*placeable_scale.y, bbsize.z*placeable_scale.z);
return size;
}
示例4: initTile
void Tiles::initTile(Ogre::SceneManager *s,std::string name,std::string mesh,std::string mat, Ogre::Vector3 v,int x,int y,int h,int tileD)
{
float d = tileD/100.0;
std::cout<<name<<" ("<<v.x<<","<<v.y<<","<<v.z<<")"<<std::endl;
sn = s->getRootSceneNode()->createChildSceneNode( name+"node",v);
e = s->createEntity(name,Ogre::SceneManager::PT_CUBE);
sn->attachObject(e);
sn->scale(Ogre::Vector3(1,d*(h+1),1));
e->setMaterialName(mat);
e->setCastShadows(false);
Ogre::AxisAlignedBox box = e->getBoundingBox();
box.scale(Ogre::Vector3(1,d*(h+1),1));
float dy = box.getCorner(Ogre::AxisAlignedBox::FAR_LEFT_BOTTOM ).y + tileD;
sn->translate(0,-dy,0);
u = NULL;
this->x=x;
this->y=y;
this->h=h;
}
示例5: insertMesh
void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
{
Ogre::SceneNode* insert = ptr.getRefData().getBaseNode();
assert(insert);
NifOgre::NIFLoader::load(mesh);
Ogre::Entity *ent = mRenderer.getScene()->createEntity(mesh);
Ogre::Vector3 extents = ent->getBoundingBox().getSize();
extents *= insert->getScale();
float size = std::max(std::max(extents.x, extents.y), extents.z);
bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) && Settings::Manager::getBool("limit small object distance", "Objects");
// do not fade out doors. that will cause holes and look stupid
if (ptr.getTypeName().find("Door") != std::string::npos)
small = false;
if (mBounds.find(ptr.getCell()) == mBounds.end())
mBounds[ptr.getCell()] = Ogre::AxisAlignedBox::BOX_NULL;
Ogre::AxisAlignedBox bounds = ent->getBoundingBox();
bounds = Ogre::AxisAlignedBox(
insert->_getDerivedPosition() + bounds.getMinimum(),
insert->_getDerivedPosition() + bounds.getMaximum()
);
bounds.scale(insert->getScale());
mBounds[ptr.getCell()].merge(bounds);
bool transparent = false;
for (unsigned int i=0; i<ent->getNumSubEntities(); ++i)
{
Ogre::MaterialPtr mat = ent->getSubEntity(i)->getMaterial();
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements())
{
Ogre::Technique* tech = techIt.getNext();
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{
Ogre::Pass* pass = passIt.getNext();
if (pass->getDepthWriteEnabled() == false)
transparent = true;
}
}
}
if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") || transparent)
{
insert->attachObject(ent);
ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0);
ent->setVisibilityFlags(mIsStatic ? (small ? RV_StaticsSmall : RV_Statics) : RV_Misc);
ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
}
else
{
Ogre::StaticGeometry* sg = 0;
if (small)
{
if( mStaticGeometrySmall.find(ptr.getCell()) == mStaticGeometrySmall.end())
{
uniqueID = uniqueID +1;
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
mStaticGeometrySmall[ptr.getCell()] = sg;
sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Viewing distance"));
}
else
sg = mStaticGeometrySmall[ptr.getCell()];
}
else
{
if( mStaticGeometry.find(ptr.getCell()) == mStaticGeometry.end())
{
uniqueID = uniqueID +1;
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
mStaticGeometry[ptr.getCell()] = sg;
}
else
sg = mStaticGeometry[ptr.getCell()];
}
// This specifies the size of a single batch region.
// If it is set too high:
// - there will be problems choosing the correct lights
// - the culling will be more inefficient
// If it is set too low:
// - there will be too many batches.
sg->setRegionDimensions(Ogre::Vector3(2500,2500,2500));
sg->addEntity(ent,insert->_getDerivedPosition(),insert->_getDerivedOrientation(),insert->_getDerivedScale());
sg->setVisibilityFlags(small ? RV_StaticsSmall : RV_Statics);
//.........这里部分代码省略.........