Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: o3d/converter_edge/cross/converter_main.cc

Issue 270062: Use ASCII strings for switch names. (Closed)
Patch Set: victory Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « o3d/converter/cross/verifier_main.cc ('k') | o3d/converter_edge/cross/verifier_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 << " they are used by a mesh that has no normals.\n" 103 << " they are used by a mesh that has no normals.\n"
104 << "--sharp-edge-threshold=<threshold>\n" 104 << "--sharp-edge-threshold=<threshold>\n"
105 << " Adds edges with normal angle larger than <threshold>.\n" 105 << " Adds edges with normal angle larger than <threshold>.\n"
106 << "--sharp-edge-color=r,g,b\n" 106 << "--sharp-edge-color=r,g,b\n"
107 << " Specify color of the additional edges, (value 0 to 1).\n" 107 << " Specify color of the additional edges, (value 0 to 1).\n"
108 << " Default value is 1,0,0.\n"; 108 << " Default value is 1,0,0.\n";
109 return EXIT_FAILURE; 109 return EXIT_FAILURE;
110 } 110 }
111 111
112 o3d::converter::Options options; 112 o3d::converter::Options options;
113 options.condition = !command_line->HasSwitch(L"no-condition"); 113 options.condition = !command_line->HasSwitch("no-condition");
114 options.pretty_print = command_line->HasSwitch(L"pretty-print"); 114 options.pretty_print = command_line->HasSwitch("pretty-print");
115 if (command_line->HasSwitch(L"base-path")) { 115 if (command_line->HasSwitch("base-path")) {
116 options.base_path = o3d::WideToFilePath( 116 options.base_path = o3d::WideToFilePath(
117 command_line->GetSwitchValue(L"base-path")); 117 command_line->GetSwitchValue("base-path"));
118 } 118 }
119 if (command_line->HasSwitch(L"asset-paths")) { 119 if (command_line->HasSwitch("asset-paths")) {
120 std::vector<std::wstring> paths; 120 std::vector<std::wstring> paths;
121 SplitString(command_line->GetSwitchValue(L"asset-paths"), ',', &paths); 121 SplitString(command_line->GetSwitchValue("asset-paths"), ',', &paths);
122 for (size_t ii = 0; ii < paths.size(); ++ii) { 122 for (size_t ii = 0; ii < paths.size(); ++ii) {
123 options.file_paths.push_back(o3d::WideToFilePath(paths[ii])); 123 options.file_paths.push_back(o3d::WideToFilePath(paths[ii]));
124 } 124 }
125 } 125 }
126 if (command_line->HasSwitch(L"up-axis")) { 126 if (command_line->HasSwitch("up-axis")) {
127 wstring up_axis_string = command_line->GetSwitchValue(L"up-axis"); 127 wstring up_axis_string = command_line->GetSwitchValue("up-axis");
128 int x, y, z; 128 int x, y, z;
129 if (swscanf(up_axis_string.c_str(), L"%d,%d,%d", &x, &y, &z) != 3) { 129 if (swscanf(up_axis_string.c_str(), L"%d,%d,%d", &x, &y, &z) != 3) {
130 std::cerr << "Invalid --up-axis value. Should be --up-axis=x,y,z\n"; 130 std::cerr << "Invalid --up-axis value. Should be --up-axis=x,y,z\n";
131 return EXIT_FAILURE; 131 return EXIT_FAILURE;
132 } 132 }
133 options.up_axis = o3d::Vector3(static_cast<float>(x), 133 options.up_axis = o3d::Vector3(static_cast<float>(x),
134 static_cast<float>(y), 134 static_cast<float>(y),
135 static_cast<float>(z)); 135 static_cast<float>(z));
136 } 136 }
137 if (command_line->HasSwitch(L"sharp-edge-threshold")) { 137 if (command_line->HasSwitch("sharp-edge-threshold")) {
138 wstring soften_edge_string = 138 wstring soften_edge_string =
139 command_line->GetSwitchValue(L"sharp-edge-threshold"); 139 command_line->GetSwitchValue("sharp-edge-threshold");
140 float soft_threshold; 140 float soft_threshold;
141 if (swscanf(soften_edge_string.c_str(), L"%f", &soft_threshold) != 1) { 141 if (swscanf(soften_edge_string.c_str(), L"%f", &soft_threshold) != 1) {
142 std::cerr << "Invalid --sharp-edges-threshold value.\n"; 142 std::cerr << "Invalid --sharp-edges-threshold value.\n";
143 return EXIT_FAILURE; 143 return EXIT_FAILURE;
144 } 144 }
145 options.enable_add_sharp_edge = true; 145 options.enable_add_sharp_edge = true;
146 options.sharp_edge_threshold = soft_threshold; 146 options.sharp_edge_threshold = soft_threshold;
147 } 147 }
148 if (command_line->HasSwitch(L"sharp-edge-color")) { 148 if (command_line->HasSwitch("sharp-edge-color")) {
149 wstring edge_color_str = 149 wstring edge_color_str =
150 command_line->GetSwitchValue(L"sharp-edge-color"); 150 command_line->GetSwitchValue("sharp-edge-color");
151 int r, g, b; 151 int r, g, b;
152 if (swscanf(edge_color_str.c_str(), L"%d,%d,%d", &r, &g, &b) != 3) { 152 if (swscanf(edge_color_str.c_str(), L"%d,%d,%d", &r, &g, &b) != 3) {
153 std::cerr << "Invalid --sharp-edge-color value. Should be " 153 std::cerr << "Invalid --sharp-edge-color value. Should be "
154 << "--sharp-edge-color=r,g,b\n"; 154 << "--sharp-edge-color=r,g,b\n";
155 return EXIT_FAILURE; 155 return EXIT_FAILURE;
156 } 156 }
157 options.sharp_edge_color = o3d::Vector3(static_cast<float>(r), 157 options.sharp_edge_color = o3d::Vector3(static_cast<float>(r),
158 static_cast<float>(g), 158 static_cast<float>(g),
159 static_cast<float>(b)); 159 static_cast<float>(b));
160 } 160 }
(...skipping 10 matching lines...) Expand all
171 return EXIT_SUCCESS; 171 return EXIT_SUCCESS;
172 } else { 172 } else {
173 std::cerr << error_messages.c_str() << std::endl; 173 std::cerr << error_messages.c_str() << std::endl;
174 std::cerr << "FAILED to convert '" 174 std::cerr << "FAILED to convert '"
175 << o3d::FilePathToUTF8(in_filename).c_str() 175 << o3d::FilePathToUTF8(in_filename).c_str()
176 << "' to '" << o3d::FilePathToUTF8(out_filename).c_str() 176 << "' to '" << o3d::FilePathToUTF8(out_filename).c_str()
177 << "'." << std::endl; 177 << "'." << std::endl;
178 return EXIT_FAILURE; 178 return EXIT_FAILURE;
179 } 179 }
180 } 180 }
OLDNEW
« no previous file with comments | « o3d/converter/cross/verifier_main.cc ('k') | o3d/converter_edge/cross/verifier_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698