当前位置: 首页>>代码示例>>C++>>正文


C++ AxisAlignedBox::getHalfSize方法代码示例

本文整理汇总了C++中ogre::AxisAlignedBox::getHalfSize方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBox::getHalfSize方法的具体用法?C++ AxisAlignedBox::getHalfSize怎么用?C++ AxisAlignedBox::getHalfSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::AxisAlignedBox的用法示例。


在下文中一共展示了AxisAlignedBox::getHalfSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetRadius

Ogre::Real LuaScriptUtilities::GetRadius(Ogre::SceneNode* const sceneNode)
{
    sceneNode->_updateBounds();
    const Ogre::AxisAlignedBox aabb = sceneNode->_getWorldAABB();

    return aabb.getHalfSize().length();
}
开发者ID:Bewolf2,项目名称:LearningGameAI,代码行数:7,代码来源:LuaScriptUtilities.cpp

示例2: 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;
}
开发者ID:danduk82,项目名称:HeartsOfOakEngine,代码行数:27,代码来源:HOO_app.cpp

示例3: isInLightRange

    //-----------------------------------------------------------------------
    bool Light::isInLightRange(const Ogre::AxisAlignedBox& container) const
    {
        bool isIntersect = true;
        //Check the 2 simple / obvious situations. Light is directional or light source is inside the container
        if ((mLightType != LT_DIRECTIONAL) && (container.intersects(mDerivedPosition) == false))
        {
            //Check that the container is within the sphere of the light
            isIntersect = Math::intersects(Sphere(mDerivedPosition, mRange),container);
            //If this is a spotlight, do a more specific check
            if ((isIntersect) && (mLightType == LT_SPOTLIGHT) && (mSpotOuter.valueRadians() <= Math::PI))
            {
                //Create a rough bounding box around the light and check if
                Quaternion localToWorld = Vector3::NEGATIVE_UNIT_Z.getRotationTo(mDerivedDirection);

                Real boxOffset = Math::Sin(mSpotOuter * 0.5) * mRange;
                AxisAlignedBox lightBoxBound;
                lightBoxBound.merge(Vector3::ZERO);
                lightBoxBound.merge(localToWorld * Vector3(boxOffset, boxOffset, -mRange));
                lightBoxBound.merge(localToWorld * Vector3(-boxOffset, boxOffset, -mRange));
                lightBoxBound.merge(localToWorld * Vector3(-boxOffset, -boxOffset, -mRange));
                lightBoxBound.merge(localToWorld * Vector3(boxOffset, -boxOffset, -mRange));
                lightBoxBound.setMaximum(lightBoxBound.getMaximum() + mDerivedPosition);
                lightBoxBound.setMinimum(lightBoxBound.getMinimum() + mDerivedPosition);
                isIntersect = lightBoxBound.intersects(container);
                
                //If the bounding box check succeeded do one more test
                if (isIntersect)
                {
                    //Check intersection again with the bounding sphere of the container
                    //Helpful for when the light is at an angle near one of the vertexes of the bounding box
                    isIntersect = isInLightRange(Sphere(container.getCenter(), 
                        container.getHalfSize().length()));
                }
            }
        }
        return isIntersect;
    }
开发者ID:bsmr-c-cpp,项目名称:ogre,代码行数:38,代码来源:OgreLight.cpp

示例4: UpdateObject

bool RoomsManager::UpdateObject(Room::ObjectType* object)
{    
    bool updated=false, inrooms=false;
    Room *room;

    //std::vector<Room*>::iterator iPos=Rooms.begin(), iEnd=Rooms.end();
	inrooms=false;
    //for (size_t i=0;i<Rooms.Size;++i)
    Ogre::AxisAlignedBox box = object->GetRoomable()->GetBoundingBox(), *RoomBox;
    
	//assert()

	for (RoomsPool::ListNode *pos = Rooms.GetBegin(); pos!=NULL; pos=pos->Next)
    {
        room = pos->Value;        
        RoomBox = room->GetBox();
        if (RoomBox->intersects(box))
        {
            updated = room->UpdateObject(object);
            if (updated)
		    {           
			    inrooms=true;			
		    }
        }
    }

	if (!inrooms)
	{
		/*char log[100];
		sprintf(log,"Rooms 1: empty room set for object %d\n",object->GetScriptable()->GetID());
		Debugging::Log("Warnings.log",log);*/		
				
		IRoomable *rmbl = object->GetRoomable();
		IPhysical *phys = object->GetPhysical();
		if (rmbl)
		{
			rmbl->RemoveFromRooms();
			rmbl->GetRooms()->Clear();			
			switch (rmbl->GetRoomOnly())
			{
				case IRoomable::ROM_RESTORE:
					{						
						for (RoomsPool::ListNode *pos = Rooms.GetBegin(); pos!=NULL; pos=pos->Next)
						{
							Ogre::AxisAlignedBox *box = pos->Value->GetBox();
							Ogre::Vector3 center = box->getCenter();
							Ogre::Vector3 position = object->GetPosition();
							Ogre::Vector3 dist = position - center;

							int sqradius = AAUtilities::f2i(box->getHalfSize().squaredLength())+3*phys->GetRadius();
														
							int sqdist = AAUtilities::f2i(dist.squaredLength());
							if (sqradius>sqdist)
							{
								//GetPhysical()->SetForwardDirection(GetOrientation()*Vector3::UNIT_Z);
								//object->GetPhysical();
								//object->RestoreBackupPosition();								
								//Ogre::Vector3 newdir=phys->GetLastVelocity();
								//phys->Stop();
								phys->SetReplacingDirection(-dist.normalisedCopy()*10);
								break;
							}
						}
						AddOuterObject(object);
						//object->RestoreBackupPosition();
						break;
					}					
				case IRoomable::ROM_DESTROY:
					{
						CommonDeclarations::DeleteObjectRequest(object);
						break;
					}					
				case IRoomable::ROM_SCRIPT:
					{
						IScriptable *scr = object->GetScriptable();
						if (scr && scr->GetID()>0)
							ScriptManager::GetInstance()->Call("OnOutOfRooms", "i", false, object->GetScriptable()->GetID());
						break;
					}
				case IRoomable::ROM_NONE:
					{
						AddOuterObject(object);
						break;
					}

			};
		}
		
	}
    
    return inrooms;
}
开发者ID:beorc,项目名称:flare_star,代码行数:92,代码来源:RoomsManager.cpp


注:本文中的ogre::AxisAlignedBox::getHalfSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。