Ejemplo n.º 1
0
void Grapple::TryRemoveNodes()
{
  std::list<rope_node_t>::reverse_iterator nodeit;

  int lg;
  Point2d V;
  Point2i handPos, contact_point;
  Double angle;

  ActiveCharacter().GetHandPosition(handPos);

  while (rope_nodes.size() > 1) {

    nodeit = rope_nodes.rbegin();
    ++nodeit;

    V.x = handPos.x - nodeit->pos.x;
    V.y = handPos.y - nodeit->pos.y;
    angle = V.ComputeAngle();
    lg = static_cast<int>(V.Norm());

    if (find_first_contact_point(nodeit->pos, angle, lg, SKIP_DST, contact_point))
      break;

    DetachNode();
  }
}
Ejemplo n.º 2
0
void
CNode::AttachToNode(CNode *pnewparent)	//adds at top of list - this will be the first
{
    if ( pnewparent ) // not NULL
    {
        /*
         *	For safety: if this node is already attached then detach
         */
        if ( _pparent ) DetachNode();

        _pparent = pnewparent;

        if (_pparent->_pchild)
        {   CNode *p0 = _pparent->_pchild;
            CNode *p1 = _pparent->_pchild->_pprev;
            CNode *p2 = this;
            CNode *p3 = _pprev;
            p0->_pprev = p3;
            p3->_pnext = p0;
            p1->_pnext = p2;
            p2->_pprev = p1;
        }
        else
        {
            _pparent->_pchild = this;		//	Make first child
        }
    }
}
Ejemplo n.º 3
0
// virtual
EC_OgreMovableTextOverlay::~EC_OgreMovableTextOverlay()
{
    if (renderer_.expired())
        return;

    if (overlay_)
    {
        overlay_->hide();
        container_->removeChild(overlayName_);
        overlay_->remove2D(container_);

        Ogre::OverlayManager *overlayManager = Ogre::OverlayManager::getSingletonPtr();
        overlayManager->destroyOverlayElement(text_element_);
        overlayManager->destroyOverlayElement(container_);
        overlayManager->destroy(overlay_);
    }

    if (node_)
    {
        DetachNode();
        Ogre::SceneManager *scene_mgr = renderer_.lock()->GetSceneManager();
        scene_mgr->destroySceneNode(node_);
        node_ = 0;
    }
}
Ejemplo n.º 4
0
bool wxListBase::DeleteNode(wxNodeBase *node)
{
    if ( !DetachNode(node) )
        return false;

    DoDeleteNode(node);

    return true;
}
Ejemplo n.º 5
0
void
CNode::MoveToBack( void )
{
    if ( !_pparent ) return;

    /*
     *      First we take this node out of the list
     */
    CNode *parent = _pparent;
    DetachNode();

    /*
     *      Now we append the node.
     */
    parent->AppendChildNode( this );
}
Ejemplo n.º 6
0
void
CNode::MoveToFront( void )
{
    if ( !_pparent ) return;

    /*
     *      First we take this node out of the list
     */
    CNode *parent = _pparent;
    DetachNode();

    /*
     *      Now we atach the node again as child thus first node in list
     */
    parent->AttachChildNode( this );
}
Ejemplo n.º 7
0
BOOL DestroyNode(ObjDescType nds)
{
	NodeType* pnode;

	pnode=GetObjPtr(nds, &Node_Carrier);
	if(!pnode) return FALSE;
	
	DetachNode(nds);

	if(pnode->pReqList) DestroyObjectList(pnode->pReqList);
	if(pnode->pItfList) DestroyObjectList(pnode->pItfList);
	if(pnode->pOpList) DestroyObjectList(pnode->pOpList);
	if(pnode->pRtList) DestroyObjectList(pnode->pRtList);
	if(pnode->pReqQueue) DestroyQueue(pnode->pReqQueue);
	
	free(pnode);
	
	return TRUE;
}
Ejemplo n.º 8
0
Placeable::~Placeable()
{
    if (world_.Expired())
    {
        if (sceneNode_)
            LogError("Placeable: World has expired, skipping uninitialization!");
        return;
    }

    if (sceneNode_)
    {
        // Emit signal now so that children can detach themselves back to scene root
        AboutToBeDestroyed.Emit();

        DetachNode();
        sceneNode_->Remove();
        sceneNode_.Reset();
    }
    else
        AboutToBeDestroyed.Emit();
}
Ejemplo n.º 9
0
void EC_OgreMovableTextOverlay::SetPlaceable(Foundation::ComponentPtr placeable)
{
    if (!node_)
        return;

    if (!placeable)
    {
        OgreRenderingModule::LogError("Null placeable for overlay");
        return;
    }

    EC_OgrePlaceable* placeableptr = dynamic_cast<EC_OgrePlaceable*>(placeable.get());
    if (!placeableptr)
    {
        OgreRenderingModule::LogError("Placeable is not" + EC_OgrePlaceable::NameStatic());
        return;
    }

    DetachNode();
    placeable_  = placeable;
    AttachNode();
}
Ejemplo n.º 10
0
	//--------------------------------------------------------------------------------------------------------------------------------------
	void Model::_UpDataJoint()
	{
		//计算子节点新位置
		for ( JointNode::iterator it = m_JointNodes.begin();
			it != m_JointNodes.end();
			)
		{
			if ( 0 == it->second->SonCount() )//没有子节点了,删除自己
			{
				DetachNode( it->second );
				SAFE_DELETE( it->second );
				JointNode::iterator temp = it++;
				m_JointNodes.erase( temp );
			}
			else//更新矩阵
			{
				Quaternionf real = m_JointVector[ it->second->m_JointIndex ].m_RealBind;
				Quaternionf dual = m_JointVector[ it->second->m_JointIndex ].m_DaulBind;

				const void* data;
				data = it->second->FatherAttribute( IAttributeNode::ATT_WORLDSCALE );
				it->second->m_Scale = NULL == data ? vector3f(1,1,1) :  *((const vector3f*)data);

				data = it->second->FatherAttribute( IAttributeNode::ATT_WORLDTRANSFORM );
				it->second->m_Transfrom = NULL == data ? Math::DualQuaternionToMatrix44( real, dual ) : Math::DualQuaternionToMatrix44( real, dual ) * *((const Matrix44f*)data);

				it->second->m_Position = vector3f( it->second->m_Transfrom.a41, it->second->m_Transfrom.a42, it->second->m_Transfrom.a43 );

				it->second->m_Rotation = it->second->m_Transfrom.ToQuaternion();

				it->second->m_RotationMatrix = Matrix33f( it->second->m_Transfrom );

				it->second->CastChangedMessage();//通知子节点
				it ++;
			}
		}
	}
Ejemplo n.º 11
0
CNode::~CNode()
{
    DetachNode();
}