diff options
author | eray orçunus <erayorcunus@gmail.com> | 2020-04-26 12:25:03 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2020-04-26 12:29:50 +0200 |
commit | 6c1a1f7cd20a2674f33b5318e6e07a3a28d016f6 (patch) | |
tree | 7a01b47b48a106ca6ff9154cc5c14d3baf54c22f /src/rw/TxdStore.cpp | |
parent | update librw (diff) | |
download | re3-6c1a1f7cd20a2674f33b5318e6e07a3a28d016f6.tar re3-6c1a1f7cd20a2674f33b5318e6e07a3a28d016f6.tar.gz re3-6c1a1f7cd20a2674f33b5318e6e07a3a28d016f6.tar.bz2 re3-6c1a1f7cd20a2674f33b5318e6e07a3a28d016f6.tar.lz re3-6c1a1f7cd20a2674f33b5318e6e07a3a28d016f6.tar.xz re3-6c1a1f7cd20a2674f33b5318e6e07a3a28d016f6.tar.zst re3-6c1a1f7cd20a2674f33b5318e6e07a3a28d016f6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/rw/TxdStore.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/rw/TxdStore.cpp b/src/rw/TxdStore.cpp index 51d018f6..bb7386d5 100644 --- a/src/rw/TxdStore.cpp +++ b/src/rw/TxdStore.cpp @@ -127,6 +127,38 @@ CTxdStore::RemoveRefWithoutDelete(int slot) GetSlot(slot)->refCount--; } +#ifdef RW_GL3 +rw::Raster* +convertTexRaster(rw::Raster* ras) +{ + rw::Image* img = ras->toImage(); +// ras->destroy(); + img->unindex(); + ras = rw::Raster::createFromImage(img); + img->destroy(); + return ras; +} + +void +convertTxd(rw::TexDictionary* txd) +{ + rw::Texture* tex; + FORLIST(lnk, txd->textures) { + tex = rw::Texture::fromDict(lnk); + rw::Raster* ras = tex->raster; + if (ras && ras->platform != rw::platform) { + if (!(ras->platform == rw::PLATFORM_D3D8 && rw::platform == rw::PLATFORM_D3D9 || + ras->platform == rw::PLATFORM_D3D9 && rw::platform == rw::PLATFORM_D3D8)) { + tex->raster = convertTexRaster(ras); + ras->destroy(); + } + } + tex->setFilter(rw::Texture::LINEAR); + } + +} +#endif + bool CTxdStore::LoadTxd(int slot, RwStream *stream) { @@ -134,6 +166,9 @@ CTxdStore::LoadTxd(int slot, RwStream *stream) if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){ def->texDict = RwTexDictionaryGtaStreamRead(stream); +#ifdef RW_GL3 + convertTxd(def->texDict); +#endif return def->texDict != nil; } printf("Failed to load TXD\n"); |