void MActorRes::LoadImp(DataStreamPtr stream) { mActor = EMotionFX::IMPORTER.LoadActor((unsigned char*)stream->GetData(), stream->Size(), mSourceName.c_str()); if (mActor) { _init(); } }
void __copyTex(const TString128 & ofile, const TString128 & ifile) { DataStreamPtr file = ResourceManager::Instance()->OpenResource(ifile.c_str(), true); File fp; fp.Open(ofile.c_str(), OM_WRITE_BINARY); fp.Write(file->GetData(), file->Size()); fp.Close(); }
ImagePtr D3D9VideoBufferManager::LoadImage_(const TString128 & source, IMAGE_FILTER filter) { DataStreamPtr stream = ResourceManager::Instance()->OpenResource(source.c_str()); if (stream == NULL) { LOG_PRINT_FORMAT("image '%s' can't find\n", source.c_str()); return NULL; } D3DXIMAGE_INFO ImgInfo; IDirect3DTexture9 * texture; HRESULT hr = D3DXCreateTextureFromFileInMemoryEx(mD3D9Device, stream->GetData(), stream->Size(), D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_UNKNOWN, D3DPOOL_SCRATCH, D3D9Mapping::GetD3DXFilter(filter), D3DX_DEFAULT, 0, &ImgInfo, NULL, &texture); D3DErrorExceptionFunction(D3DXCreateTextureFromInMemoryEx, hr); D3DSURFACE_DESC desc; texture->GetLevelDesc(0, &desc); D3D9Image * image = new D3D9Image(); image->mWidth = desc.Width; image->mHeight = desc.Height; image->mSrcWidth = ImgInfo.Width; image->mSrcHeight = ImgInfo.Height; image->mFormat = D3D9Mapping::GetFormat(desc.Format); image->mMipmapLevel = texture->GetLevelCount(); image->mD3D9Texture = texture; return ImagePtr(image); }
void MGUI_Font::LoadFromXml(const char * source) { DataStreamPtr stream = ResourceManager::Instance()->OpenResource(source); if (stream.IsNull()) return; xml_doc doc; XmlHelper::LoadXmlFromMem(doc, (char *)stream->GetData()); xml_node * root = doc.first_node("Font"); xml_node * node = root->first_node("FontSource"); d_assert (node != NULL); mFontSource = node->first_attribute("value")->value(); node = root->first_node("Resolution"); if (node) mResolution = atoi(node->first_attribute("value")->value()); node = root->first_node("CharSize"); if (node) mCharSize = atoi(node->first_attribute("value")->value()); node = root->first_node("CharRange"); while (node) { MGUI_Char low_ch = (MGUI_Char)atoi(node->first_attribute("low")->value()); MGUI_Char high_ch = (MGUI_Char)atoi(node->first_attribute("high")->value()); MGUI_CharRange cr = { low_ch, high_ch }; mCharRanges.PushBack(cr); node = node->next_sibling("CharRange"); } }
void GmDataManager::_loadNpcInfo() { DataStreamPtr stream = ResourceManager::Instance()->OpenResource("NpcInfo.ini"); d_assert (stream != NULL); xml_doc doc; doc.parse<0>((char *)stream->GetData()); xml_node * root = doc.first_node("npcs"); xml_node * node = root->first_node("npc"); while (node) { GmNpcInfo info; xml_attri * nd_id = node->first_attribute("id"); xml_attri * nd_name = node->first_attribute("name"); info.id = atoi(nd_id->value()); info.name = nd_name->value(); xml_node * nd_part = node->first_node("part"); _loadNpcPart(info, nd_part); xml_node * nd_anim = node->first_node("animation"); _loadNpcAnim(info, nd_anim); mNpcInfos.PushBack(info); node = node->next_sibling(); } }