当前位置: 首页>>代码示例>>C++>>正文


C++ NodePath类代码示例

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


在下文中一共展示了NodePath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CenterCameraOn

void SceneCamera::CenterCameraOn(NodePath np)
{
  if (_useTrackball)
    _window->center_trackball(np);
  else
  {
    _centeringCamera   = true;
    _objectivePos      = np.get_pos(_window->get_render());
    _objectivePos.set_z(_objectivePos.get_z() + _camera_height);

    LPoint3f cameraRot = _camera.get_hpr();
    float    rad2deg   = 3.1415926535897 / 180;

    cameraRot.set_x(cameraRot.get_x() * rad2deg);
    cameraRot.set_y(cameraRot.get_y() * rad2deg);
    cameraRot.set_z(cameraRot.get_z() * rad2deg);

    _objectivePos.set_x(np.get_x() + sin(cameraRot.get_x()) * 100);
    _objectivePos.set_y(np.get_y() + tan(cameraRot.get_y()) * 100);

    if (_currentCameraAngle == 1)
      _objectivePos.set_y(_objectivePos.get_y() + 80 + (140 - _camera_height) / 1.35);
    else
    {
      _objectivePos.set_x(_objectivePos.get_x() + 25 - (_camera_height - 50) * 0.85);
      _objectivePos.set_y(_objectivePos.get_y() + 40 - (_camera_height - 50) * 1);
    }
  }
}
开发者ID:655473,项目名称:fallout-equestria,代码行数:29,代码来源:scene_camera.cpp

示例2: setNodePath

void ObserverNodePath::setNodePathTo(osg::Node* node)
{
    if (node)
    {
        NodePathList nodePathList = node->getParentalNodePaths();
        if (nodePathList.empty())
        {
            NodePath nodePath;
            nodePath.push_back(node);
            setNodePath(nodePath);
        }
        else
        {
            if (nodePathList[0].empty())
            {
                nodePathList[0].push_back(node);
            }
            setNodePath(nodePathList[0]);
        }
    }
    else
    {
        clearNodePath();
    }
}
开发者ID:Kurdakov,项目名称:emscripten_OSG,代码行数:25,代码来源:ObserverNodePath.cpp

示例3: Leveling

void WaypointGenerator::Leveling(void)
{
  float          step           = 0;
  float          steps          = object->waypoints.size();

  for (unsigned int it = 0 ; it < object->waypoints.size() ; ++it)
  {
    unsigned int attempts = 0;
    Waypoint*    wp       = object->waypoints[it];
    NodePath     np       = wp->nodePath;

    while (LevelWaypoint(wp) == false && attempts < 3)
    {
      if (attempts % 2)
        np.set_x(np.get_x() + 0.01);
      else
        np.set_y(np.get_y() + 0.01);
      ++attempts;
    }
    if (attempts == 3)
    {
      it--;
      world->DeleteWayPoint(wp);
    }
    UpdateProgress("Waypoint Leveling (4/4): %p%", ++step / steps * 100);
  }
}
开发者ID:655473,项目名称:fallout-equestria,代码行数:27,代码来源:dialogwaypointgenerate.cpp

示例4: _add_pinned_point

void SoftBody::_add_pinned_point(int p_point_index, const NodePath &p_spatial_attachment_path) {
	SoftBody::PinnedPoint *pinned_point;
	if (-1 == _get_pinned_point(p_point_index, pinned_point)) {

		// Create new
		PinnedPoint pp;
		pp.point_index = p_point_index;
		pp.spatial_attachment_path = p_spatial_attachment_path;

		if (!p_spatial_attachment_path.is_empty() && has_node(p_spatial_attachment_path)) {
			pp.spatial_attachment = Object::cast_to<Spatial>(get_node(p_spatial_attachment_path));
			pp.offset = (pp.spatial_attachment->get_global_transform().affine_inverse() * get_global_transform()).xform(PhysicsServer::get_singleton()->soft_body_get_point_global_position(physics_rid, pp.point_index));
		}

		pinned_points.push_back(pp);

	} else {

		pinned_point->point_index = p_point_index;
		pinned_point->spatial_attachment_path = p_spatial_attachment_path;

		if (!p_spatial_attachment_path.is_empty() && has_node(p_spatial_attachment_path)) {
			pinned_point->spatial_attachment = Object::cast_to<Spatial>(get_node(p_spatial_attachment_path));
			pinned_point->offset = (pinned_point->spatial_attachment->get_global_transform().affine_inverse() * get_global_transform()).xform(PhysicsServer::get_singleton()->soft_body_get_point_global_position(physics_rid, pinned_point->point_index));
		}
	}
}
开发者ID:KellyThomas,项目名称:godot,代码行数:27,代码来源:soft_body.cpp

