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/converter | |
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/converter')
-rw-r--r-- | o3d/converter/converter.gyp | 2 | ||||
-rw-r--r-- | o3d/converter/cross/converter.cc | 1 | ||||
-rw-r--r-- | o3d/converter/cross/converter.h | 7 | ||||
-rw-r--r-- | o3d/converter/cross/converter_main.cc | 6 |
4 files changed, 14 insertions, 2 deletions
diff --git a/o3d/converter/converter.gyp b/o3d/converter/converter.gyp index ffede11f..fb99ddf 100644 --- a/o3d/converter/converter.gyp +++ b/o3d/converter/converter.gyp @@ -14,6 +14,7 @@ '..', '../..', '../../<(gtestdir)', + '../<(txcdir)', ], }, 'targets': [ @@ -53,6 +54,7 @@ 'cross/stream_bank_stub.h', 'cross/texture_stub.cc', 'cross/texture_stub.h', + '../<(txcdir)/txc_fetch_dxtn.cc', ], 'conditions' : [ ['renderer == "gl"', diff --git a/o3d/converter/cross/converter.cc b/o3d/converter/cross/converter.cc index cda3143..f039f5de 100644 --- a/o3d/converter/cross/converter.cc +++ b/o3d/converter/cross/converter.cc @@ -298,6 +298,7 @@ bool Convert(const FilePath& in_filename, collada_options.base_path = options.base_path; collada_options.file_paths = options.file_paths; collada_options.up_axis = options.up_axis; + collada_options.convert_dds_to_png = options.convert_dds_to_png; Collada collada(pack.Get(), collada_options); bool result = collada.ImportFile(in_filename, root, param_float); if (!result || !error_collector.errors().empty()) { diff --git a/o3d/converter/cross/converter.h b/o3d/converter/cross/converter.h index 47dde59..7a289ee 100644 --- a/o3d/converter/cross/converter.h +++ b/o3d/converter/cross/converter.h @@ -55,7 +55,8 @@ struct Options { pretty_print(false), keep_filters(false), keep_materials(false), - archive(true) { + archive(true), + convert_dds_to_png(false) { } // A list of paths to search for assets.. @@ -90,6 +91,10 @@ struct Options { // True means make a gzipped tar file. False means write individual files. bool archive; + + // True means convert DDS files to PNGs. For cube map textures, this + // implies writing six separate PNGs. + bool convert_dds_to_png; }; // Converts the given file for use in O3D. This is done by diff --git a/o3d/converter/cross/converter_main.cc b/o3d/converter/cross/converter_main.cc index 90d7774..9af930f 100644 --- a/o3d/converter/cross/converter_main.cc +++ b/o3d/converter/cross/converter_main.cc @@ -106,7 +106,10 @@ int CrossMain(int argc, char**argv) { << "--no-archive\n" << " Don't make a gzipped tar file, just flat files. Still takes\n" << " the name of an archive file; for archive.o3dtgz, creates\n" - << " directory named archive/ and writes files inside.\n"; + << " directory named archive/ and writes files inside.\n" + << "--convert-dds-to-png\n" + << " Convert all DDS textures to PNGs. For cube map textures,\n" + << " writes six separate PNGs with suffixes _posx, _negx, etc.\n"; return EXIT_FAILURE; } @@ -115,6 +118,7 @@ int CrossMain(int argc, char**argv) { options.pretty_print = command_line->HasSwitch("pretty-print"); options.binary = !command_line->HasSwitch("no-binary"); options.archive = !command_line->HasSwitch("no-archive"); + options.convert_dds_to_png = command_line->HasSwitch("convert-dds-to-png"); if (command_line->HasSwitch("base-path")) { options.base_path = o3d::WideToFilePath( command_line->GetSwitchValue("base-path")); |