本文整理汇总了C++中ogre::Entity::setQueryFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::setQueryFlags方法的具体用法?C++ Entity::setQueryFlags怎么用?C++ Entity::setQueryFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Entity
的用法示例。
在下文中一共展示了Entity::setQueryFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadWorld
int CUIMain::LoadWorld(void)
{
Ogre::SceneNode* RootNode = mSceneMgr->getRootSceneNode();
Ogre::Plane plane(Ogre::Vector3::UNIT_Y, -1); //1 unit under the ground
Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
2000,2000,20,20,true,1,5,5,Ogre::Vector3::UNIT_Z);
Ogre::Entity *GroundEnt = mSceneMgr->createEntity("GroundEntity", "ground");
GroundEnt->setQueryFlags(QUERY_MASK_MOUSE_MOVEMENT);
GroundEnt->setMaterialName("Rockwall");
RootNode->createChildSceneNode()->attachObject(GroundEnt);
CharacterInfo local_player_info;
mWorld.LocalPlayer = new CLocalPlayer(mWorld, RootNode->createChildSceneNode());
AttachMeshes(mWorld.LocalPlayer, local_player_info);
mWorld.LocalPlayer->SetMoveSpeed(100);
mWorld.LocalPlayer->SetState(State_Idle);
//Test:
CreateNewPlayer(0, CharacterInfo());
Ogre::SceneNode *DestMarkerNode = RootNode->createChildSceneNode();
Ogre::Entity *DestMarker = mSceneMgr->createEntity("Ent-DestMarker", "arrow.mesh");
DestMarker->setQueryFlags(0);
DestMarkerNode->attachObject(DestMarker);
DestMarkerNode->setVisible(false);
mWorld.LocalPlayer->SetDestinationMarker(DestMarkerNode, DestMarker);
mMoveDestinationIndicator = RootNode->createChildSceneNode();
Ogre::Entity* MouseIndicatorEntity = mSceneMgr->createEntity("Ent-MouseIndicator", "arrow.mesh");
MouseIndicatorEntity->setQueryFlags(0);
MouseIndicatorEntity->setMaterialName("ArrowTransparent");
mMoveDestinationIndicator->attachObject(MouseIndicatorEntity);
mMoveDestinationIndicator->scale(0.8, 0.8, 0.8);
mEntityHoveringIndicator = RootNode->createChildSceneNode();
mEntitySelectionIndicator = RootNode->createChildSceneNode();
Ogre::Entity* HoverIndicatorEntity = mSceneMgr->createEntity("Ent-HoveringIndicator", "arrows.mesh");
Ogre::Entity* SelectionIndicatorEntity = mSceneMgr->createEntity("Ent-SelectionIndicator", "arrows.mesh");
HoverIndicatorEntity->setQueryFlags(0);
SelectionIndicatorEntity->setQueryFlags(0);
HoverIndicatorEntity->setMaterialName("ArrowTransparent");
mEntitySelectionIndicator->setInheritOrientation(false);
mEntityHoveringIndicator->attachObject(HoverIndicatorEntity);
mEntitySelectionIndicator->attachObject(SelectionIndicatorEntity);
mEntityHoveringIndicator->setVisible(false);
mEntitySelectionIndicator->setVisible(false);
return 1;
}
示例2: onGhostAdd
bool PlayerCamera::onGhostAdd(TNL::GhostConnection *theConnection)
{
if(!Parent::onGhostAdd(theConnection))
return false; //A parent had an error
#ifdef CLIENT_SIDE
if(owner() == Player::myId())
{
qDebug() << "========= Got My Camera";
return(true);
}
else
{
qDebug() << "========= Got user camera:" << owner();
Ogre::Entity *entity;
char entname[100];
snprintf(entname, 100, "crateent%i", entnum);
entity = Application::instance()->getScene()->createEntity(entname, "cube.mesh");
entity->setQueryFlags(1 << 2);
char entname2[100];
snprintf(entname2, 100, "crateent%i", entnum);
_node = Application::instance()->getScene()->getRootSceneNode()->createChildSceneNode(entname2);
_node->attachObject(entity);
entnum++;
}
#endif
return(true);
}
示例3: id
void
PlayersManager::createPlayer(zappy::Player *player)
{
Ogre::Entity *ent;
Ogre::SceneNode *node;
Ogre::AnimationState *anim;
std::string id(NumberToString<unsigned int>(player->getId()));
OPlayer *toAdd;
ent = this->mSceneMgr->createEntity("Player" + id, "robot.mesh");
node = this->mSceneMgr->getRootSceneNode()->
createChildSceneNode(PLAYERNODENAME + id,
Ogre::Vector3(player->getX() * Constants::SquareSize,
0,
player->getY() * Constants::SquareSize));
ent->setQueryFlags(Constants::PLAYER_MASK);
anim = ent->getAnimationState("Idle");
anim->setLoop(true);
anim->setEnabled(true);
node->attachObject(ent);
player->setRendered(true);
toAdd = new OPlayer(ent, node);
toAdd->setSpell(this->mSceneMgr->createParticleSystem("Aureola" + id, "Examples/Aureola"));
toAdd->setBroad(this->mSceneMgr->createParticleSystem("Purple" + id, "Examples/PurpleFountain"));
this->mOPlayers.push_back(toAdd);
}
示例4: Character
AnimateableCharacter::AnimateableCharacter(Ogre::String name, Ogre::SceneManager *sceneMgr, OgreDetourCrowd* detourCrowd, bool debugDraw, Ogre::Vector3 position)
: Character(name, sceneMgr, detourCrowd, position),
mAnimState(NULL),
mAnimSpeedScale(1),
mDebugNode(NULL)
{
mNode = sceneMgr->getRootSceneNode()->createChildSceneNode(name+"Node");
mEnt = sceneMgr->createEntity(name, "Gamechar-male.mesh");
// Assign random texture
int i = (int)Ogre::Math::RangeRandom(0,14);
if (i > 13)
i = 13;
mEnt->setMaterialName("GameChar_Male_Mat_"+Ogre::StringConverter::toString(i));
mEnt->setQueryFlags(OgreRecastApplication::DEFAULT_MASK); // Exclude from ray queries
mNode->attachObject(mEnt);
mNode->setPosition(position);
// Assign animation
mAnimState= mEnt->getAnimationState("Walk");
mAnimState->setEnabled(true);
mAnimState->setLoop(true);
Ogre::Vector3 bBoxSize = mEnt->getBoundingBox().getSize();
Ogre::Real agentRadius = mDetourCrowd->getAgentRadius();
Ogre::Real agentHeight = mDetourCrowd->getAgentHeight();
// Set Height to match that of agent
//mNode->setScale((agentRadius*2)/bBoxSize.y, agentHeight/bBoxSize.y, (agentRadius*2)/bBoxSize.y);
Ogre::Real scale = agentHeight/bBoxSize.y;
mNode->setScale(scale, scale, scale);
// Set animation speed scaling
mAnimSpeedScale = 0.35*(scale*4);
// Debug draw agent
mDebugNode = mNode->createChildSceneNode(name+"AgentDebugNode");
mDebugNode->setPosition(0, mDetourCrowd->m_recast->getNavmeshOffsetFromGround(), 0);
Ogre::Entity* debugEnt = sceneMgr->createEntity(name+"AgentDebug", "Cylinder.mesh");
debugEnt->setMaterialName("Cylinder/Wires/LightBlue");
mDebugNode->attachObject(debugEnt);
// Set marker scale to size of agent
mDebugNode->setInheritScale(false);
mDebugNode->setScale(agentRadius*2, agentHeight, agentRadius*2);
debugEnt->setQueryFlags(OgreRecastApplication::DEFAULT_MASK); // Exclude from ray queries
mDebugNode->setVisible(debugDraw);
}
示例5: AddEntity
Ogre::Entity* ManipulatorObject::AddEntity( const STRING& meshname, const POS& worldPos, bool bOp, const ORIENT& orient, const SCALE& scale )
{
static int counter = 0;
Ogre::String entName("Entity_");
entName += Ogre::StringConverter::toString(counter++);
Ogre::Entity* newEntity = RenderManager.m_pSceneMgr->createEntity(entName, meshname);
if(!newEntity)
return nullptr;
Ogre::SceneNode* pNode = RenderManager.m_pSceneMgr->getRootSceneNode()->createChildSceneNode(worldPos, orient);
pNode->setScale(scale);
pNode->attachObject(newEntity);
//每个Entity创建一个包围盒节点
Ogre::WireBoundingBox* aabb = new Ogre::WireBoundingBox;
aabb->setMaterial("BaseWhiteNoLighting");
aabb->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY);
Ogre::SceneNode* aabbNode = pNode->createChildSceneNode(entName);
aabbNode->attachObject(aabb);
aabbNode->setVisible(false);
_UpdateAABBOfEntity(newEntity);
//设置查询掩码
newEntity->setQueryFlags(eQueryMask_Entity);
SObjectInfo* objInfo = new SObjectInfo;
objInfo->m_meshname = meshname;
objInfo->m_pos = worldPos;
objInfo->m_rot = orient;
objInfo->m_scale = scale;
m_objects.insert(std::make_pair(newEntity, objInfo));
//可撤销操作
if (bOp)
{
opObjectAddRemove* op = ManipulatorSystem.GetOperation().NewOperation<opObjectAddRemove>();
opObjectAddRemove::SOpItem item;
item.bAddOrRemove = true;
item.ent = newEntity;
item.objInfo = *objInfo;
op->AddOp(item);
ManipulatorSystem.GetOperation().Commit(op);
}
return newEntity;
}
示例6: createWall
void SceneLoader::createWall( Ogre::Vector3 pos, Ogre::Real scale )
{
Ogre::Entity* ent = mSceneMgr->createEntity("atd_cube.mesh");
// Ogre::MeshPtr mesh = ent->getMesh();
// mesh->freeEdgeList();
// mesh->buildEdgeList();
ent->setCastShadows(true);
ent->setQueryFlags(AugmentedTowerDefense::MASK_WALLS);
Ogre::SceneNode* node = mSceneRootNode->createChildSceneNode("Wall_" + AugmentedTowerDefense::HelperClass::ToString(mWallCount));
node->setPosition(pos);
node->setScale(Ogre::Vector3::UNIT_SCALE*scale);
node->attachObject(ent);
mWallCount++;
}
示例7: placeObjectOnTerrain
void OgreWidget::placeObjectOnTerrain(const QString meshName, const Ogre::Vector3 position, const float rotationY, const Ogre::Vector3 scale)
{
Ogre::Quaternion rotation;
QString name(meshName);
name.replace(".mesh", "");
Ogre::Entity* entity = mSceneManager->createEntity(name.toStdString(), meshName.toStdString());
entity->setQueryFlags(0xFFFFFFFF);
rotation.FromAngleAxis(Ogre::Degree(rotationY), Ogre::Vector3::UNIT_Y);
Ogre::SceneNode* sceneNode = mSceneManager->getRootSceneNode()->createChildSceneNode(
position + Ogre::Vector3(0, mTerrainGroup->getHeightAtWorldPosition(position) + mTerrainPos.y - 0.2, 0),
rotation);
sceneNode->setScale(scale);
sceneNode->attachObject(entity);
addMeshInformation(entity, sceneNode);
}
示例8: createBackGround
/*
* Create a fake Plane for Drag and Drop
*/
void MyFrameListener::createBackGround() {
Ogre::SceneManager* mSceneMgr = Ogre::Root::getSingleton().
getSceneManager("mainSM");
Ogre::Plane *mPlane = new Ogre::Plane(Ogre::Vector3::UNIT_Z, -2);
Ogre::MeshManager::getSingleton().createPlane("backPlane",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
*mPlane,800, 800, 20, 20, true, 1, 5, 5
, Ogre::Vector3::UNIT_Y);
Ogre::Entity* plane = mSceneMgr->createEntity("backPlane");
plane->setQueryFlags(PLANE_DRAG_DROP);
plane->setMaterialName("sheet");
Ogre::Root::getSingleton().
getSceneManager("mainSM")->getRootSceneNode()->
attachObject(plane);
}
示例9: mAdd
// add a control point
Ogre::String CTrack::mAdd( ControlPoint tCP )
{
Ogre::Entity *ent;
char name[16];
sprintf(name, "ControlPoint%d", mCount++);
ent = mSm->createEntity(name, "point.mesh");
ent->setQueryFlags(ObjectControl::CONTROL_POINT);
Ogre::SceneNode *mCurrentObject = mSm->getRootSceneNode()->createChildSceneNode(std::string(name) + "Node", tCP.pos);
mCurrentObject->attachObject(ent);
mCurrentObject->setScale(0.05f, 0.05f, 0.05f);
tCP.name = mCurrentObject->getName();
CPs.push_back(tCP);
return mCurrentObject->getName();
}
示例10: getIndicatorRootSceneNode
Ogre::SceneNode*
JunctionPoints::allocNode(void)
{
Ogre::SceneNode* node;
if (mFreeNodes.empty())
{
node = getIndicatorRootSceneNode()->createChildSceneNode();
Ogre::Entity* entity = getSceneManager()->createEntity(node->getName(), mBaseMesh->getName());
entity->setQueryFlags(0);
//david-<<
//entity->setNormaliseNormals(true);
//david->>
node->attachObject(entity);
}
else
{
node = mFreeNodes.back();
mFreeNodes.pop_back();
getIndicatorRootSceneNode()->addChild(node);
}
node->setScale(mScale, mScale, mScale);
return node;
}
示例11: mMarkerEntity
/**
* @brief Ctor.
* @param entity The entity which the marker is attached to.
* @param sceneManager A scene manager used to create nodes and entities.
* @param terrainManager Provides height data.
* @param point The location which will be marked.
*/
EntityPointMarker(Eris::Entity& entity, Ogre::SceneManager& sceneManager, const IHeightProvider& heightProvider, const WFMath::Point<3>& point) :
mEntity(entity), mMarkerEntity(0), mMarkerNode(0), mMarkerDirectionIndicator(0), mHeightProvider(heightProvider), mPoint(point)
{
mMarkerNode = sceneManager.getRootSceneNode()->createChildSceneNode();
try {
mMarkerEntity = sceneManager.createEntity("3d_objects/primitives/models/sphere.mesh");
//start out with a normal material
mMarkerEntity->setMaterialName("/global/authoring/point");
//The material is made to ignore depth checks, so if we put it in a later queue we're
//making sure that the marker is drawn on top of everything else, making it easier to interact with.
mMarkerEntity->setRenderQueueGroup(Ogre::RENDER_QUEUE_9);
mMarkerEntity->setRenderingDistance(300);
mMarkerEntity->setQueryFlags(MousePicker::CM_NONPICKABLE);
mMarkerNode->attachObject(mMarkerEntity);
} catch (const std::exception& ex) {
S_LOG_WARNING("Error when creating marker node." << ex);
return;
}
mMarkerNode->setVisible(true);
mMarkerDirectionIndicator = new ShapeVisual(*sceneManager.getRootSceneNode(), false);
mEntity.Moved.connect(sigc::mem_fun(*this, &EntityPointMarker::entityMoved));
}
示例12: AddCollisionEntity
ObjectEditHandler::ObjectEditHandler(SceneDoc *Owner)
{
mOwner = Owner;
mMode = OEM_NONE;
mAxisMode = AM_NONE;
mTarget = NULL;
mObjectEditNode = mOwner->getSceneManager()->getRootSceneNode()->createChildSceneNode();
mRayQuery = mOwner->getSceneManager()->createRayQuery(Ogre::Ray());
mMaterials[0] = Ogre::MaterialManager::getSingletonPtr()->getByName("Editor/RedMat");
mMaterials[1] = Ogre::MaterialManager::getSingletonPtr()->getByName("Editor/GreenMat");
mMaterials[2] = Ogre::MaterialManager::getSingletonPtr()->getByName("Editor/BlueMat");
mMaterials[3] = Ogre::MaterialManager::getSingletonPtr()->getByName("Editor/ObjectIndicatorWhiteMat");
mMaterials[4] = Ogre::MaterialManager::getSingletonPtr()->getByName("Editor/ObjectIndicatorYellowMat");
//////////////////////////////////////////////////
// 碰撞检测
//////////////////////////////////////////////////
mCollisionManager = new OgreOpcode::CollisionManager(Owner->getSceneManager());
mCollisionManager->addCollClass("Object");
mCollisionManager->addCollType("Object", "Object", OgreOpcode::COLLTYPE_IGNORE);
mCollisionContext = mCollisionManager->createContext("SceneObject");
Ogre::MovableObjectFactory* Factory =
Ogre::Root::getSingleton().getMovableObjectFactory(Ogre::EntityFactory::FACTORY_TYPE_NAME);
Ogre::NameValuePairList Params;
//////////////////////////////////////////////////
// 平移放缩指示器
//////////////////////////////////////////////////
mIndicatorContext = mCollisionManager->createContext("TransScale");
mTransScaleNode = mObjectEditNode->createChildSceneNode("TransScaleIndicator");
mTransScaleNode->setScale(200.0f, 200.0f, 200.0f);
// x
Ogre::SceneNode *SubNode = mTransScaleNode->createChildSceneNode();
SubNode->roll(Ogre::Degree(-90.0f));
Ogre::Entity *Entity = Owner->getSceneManager()->createEntity("TransScaleXLine", "MoveArrowLineVisible.mesh");
//Entity->setQueryFlags(0); // 参与查询
Entity->setCastShadows(false);
Entity->setMaterial(mMaterials[0]);
Entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_8);
SubNode->attachObject(Entity);
mTransformEntities[AM_TRANS_SCALE_X] = Entity;
Entity = Owner->getSceneManager()->createEntity("TransScaleXCone", "MoveArrowConeVisible.mesh");
Entity->setQueryFlags(0);
Entity->setCastShadows(false);
Entity->setMaterial(mMaterials[0]);
Entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_8);
SubNode->attachObject(Entity);
Params["mesh"] = "MoveArrowCollision.mesh";
Entity = (Ogre::Entity*)Factory->createInstance("TransScaleXCol", Owner->getSceneManager(), &Params);
Entity->setQueryFlags(0);
Entity->setCastShadows(false);
Entity->setVisible(false);
SubNode->attachObject(Entity);
OgreOpcode::CollisionObject *CollisionObject =
AddCollisionEntity(mIndicatorContext, Entity);
mCollisionObjectToAxisMode[CollisionObject] = AM_TRANS_SCALE_X;
// y
SubNode = mTransScaleNode;
Entity = Owner->getSceneManager()->createEntity("TransScaleYLine", "MoveArrowLineVisible.mesh");
//Entity->setQueryFlags(0);
Entity->setCastShadows(false);
Entity->setMaterial(mMaterials[1]);
Entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_8);
SubNode->attachObject(Entity);
mTransformEntities[AM_TRANS_SCALE_Y] = Entity;
Entity = Owner->getSceneManager()->createEntity("TransScaleYCone", "MoveArrowConeVisible.mesh");
Entity->setQueryFlags(0);
Entity->setCastShadows(false);
Entity->setMaterial(mMaterials[1]);
Entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_8);
SubNode->attachObject(Entity);
Params["mesh"] = "MoveArrowCollision.mesh";
Entity = (Ogre::Entity*)Factory->createInstance("TransScaleYCol", Owner->getSceneManager(), &Params);
Entity->setQueryFlags(0);
Entity->setCastShadows(false);
Entity->setVisible(false);
SubNode->attachObject(Entity);
CollisionObject = AddCollisionEntity(mIndicatorContext, Entity);
mCollisionObjectToAxisMode[CollisionObject] = AM_TRANS_SCALE_Y;
// z
SubNode = mTransScaleNode->createChildSceneNode();
SubNode->pitch(Ogre::Degree(90));
//.........这里部分代码省略.........
示例13: createEntities
//.........这里部分代码省略.........
current_type_name = type_name;
destroyAllAttachedMovableObjects(target_node);
}
else {
return;
}
LibGens::ObjectPhysics *object_physics = object_production->getObjectPhysics(type_name);
if (object_physics) {
vector<string> models=object_physics->getModels();
vector<string> motions=object_physics->getMotions();
vector<string> motion_skeletons=object_physics->getMotionSkeletons();
for (size_t i=0; i<models.size(); i++) {
string model_id=models[i];
string skeleton_id = "";
string animation_id = "";
LibGens::Model *model=model_library->getModel(model_id);
if (i < motions.size()) {
animation_id = motions[i];
}
if (i < motion_skeletons.size()) {
skeleton_id = motion_skeletons[i];
}
if (model) {
prepareSkeletonAndAnimation(skeleton_id, animation_id);
buildModel(target_node, model, model->getName(), skeleton_id, scene_manager, material_library, EDITOR_NODE_QUERY_OBJECT, GENERAL_MESH_GROUP, false);
createAnimationState(animation_id);
found_model = true;
}
}
}
}
if (found_model) {
return;
}
else {
current_model_name = "";
}
}
if ((model_name != current_model_name) || (skeleton_name != current_skeleton_name) || (animation_name != current_animation_name)) {
current_model_name = model_name;
current_skeleton_name = skeleton_name;
current_animation_name = animation_name;
destroyAllAttachedMovableObjects(target_node);
}
else {
return;
}
string model_id=model_name;
model_id.resize(model_id.size() - ((string)OBJECT_NODE_MODEL_EXTENSION).size());
string skeleton_id="";
if (skeleton_name.size()) {
skeleton_id=skeleton_name;
skeleton_id.resize(skeleton_id.size() - ((string)OBJECT_NODE_SKELETON_EXTENSION).size());
}
string animation_id="";
if (animation_name.size()) {
animation_id=animation_name;
animation_id.resize(animation_id.size() - ((string)OBJECT_NODE_ANIMATION_EXTENSION).size());
}
if (model_name.find(OBJECT_NODE_MODEL_EXTENSION) != string::npos) {
LibGens::Model *model=model_library->getModel(model_id);
if (model) {
prepareSkeletonAndAnimation(skeleton_id, animation_id);
buildModel(target_node, model, model->getName(), skeleton_id, scene_manager, material_library, EDITOR_NODE_QUERY_OBJECT, GENERAL_MESH_GROUP, false);
}
else {
Ogre::Entity *entity = scene_manager->createEntity(OBJECT_NODE_UNKNOWN_MESH);
entity->setQueryFlags(EDITOR_NODE_QUERY_OBJECT);
target_node->attachObject(entity);
}
}
else if (model_name.find(OBJECT_NODE_MESH_EXTENSION) != string::npos) {
Ogre::Entity *entity = scene_manager->createEntity(model_name);
entity->setQueryFlags(EDITOR_NODE_QUERY_OBJECT);
target_node->attachObject(entity);
}
createAnimationState(animation_id);
// Create PreviewBox if necessary
if ((preview_box_x.size()) || (preview_box_y.size()) || (preview_box_z.size())) {
preview_box_entity = scene_manager->createEntity("preview_box.mesh");
preview_box_entity->setRenderQueueGroup(Ogre::RENDER_QUEUE_MAX);
preview_box_entity->setQueryFlags(EDITOR_NODE_QUERY_PREVIEW_BOX);
preview_box_node->attachObject(preview_box_entity);
}
}
示例14: initialize
void GameRenderer::initialize(){
DEBUG("GameRenderer::initialize");
Client::getInstance().getOgreManager().getRoot()->addFrameListener(this);
// Tray manager, hacky fix for intel graphics
mTrayMgr = new OgreBites::SdkTrayManager(
"InterfaceName",
Client::getInstance().getOgreManager().getWindow(),
Client::getInstance().getOISManager().getMouse(),
this);
mTrayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
mTrayMgr->toggleAdvancedFrameStats();
mTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
mTrayMgr->hideCursor();
//cameraMan = new OgreBites::SdkCameraMan(Client::getInstance().getOgreManager().getCamera());
Client::getInstance().getOISManager().addMouseListener(this);
Client::getInstance().getOISManager().addKeyListener(this);
Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
plane, 1500, 1500, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
Ogre::Entity* entGround =
Client::getInstance()
.getOgreManager()
.getSceneManager()
->createEntity("GroundEntity", "ground");
Ogre::SceneNode* groundNode = Client::getInstance().getOgreManager().getSceneManager()->getRootSceneNode()->createChildSceneNode();
groundNode->attachObject(entGround);
groundNode->scale(.1, .1, .1);
entGround->setMaterialName("Examples/Rockwall");
entGround->setCastShadows(false);
entGround->setQueryFlags(0);
//point light
Ogre::Light* pointLight = Client::getInstance().getOgreManager().getSceneManager()->createLight("pointLight");
pointLight->setType(Ogre::Light::LT_POINT);
pointLight->setPosition(Ogre::Vector3(0, 10, 10));
pointLight->setDiffuseColour(1.0, 1.0, 1.0);
pointLight->setSpecularColour(1.0, 1.0, 1.0);
Client::getInstance()
.getOgreManager()
.getSceneManager()
->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
orb = new OgreOrb(Client::getInstance().getOgreManager().getSceneManager());
felhound = new OgreFelhound(Client::getInstance().getOgreManager().getSceneManager(),0);
//TODO: magic strings
cameraStyles["TOCameraMan"] = new TOCameraManStyle();
cameraStyles["WC3Style"] = new WC3CameraStyle();
//TODO: configurable default
setCameraStyle("WC3Style");
DEBUG("GameRenderer::initialize done");
}
示例15: init
void WalkabilityMap::init(TWalkabilityMapParameters tWalkabilityMapParameters,Ogre::SceneManager * pSceneManager,Ogre::SceneNode * pDebugObjects)
{
unsigned int i,j;
mDebugObjects=pDebugObjects;
mSceneManager=pSceneManager;
mName=tWalkabilityMapParameters.name;
mDebugObjects->createChildSceneNode("walkability#"+tWalkabilityMapParameters.name);
myLines.clear();
myNodes.clear();
mDisplays.clear();
//init node numbers
mNodeNumbers.clear();
for(i=0;i<tWalkabilityMapParameters.walkabilityNodes.size();i++)
{
mNodeNumbers[tWalkabilityMapParameters.walkabilityNodes[i].nodeName]=i;
}
//init graph
mGraph.clear();
mGraph = Graph(mNodeNumbers.size());
Ogre::SceneNode * pSceneNode;
Ogre::Entity * pEntity;
Ogre::SceneNode * pEntityDebugNode;
ObjectTextDisplay* pDisplay;
//create graph nodes
for(i=0;i<tWalkabilityMapParameters.walkabilityNodes.size();i++)
{
//Logger::getInstance()->log("Adding node "+tWalkabilityMapParameters.walkabilityNodes[i].nodeName);
if(pSceneManager->hasSceneNode(tWalkabilityMapParameters.walkabilityNodes[i].nodeName))
{
pSceneNode=pSceneManager->getSceneNode(tWalkabilityMapParameters.walkabilityNodes[i].nodeName);
}
else
{
pSceneNode=pSceneManager->getRootSceneNode()->createChildSceneNode(tWalkabilityMapParameters.walkabilityNodes[i].nodeName);
pSceneNode->setPosition(tWalkabilityMapParameters.walkabilityNodes[i].position);
pSceneNode->setOrientation(tWalkabilityMapParameters.walkabilityNodes[i].orientation);
}
mGraph[getNodeNumber(tWalkabilityMapParameters.walkabilityNodes[i].nodeName)].mSceneNode=pSceneNode;
//create graphics debug objects
std::string debugName="walkability#"+tWalkabilityMapParameters.name+"#"+tWalkabilityMapParameters.walkabilityNodes[i].nodeName;
pEntityDebugNode=mDebugObjects->createChildSceneNode(debugName);
pEntityDebugNode->setPosition(pSceneNode->getPosition());
pEntityDebugNode->setVisible(mVisible);
pEntity=pSceneManager->createEntity(debugName,"node.mesh");
pEntity->setMaterialName("red");
pEntity->setVisible(mVisible);
pEntity->setCastShadows(false);
pEntity->setQueryFlags(OUAN::QUERYFLAGS_NONE);
pEntityDebugNode->attachObject(pEntity);
myNodes.push_back(pEntity);
pDisplay = new ObjectTextDisplay(pEntity,Application::getInstance()->getCameraManager()->getCamera());
pDisplay->setText(tWalkabilityMapParameters.walkabilityNodes[i].nodeName);
pDisplay->enable(mVisible);
mDisplays.push_back(pDisplay);
}
//add graph edges
for(i=0;i<tWalkabilityMapParameters.walkabilityNodes.size();i++)
{
for(j=0;j<tWalkabilityMapParameters.walkabilityNodes[i].neighbors.size();j++)
{
//Logger::getInstance()->log("Adding edge "+tWalkabilityMapParameters.walkabilityNodes[i].nodeName+"-"
// +tWalkabilityMapParameters.walkabilityNodes[i].neighbors[j]);
if(hasNode(tWalkabilityMapParameters.walkabilityNodes[i].neighbors[j]))
{
add_edge(getNodeNumber(tWalkabilityMapParameters.walkabilityNodes[i].nodeName.c_str()),
getNodeNumber(tWalkabilityMapParameters.walkabilityNodes[i].neighbors[j].c_str()),
mGraph);
}
}
}
//set graph edges properties
Graph::vertex_descriptor v1,v2;
Ogre::SceneNode * pSceneNode1;
Ogre::SceneNode * pSceneNode2;
Graph::edge_descriptor e;
boost::graph_traits<Graph>::edge_iterator eit,eend;
boost::property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, mGraph);
i=0;
Line3D *myLine;
for (tie(eit, eend) = edges(mGraph); eit != eend; ++eit)
{
//.........这里部分代码省略.........