• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ scene::INodePtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中scene::INodePtr的典型用法代码示例。如果您正苦于以下问题:C++ INodePtr类的具体用法?C++ INodePtr怎么用?C++ INodePtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了INodePtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
        }
    }
}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:25,代码来源:TransformationVisitors.cpp


示例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);
}
开发者ID:codereader,项目名称:DarkRadiant,代码行数:29,代码来源:ModelExporter.cpp


示例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;
	}
}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:25,代码来源:MapImporter.cpp


示例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));
	}
}
开发者ID:nbohr1more,项目名称:DarkRadiant,代码行数:25,代码来源:GraphTreeModel.cpp


示例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);
		}
	}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:7,代码来源:CSG.cpp


示例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++;
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:27,代码来源:InfoFileExporter.cpp


示例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;
    }
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:33,代码来源:Namespace.cpp


示例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);
}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:56,代码来源:Namespace.cpp


示例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;
		}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:10,代码来源:GroupCycle.cpp


示例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);
		}
	}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:19,代码来源:Transformation.cpp


示例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);
	}
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:11,代码来源:Planes.cpp


示例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;
     }
 }
开发者ID:Zbyl,项目名称:DarkRadiant,代码行数:12,代码来源:Map.cpp


示例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;
		}
	}
开发者ID:,项目名称:,代码行数:13,代码来源:


示例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();
	}
开发者ID:,项目名称:,代码行数:14,代码来源:


示例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;
    }
开发者ID:Zbyl,项目名称:DarkRadiant,代码行数:23,代码来源:CamWnd.cpp


示例16: pre

	bool pre(const scene::INodePtr& node) {
		if (node->visible()) {
			Brush* brush = Node_getBrush(node);

			if (brush != NULL && brush->hasShader(_name)) {
				Node_setSelected(node, true);
				return false; // don't traverse brushes
			}

			// not a suitable brush, traverse further
			return true;
		}
		else {
			return false; // don't traverse invisible nodes
		}
	}
开发者ID:,项目名称:,代码行数:16,代码来源:


示例17: pre

	bool pre(const scene::INodePtr& node)
	{
		// Don't clone root items
		if (node->isRoot())
		{
			return true;
		}

		if (Node_isSelected(node))
		{
			// Don't traverse children of cloned nodes
			return false;
		}

		return true;
	}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:16,代码来源:Transformation.cpp


示例18: processBrush

void ModelExporter::processBrush(const scene::INodePtr& node)
{
	IBrush* brush = Node_getIBrush(node);

	if (brush == nullptr) return;

	Matrix4 exportTransform = node->localToWorld().getPremultipliedBy(_centerTransform);

	for (std::size_t b = 0; b < brush->getNumFaces(); ++b)
	{
		const IFace& face = brush->getFace(b);

		const std::string& materialName = face.getShader();

		if (!isExportableMaterial(materialName)) continue;

		const IWinding& winding = face.getWinding();

		std::vector<model::ModelPolygon> polys;

		if (winding.size() < 3)
		{
			rWarning() << "Skipping face with less than 3 winding verts" << std::endl;
			continue;
		}

		// Create triangles for this winding 
		for (std::size_t i = 1; i < winding.size() - 1; ++i)
		{
			model::ModelPolygon poly;

			poly.a = convertWindingVertex(winding[i + 1]);
			poly.b = convertWindingVertex(winding[i]);
			poly.c = convertWindingVertex(winding[0]);

			polys.push_back(poly);
		}

		_exporter->addPolygons(materialName, polys, exportTransform);
	}
}
开发者ID:codereader,项目名称:DarkRadiant,代码行数:41,代码来源:ModelExporter.cpp


示例19: updateSelectionStatus

void GraphTreeModel::updateSelectionStatus(const Glib::RefPtr<Gtk::TreeSelection>& selection, const scene::INodePtr& node)
{
	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)
	{
		if (Node_isSelected(node))
		{
			// Select the row in the TreeView
			selection->select(foundNode->getIter());

			// Scroll to the row
			Gtk::TreeView* tv = selection->get_tree_view();

			Gtk::TreeModel::Path selectedPath(foundNode->getIter());

			tv->expand_to_path(selectedPath);
			tv->scroll_to_row(selectedPath, 0.3f);
		}
		else
		{
			selection->unselect(foundNode->getIter());
		}
	}
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:40,代码来源:GraphTreeModel.cpp


示例20: processPatch

void ModelExporter::processPatch(const scene::INodePtr& node)
{
	IPatch* patch = Node_getIPatch(node);

	if (patch == nullptr) return;

	const std::string& materialName = patch->getShader();

	if (!isExportableMaterial(materialName)) return;

	PatchMesh mesh = patch->getTesselatedPatchMesh();

	std::vector<model::ModelPolygon> polys;

	for (std::size_t h = 0; h < mesh.height - 1; ++h)
	{
		for (std::size_t w = 0; w < mesh.width - 1; ++w)
		{
			model::ModelPolygon poly;

			poly.a = convertPatchVertex(mesh.vertices[w + (h*mesh.width)]);
			poly.b = convertPatchVertex(mesh.vertices[w + 1 + (h*mesh.width)]);
			poly.c = convertPatchVertex(mesh.vertices[w + mesh.width + (h*mesh.width)]);

			polys.push_back(poly);
				
			poly.a = convertPatchVertex(mesh.vertices[w + 1 + (h*mesh.width)]);
			poly.b = convertPatchVertex(mesh.vertices[w + 1 + mesh.width + (h*mesh.width)]);
			poly.c = convertPatchVertex(mesh.vertices[w + mesh.width + (h*mesh.width)]);

			polys.push_back(poly);
		}
	}

	Matrix4 exportTransform = node->localToWorld().getPremultipliedBy(_centerTransform);

	_exporter->addPolygons(materialName, polys, exportTransform);
}
开发者ID:codereader,项目名称:DarkRadiant,代码行数:38,代码来源:ModelExporter.cpp



注:本文中的scene::INodePtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ scene::Path类代码示例发布时间:2022-05-31
下一篇:
C++ scene::IMeshSceneNode类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap