本文整理汇总了C++中NodeRefPtr::setTravMask方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeRefPtr::setTravMask方法的具体用法?C++ NodeRefPtr::setTravMask怎么用?C++ NodeRefPtr::setTravMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeRefPtr
的用法示例。
在下文中一共展示了NodeRefPtr::setTravMask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyPressed
virtual void keyPressed(const KeyEventUnrecPtr e)
{
if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_COMMAND)
{
TutorialWindow->closeWindow();
}
switch(e->getKey())
{
case KeyEvent::KEY_S:
{
buildSphere();
}
break;
case KeyEvent::KEY_B:
{
buildBox();
}
break;
case KeyEvent::KEY_T:
{
buildTriMesh();
}
break;
case KeyEvent::KEY_D:
{
if(PhysDrawableNode->getTravMask())
{
PhysDrawableNode->setTravMask(TypeTraits<UInt32>::getMin());
}
else
{
PhysDrawableNode->setTravMask(TypeTraits<UInt32>::getMax());
}
}
break;
}
}
示例2: main
// Initialize GLUT & OpenSG and set up the rootNode
int main(int argc, char **argv)
{
// OSG init
osgInit(argc,argv);
// Set up Window
TutorialWindow = createNativeWindow();
TutorialWindow->initWindow();
TutorialWindow->setDisplayCallback(display);
TutorialWindow->setReshapeCallback(reshape);
TutorialKeyListener TheKeyListener;
TutorialWindow->addKeyListener(&TheKeyListener);
TutorialMouseListener TheTutorialMouseListener;
TutorialMouseMotionListener TheTutorialMouseMotionListener;
TutorialWindow->addMouseListener(&TheTutorialMouseListener);
TutorialWindow->addMouseMotionListener(&TheTutorialMouseMotionListener);
// Create the SimpleSceneManager helper
mgr = new SimpleSceneManager;
// Tell the Manager what to manage
mgr->setWindow(TutorialWindow);
//Make Base Geometry Node
TriGeometryBase = makeTorus(0.5, 1.0, 24, 24);
//Make Main Scene Node
NodeRefPtr scene = makeCoredNode<Group>();
setName(scene, "scene");
rootNode = Node::create();
setName(rootNode, "rootNode");
ComponentTransformRefPtr Trans;
Trans = ComponentTransform::create();
rootNode->setCore(Trans);
// add the torus as a child
rootNode->addChild(scene);
//Make The Physics Characteristics Node
PhysicsCharacteristicsDrawableRefPtr PhysDrawable = PhysicsCharacteristicsDrawable::create();
PhysDrawable->setRoot(rootNode);
PhysDrawableNode = Node::create();
PhysDrawableNode->setCore(PhysDrawable);
PhysDrawableNode->setTravMask(TypeTraits<UInt32>::getMin());
rootNode->addChild(PhysDrawableNode);
//Setup Physics Scene
physicsWorld = PhysicsWorld::create();
physicsWorld->setWorldContactSurfaceLayer(0.005);
physicsWorld->setAutoDisableFlag(1);
physicsWorld->setAutoDisableTime(0.75);
physicsWorld->setWorldContactMaxCorrectingVel(100.0);
physicsWorld->setGravity(Vec3f(0.0, 0.0, -9.81));
physicsSpace = PhysicsHashSpace::create();
physHandler = PhysicsHandler::create();
physHandler->setWorld(physicsWorld);
physHandler->pushToSpaces(physicsSpace);
physHandler->setUpdateNode(rootNode);
physHandler->attachUpdateProducer(TutorialWindow->editEventProducer());
/************************************************************************/
/* create spaces, geoms and bodys */
/************************************************************************/
//create a group for our space
GroupRefPtr spaceGroup;
spaceGroupNode = makeCoredNode<Group>(&spaceGroup);
//create the ground plane
GeometryRefPtr plane;
NodeRefPtr planeNode = makeBox(30.0, 30.0, 1.0, 1, 1, 1);
plane = dynamic_cast<Geometry*>(planeNode->getCore());
//and its Material
SimpleMaterialRefPtr plane_mat = SimpleMaterial::create();
plane_mat->setAmbient(Color3f(0.7,0.7,0.7));
plane_mat->setDiffuse(Color3f(0.9,0.6,1.0));
plane->setMaterial(plane_mat);
//create Physical Attachments
PhysicsBoxGeomRefPtr planeGeom = PhysicsBoxGeom::create();
planeGeom->setLengths(Vec3f(30.0, 30.0, 1.0));
//add geoms to space for collision
planeGeom->setSpace(physicsSpace);
//add Attachments to nodes...
spaceGroupNode->addAttachment(physicsSpace);
//.........这里部分代码省略.........