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); }