Пример #1
0
	void MActorRes::LoadImp(DataStreamPtr stream)
	{
		mActor = EMotionFX::IMPORTER.LoadActor((unsigned char*)stream->GetData(), stream->Size(), mSourceName.c_str());

		if (mActor)
		{
			_init();
		}
	}
Пример #2
0
	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();
	}
Пример #3
0
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);
}