本文整理汇总了C++中ogre::AxisAlignedBox类的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBox类的具体用法?C++ AxisAlignedBox怎么用?C++ AxisAlignedBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AxisAlignedBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allocateEntityToNode
int HOO::allocateEntityToNode(Ogre::SceneManager *& SceneManager, Ogre::SceneNode *& node, Ogre::Entity*& Ent , const Ogre::String& entityName, const Ogre::String& meshName, HOO::entityVector * debugEntityVector){
try{
Ent = SceneManager->createEntity( entityName, meshName );
node->attachObject(Ent);
} catch( Ogre::Exception & e ){
Ent = SceneManager->createEntity( entityName, "cube.mesh");
debugEntityVector->push_back(Ent);
Ogre::String message = "WARNING ! Failed to load the following mesh : ";
message += meshName;
Ogre::LogManager::getSingletonPtr()->logMessage( message);
node->attachObject(Ent);
float scale=0.2f;
node->setScale(scale,scale,scale);
Ogre::String txtName = "ErrorTxtObject_n";
txtName += debugEntityVector->size();
Ogre::MovableText* msg = new Ogre::MovableText(txtName, message ,"BlueHighway-8",int(2/scale),Ogre::ColourValue::Green);
msg->setTextAlignment(Ogre::MovableText::H_CENTER, Ogre::MovableText::V_CENTER); // Center horizontally and display above the node
Ogre::AxisAlignedBox AABB =Ent->getWorldBoundingBox(true);
msg->setLocalTranslation(Ogre::Vector3(0.0f,AABB.getHalfSize()[2]+0.1f,0.0f));
node->attachObject(msg);
return HOO::ALLOCATEFAIL;
}
return HOO::SUCCESS;
}
示例2: updateTrackedBoxes
void SelectionHandler::updateTrackedBoxes()
{
M_HandleToBox::iterator it = boxes_.begin();
M_HandleToBox::iterator end = boxes_.end();
for (; it != end; ++it)
{
V_AABB aabbs;
Picked p(it->first.first);
p.extra_handles.insert(it->first.second);
getAABBs(Picked(it->first.first), aabbs);
if (!aabbs.empty())
{
Ogre::AxisAlignedBox combined;
V_AABB::iterator aabb_it = aabbs.begin();
V_AABB::iterator aabb_end = aabbs.end();
for (; aabb_it != aabb_end; ++aabb_it)
{
combined.merge(*aabb_it);
}
createBox(std::make_pair(p.handle, it->first.second), combined, "RVIZ/Cyan");
}
}
}
示例3: initializeSceneManager
void ProjectManager::initializeSceneManager()
{
assert(QThread::currentThread() == thread());
Ogre::Root& root = Ogre::Root::getSingleton();
Ogre::SceneManager* mgr = NULL;
if(root.hasSceneManager(Application::sSceneManagerName))
{
mgr = root.getSceneManager(Application::sSceneManagerName);
root.destroySceneManager(mgr);
}
mgr = root.createSceneManager(Ogre::ST_GENERIC, Application::sSceneManagerName);
mgr->setShadowTechnique(Ogre::SHADOWTYPE_NONE);
mgr->setAmbientLight(Ogre::ColourValue(1, 1, 1));
mgr->setShadowCasterRenderBackFaces(false);
mgr->setCameraRelativeRendering(true);
mgr->setShowDebugShadows(true);
// This fixes some issues with ray casting when using shallow terrain.
Ogre::AxisAlignedBox box;
Ogre::Vector3 max(100000, 100000, 100000);
box.setExtents(-max, max);
mgr->setOption("Size", &box);
}
示例4: setup
//-------------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
mRoot = new Ogre::Root(mPluginsCfg);
setupResources();
bool carryOn = configure();
if (!carryOn) return false;
chooseSceneManager();
createCamera();
createViewports();
// Set default mipmap level (NB some APIs ignore this)
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
// Create background material
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("Background", "General");
material->getTechnique(0)->getPass(0)->createTextureUnitState("space.jpg");
material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
// Create background rectangle covering the whole screen
rect = new Ogre::Rectangle2D(true);
rect->setCorners(-1.0, 1.0, 1.0, -1.0);
rect->setMaterial("Background");
// Render the background before everything else
rect->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
// Use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
rect->setBoundingBox(aabInf);
// Attach background to the scene
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Background");
node->attachObject(rect);
// Example of background scrolling
material->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setScrollAnimation(-0.10, 0.0);
// Don't forget to delete the Rectangle2D in the destructor of your application:
// Create any resource listeners (for loading screens)
createResourceListener();
// Load resources
loadResources();
// Create the scene
createScene();
createFrameListener();
return true;
};
示例5: OnEditsceneAddentity
void CSceneEditorView::OnEditsceneAddentity()
{
CEntityCreatorDlg EntityCreatorDlg;
if (IDOK == EntityCreatorDlg.DoModal())
{
HTREEITEM Selected = m_SceneManagerDlg->m_SceneTree.GetSelectedItem();
m_SceneManagerDlg->m_SceneTree.InsertItem(EntityCreatorDlg.m_EntityName, Selected);
Ogre::String SceneNodeName = m_SceneManagerDlg->m_SceneTree.GetItemText(Selected);
Ogre::Entity *Entity = m_SceneManager->createEntity(Ogre::String(EntityCreatorDlg.m_EntityName), Ogre::String(EntityCreatorDlg.m_MeshName));
Ogre::SceneNode *SceneNode = m_SceneManager->getSceneNode(SceneNodeName);
SceneNode->attachObject(Entity);
Ogre::AxisAlignedBox Box = Entity->getBoundingBox();
Ogre::Vector3 Center = Box.getCenter();
m_Camera->lookAt(Center);
m_SceneManagerDlg->m_SceneTree.Expand(Selected, TVE_EXPAND);
if (m_Root != NULL)
{
m_Root->renderOneFrame();
}
}
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:26,代码来源:SceneEditorView.cpp
示例6: calculateBillboardsBoundingBox
Ogre::AxisAlignedBox GPUBillboardSet::calculateBillboardsBoundingBox(const std::vector<PhotoSynth::Vertex>& vertices)
{
Ogre::AxisAlignedBox box;
for (std::size_t i=0; i<vertices.size(); ++i)
box.merge(vertices[i].position);
return box;
}
示例7: MergeBounds
void MergeBounds(Ogre::SceneNode* node, Ogre::SceneNode* rootNode,
const Ogre::Matrix4& parentTransform, Ogre::AxisAlignedBox& aabb)
{
// Get this nodes current transform
Ogre::Matrix4 currentTransform = parentTransform;
if (node != rootNode)
{
Ogre::Matrix4 localTransform(node->getOrientation());
localTransform.setTrans(node->getPosition());
currentTransform = currentTransform * localTransform;
}
// Merge this nodes objects
Ogre::SceneNode::ObjectIterator object = node->getAttachedObjectIterator();
while (object.hasMoreElements())
{
Ogre::AxisAlignedBox localAABB = object.getNext()->getBoundingBox();
localAABB.transform(currentTransform);
aabb.merge(localAABB);
}
// Iterate through all children and call this function on them
Ogre::SceneNode::ChildNodeIterator child = node->getChildIterator();
while (child.hasMoreElements())
{
MergeBounds(static_cast<Ogre::SceneNode*>(child.getNext()), rootNode, currentTransform, aabb);
}
}
示例8: Init
void AIRayPathFinderStrategy::Init()
{
AIPathFinderStrategy::Init();
//if (Inited)
// return;
Inited=true;
if (Lines)
delete [] Lines;
Lines = new Ogre::Ray[LinesNumber];
IScenable *scen = Parent->GetScenable();
assert(scen);
Ogre::AxisAlignedBox OurBox = scen->GetBoundingBox(false);
Vector3 extent = OurBox.getSize();
float HalfSide = extent.z/2, Side=HalfSide*2;
LineOrigins[0]=Vector3(-HalfSide,-HalfSide,0);
LineOrigins[1]=Vector3(-HalfSide,HalfSide,0);
LineOrigins[2]=Vector3(HalfSide,HalfSide,0);
LineOrigins[3]=Vector3(HalfSide,-HalfSide,0);
LineOrigins[4]=Vector3(0,-HalfSide,0);
LineOrigins[5]=Vector3(-HalfSide,0,0);
LineOrigins[6]=Vector3(0,HalfSide,0);
LineOrigins[7]=Vector3(HalfSide,0,0);
}
示例9:
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
}
示例10: createSkybox
void EditorApplication::createSkybox(string skybox_name) {
LibGens::Model *skybox_model=current_level->getModelLibrary()->getModel(skybox_name);
if (skybox_model) {
Ogre::SceneNode *scene_node = scene_manager->getRootSceneNode()->createChildSceneNode();
buildModel(scene_node, skybox_model, skybox_model->getName(), "", scene_manager, current_level->getMaterialLibrary(), 0, GENERAL_MESH_GROUP, false);
unsigned short attached_objects=scene_node->numAttachedObjects();
for (unsigned short i=0; i<attached_objects; i++) {
Ogre::Entity *entity=static_cast<Ogre::Entity *>(scene_node->getAttachedObject(i));
entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_SKIES_EARLY);
unsigned int attached_entities=entity->getNumSubEntities();
Ogre::AxisAlignedBox aabb;
aabb.setInfinite();
entity->getMesh()->_setBounds(aabb, false);
for (unsigned int j=0; j<attached_entities; j++) {
Ogre::SubEntity *sub_entity=entity->getSubEntity(j);
Ogre::MaterialPtr material=sub_entity->getMaterial();
Ogre::Pass *pass=material->getTechnique(0)->getPass(0);
pass->setDepthWriteEnabled(false);
}
}
}
}
示例11: GetRadius
Ogre::Real LuaScriptUtilities::GetRadius(Ogre::SceneNode* const sceneNode)
{
sceneNode->_updateBounds();
const Ogre::AxisAlignedBox aabb = sceneNode->_getWorldAABB();
return aabb.getHalfSize().length();
}
示例12:
const Ogre::AxisAlignedBox& Canvas::getBoundingBox() const
{
static Ogre::AxisAlignedBox box;
box.setInfinite();
return box;
}
示例13:
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()
}
示例14: mSceneMgr
LoadingScreen::LoadingScreen(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* rw)
: mSceneMgr(sceneMgr)
, mWindow(rw)
, WindowBase("openmw_loading_screen.layout")
, mLastRenderTime(0.f)
, mLastWallpaperChangeTime(0.f)
, mFirstLoad(true)
, mProgress(0)
, mVSyncWasEnabled(false)
{
getWidget(mLoadingText, "LoadingText");
getWidget(mProgressBar, "ProgressBar");
getWidget(mBackgroundImage, "BackgroundImage");
mProgressBar->setScrollViewPage(1);
mBackgroundMaterial = Ogre::MaterialManager::getSingleton().create("BackgroundMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mBackgroundMaterial->getTechnique(0)->getPass(0)->setLightingEnabled(false);
mBackgroundMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
mBackgroundMaterial->getTechnique(0)->getPass(0)->createTextureUnitState("");
mRectangle = new Ogre::Rectangle2D(true);
mRectangle->setCorners(-1.0, 1.0, 1.0, -1.0);
mRectangle->setMaterial("BackgroundMaterial");
// Render the background before everything else
mRectangle->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY-1);
// Use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
mRectangle->setBoundingBox(aabInf);
// Attach background to the scene
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
node->attachObject(mRectangle);
mRectangle->setVisible(false);
}
示例15: mSceneMgr
Fader::Fader(Ogre::SceneManager* sceneMgr)
: mSceneMgr(sceneMgr)
, mMode(FadingMode_In)
, mRemainingTime(0.f)
, mTargetTime(0.f)
, mTargetAlpha(0.f)
, mCurrentAlpha(0.f)
, mStartAlpha(0.f)
, mFactor(1.f)
{
// Create the fading material
MaterialPtr material = MaterialManager::getSingleton().create("FadeInOutMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
Pass* pass = material->getTechnique(0)->getPass(0);
pass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
pass->setDepthWriteEnabled (false);
mFadeTextureUnit = pass->createTextureUnitState("black.png");
mFadeTextureUnit->setColourOperationEx(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, ColourValue(0.f, 0.f, 0.f)); // always black colour
mRectangle = new Ogre::Rectangle2D(true);
mRectangle->setCorners(-1.0, 1.0, 1.0, -1.0);
mRectangle->setMaterial("FadeInOutMaterial");
mRectangle->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY-1);
// Use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
mRectangle->setBoundingBox(aabInf);
// Attach background to the scene
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
node->attachObject(mRectangle);
mRectangle->setVisible(false);
mRectangle->setVisibilityFlags (2048);
}