本文整理汇总了C++中ogre::SceneNode::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::setVisible方法的具体用法?C++ SceneNode::setVisible怎么用?C++ SceneNode::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::setVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1)
{
{
Ogre::SceneNode *Node = static_cast<Ogre::SceneNode *>(colObj0->getUserPointer());
if(Node)
Node->setVisible(false);
}
{
Ogre::SceneNode *Node = static_cast<Ogre::SceneNode *>(colObj1->getUserPointer());
if(Node)
Node->setVisible(false);
}
//testVal = true;
return 0;
}
示例2: update
void Replicator::update(float value)
{
//logFile << getFrequentcyRange() << " :\t " << value << "\n";
Ogre::Vector3 currentScale = getScale();
this->setThreshold(0.7*this->getThreshold() + 0.4*value);
float result = value / this->getThreshold();
int numOfChildrenToGenerate = result > 1.0 ? (result - value) * 2 : 0;
//logFile << value / this->getThreashold() << "\t" << (result - value) * 10 << "\t" << numOfChildrenToGenerate << "\n";
for ( int i = 0; i < numOfChildrenToGenerate; i++ ) {
createChildren(numOfChildrenToGenerate);
}
for(std::vector<Ogre::Entity*>::size_type i = 0; i < children.size(); ) {
Ogre::SceneNode* childNode = children[i]->getParentSceneNode();
Ogre::Real res = childNode->getScale().length();
if ( res < 0.1 ) {
children[i]->setVisible(false);
childNode->setVisible(false);
childNode->detachObject(children[i]->getName());
_sceneManager->destroyEntity(children[i]->getName());
// entity is now destroyed, don't try to use the pointer anymore!
// optionally destroy node
_sceneManager->destroySceneNode(childNode->getName());
children.erase( children.begin() + i );
} else {
Ogre::Vector3 currScale = childNode->getScale();
childNode->setScale(Ogre::Vector3(currScale.x - currScale.x/3, currScale.y - currScale.y/3, currScale.z - currScale.z/3));
i++;
}
}
}
示例3: ShowEntityGizmo
void ManipulatorObject::ShowEntityGizmo(Ogre::Entity* pEntity, bool bShow, eEditMode mode, bool bDrift/* = false*/)
{
if(!pEntity)
return;
assert(mode != eEditMode_None);
if (mode == eEditMode_Select)
{
Ogre::SceneNode* aabbNode = dynamic_cast<Ogre::SceneNode*>(pEntity->getParentSceneNode()->getChild(pEntity->getName()));
aabbNode->setVisible(bShow);
if (bShow)
{
//显示包围盒
Ogre::WireBoundingBox* pAABB = GetEntityAABBGizmo(pEntity);
if(bDrift) //显示为红色
pAABB->setMaterial("RedEmissive_ZCheck");
else //显示为绿色
pAABB->setMaterial("GreenEmissive_ZCheck");
}
}
else
{
//显示坐标轴
m_pGizmoAixs->Show(bShow, mode == eEditMode_Move || mode == eEditMode_Scale);
if (bShow)
m_pGizmoAixs->Attach(pEntity->getParentSceneNode());
}
}
示例4: _updateRenderQueue
//-----------------------------------------------------------------------
void EntityRenderer::_updateRenderQueue(Ogre::RenderQueue* queue, ParticlePool* pool)
{
// Always perform this one
ParticleRenderer::_updateRenderQueue(queue, pool);
if (!mVisible)
return;
// Fast check to determine whether there are visual particles
if (pool->isEmpty(Particle::PT_VISUAL))
return;
VisualParticle* particle = static_cast<VisualParticle*>(pool->getFirst(Particle::PT_VISUAL));
while (!pool->end(Particle::PT_VISUAL))
{
if (particle)
{
if (!particle->visualData && !mVisualData.empty())
{
particle->visualData = mVisualData.back();
mVisualData.pop_back();
}
if (particle->visualData)
{
Ogre::SceneNode* node = (static_cast<EntityRendererVisualData*>(particle->visualData))->node;
if (node)
{
node->_setDerivedPosition(particle->position);
if (mEntityOrientationType == ENT_ORIENTED_SHAPE)
{
// Use the orientation of the particle itself
node->setOrientation(particle->orientation);
}
else if (mEntityOrientationType == ENT_ORIENTED_SELF)
{
// Rotate towards the direction
node->setOrientation(Vector3::UNIT_X.getRotationTo(particle->direction));
}
else if (mEntityOrientationType == ENT_ORIENTED_SELF_MIRRORED)
{
// Rotate towards the negative direction
node->setOrientation(Vector3::UNIT_X.getRotationTo(-particle->direction));
}
node->setVisible(true);
node->setScale(particle->width / mBoxWidth, particle->height / mBoxHeight, particle->depth / mBoxDepth);
if (mZRotated)
{
_rotateTexture(particle, static_cast<Ogre::Entity*>(node->getAttachedObject(0))); // We know for sure there is only one and it is an Entity*
}
}
}
}
particle = static_cast<VisualParticle*>(pool->getNext(Particle::PT_VISUAL));
}
}
示例5:
// This is a helper function to create a new flag in the Ogre scene and save its scene node in a list.
void FlagTool3D::makeFlag( const Ogre::Vector3& position )
{
Ogre::SceneNode* node = scene_manager_->getRootSceneNode()->createChildSceneNode();
Ogre::Entity* entity = scene_manager_->createEntity( flag_resource_ );
node->attachObject( entity );
node->setVisible( true );
node->setPosition( position );
flag_nodes_.push_back( node );
}
示例6: Listener
// TO DO: finish listener thread to get keyboard input from client!!
DWORD WINAPI Listener(LPVOID lpParam)
{
UDPReceive receiver = UDPReceive();
receiver.init(5001); // set to port specified in client
Ogre::SceneManager* mSceneMgr = (Ogre::SceneManager*)lpParam;
Ogre::SceneNode* penguin = mSceneMgr->getSceneNode("PlayerNode");
char* data = (char*) malloc(128);
double* ptime = new double(1);
std::string cInput;
int counter;
while(true) {
counter = receiver.receive(data,strlen(data),ptime);
(*ptime)++;
cInput.assign(data,0,counter);
// make sure variables are set the same as in client!
if ((cInput.find("KEY_YELLOW",0)!=std::string::npos)) {
penguin->setVisible( true );
penguin->setPosition(0,20,0);
}
if ((cInput.find("KEY_RED",0)!=std::string::npos)) {
penguin->setVisible( true );
penguin->setPosition(65,20,0);
}
if ((cInput.find("KEY_BLUE",0)!=std::string::npos)) {
penguin->setVisible( true );
penguin->setPosition(0,20,65);
}
if ((cInput.find("KEY_GREEN",0)!=std::string::npos)) {
penguin->setVisible( true );
penguin->setPosition(65,20,65);
}
}
return 0;
}
示例7: createGrassMesh
bool
CGrassSticks::buildGrassSticks(Ogre::SceneManager* sceneMgr, btDynamicsWorld* dynamicsWorld, btSoftBodyWorldInfo &softBodyWorldInfo)
{
// create our grass mesh, and create a grass entity from it
if (!sceneMgr->hasEntity(GRASS_MESH_NAME))
{
createGrassMesh();
} // End if
const int n=16;
const int sg=4;
const btScalar sz=16;
const btScalar hg=4;
const btScalar in=1/(btScalar)(n-1);
int index = 0;
for(int y=0;y<n;++y)
{
for(int x=0;x<n;++x)
{
const btVector3 org(-sz+sz*2*x*in,
1,
-sz+sz*2*y*in);
btSoftBody* psb=btSoftBodyHelpers::CreateRope(softBodyWorldInfo, org,
org+btVector3(hg*0.001f,hg,0),
sg,
1);
psb->m_cfg.kDP = 0.005f;
psb->m_cfg.kCHR = 0.1f;
for(int i=0;i<3;++i)
{
psb->generateBendingConstraints(2+i);
}
psb->setMass(1,0);
psb->setTotalMass(0.01f);
static_cast<btSoftRigidDynamicsWorld*>(dynamicsWorld)->addSoftBody(psb);
const Ogre::String& strIndex = Ogre::StringConverter::toString(index++);
Ogre::Entity* grass = sceneMgr->createEntity("Grass" + strIndex, GRASS_MESH_NAME);
Ogre::SceneNode* node = sceneMgr->getRootSceneNode()->createChildSceneNode("node_grass_" + strIndex
,Ogre::Vector3(org.getX(), org.getY(), org.getZ())
,Ogre::Quaternion(Ogre::Degree(0), Vector3::UNIT_Y));
node->attachObject(grass);
node->scale(1.0f, Ogre::Math::RangeRandom(0.85f, 1.15f), 1.0f);
node->setVisible(true);
psb->setUserPointer((void*)(grass->getSubEntity(0)));
} // End for
} // End for
dynamicsWorld->setInternalTickCallback(&CGrassSticks::simulationTickCallback);
return true;
}
示例8:
void
GraphicsController::_initBackgroundHdr()
{
Ogre::Rectangle2D* rect = new Ogre::Rectangle2D(false);
rect->setCorners(-1.0f, 1.0f, 1.0f, -1.0f);
rect->setMaterial("PRJZ/HDRBackground");
rect->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND + 1);
rect->setBoundingBox(Ogre::AxisAlignedBox(-100000.0*Ogre::Vector3::UNIT_SCALE, 100000.0*Ogre::Vector3::UNIT_SCALE));
rect->setCastShadows(false);
rect->setVisibilityFlags(0xf00000);
Ogre::SceneNode* node = _scnMgr->getRootSceneNode()->createChildSceneNode("HdrBackground");
node->attachObject(rect);
node->setVisible(true);
}
示例9: 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;
}
示例10: 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;
}
示例11: setParameter
void DatuPointEditAction::setParameter(const String& name, const String& value)
{
if (name == "ShowDatuPointItem")
{
mShowSoundEntity = value == "true";
if (mSoundNode)
{
mSoundNode->setVisible(mShowSoundEntity);
}
}
else if (name == "CreatePointEntity")
{
Ogre::StringVector values = Ogre::StringUtil::split(value);
_createPointEntity(Ogre::StringConverter::parseInt(values[0]), Ogre::StringConverter::parseInt(values[1]));
}
else if (name == "ClearPointEntity")
{
_clearAllPointEntities();
}
else if (name == "DeleteDatuPointItem")
{
_deletePointEntity( Ogre::StringConverter::parseInt(value) );
}
else if (name == "ShowRadiusEntity")
{
Ogre::StringVector valueVector = Ogre::StringUtil::split(value);
if (mDatuPointRadiusEntity)
{
Ogre::SceneNode* node = mDatuPointRadiusEntity->getParentSceneNode();
node->setVisible(true);
node->setPosition( Ogre::StringConverter::parseReal(valueVector[0]),
Ogre::StringConverter::parseReal(valueVector[1]),
Ogre::StringConverter::parseReal(valueVector[2]) );
float scale = Ogre::StringConverter::parseReal(valueVector[3]) * 100.0f;
node->setScale( scale, 1, scale );
}
}
else
{
Action::setParameter(name, value);
}
}
示例12: mNode
SnapToMovement::SnapToMovement(Eris::Entity& entity, Ogre::Node& node, float snapThreshold, Ogre::SceneManager& sceneManager, bool showDebugOverlay) :
mEntity(entity), mNode(node), mSnapThreshold(snapThreshold), mSceneManager(sceneManager)
{
if (showDebugOverlay) {
for (int i = 0; i < 30; ++i) {
Ogre::SceneNode* node = mSceneManager.getRootSceneNode()->createChildSceneNode();
Ogre::Entity* sphereEntity = mSceneManager.createEntity(node->getName() + "_entity", "3d_objects/primitives/models/sphere.mesh");
//start out with a normal material
sphereEntity->setMaterialName("/global/authoring/point");
sphereEntity->setRenderingDistance(300);
// entity.setQueryFlags(MousePicker::CM_UNDEFINED);
node->setScale(0.25, 0.25, 0.25);
node->attachObject(sphereEntity);
node->setVisible(false);
mDebugNodes.push_back(node);
}
}
}
示例13:
Ring::Ring(Ogre::String name, RingFlier* flier):flier(flier)
{
check=true;
ringName=name;
position.x=(rand()%5000);
position.z=(rand()%5000);
position.y=(rand()%700)+flier->getTerrainHeightAt(position.x,position.z)+100.0f;
Ogre::SceneNode* sn = flier->getSceneManager()->getRootSceneNode()->createChildSceneNode("sn"+name);
Ogre::Entity* ring = flier->getSceneManager()->createEntity(name,"Torus.mesh");
sn->attachObject(ring);
sn->scale(Ogre::Vector3(015.10f,015.10f,015.10f));
sn->setPosition(position);
sn->setVisible(true);
sn->setOrientation(Ogre::Quaternion(Ogre::Radian(30.0f), Ogre::Vector3::UNIT_Z));
sn->setDirection(rand()%10,rand()%10,rand()%10,Ogre::Node::TransformSpace::TS_LOCAL,Ogre::Vector3::NEGATIVE_UNIT_Z);
Ogre::ParticleSystem* pSysRing = flier->getSceneManager()->createParticleSystem(ringName+'p',"PEExamples/ringShimmer");
flier->getSceneManager()->getSceneNode("sn"+ringName)->attachObject(pSysRing);
}
示例14: insertBegin
void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_)
{
Ogre::SceneNode* root = mMwRoot;
Ogre::SceneNode* cellnode;
if(mCellSceneNodes.find(ptr.getCell()) == mCellSceneNodes.end())
{
//Create the scenenode and put it in the map
cellnode = root->createChildSceneNode();
mCellSceneNodes[ptr.getCell()] = cellnode;
}
else
{
cellnode = mCellSceneNodes[ptr.getCell()];
}
Ogre::SceneNode* insert = cellnode->createChildSceneNode();
const float *f = ptr.getRefData().getPosition().pos;
insert->setPosition(f[0], f[1], f[2]);
insert->setScale(ptr.getCellRef().scale, ptr.getCellRef().scale, ptr.getCellRef().scale);
// Convert MW rotation to a quaternion:
f = ptr.getCellRef().pos.rot;
// Rotate around X axis
Ogre::Quaternion xr(Ogre::Radian(-f[0]), Ogre::Vector3::UNIT_X);
// Rotate around Y axis
Ogre::Quaternion yr(Ogre::Radian(-f[1]), Ogre::Vector3::UNIT_Y);
// Rotate around Z axis
Ogre::Quaternion zr(Ogre::Radian(-f[2]), Ogre::Vector3::UNIT_Z);
// Rotates first around z, then y, then x
insert->setOrientation(xr*yr*zr);
if (!enabled)
insert->setVisible (false);
ptr.getRefData().setBaseNode(insert);
mIsStatic = static_;
}
示例15: 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));
}