示例5: accumulate

        void accumulate(const NodePath& nodePath)
        {
            if (nodePath.empty()) return;
 
            unsigned int i = 0;
            if (_ignoreCameras)
            {
                // we need to found out the last absolute Camera in NodePath and
                // set the i index to after it so the final accumulation set ignores it.
                i = nodePath.size();
                NodePath::const_reverse_iterator ritr;
                for(ritr = nodePath.rbegin();
                    ritr != nodePath.rend();
                    ++ritr, --i)
                {
                    const osg::Camera* camera = dynamic_cast<const osg::Camera*>(*ritr);
                    if (camera && 
                        (camera->getReferenceFrame()!=osg::Transform::RELATIVE_RF || camera->getParents().empty()))
                    {
                        break;
                    }
                }
            }            

            // do the accumulation of the active part of nodepath.        
            for(;
                i<nodePath.size();
                ++i)
            {
                const_cast<Node*>(nodePath[i])->accept(*this);
            }
        }
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:32,代码来源:Transform.cpp

示例6: getNodePath

NodePath SceneGraphManipulator::getNodePath() const
{
    NodePath nodePath;
    ObserveredNodePath::const_iterator itr = _trackNodePath.begin();
    for(; itr != _trackNodePath.end(); ++itr)
        nodePath.push_back(const_cast<Node*>(itr->get()));
    return nodePath;
}
开发者ID:ConfusedReality,项目名称:pkg_augmented-reality_polAR,代码行数:8,代码来源:SceneGraphManipulator.cpp

示例7: set_view_billboard

// Disables freelook and places the camera in a good position to
// demonstrate the billboard effect
void World::set_view_billboard(const Event* event)
   {
   // Note: detach the trackball from the mouse to disable it
   m_trackball.detach_node();
   const NodePath& render = m_windowFramework->get_render();
   NodePath camera = m_windowFramework->get_camera_group();
   camera.reparent_to(render);
   camera.set_pos_hpr(-7, 7, 0, -90, 0, 0);
   }
开发者ID:drivird,项目名称:drunken-octo-robot,代码行数:11,代码来源:world.cpp

示例8: set_view_main

// Enables freelook
void World::set_view_main(const Event* event)
   {
   const NodePath& render = m_windowFramework->get_render();
   NodePath camera = m_windowFramework->get_camera_group();
   camera.reparent_to(render);
   // Note: reparent the trackball to the mouse to enable it
   const NodePath& mouse = m_windowFramework->get_mouse();
   m_trackball.reparent_to(mouse);
   }
开发者ID:drivird,项目名称:drunken-octo-robot,代码行数:10,代码来源:world.cpp

示例9: GetApplication

OpState	OpBreakAtPoints::GetState(String_256* UIDescription, OpDescriptor*)
{

	OpState OpSt;
	String_256 DisableReason; 

   	OpSt.Greyed = FALSE;
	BOOL FoundSelected = FALSE;

	// Go through the selection until we find a selected point

	SelRange* Selected = GetApplication()->FindSelection();
	Node* pNode = Selected->FindFirst();

	while (pNode)
	{
		if (IS_A(pNode,NodePath) || IS_A(pNode,NodeBlendPath))
		{
			NodePath* pNodePath = (NodePath*)pNode;
			INT32 NumSplinters = pNodePath->InkPath.NumSplinters();

			if (NumSplinters > 0)
			{
				// We need to ask the effected nodes if they (and their parents) can handle this node being replaced
				ObjChangeFlags cFlags;

				if (NumSplinters > 1)
					cFlags.MultiReplaceNode = TRUE;	// Node will be replaced with more than one node.
				else
					cFlags.ReplaceNode = TRUE;		// Node will be replaced with one node only.

				String_32 optokenstring(OPTOKEN_BREAKATPOINTS);
				ObjChangeParamWithToken ObjChange(OBJCHANGE_STARTING,cFlags,pNodePath,NULL,&optokenstring);

				// Will the node allow this op to happen?
				if (pNodePath->AllowOp(&ObjChange,FALSE))
				{
					FoundSelected = TRUE;
					break;
				}
			}
		}
		pNode = Selected->FindNext(pNode);
	}

	// The operation is disabled if there are no complex paths selected

	if (!FoundSelected)
	{
		OpSt.Greyed = TRUE;
		DisableReason = String_256(_R(IDS_NEEDS_SELECTED_POINT));
		*UIDescription = DisableReason;
	}
	
	return(OpSt);   
}
开发者ID:vata,项目名称:xarino,代码行数:56,代码来源:opbreak.cpp

示例10: getPath

	void Pathfinder::getPath(AStarNode *node, NodePath &path)
	{
		while(node != NULL)
		{
			path.push_back(node->position);
			node = node->parent;
		}

		reverse(path.begin(), path.end());
	}
