From 82be9f01176704e26ccdcf9713ae57c4a6401677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=94=A1?= Date: Wed, 19 Nov 2025 13:43:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=90=89=E6=9E=97=E4=B8=80=E5=8F=B7=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA=EF=BC=8C=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E4=B8=BA=EF=BC=9Aosgviewer.exe=200-0-0.verse=5Ftms=20-O=20"Ort?= =?UTF-8?q?hophoto=3Dhttps://api.jl1mall.com/getMap/{z}/{x}/{y}=3Fmk%3d3dd?= =?UTF-8?q?ec00f5f435270285ffc7ad1a60ce5&tk%3da22c04e7a4725cc390b3489d95fd?= =?UTF-8?q?2d57=20UseEarth3D=3D1=20OriginBottomLeft=3D1=20UseWebMercator?= =?UTF-8?q?=3D1"=20=E5=8E=9F=E5=9B=A0=EF=BC=9A1)=20verse=5Ftms=E6=9C=AA?= =?UTF-8?q?=E9=A2=84=E5=85=88=E5=8A=A0=E8=BD=BDweb=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E8=B7=AF=E5=BE=84=E6=97=A0=E6=B3=95=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=EF=BC=9B2=EF=BC=89image/webp=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E5=83=8F=E6=97=A0=E6=B3=95=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=EF=BC=9B3=EF=BC=89webp=E6=A0=BC=E5=BC=8F=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E5=83=8F=E8=A7=A3=E6=9E=90=E5=90=8E=E5=87=BA=E7=8E=B0=E4=B8=8A?= =?UTF-8?q?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8?q?=E7=9A=84=E5=9D=90=E6=A0=87=E7=B3=BB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/osgdb_tms/ReaderWriterTMS.cpp | 1 + plugins/osgdb_web/ReaderWriterWeb.cpp | 4 +++- plugins/osgdb_webp/ReaderWriterWebP.cpp | 8 ++++++-- readerwriter/MimeTypes.cpp | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/osgdb_tms/ReaderWriterTMS.cpp b/plugins/osgdb_tms/ReaderWriterTMS.cpp index f9ba5be..810a23e 100644 --- a/plugins/osgdb_tms/ReaderWriterTMS.cpp +++ b/plugins/osgdb_tms/ReaderWriterTMS.cpp @@ -73,6 +73,7 @@ public: supportsOption("MaximumLevel", "Set maximum level (Z) to load: default 0 (infinite)"); supportsOption("TileSkirtRatio", "Create skirts for every tile: default 0.02"); supportsOption("TileElevationScale", "Set elevation scale for every tile: default 1.0"); + osgDB::Registry::instance()->getReaderWriterForExtension("verse_web"); } virtual const char* className() const diff --git a/plugins/osgdb_web/ReaderWriterWeb.cpp b/plugins/osgdb_web/ReaderWriterWeb.cpp index 83a264d..903c1ca 100644 --- a/plugins/osgdb_web/ReaderWriterWeb.cpp +++ b/plugins/osgdb_web/ReaderWriterWeb.cpp @@ -54,7 +54,9 @@ public: supportsExtension("verse_web", "Pseudo file extension, used to select libhv plugin."); supportsExtension("*", "Passes all read files to other plugins to handle actual model loading."); supportsOption("Extension", "Set another pseudo extension for loaded file"); - supportsOption("RequestHeaders", "Set request header list (key1;value1;key2;value2;...) as a string"); + supportsOption("RequestHeaders", "Set request header list (key1;value1;key2;value2;...) as a string"); + + osgDB::Registry::instance()->addFileExtensionAlias("webp","verse_webp"); } virtual ~ReaderWriterWeb() diff --git a/plugins/osgdb_webp/ReaderWriterWebP.cpp b/plugins/osgdb_webp/ReaderWriterWebP.cpp index 1164f1d..e249573 100644 --- a/plugins/osgdb_webp/ReaderWriterWebP.cpp +++ b/plugins/osgdb_webp/ReaderWriterWebP.cpp @@ -48,7 +48,9 @@ public: image->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE); image->setInternalTextureFormat(GL_RGBA8); memcpy(image->data(), rgba, image->getTotalSizeInBytes()); - WebPFree(rgba); return image.get(); + WebPFree(rgba); + image->flipVertical(); + return image.get(); } virtual WriteResult writeImage(const osg::Image& image, const std::string& path, @@ -57,7 +59,9 @@ public: std::string ext; std::string fileName = getRealFileName(path, ext); std::ofstream out(fileName, std::ios::out | std::ios::binary); if (!out) return WriteResult::ERROR_IN_WRITING_FILE; - return writeImage(image, out, options); + osg::ref_ptr tmp_img = new osg::Image(image); + tmp_img->flipVertical(); + return writeImage(*tmp_img, out, options); } virtual WriteResult writeImage(const osg::Image& image, std::ostream& out, diff --git a/readerwriter/MimeTypes.cpp b/readerwriter/MimeTypes.cpp index 0a65370..107d01b 100644 --- a/readerwriter/MimeTypes.cpp +++ b/readerwriter/MimeTypes.cpp @@ -41,6 +41,7 @@ const char* osgv_builtinMimeTypeExtMappings[] = "image/pjpeg","jpg", "image/png","png", "image/tiff","tif", + "image/webp","webp", "image/vasa","mcf", "image/vnd.dwg","dxf", "image/vnd.fpx","fpx", -- Gitee