本文整理汇总了C++中RendererPtr::readFrom2方法的典型用法代码示例。如果您正苦于以下问题:C++ RendererPtr::readFrom2方法的具体用法?C++ RendererPtr::readFrom2怎么用?C++ RendererPtr::readFrom2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RendererPtr
的用法示例。
在下文中一共展示了RendererPtr::readFrom2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: style_ctxt
qlib::LScrSp<qlib::LScrObjBase> SceneXMLReader::fromByteArray(const qlib::LScrSp<qlib::LByteArray> &pbuf)
{
qlib::uid_t nSceneID = m_pClient->getUID();
// Enter the context
AutoStyleCtxt style_ctxt(nSceneID);
MB_DPRINTLN("fromXML\n%s<<<", pbuf->data());
MB_DPRINTLN("Length: %d", pbuf->size());
//
// Setup streams
//
qlib::StrInStream fis(pbuf);
qlib::LDom2InStream ois(fis);
qlib::LDom2Tree tree;
ois.read(tree);
qlib::LDom2Node *pNode = tree.top();
//pNode->dump();
qlib::LScrSp<qlib::LScrObjBase> pSObj;
LString tag = pNode->getTagName();
LString type_name = pNode->getTypeName();
if (tag.equals("renderer") && !type_name.isEmpty()) {
// pbuf contains Renderer
RendererFactory *pRF = RendererFactory::getInstance();
RendererPtr pRend = pRF->create(type_name);
pRend->resetAllProps();
pRend->readFrom2(pNode);
pSObj = pRend;
}
else if (tag.equals("object") && !type_name.isEmpty()) {
ObjectPtr pObj = pNode->createObjByTypeNameT<Object>();
pObj->readFrom2(pNode);
LString src = pObj->getSource();
LString altsrc = pObj->getAltSource();
LString srctype = pObj->getSourceType();
pNode->requestDataLoad(src, altsrc, srctype, pObj.get());
pSObj = pObj;
// clearChunkMap();
procDataSrcLoad(ois, pNode);
procDataChunks(ois, pNode);
// clearChunkMap();
}
else if (tag.equals("camera")) {
// pbuf contains Camera
CameraPtr pCam(MB_NEW Camera);
pCam->readFrom2(pNode);
pSObj = pCam;
}
else {
MB_DPRINTLN("readRendFromXML> ERROR, Invalid QSC XML");
return pSObj;
}
return pSObj;
}