开发者ID:astrellon,项目名称:GPP,代码行数:10,代码来源:pathfinder.cpp

示例11: NodePathFullName

std::string NodePathFullName(NodePath nodepath, NodePath root)
{
  NodePath    cur  = nodepath.get_parent();
  std::string name = nodepath.get_name();

  while (cur != root)
  {
    name = cur.get_name() + '/' + name;
    cur = cur.get_parent();
  }
  return (name);
}
开发者ID:655473,项目名称:fallout-equestria,代码行数:12,代码来源:mouse.cpp

示例12: FlattenObjects

void WorldFlattener::FlattenObjects(MapObject* first, MapObject* second)
{
  NodePath target            = first->render;
  LPoint3f relative_position = second->nodePath.get_pos(target);
  LPoint3f relative_hpr      = second->nodePath.get_hpr(target);

  second->render.reparent_to(target);
  second->render.set_pos(relative_position);
  second->render.set_hpr(relative_hpr);
  target.clear_model_nodes();
  target.flatten_strong();
  second->render = target;
}
开发者ID:655473,项目名称:fallout-equestria,代码行数:13,代码来源:world_flatten.cpp

示例13: save_path

void Dijkstra::save_path(Node* start, Node* dest) {
	NodePath* path = new NodePath;
	Node* current_node = dest;
	if (current_node->get_cost_from_start() == max_cost) {
		saved_paths[NodePair(start, dest)] = path;
		return;
	}
	while (start != current_node) {
		path->push_back(current_node);
		current_node = current_node->get_parent();
	}
	saved_paths[NodePair(start, dest)] = path;
}
开发者ID:trew,项目名称:TDP005,代码行数:13,代码来源:Dijkstra.cpp

示例14: nassertv

/**
 * @brief Constructs a new TagStateManager
 * @details This constructs a new TagStateManager. The #main_cam_node should
 *   refer to the main scene camera, and will most likely be base.cam.
 *   It is necessary to pass the camera because the C++ code does not have
 *   access to the showbase.
 *
 * @param main_cam_node The main scene camera
 */
TagStateManager::TagStateManager(NodePath main_cam_node) {
    nassertv(!main_cam_node.is_empty());
    nassertv(DCAST(Camera, main_cam_node.node()) != NULL);
    _main_cam_node = main_cam_node;

    // Set default camera mask
    DCAST(Camera, _main_cam_node.node())->set_camera_mask(BitMask32::bit(1));

    // Init containers
    _containers["shadow"]   = StateContainer("Shadows",  2, false);
    _containers["voxelize"] = StateContainer("Voxelize", 3, false);
    _containers["envmap"]   = StateContainer("Envmap",   4, true);
    _containers["forward"]  = StateContainer("Forward",  5, true);
}
开发者ID:croxis,项目名称:SpaceDrive,代码行数:23,代码来源:tag_state_manager.cpp

示例15: apply_state

/**
 * @brief Applies a given state to a NodePath
 * @details This applies a shader to the given NodePath which is used when the
 *   NodePath is rendered by any registered camera of the container.
 *
 * @param container The container which is used to store the state
 * @param np The nodepath to apply the shader to
 * @param shader A handle to the shader to apply
 * @param name Name of the state, should be a unique identifier
 * @param sort Changes the sort with which the shader will be applied.
 */
void TagStateManager::apply_state(StateContainer& container, NodePath np, Shader* shader,
                                  const string &name, int sort) {
    if (tagstatemgr_cat.is_spam()) {
        tagstatemgr_cat.spam() << "Constructing new state " << name
                               << " with shader " << shader << endl;
    }

    // Construct the render state
    CPT(RenderState) state = RenderState::make_empty();

    // Disable color write for all stages except the environment container
    if (!container.write_color) {
        state = state->set_attrib(ColorWriteAttrib::make(ColorWriteAttrib::C_off), 10000);
    }
    state = state->set_attrib(ShaderAttrib::make(shader, sort), sort);

    // Emit a warning if we override an existing state
    if (container.tag_states.count(name) != 0) {
        tagstatemgr_cat.warning() << "Overriding existing state " << name << endl;
    }

    // Store the state, this is required whenever we attach a new camera, so
    // it can also track the existing states
    container.tag_states[name] = state;

    // Save the tag on the node path
    np.set_tag(container.tag_name, name);

    // Apply the state on all cameras which are attached so far
    for (size_t i = 0; i < container.cameras.size(); ++i) {
        container.cameras[i]->set_tag_state(name, state);
    }
}
开发者ID:croxis,项目名称:SpaceDrive,代码行数:44,代码来源:tag_state_manager.cpp


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