本文整理汇总了C++中scene::INodePtr类的典型用法代码示例。如果您正苦于以下问题:C++ INodePtr类的具体用法?C++ INodePtr怎么用?C++ INodePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了INodePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
void RotateSelected::visit(const scene::INodePtr& node) const
{
ITransformNodePtr transformNode = Node_getTransformNode(node);
if (transformNode)
{
// Upcast the instance onto a Transformable
ITransformablePtr transformable = Node_getTransformable(node);
if (transformable)
{
// The object is not scaled or translated explicitly
// A translation might occur due to the rotation around a pivot point
transformable->setType(TRANSFORM_PRIMITIVE);
transformable->setScale(c_scale_identity);
transformable->setTranslation(c_translation_identity);
// Pass the rotation quaternion and the world pivot,
// unless we're rotating each object around their own center
transformable->setRotation(_rotation,
_freeObjectRotation ? transformable->getUntransformedOrigin() : _worldPivot,
node->localToWorld());
}
}
}
示例2: processLight
void ModelExporter::processLight(const scene::INodePtr& node)
{
// Export lights as small polyhedron
static const double EXTENTS = 8.0;
std::vector<model::ModelPolygon> polys;
Vertex3f up(0, 0, EXTENTS);
Vertex3f down(0, 0, -EXTENTS);
Vertex3f north(0, EXTENTS, 0);
Vertex3f south(0, -EXTENTS, 0);
Vertex3f east(EXTENTS, 0, 0);
Vertex3f west(-EXTENTS, 0, 0);
// Upper semi-diamond
polys.push_back(createPolyCCW(up, south, east));
polys.push_back(createPolyCCW(up, east, north));
polys.push_back(createPolyCCW(up, north, west));
polys.push_back(createPolyCCW(up, west, south));
// Lower semi-diamond
polys.push_back(createPolyCCW(down, south, west));
polys.push_back(createPolyCCW(down, west, north));
polys.push_back(createPolyCCW(down, north, east));
polys.push_back(createPolyCCW(down, east, south));
Matrix4 exportTransform = node->localToWorld().getPremultipliedBy(_centerTransform);
_exporter->addPolygons("lights/default", polys, exportTransform);
}
示例3: addPrimitiveToEntity
bool MapImporter::addPrimitiveToEntity(const scene::INodePtr& primitive, const scene::INodePtr& entity)
{
_nodes.insert(NodeMap::value_type(
NodeIndexPair(_entityCount, _primitiveCount), primitive));
_primitiveCount++;
if (_dialog && _dialogEventLimiter.readyForEvent())
{
_dialog->setTextAndFraction(
_dlgEntityText + "Primitive " + string::to_string(_primitiveCount),
getProgressFraction()
);
}
if (Node_getEntity(entity)->isContainer())
{
entity->addChildNode(primitive);
return true;
}
else
{
return false;
}
}
示例4: updateSelectionStatus
void GraphTreeModel::updateSelectionStatus(const scene::INodePtr& node,
const NotifySelectionUpdateFunc& notifySelectionChanged)
{
NodeMap::const_iterator found = _nodemap.find(scene::INodeWeakPtr(node));
GraphTreeNodePtr foundNode;
if (found == _nodemap.end())
{
// The node is not in our map, it might have been previously hidden
if (node->visible())
{
foundNode = insert(node);
}
}
else
{
foundNode = found->second;
}
if (foundNode)
{
notifySelectionChanged(foundNode->getIter(), Node_isSelected(node));
}
}
示例5: visit
void visit(const scene::INodePtr& node) const {
BrushNodePtr brush = std::dynamic_pointer_cast<BrushNode>(node);
if (brush != NULL && node->visible()) {
brush->setClipPlane(_plane);
}
}
示例6: visit
void InfoFileExporter::visit(const scene::INodePtr& node)
{
// Don't export the layer settings for models and particles, as they are not there
// at map load/parse time - these shouldn't even be passed in here
assert(node && !Node_isModel(node) && !particles::isParticleNode(node));
// Open a Node block
_stream << "\t\t" << InfoFile::NODE << " { ";
scene::LayerList layers = node->getLayers();
// Write a space-separated list of node IDs
for (scene::LayerList::const_iterator i = layers.begin(); i != layers.end(); ++i)
{
_stream << *i << " ";
}
// Close the Node block
_stream << "}";
// Write additional node info, for easier debugging of layer issues
_stream << " // " << getNodeInfo(node);
_stream << std::endl;
_layerInfoCount++;
}
示例7: pre
virtual bool pre(const scene::INodePtr& node)
{
NamespacedPtr namespaced = Node_getNamespaced(node);
if (!namespaced)
{
return true;
}
INamespace* foreignNamespace = namespaced->getNamespace();
// Do not reconnect to same namespace, this causes invalid name changes
if (foreignNamespace == _nspace)
{
rWarning() << "ConnectNamespacedWalker: node '" << node->name()
<< "' is already attached to namespace at " << _nspace
<< std::endl;
return true;
}
else if (foreignNamespace)
{
// The node is already connected to a different namespace, disconnect
namespaced->disconnectNameObservers();
namespaced->detachNames();
namespaced->setNamespace(NULL);
}
// Set the namespace reference and add all "names"
namespaced->setNamespace(_nspace);
namespaced->attachNames();
return true;
}
示例8: ensureNoConflicts
void Namespace::ensureNoConflicts(const scene::INodePtr& root)
{
// Instantiate a new, temporary namespace for the nodes below root
Namespace foreignNamespace;
// Move all nodes below (and including) root into this temporary namespace
foreignNamespace.connect(root);
// Collect all namespaced items from the foreign root
GatherNamespacedWalker walker;
root->traverse(walker);
rDebug() << "Namespace::ensureNoConflicts(): imported set of "
<< walker.result.size() << " namespaced nodes" << std::endl;
// Build a union set containing all imported names and all existing names.
// We need to know all existing names to ensure that newly created names are
// unique in *both* namespaces
UniqueNameSet allNames = _uniqueNames;
allNames.merge(foreignNamespace._uniqueNames);
// Process each object in the to-be-imported tree of nodes, ensuring that it
// has a unique name
for (const NamespacedPtr& n : walker.result)
{
// If the imported node conflicts with a name in THIS namespace, then it
// needs to be given a new name which is unique in BOTH namespaces.
if (_uniqueNames.nameExists(n->getName()))
{
// Name exists in the target namespace, get a new name
std::string uniqueName = allNames.insertUnique(n->getName());
rMessage() << "Namespace::ensureNoConflicts(): '" << n->getName()
<< "' already exists in this namespace. Rename it to '"
<< uniqueName << "'\n";
// Change the name of the imported node, this should trigger all
// observers in the foreign namespace
n->changeName(uniqueName);
}
else
{
// Name does not exist yet, insert it into the local combined
// namespace (but not our destination namespace, this will be
// populated in the subsequent call to connect()).
allNames.insert(n->getName());
}
}
// at this point, all names in the foreign namespace have been converted to
// something unique in this namespace. The calling code can now move the
// nodes into this namespace without name conflicts
// Disconnect the root from the foreign namespace again, it will be destroyed now
foreignNamespace.disconnect(root);
}
示例9: pre
bool pre(const scene::INodePtr& node) {
SelectablePtr selectable = Node_getSelectable(node);
// If a visible selectable was found and the path depth is appropriate, add it
if (selectable != NULL && node->visible()) {
_targetList.push_back(node);
}
return true;
}
示例10: post
void post(const scene::INodePtr& node)
{
if (node->isRoot())
{
return;
}
if (Node_isSelected(node))
{
// Clone the current node
scene::INodePtr clone = map::Node_Clone(node);
// Add the cloned node and its parent to the list
_cloned.insert(Map::value_type(clone, node->getParent()));
// Insert this node in the root
_cloneRoot->addChildNode(clone);
}
}
示例11: visit
void PlaneSelectableSelectPlanes::visit(const scene::INodePtr& node) const {
// Skip hidden nodes
if (!node->visible()) {
return;
}
PlaneSelectablePtr planeSelectable = Node_getPlaneSelectable(node);
if (planeSelectable != NULL) {
planeSelectable->selectPlanes(_selector, _test, _selectedPlaneCallback);
}
}
示例12: addPrimitiveToEntity
bool addPrimitiveToEntity(const scene::INodePtr& primitive, const scene::INodePtr& entity)
{
if (Node_getEntity(entity)->isContainer())
{
entity->addChildNode(primitive);
return true;
}
else
{
return false;
}
}
示例13: visit
void visit(const scene::INodePtr& node) const {
ASSERT_MESSAGE(_count <= _max, "Invalid _count in CollectSelectedBrushesBounds");
// stop if the array is already full
if (_count == _max) {
return;
}
if (Node_isSelected(node) && Node_isBrush(node)) {
_bounds[_count] = node->worldAABB();
++_count;
}
}
示例14: post
void post(const scene::INodePtr& node)
{
// greebo: We've traversed this subtree, now check if we had selected children
if (!node->isRoot() &&
!_stack.empty() && _stack.top() == false &&
!Node_isSelected(node))
{
// No selected child nodes, hide this node
hideSubgraph(node, _hide);
}
// Go upwards again, one level
_stack.pop();
}
示例15: pre
bool pre(const scene::INodePtr& node) {
if (!node->visible()) return false; // don't traverse hidden nodes
if (Node_isBrush(node)) // this node is a floor
{
const AABB& aabb = node->worldAABB();
float floorHeight = aabb.origin.z() + aabb.extents.z();
if (floorHeight > _current && floorHeight < _bestUp) {
_bestUp = floorHeight;
}
if (floorHeight < _current && floorHeight > _bestDown) {
_bestDown = floorHeight;
}
return false;
}
return true;
}