diff options
author | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-20 06:05:23 +0000 |
---|---|---|
committer | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-20 06:05:23 +0000 |
commit | e08b2652afb31bad466bc69d1f1aa3b80298361f (patch) | |
tree | 305527e71cd5d41394aab78e3607c9e8c31e7451 /o3d/core | |
parent | b2d346da57198822ddf59563a7c100eb6f6bc5a2 (diff) | |
download | chromium_src-e08b2652afb31bad466bc69d1f1aa3b80298361f.zip chromium_src-e08b2652afb31bad466bc69d1f1aa3b80298361f.tar.gz chromium_src-e08b2652afb31bad466bc69d1f1aa3b80298361f.tar.bz2 |
Added --convert-dds-to-png command line option to the COLLADA converter,
which causes all DDS textures to be outputted as PNGs. This required
changes to the serialization code to reconstitute cube map textures from
six separate images. Some bugs in the plugin were uncovered with this
change which have been worked around for the time being.
Pulled in libtxc_dxtn library for decompressing DXTn textures.
Tested by converting teapot with --convert-dds-to-png and running
helloworld.html and render-mode.html.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1677002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r-- | o3d/core/cross/bitmap.h | 2 | ||||
-rw-r--r-- | o3d/core/cross/bitmap_png.cc | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/o3d/core/cross/bitmap.h b/o3d/core/cross/bitmap.h index 96e9b7b..8af80a5 100644 --- a/o3d/core/cross/bitmap.h +++ b/o3d/core/cross/bitmap.h @@ -239,6 +239,8 @@ class Bitmap : public ParamObject { // Generates Mips from the source_level for num_levels void GenerateMips(int source_level, int num_levels); + bool WriteToPNGStream(std::vector<uint8>* stream); + private: friend class IClassManager; static ObjectBase::Ref Create(ServiceLocator* service_locator); diff --git a/o3d/core/cross/bitmap_png.cc b/o3d/core/cross/bitmap_png.cc index 6b73b94..686e854 100644 --- a/o3d/core/cross/bitmap_png.cc +++ b/o3d/core/cross/bitmap_png.cc @@ -316,6 +316,24 @@ bool CreatePNGInUInt8Vector(const Bitmap& bitmap, std::vector<uint8>* buffer) { } // anonymous namespace +bool Bitmap::WriteToPNGStream(std::vector<uint8>* stream) { + if (format_ != Texture::ARGB8) { + O3D_ERROR(service_locator()) << "Can only write ARGB8 images to PNGs."; + return false; + } + if (num_mipmaps_ != 1) { + O3D_ERROR(service_locator()) << + "Can only write 2d images with no mips to PNGs."; + return false; + } + + if (!CreatePNGInUInt8Vector(*this, stream)) { + return false; + } + + return true; +} + String Bitmap::ToDataURL() { if (format_ != Texture::ARGB8) { O3D_ERROR(service_locator()) << "Can only get data URL from ARGB8 images."; |