//
	// 加载XML
	//
	VOID CGfxBillboard::LoadXML(TiXmlNode *pGfxNode)
	{
		ASSERT(pGfxNode);

		if (TiXmlNode *pOffsetNode = pGfxNode->FirstChild("Offset")) {
			SetOffset(pOffsetNode->ToElement()->AttributeFloat("value"));
		}

		if (TiXmlNode *pDirectionNode = pGfxNode->FirstChild("Direction")) {
			SetDirectionType((DIRECTION_TYPE)pDirectionNode->ToElement()->AttributeInt("value"));
		}

		CGfxBase::LoadXML(pGfxNode);
	}
示例#2
0
bool psEffectAnchor::Load(iDocumentNode *node)
{
    name = node->GetAttributeValue("name");
    
    csRef<iDocumentNode> dataNode;
    
    // direction
    dataNode = node->GetNode("dir");
    dir = DT_NONE;
    if (dataNode)
    {
        SetDirectionType(dataNode->GetContentsValue());
    }
    
    // KEYFRAMES
    csRef<iDocumentNodeIterator> xmlbinds;
    xmlbinds = node->GetNodes("keyFrame");
    csRef<iDocumentNode> keyNode;

    animLength = 0;
    psEffectAnchorKeyFrame * prevKeyFrame = 0;
    while (xmlbinds->HasNext())
    {
        keyNode = xmlbinds->Next();
        psEffectAnchorKeyFrame * keyFrame = new psEffectAnchorKeyFrame(keyNode, prevKeyFrame);
        if (keyFrame->time > animLength)
            animLength = keyFrame->time;
        prevKeyFrame = keyFrame;
        keyFrames->Push(keyFrame);
    }
    animLength += 10;
    // TODO: sort keyframes by time here

    // linearly interpolate values where an action wasn't specified
    FillInLerps();

    return true;
}