summaryrefslogtreecommitdiffstats
path: root/o3d/converter
diff options
context:
space:
mode:
authoramarinichev@chromium.org <amarinichev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-23 23:17:56 +0000
committeramarinichev@chromium.org <amarinichev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-23 23:17:56 +0000
commitbc3ef7faa993606415465cc3a036b5f3af9de660 (patch)
tree69c51db29737194ed207c84c6235a18779a3e91c /o3d/converter
parent1eb71d721dee36e8f386bdc0900f915a0813981a (diff)
downloadchromium_src-bc3ef7faa993606415465cc3a036b5f3af9de660.zip
chromium_src-bc3ef7faa993606415465cc3a036b5f3af9de660.tar.gz
chromium_src-bc3ef7faa993606415465cc3a036b5f3af9de660.tar.bz2
Adds --convert-cg-to-glsl to the Collada converter tool.
Review URL: http://codereview.chromium.org/1750008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45514 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/converter')
-rw-r--r--o3d/converter/cross/converter.cc2
-rw-r--r--o3d/converter/cross/converter.h10
-rw-r--r--o3d/converter/cross/converter_main.cc14
3 files changed, 24 insertions, 2 deletions
diff --git a/o3d/converter/cross/converter.cc b/o3d/converter/cross/converter.cc
index f039f5de..4726392 100644
--- a/o3d/converter/cross/converter.cc
+++ b/o3d/converter/cross/converter.cc
@@ -299,6 +299,8 @@ bool Convert(const FilePath& in_filename,
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_options.convert_cg_to_glsl = options.convert_cg_to_glsl;
+ collada_options.converter_tool = options.converter_tool;
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 7a289ee..69e801b 100644
--- a/o3d/converter/cross/converter.h
+++ b/o3d/converter/cross/converter.h
@@ -56,7 +56,9 @@ struct Options {
keep_filters(false),
keep_materials(false),
archive(true),
- convert_dds_to_png(false) {
+ convert_dds_to_png(false),
+ convert_cg_to_glsl(false),
+ converter_tool() {
}
// A list of paths to search for assets..
@@ -95,6 +97,12 @@ struct Options {
// True means convert DDS files to PNGs. For cube map textures, this
// implies writing six separate PNGs.
bool convert_dds_to_png;
+
+ // True means convert CG shaders go GLSL using external cgc tool.
+ bool convert_cg_to_glsl;
+
+ // Path to shader converter tool.
+ FilePath converter_tool;
};
// 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 9af930f..ab72b61 100644
--- a/o3d/converter/cross/converter_main.cc
+++ b/o3d/converter/cross/converter_main.cc
@@ -69,6 +69,9 @@ int CrossMain(int argc, char**argv) {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
FilePath in_filename, out_filename;
+ const FilePath converter_tool = FilePath(argv[0]).DirName().Append(
+ o3d::UTF8ToFilePath("convert.py"));
+
std::vector<std::wstring> values = command_line->GetLooseValues();
if (values.size() == 1) {
@@ -109,7 +112,12 @@ int CrossMain(int argc, char**argv) {
<< " 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";
+ << " writes six separate PNGs with suffixes _posx, _negx, etc.\n"
+ << "--convert-cg-to-glsl\n"
+ << " Convert shaders using an external tool.\n"
+ << "--converter-tool=<filename> [default: "
+ << converter_tool.value() << "]\n"
+ << " Specifies the shader converter tool.\n";
return EXIT_FAILURE;
}
@@ -119,6 +127,10 @@ int CrossMain(int argc, char**argv) {
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");
+ options.convert_cg_to_glsl = command_line->HasSwitch("convert-cg-to-glsl");
+ options.converter_tool = command_line->HasSwitch("converter-tool") ?
+ o3d::WideToFilePath(command_line->GetSwitchValue("converter-tool")) :
+ converter_tool;
if (command_line->HasSwitch("base-path")) {
options.base_path = o3d::WideToFilePath(
command_line->GetSwitchValue("base-path"));