本文整理汇总了C++中ogre::AxisAlignedBox::getMaximum方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBox::getMaximum方法的具体用法?C++ AxisAlignedBox::getMaximum怎么用?C++ AxisAlignedBox::getMaximum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::AxisAlignedBox
的用法示例。
在下文中一共展示了AxisAlignedBox::getMaximum方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sceneMgr
RenderedTexture::RenderedTexture(Ogre::Entity* entity,
Ogre::SceneManager* sceneMgr,
Ogre::uint8 renderQueueGroup) :
sceneMgr(sceneMgr),
entity(entity),
entityKey(generateEntityKey(entity)),
renderQueueGroup(renderQueueGroup)
{
//Add self to list of RenderedTexture's
typedef std::pair<std::string, RenderedTexture*> ListItem;
selfList.insert(ListItem(entityKey, this));
// TODO: use bounding sphere
//Note - this radius calculation assumes the object is somewhat rounded (like trees/rocks/etc.)
Ogre::Real tmp;
Ogre::AxisAlignedBox boundingBox = entity->getBoundingBox();
entityRadius = boundingBox.getMaximum().x - boundingBox.getCenter().x;
tmp = boundingBox.getMaximum().y - boundingBox.getCenter().y;
if (tmp > entityRadius)
entityRadius = tmp;
tmp = boundingBox.getMaximum().z - boundingBox.getCenter().z;
if (tmp > entityRadius)
entityRadius = tmp;
entityCenter = boundingBox.getCenter();
//Render impostor textures
renderTextures();
//Set up material
material =
Ogre::MaterialManager::getSingleton().create(
getUniqueID("RenderedEntityMaterial"), "EntityRenderer");
Ogre::Material* m = material.getPointer();
Ogre::Pass* p = m->getTechnique(0)->getPass(0);
p->createTextureUnitState(texture->getName());
p->setLightingEnabled(false);
m->setReceiveShadows(false);
if (blendMode == ALPHA_REJECT_IMPOSTOR){
p->setAlphaRejectSettings(Ogre::CMPF_GREATER_EQUAL, 128);
//p->setAlphaRejectSettings(CMPF_GREATER_EQUAL, 64);
} else if (blendMode == ALPHA_BLEND_IMPOSTOR){
p->setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
p->setDepthWriteEnabled(false);
}
}
示例2:
InputGeometry::InputGeometry(std::vector<Ogre::Entity*> sourceMeshes,const Ogre::AxisAlignedBox& tileBounds)
: _sourceMeshes(sourceMeshes),
_numVertices(0),
_numTriangles(0),
_referenceNode(0),
_boundMin(0),
_boundMax(0),
_normals(0),
_vertices(0),
_triangles(0)
{
if(sourceMeshes.empty())
{
return;
}
Ogre::Entity* ent = sourceMeshes[0];
_referenceNode = ent->getParentSceneNode()->getCreator()->getRootSceneNode();
_boundMin = new float[3];
_boundMax = new float[3];
Utility::vector3_toFloatPtr(tileBounds.getMinimum(),_boundMin);
Utility::vector3_toFloatPtr(tileBounds.getMaximum(),_boundMax);
_convertOgreEntities(tileBounds);
//eventually add _buildChunkyTriMesh()
}
示例3:
ConvexVolume::ConvexVolume(Ogre::AxisAlignedBox boundingBox, float offset)
{
Ogre::Vector3 max = boundingBox.getMaximum();
Ogre::Vector3 min = boundingBox.getMinimum();
// Offset bounding box (except height)
if(offset > 0.01f) {
max = max + offset*Ogre::Vector3(1,0,1);
min = min - offset*Ogre::Vector3(1,0,1);
}
// Create box verts (in clockwise fashion!!)
verts[0]= min.x; verts[1]= min.y; verts[2]= max.z;
verts[3]= max.x; verts[4]= max.y; verts[5]= max.z;
verts[6]= max.x; verts[7]= max.y; verts[8]= min.z;
verts[9]= min.x; verts[10]= min.y; verts[11]= min.z;
nverts = 4; // For rcMarkConvexPoly the verts of the shape need to be in clockwise order
// Set bounding box limits
OgreRecast::OgreVect3ToFloatA(min, bmin);
OgreRecast::OgreVect3ToFloatA(max, bmax);
// Set height limits
hmin = min.y;
hmax = max.y;
area = SAMPLE_POLYAREA_DOOR; // You can choose whatever flag you assing to the poly area
}
示例4: _calculateExtents
void InputGeometry::_calculateExtents()
{
Ogre::Entity* ent = _sourceMeshes[0];
Ogre::AxisAlignedBox sourceMeshBB = ent->getBoundingBox();
Ogre::Matrix4 transform;
transform = _referenceNode->_getFullTransform().inverse() * ent->getParentSceneNode()->_getFullTransform();
sourceMeshBB.transform(transform);
Ogre::Vector3 min = sourceMeshBB.getMinimum();
Ogre::Vector3 max = sourceMeshBB.getMaximum();
for(auto itr = _sourceMeshes.begin(); itr != _sourceMeshes.end(); ++itr)
{
Ogre::Entity* tmpEnt = *itr;
transform = _referenceNode->_getFullTransform().inverse() * tmpEnt->getParentSceneNode()->_getFullTransform();
sourceMeshBB = ent->getBoundingBox();
sourceMeshBB.transform(transform);
Ogre::Vector3 min2 = sourceMeshBB.getMinimum();
if(min2.x < min.x)
min.x = min2.x;
if(min2.y < min.y)
min.y = min2.y;
if(min2.z < min.z)
min.z = min2.z;
Ogre::Vector3 max2 = sourceMeshBB.getMaximum();
if(max2.x > max.x)
max.x = max2.x;
if(max2.y > max.y)
max.y = max2.y;
if(max2.z > max.z)
max.z = max2.z;
}
if(!_boundMin)
{
_boundMin = new float[3];
}
if(!_boundMax)
{
_boundMax = new float[3];
}
Utility::vector3_toFloatPtr(min,_boundMin);
Utility::vector3_toFloatPtr(max,_boundMax);
}
示例5: convertBounds
void World::convertBounds(Ogre::AxisAlignedBox& bounds)
{
switch (mAlign)
{
case Align_XY:
return;
case Align_XZ:
convertPosition(bounds.getMinimum());
convertPosition(bounds.getMaximum());
// Because we changed sign of Z
std::swap(bounds.getMinimum().z, bounds.getMaximum().z);
return;
case Align_YZ:
convertPosition(bounds.getMinimum());
convertPosition(bounds.getMaximum());
return;
}
}
示例6: updateBoundingBoxAndSphereFromBillboards
void GPUBillboardSet::updateBoundingBoxAndSphereFromBillboards(const std::vector<PhotoSynth::Vertex>& vertices)
{
Ogre::AxisAlignedBox box = calculateBillboardsBoundingBox(vertices);
setBoundingBox(box);
Ogre::Vector3 vmax = box.getMaximum();
Ogre::Vector3 vmin = box.getMinimum();
Ogre::Real sqLen = std::max(vmax.squaredLength(), vmin.squaredLength());
mBBRadius = Ogre::Math::Sqrt(sqLen);
}
示例7: mBuildingBlock
ModelBlock::ModelBlock(Ogre::SceneNode* baseNode,const Carpenter::BuildingBlock* buildingBlock, Model::Model* model, Construction* construction)
: mBuildingBlock(buildingBlock)
, mModel(model)
, mModelNode(0)
, mConstruction(construction)
{
mNode = baseNode->createChildSceneNode(Convert::toOgre(buildingBlock->getPosition()), Convert::toOgre(buildingBlock->getOrientation()));
mPointBillBoardSet = mNode->getCreator()->createBillboardSet( std::string("__construction_") + construction->getBluePrint()->getName() + "_" + buildingBlock->getName() + "_billboardset__" + mNode->getName());
mPointBillBoardSet->setDefaultDimensions(1, 1);
mPointBillBoardSet->setMaterialName("carpenter/flare");
mPointBillBoardSet->setVisible(false);
// Ogre::SceneNode* aNode = EmberOgre::getSingleton().getSceneManager()->getRootSceneNode()->createChildSceneNode();
mNode->attachObject(mPointBillBoardSet);
if (model) {
JesusPickerObject* pickerObject = new JesusPickerObject(this, 0);
model->setUserObject(pickerObject);
mModelNode = mNode->createChildSceneNode();
mModelNode->attachObject(model);
model->setQueryFlags(Jesus::CM_MODELBLOCK);
//only autoscale the model if we've not set the scale in the modeldefinition
//TODO: it would of course be best if all models were correctly scaled and this code could be removed
if (model->getDefinition()->getScale() == 0) {
const Ogre::AxisAlignedBox ogreBoundingBox = model->getBoundingBox();
const Ogre::Vector3 ogreMax = ogreBoundingBox.getMaximum();
const Ogre::Vector3 ogreMin = ogreBoundingBox.getMinimum();
const WFMath::AxisBox<3> wfBoundingBox = buildingBlock->getBuildingBlockSpec()->getBlockSpec()->getBoundingBox();
const WFMath::Point<3> wfMax = wfBoundingBox.highCorner();
const WFMath::Point<3> wfMin = wfBoundingBox.lowCorner();
Ogre::Real scaleX;
Ogre::Real scaleY;
Ogre::Real scaleZ;
scaleX = fabs((wfMax.x() - wfMin.x()) / (ogreMax.x - ogreMin.x));
scaleY = fabs((wfMax.z() - wfMin.z()) / (ogreMax.y - ogreMin.y));
scaleZ = fabs((wfMax.y() - wfMin.y()) / (ogreMax.z - ogreMin.z));
mModelNode->setScale(scaleX, scaleY, scaleZ);
}
}
}
示例8: unloadTiles
void OgreDetourTileCache::unloadTiles(const Ogre::AxisAlignedBox &areaToUpdate)
{
// Determine which navmesh tiles have to be removed
float bmin[3], bmax[3];
OgreRecast::OgreVect3ToFloatA(areaToUpdate.getMinimum(), bmin);
OgreRecast::OgreVect3ToFloatA(areaToUpdate.getMaximum(), bmax);
dtCompressedTileRef touched[DT_MAX_TOUCHED_TILES];
int ntouched = 0;
m_tileCache->queryTiles(bmin, bmax, touched, &ntouched, DT_MAX_TOUCHED_TILES);
// Remove tiles
for (int i = 0; i < ntouched; ++i)
{
removeTile(touched[i]);
}
}
示例9: setupNodes
void Player::setupNodes (Ogre::SceneManager* sceneManager)
{
// Create the nodes
mPlayerNode = sceneManager->getRootSceneNode()->createChildSceneNode("PlayerNode");
mPlayerCameraNode = mPlayerNode->createChildSceneNode("PlayerCameraNode");
mCharacterNode = mPlayerNode->createChildSceneNode("PlayerCharacterNode");
mTargettingPathNode = mPlayerNode->createChildSceneNode("PlayerPathNode");
mTargettingEndNode = sceneManager->getRootSceneNode()->createChildSceneNode("TargettingEndNode");
mTargettingPathNode->setVisible(false);
mPlayerCameraNode->setPosition(0, 100, 200);
// Add the entities
// Add player
Ogre::Entity* playerEntity = sceneManager->createEntity("PlayerCharacter", "potato.mesh");
Ogre::AxisAlignedBox bb = playerEntity->getBoundingBox();
mPlayerHeight = (bb.getMaximum().y - bb.getMinimum().y) * 0.1f * 0.5f;
mCharacterNode->attachObject(playerEntity);
mCharacterNode->setScale(0.1f, 0.1f, 0.1f);
mCharacterNode->setPosition(0, 0, 0);
// Add target marker
mTargettingEndNode = sceneManager->getRootSceneNode()->createChildSceneNode("TargetNode");
Ogre::Entity* targetEntity = sceneManager->createEntity("TargetEntity", "sphere.mesh");
mTargettingEndNode->attachObject(targetEntity);
targetEntity = sceneManager->createEntity("TargetEntity2", "column.mesh");
mTargettingEndNode->attachObject(targetEntity);
mTargettingEndNode->setScale(0.1f, 0.1f, 0.1f);
mTargettingEndNode->setPosition(0, 0, 0);
// Billboard set
/*mTargettingEndBBS = sceneManager->createBillboardSet("TargetBillboardSet", 2);
sceneManager->getRootSceneNode()->attachObject(mTargettingEndBBS);
mTargettingEndBBS->setMaterialName("Examples/Flare");
mTargettingEndBBS->setVisible(true);
mTargettingEndBBS->createBillboard(0, 300, 0, Ogre::ColourValue(0.5f, 0.6f, 1.0f));
mTargettingEndBBS->setDefaultDimensions(100, 100);
mTargettingEndBBS->setBillboardType(Ogre::BBT_ORIENTED_COMMON);
mTargettingEndBBS->setCommonUpVector(Ogre::Vector3(0, 1, 0));*/
}
示例10: buildTiles
void OgreDetourTileCache::buildTiles(InputGeom *inputGeom, const Ogre::AxisAlignedBox *areaToUpdate)
{
// Use bounding box from inputgeom if no area was explicitly specified
Ogre::AxisAlignedBox updateArea;
if(!areaToUpdate)
updateArea = inputGeom->getBoundingBox();
else
updateArea = *areaToUpdate;
// Reduce bounding area a little with one cell in size, to be sure that if it was already tile-aligned, we don't select an extra tile
updateArea.setMinimum( updateArea.getMinimum() + Ogre::Vector3(m_cellSize, 0, m_cellSize) );
updateArea.setMaximum( updateArea.getMaximum() - Ogre::Vector3(m_cellSize, 0, m_cellSize) );
// Select tiles to build or rebuild (builds a tile-aligned BB)
TileSelection selection = getTileSelection(updateArea);
// Debug drawing of bounding area that is updated
// Remove previous debug drawn bounding box of rebuilt area
if(mDebugRebuiltBB) {
mDebugRebuiltBB->detachFromParent();
m_recast->m_pSceneMgr->destroyManualObject(mDebugRebuiltBB);
mDebugRebuiltBB = NULL;
}
if(DEBUG_DRAW_REBUILT_BB)
mDebugRebuiltBB = InputGeom::drawBoundingBox(selection.bounds, m_recast->m_pSceneMgr);
int tilesToBuildX = (selection.maxTx - selection.minTx)+1; // Tile ranges are inclusive
int tilesToBuildY = (selection.maxTy - selection.minTy)+1;
if(tilesToBuildX * tilesToBuildY > 5)
Ogre::LogManager::getSingletonPtr()->logMessage("Building "+Ogre::StringConverter::toString(tilesToBuildX)+" x "+Ogre::StringConverter::toString(tilesToBuildY)+" navmesh tiles.");
// Build tiles
for (int ty = selection.minTy; ty <= selection.maxTy; ty++) {
for (int tx = selection.minTx; tx <= selection.maxTx; tx++) {
buildTile(tx, ty, inputGeom);
}
}
}
示例11: outputTextures
bool MiniMapMaker::outputTextures(void)
{
// 如果需要(纹理大小改变了或第一次输出文件时),就重建render texture
if (mNeedRecreate)
{
destroy();
init();
}
mTempOutputFileNames.clear();
static const String TEMP_GROUP_NAME = "#TEMP#";
// 创建临时的资源组
Ogre::ResourceGroupManager& rgm = Ogre::ResourceGroupManager::getSingleton();
rgm.addResourceLocation(mPath, "FileSystem", TEMP_GROUP_NAME, false);
// 合并所有物体的包围盒
Ogre::AxisAlignedBox aabb;
Ogre::SceneManager::MovableObjectIterator itm =
mManipulator->getSceneManager()->getMovableObjectIterator(Ogre::EntityFactory::FACTORY_TYPE_NAME);
while (itm.hasMoreElements())
{
Ogre::MovableObject* movable = itm.getNext();
aabb.merge(movable->getWorldBoundingBox(true));
}
mCamera->setFarClipDistance(mCamera->getNearClipDistance() + 2 * (aabb.getMaximum().y - aabb.getMinimum().y ));
mCamera->setNearClipDistance(mTileSize/2);
// 设置摄像机的高度
Real yPos = mCamera->getNearClipDistance() + aabb.getMaximum().y;
TerrainData* terrainData = mManipulator->getTerrainData();
assert (terrainData);
float terrainHeight = terrainData->mMaxZ - terrainData->mMinZ;
float terrainWidth = terrainData->mMaxX - terrainData->mMinX;
// 投影的真正面积
Real projectSize = 0.0f;
// 最终切割成小块纹理的块数
int xIndex = 0;
int zIndex = 0;
Ogre::Vector3 originPoint(Ogre::Vector3::ZERO);
if (mUseRealCameraAngle)
{
float outerSquareWidth = 0.0f;
float outerSquareHeight = 0.0f;
Ogre::Radian alphaAngle = Ogre::Math::ATan( Ogre::Math::Abs(mMoveZDir.z / mMoveZDir.x) );
switch (mCameraDirQuadrant)
{
case WestNorth :
{
float leftWidth = Ogre::Math::Sin(alphaAngle) * terrainHeight;
float rightWidth = Ogre::Math::Cos(alphaAngle) * terrainWidth;
outerSquareWidth = leftWidth + rightWidth;
float topHeight = Ogre::Math::Cos(alphaAngle) * terrainHeight;
float bottomHeight = Ogre::Math::Sin(alphaAngle) * terrainWidth;
outerSquareHeight = topHeight + bottomHeight;
originPoint = Ogre::Vector3(terrainData->mMinX,0,terrainData->mMinZ) +
(-mMoveZDir * leftWidth);
float projectOffset = yPos / Ogre::Math::Tan(mCamDirAngle);
originPoint.x += (mInvertCameraDir * projectOffset ).x;
originPoint.z += (mInvertCameraDir * projectOffset ).z;
break;
}
case EastNorth :
{
float leftWidth = Ogre::Math::Cos(alphaAngle) * terrainWidth;
float rightWidth = Ogre::Math::Sin(alphaAngle) * terrainHeight;
outerSquareWidth = leftWidth + rightWidth;
float topHeight = Ogre::Math::Cos(alphaAngle) * terrainHeight;
float bottomHeight = Ogre::Math::Sin(alphaAngle) * terrainWidth;
outerSquareHeight = topHeight + bottomHeight;
originPoint = Ogre::Vector3(terrainData->mMaxX,0,terrainData->mMinZ) +
(-mMoveZDir * leftWidth);
float projectOffset = yPos / Ogre::Math::Tan(mCamDirAngle);
originPoint.x += (mInvertCameraDir * projectOffset ).x;
originPoint.z += (mInvertCameraDir * projectOffset ).z;
break;
}
case EastSouth :
//.........这里部分代码省略.........
示例12: setWorldSize
void World::setWorldSize( const Ogre::AxisAlignedBox& box )
{
NewtonSetWorldSize( m_world, (float*)&box.getMinimum(), (float*)&box.getMaximum() );
m_limits = box;
}
示例13: OnTimer
void CTerrainWalkingView::OnTimer(UINT_PTR nIDEvent)
{
Ogre::Quaternion Quaternion;
CEngine *Engine = ((CTerrainWalkingApp*)AfxGetApp())->m_Engine;
Ogre::Root *Root = Engine->GetRoot();
Ogre::SceneNode *RobotNode = Root->getSceneManager("Walking")->getSceneNode("Robot");
Ogre::Entity *RobotEntity = Root->getSceneManager("Walking")->getEntity("Robot");
Ogre::AxisAlignedBox RobotBox = RobotEntity->getBoundingBox();
Ogre::Entity *TopographyEntity = Root->getSceneManager("Walking")->getEntity("Topography");
Ogre::AxisAlignedBox TopographyBox = TopographyEntity->getBoundingBox();
Ogre::Vector3 Start = TopographyBox.getMinimum();
Ogre::Vector3 Finish = TopographyBox.getMaximum();
double x = Start[0] + (Finish[0] - Start[0]) * m_RelativeDistance;
double y = Start[1] + (Finish[1] - Start[1]) * m_RelativeDistance;
double z = Start[2] + (Finish[2] - Start[2]) * m_RelativeDistance;
Ogre::Vector3 Elevation(x, y, z);
Ogre::Vector3 CameraMove;
switch (nIDEvent)
{
case 1:
m_Animation->addTime(0.01);
m_RelativeDistance += 0.01;
if (m_CollisionTools->collidesWithEntity(Elevation, Ogre::Vector3(x,y - 1,z), Ogre::Vector3(x,y + 1,z), 100.0f, 0.0f, 4294967295))
{
x = Elevation[0];
y = Elevation[1] + RobotBox.getSize()[1];
z = Elevation[2];
}
RobotNode->setPosition(x, y, z);
m_Camera->lookAt(x, y, z);
if (m_RelativeDistance > 1.0)
KillTimer(1);
break;
case 2:
CameraMove[0] = -100;
CameraMove[1] = 0;
CameraMove[2] = 0;
m_Camera->moveRelative(CameraMove);
break;
case 3:
CameraMove[0] = 0;
CameraMove[1] = 100;
CameraMove[2] = 0;
m_Camera->moveRelative(CameraMove);
break;
case 4:
CameraMove[0] = 100;
CameraMove[1] = 0;
CameraMove[2] = 0;
m_Camera->moveRelative(CameraMove);
break;
case 5:
CameraMove[0] = 0;
CameraMove[1] = -100;
CameraMove[2] = 0;
m_Camera->moveRelative(CameraMove);
break;
}
Root->renderOneFrame();
CView::OnTimer(nIDEvent);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:85,代码来源:TerrainWalkingView.cpp
示例14: getRadius
float SimpleVehicle::getRadius() const
{
// this is only the radius in x axis, but i think, this is the value that should be used here
Ogre::AxisAlignedBox aab = mCreature->getActor()->getPhysicalThing()->_getBody()->getCollision()->getAABB();
return(aab.getMaximum().x - aab.getMinimum().x)/2;
}
示例15: getHeight
float SimpleVehicle::getHeight() const
{
Ogre::AxisAlignedBox aab = mCreature->getActor()->getPhysicalThing()->_getBody()->getCollision()->getAABB();
return aab.getMaximum().y - aab.getMinimum().y;
}