本文整理汇总了C++中ogre::SceneNode::showBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::showBoundingBox方法的具体用法?C++ SceneNode::showBoundingBox怎么用?C++ SceneNode::showBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::showBoundingBox方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCivils
void Test::createCivils(void)
{
// set the collision system
Ogre::Real MAX_VEL = 50.0f;
CivilSMTTable *tt = CivilFSMBuilder::build();
CivilUnit::setSMTTable(tt);
sm::Vector2 p;
for(int i = 0; i < 1; ++i){
Ogre::Entity * ent = GLOBAL_SCN_MNGR->createEntity("civil01.mesh");
Ogre::SceneNode *node = GLOBAL_SCN_MNGR->getRootSceneNode()->createChildSceneNode();
CivilUnit *cu = new CivilUnit;
cu->setEntity(ent);
cu->setSceneNode(node);
cu->setHeight(5);
cu->build();
cu->setLife(190);
node->showBoundingBox(true);
cu->setVelocity(MAX_VEL);
p.x = 507;
p.y = 1030;
cu->setPosition(p);
mCivils.push_back(cu);
}
}
示例2: createPlayer
// create game objects
void Test::createPlayer(void)
{
GameObject::collMng = mLevelManager.getCollisionManager();
Ogre::Real MAX_VEL = 180.0f;
PlayerSMTTable *tt = PlayerFSMBuilder::build();
PlayerUnit::setSMTransitionTable(tt);
// Create the player group
PlayerGroup::setLevelManager(&mLevelManager);
mPlayerGroup = new PlayerGroup;
for(int i = 0; i < 1; i++){
Ogre::Entity * ent = GLOBAL_SCN_MNGR->createEntity("coral.mesh");
Ogre::SceneNode *node = GLOBAL_SCN_MNGR->getRootSceneNode()->createChildSceneNode();
PlayerUnit *zu = new PlayerUnit;
zu->setEntity(ent);
zu->setSceneNode(node);
zu->setHeight(5);
zu->build();
zu->setLife(9);
node->showBoundingBox(true);
zu->setMaxVelocity(MAX_VEL*2.0f);
zu->setVelocity(MAX_VEL);
sm::Vector2 p;
p.x = 507 + 5*i;
p.y = 788 + 30*i;
zu->setPosition(p);
mPlayers.push_back(zu);
mPlayerGroup->addUnit(zu);
}
CircularFormation *formation = new CircularFormation;
mPlayerGroup->setCreator(mPlayers[0]);
mPlayerGroup->setFormation(formation);
mPlayerGroup->build();
static ShootContainer sc;
Shoot::setCollisionManager(mLevelManager.getCollisionManager());
Shoot::setContainer(&sc);
Shoot::setUpdObjsManager(&mUpdMngr);
for(int i = 0; i < 10; ++i){
Shoot *s = new Shoot;
s->build(Ogre::Math::RangeRandom(8,16));
}
Weapon::setShootContainer(&sc);
Gun9mm *w = new Gun9mm;
w->setOwner(mPlayers.back());
w->setPower(1);
w->setSqrRange(90000.0);
w->setEntity(GLOBAL_SCN_MNGR->createEntity("9mm.mesh"));
Weapon::Ammunition ammo;
ammo.ammo = 25;
w->setAmmunition(ammo);
mPlayers.back()->addNewWeapon(w);
}
示例3: create
int Create_Static_Object::create(Ogre::SceneManager *mainSceneMgr) {
if (meshName.empty() ) {
std::cout << "Whoops, what do you think you're doing? You didn't give a mesh name!" << std::endl;
return 0;
}
if (meshFile.empty() ) {
std::cout << "Well what did you expect? There's no mesh file to load!" << std::endl;
return 0;
}
Ogre::SceneNode *nodeStaticObject = mainSceneMgr->getRootSceneNode()->createChildSceneNode(meshName, location, rotation);
Ogre::Entity *entityStaticObject = mainSceneMgr->createEntity(meshName, meshFile);
if (!materialName.empty() ){
entityStaticObject->setMaterialName(materialName);
}
entityStaticObject->setCastShadows(shadow);
nodeStaticObject->attachObject(entityStaticObject);
nodeStaticObject->showBoundingBox(showBBox);
nodeStaticObject->scale(scale);
//Create the ground shape.
BtOgre::StaticMeshToShapeConverter ogreBulletShapeConverter(entityStaticObject);
if (bulletCollision == "sphere"){
shapeStaticObject = ogreBulletShapeConverter.createSphere();
} else if (bulletCollision == "box"){
shapeStaticObject = ogreBulletShapeConverter.createBox();
offsetLocation = entityStaticObject->getBoundingBox().getHalfSize();
location.y = location.y - offsetLocation.y;
} else if (bulletCollision == "trimesh"){
shapeStaticObject = ogreBulletShapeConverter.createTrimesh();
} else if (bulletCollision == "cylinder"){
shapeStaticObject = ogreBulletShapeConverter.createCylinder();
} else if (bulletCollision == "convex"){
shapeStaticObject = ogreBulletShapeConverter.createConvex();
}else{
return 0;
}
shapeStaticObject->setLocalScaling(BtOgre::Convert::toBullet(nodeStaticObject->getScale() ) );
//Create MotionState (no need for BtOgre here, you can use it if you want to though).
stateStaticObject = new btDefaultMotionState(btTransform( BtOgre::Convert::toBullet(rotation), BtOgre::Convert::toBullet(location) ) );
//Create the Body.
bodyStaticObject = new btRigidBody(0, stateStaticObject, shapeStaticObject, btVector3(0,0,0));
Globals::phyWorld->addRigidBody(bodyStaticObject);
return 1;
}
示例4: createZombies
void Test::createZombies(void)
{
// set the collision system
Ogre::Real MAX_VEL = 50.0f;
ZombieSMTTable *tt = ZombieFSMBuilder::build();
ZombieUnit::setSMTransitionTable(tt);
// create the batery for the zombies
static BillboardBatery bbb;
bbb.createSet(20, "Billboard/ZombieBlood", 10);
ZombieUnit::setBillboardBBlood(&bbb);
static ZombieQueue q;
ZombieUnit::setQueue(&q);
sm::Vector2 p;
for(int i = 0; i < 15; ++i){
Ogre::Entity * ent = GLOBAL_SCN_MNGR->createEntity("zombie01.mesh");
Ogre::SceneNode *node = GLOBAL_SCN_MNGR->getRootSceneNode()->createChildSceneNode();
ZombieUnit *zu = new ZombieUnit;
zu->setEntity(ent);
zu->setSceneNode(node);
zu->setHeight(5);
zu->setAttackPower(1);
zu->build();
zu->setLife(19);
node->showBoundingBox(true);
zu->setWalkVelocity(MAX_VEL);
zu->setAttackVelocity(MAX_VEL*2.0f);
zu->setVelocity(MAX_VEL);
p.x = 1107;
p.y = 1030;
zu->setPosition(p);
mZombies.push_back(zu);
}
}
示例5: App
App()
{
_makeOgre();
_makeOIS();
// Create the Librarian this is the "Root" class of Orangutan, responsible for
// creating and destroying Orangutan Geometries.
mLibrarian = new Orangutan::Librarian();
// A node to attach our about to be created Geometry too.
mNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
// Create a Geometry, but though the SceneManager as it's a MovableObject.
// Use "OrangutanGeometry" as the type of MovableObject to create, as long as the Librarian
// has been created, Ogre knows what you mean.
mGeometry = static_cast<Orangutan::Geometry*>( mSceneMgr->createMovableObject("OrangutanGeometry") );
mGeometry->setMaterialName(0, "uv_blend_test");
mGeometry->setMaterialName(1, "BaseWhiteNoLighting");
// Then attach it. Just treat Geometries like Entities, Lights or ManualObjects.
mNode->attachObject(mGeometry);
mGeometry->createPlane(Ogre::Vector3(0,0,0), Ogre::Vector2(10,10));
#if 1
Orangutan::Displacement* dis = mGeometry->createDisplacement(Ogre::Vector3(0,0,0), Ogre::Vector3(0.25,0.25,0.25));
dis->begin(10,10);
for (size_t i=0;i < 10*10;i++)
{
dis->sample(i * 0.01f, Ogre::ColourValue(0.5f,0.5f,0.5f,0.5f));
}
dis->end();
mNode->showBoundingBox(true);
#endif
Orangutan::Block* block = mGeometry->createBlock(Ogre::Vector3(0,0,0), Ogre::Vector3(20,1,10));
block->quad_index(Orangutan::Block::Quad_Top, 1);
block->quad_show(Orangutan::Block::Quad_Left);
mGeometry->saveAsOokFile("test.ook");
}
示例6: loadMap
void TutorialApplication::loadMap(l2p::StringRef name) {
l2p::Package *package = l2p::Package::GetPackage(name);
if (!package)
return;
std::vector<std::shared_ptr<l2p::UModel>> models;
package->GetObjects("Model", models);
// Find the largest model. The others aren't right or something like that...
std::shared_ptr<l2p::UModel> m = nullptr;
for (auto i = models.begin(), e = models.end(); i != e; ++i) {
if (!m) {
m = *i;
continue;
}
if ((*i)->nodes.size() > m->nodes.size())
m = *i;
}
// Get region from path.
{
name.substr(0, 2).getAsInteger(10, m->regionX);
name.substr(3, 2).getAsInteger(10, m->regionY);
mLoadedRegions.push_back(std::make_pair(m->regionX, m->regionY));
}
if (m->points.size() != 0)
loadBSP(m);
std::vector<std::shared_ptr<l2p::ABlockingVolume>> blocking_volumes;
package->GetObjects("BlockingVolume", blocking_volumes);
for (auto i = blocking_volumes.begin(), e = blocking_volumes.end(); i != e; ++i) {
std::shared_ptr<l2p::UModel> m = (*i)->brush;
if (m) {
Ogre::SceneNode *n = loadBSP(m, false);
if (n) {
assignActorPropsToNode(*i, n);
n->showBoundingBox(true);
dynamic_cast<Ogre::Entity*>(
n->getAttachedObject(0))->setMaterialName("Volume/Display");
}
}
}
std::vector<std::shared_ptr<l2p::ATerrainInfo>> terrains;
package->GetObjects("TerrainInfo", terrains);
for (auto i = terrains.begin(), e = terrains.end(); i != e; ++i) {
loadTerrain(*i);
}
std::vector<std::shared_ptr<l2p::AStaticMeshActor>> smeshes;
package->GetObjects("StaticMeshActor", smeshes);
package->GetObjects("MovableStaticMeshActor", smeshes);
for (auto i = smeshes.begin(), e = smeshes.end(); i != e; ++i) {
if ( (*i)->bHidden
|| (*i)->bDeleteMe
|| !(*i)->bCollideActors
|| !(*i)->bBlockActors
|| !(*i)->bBlockPlayers
)
continue;
loadStaticMeshActor(*i);
}
}
示例7: setSelected
virtual void setSelected(bool selected) {
mSceneNode->showBoundingBox(selected);
}
示例8: drawBoard
void GameG::drawBoard()
{
Ogre::SceneManager* m_pSceneMgr=OgreFramework::getSingletonPtr()->m_pRoot->getSceneManager("GameSceneMgr");
float widthKw = 30;
float heightKw = 30;
Ogre::ManualObject mo("Pole");
mo.begin("Examples/Rocky", Ogre::RenderOperation::OT_TRIANGLE_LIST);
mo.position(0, 0, heightKw);
mo.textureCoord(0, 0);
mo.position(widthKw, 0, heightKw);
mo.textureCoord(1, 0);
mo.position(widthKw, 0, 0);
mo.textureCoord(0, 1);
mo.position(0, 0, 0);
mo.textureCoord(1, 1);
mo.triangle(0, 1, 2);
mo.triangle(0, 2, 3);
mo.end();
mo.convertToMesh("PoleKw");
float width = 18;
float height = 30;
mo.clear();
mo.begin("Examples/Rocky", Ogre::RenderOperation::OT_TRIANGLE_LIST);
mo.position(0, 0, height);
mo.textureCoord(0, 0);
mo.position(width, 0, height);
mo.textureCoord(1, 0);
mo.position(width, 0, 0);
mo.textureCoord(0, 1);
mo.position(0, 0, 0);
mo.textureCoord(1, 1);
mo.triangle(0, 1, 2);
mo.triangle(0, 2, 3);
mo.end();
mo.convertToMesh("Pole");
Ogre::Entity *pole = m_pSceneMgr->createEntity("pole0", "PoleKw");
pole->setMaterialName("Examples/Chrome");
Ogre::SceneNode *poleNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("poleNode0");
poleNode->attachObject(pole);
poleNode->setPosition(Ogre::Vector3(4.5*width, 0,-4.5*width));
poleNode->showBoundingBox(true);
Ogre::Entity *pole2 = m_pSceneMgr->createEntity("pole10", "PoleKw");
pole2->setMaterialName("Examples/OgreLogo");
Ogre::SceneNode *poleNode2 = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("poleNode10");
poleNode2->attachObject(pole2);
poleNode2->setPosition(Ogre::Vector3(-4.5*width-height, 0,-4.5*width));
poleNode2->showBoundingBox(true);
Ogre::Entity *pole3 = m_pSceneMgr->createEntity("pole20", "PoleKw");
pole3->setMaterialName("Examples/OgreLogo");
Ogre::SceneNode *poleNode3 = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("poleNode20");
poleNode3->attachObject(pole3);
poleNode3->setPosition(Ogre::Vector3(-4.5*width-height, 0,4.5*width+height));
poleNode3->showBoundingBox(true);
Ogre::Entity *pole4 = m_pSceneMgr->createEntity("pole30", "PoleKw");
pole4->setMaterialName("Examples/OgreLogo");
Ogre::SceneNode *poleNode4 = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("poleNode30");
poleNode4->attachObject(pole4);
poleNode4->setPosition(Ogre::Vector3(4.5*width , 0,4.5*width+height));
poleNode4->showBoundingBox(true);
for (int i=0; i<9; i++)
{
Ogre::Entity *pole = m_pSceneMgr->createEntity("pole"+Ogre::StringConverter::toString(i+1), "Pole");
Ogre::SceneNode *poleNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("poleNode"+Ogre::StringConverter::toString(i+1));
poleNode->attachObject(pole);
poleNode->setPosition(Ogre::Vector3(3.5*width-i*width, 0, -4.5*width));
poleNode->showBoundingBox(true);
}
for (int i=0; i<9; i++)
{
Ogre::Entity *pole = m_pSceneMgr->createEntity("pole"+Ogre::StringConverter::toString(i+11), "Pole");
Ogre::SceneNode *poleNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("poleNode"+Ogre::StringConverter::toString(i+11));
poleNode->attachObject(pole);
poleNode->yaw(Ogre::Radian(Ogre::Math::PI/2.f));
poleNode->setPosition(Ogre::Vector3(-4.5*width-height, 0, -1.8*width+i*width));
poleNode->showBoundingBox(true);
}
//.........这里部分代码省略.........
示例9: create_SAF
Ogre::SceneNode* GameObjectFactory::create_SAF()
{
Ogre::String _objectName = "SAF_" + Ogre::StringConverter::toString(SAF_id);
SAF_id++;
Ogre::SceneNode* root_scene_node = scene_manager->getRootSceneNode();
Ogre::Entity* entity = scene_manager->createEntity(_objectName, "Base_Ship.mesh");
Ogre::SceneNode* node = root_scene_node->createChildSceneNode(_objectName);
entity->setMaterialName("ShinyMaterial");
node->attachObject(entity);
//node->setPosition(0.0,0.0,0.0);
node->setScale(1.0,1.0,1.0);
node->showBoundingBox(true);
//cockpit
entity = scene_manager->createEntity(_objectName + "_Cockpit", "Cockpit.mesh");
Ogre::SceneNode* child = node->createChildSceneNode(_objectName + "_Cockpit");
entity->setMaterialName("BlueMaterial");
child->attachObject(entity);
child->rotate(Ogre::Quaternion(Ogre::Radian(1.570797f), Ogre::Vector3(0.0,0.0,-1.0)));
child->translate(-1.22, -0.17430, 0.0f);
//
/*
Ogre::SceneNode* camera = scene_manager->getSceneNode("MyCameraNode");
Ogre::Camera* mCam = (Ogre::Camera*)camera->detachObject("MyCamera");
scene_manager->destroySceneNode("MyCameraNode");
mCam->setPosition(child->_getDerivedPosition());
mCam->setOrientation(child->_getDerivedOrientation());
mCam->move(Ogre::Vector3(0.0, 0.5, 0.0));
cout << mCam->getPosition() << endl;
child->attachObject(mCam);
child = child->createChildSceneNode("MyCameraNode");
child->attachObject(mCam);
child->rotate(Ogre::Quaternion(Ogre::Radian(3.14159f), Ogre::Vector3(-1.0, 0.0, 1.0)));
child->pitch(Ogre::Degree(95));
child->translate(0.0, -1.6, 0.0);
*/
//generators
entity = scene_manager->createEntity(_objectName + "_Generator", "Generator.mesh");
child = node->createChildSceneNode(_objectName + "_Generator");
entity->setMaterialName("ObjectMaterial");
child->attachObject(entity);
child->translate(0.5f, 0.0f, 0.0f);
//engines
entity = scene_manager->createEntity(_objectName + "_Engines", "Engines.mesh");
child = node->createChildSceneNode(_objectName + "_Engines");
entity->setMaterialName("ShinyBlueMaterial");
child->attachObject(entity);
child->rotate(Ogre::Quaternion(Ogre::Radian(3.01f), Ogre::Vector3(-1.0,0.0,0.0)));
child->translate(-0.02796f, -0.92620f, -0.87242f);
//
entity = scene_manager->createEntity(_objectName + "_Impulse", "Impule_Engine.mesh");
child = node->createChildSceneNode(_objectName + "_Impulse");
entity->setMaterialName("ObjectMaterial");
child->attachObject(entity);
child->translate(1.69124f, 0.31351f, 0.005f);
//launchers
entity = scene_manager->createEntity(_objectName + "_Launcher", "Launcher_Weapon.mesh");
child = node->createChildSceneNode(_objectName + "_Launcher");
entity->setMaterialName("ShinyBlueMaterial");
child->attachObject(entity);
child->translate(1.64124f, 0.2, 0.005);
//laser
entity = scene_manager->createEntity(_objectName + "_Laser", "Laser_Weapon.mesh");
child = node->createChildSceneNode(_objectName + "_Laser");
entity->setMaterialName("ShinyBlueMaterial");
child->attachObject(entity);
child->translate(1.66224f, 0.21, 0.005);
//
return node;
}