1 | // ================================================================
|
---|
2 | // $Id: environ.cpp,v 1.1 2004/02/16 14:45:59 bittner Exp $
|
---|
3 | //
|
---|
4 | // environ.cpp
|
---|
5 | // Implementation of the environment operations, ie. reading
|
---|
6 | // environment file, reading command line parameters etc.
|
---|
7 | //
|
---|
8 |
|
---|
9 | //#define _DEBUG_PARAMS
|
---|
10 |
|
---|
11 | #include <math.h>
|
---|
12 | #include <stdlib.h>
|
---|
13 | #include <stdio.h>
|
---|
14 | #include <string.h>
|
---|
15 | #include <fstream>
|
---|
16 |
|
---|
17 | #include "gzstream.h"
|
---|
18 | #include "common.h"
|
---|
19 | #include "Environment.h"
|
---|
20 | #include "Vector3.h"
|
---|
21 |
|
---|
22 | using namespace std;
|
---|
23 |
|
---|
24 | namespace GtpVisibilityPreprocessor {
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 | Environment *environment = NULL;
|
---|
29 |
|
---|
30 | Environment::~Environment()
|
---|
31 | {
|
---|
32 | int i, j;
|
---|
33 |
|
---|
34 | // delete the params structure
|
---|
35 | for (i = 0; i < numParams; i++) {
|
---|
36 | for (j = 0; j < paramRows; j++)
|
---|
37 | if (params[i][j] != NULL)
|
---|
38 | delete[] params[i][j];
|
---|
39 | if (params[i] != NULL)
|
---|
40 | delete[] params[i];
|
---|
41 | }
|
---|
42 |
|
---|
43 | if (params != NULL)
|
---|
44 | delete[] params;
|
---|
45 |
|
---|
46 | // delete the options structure
|
---|
47 | if (options != NULL)
|
---|
48 | delete[] options;
|
---|
49 |
|
---|
50 | if (optionalParams != NULL)
|
---|
51 | DEL_PTR(optionalParams);
|
---|
52 | }
|
---|
53 |
|
---|
54 | bool
|
---|
55 | Environment::CheckForSwitch(const int argc,
|
---|
56 | char **argv,
|
---|
57 | const char swtch) const
|
---|
58 | {
|
---|
59 | for (int i = 1; i < argc; i++)
|
---|
60 | if ((argv[i][0] == '-') && (argv[i][1] == swtch))
|
---|
61 | return true;
|
---|
62 | return false;
|
---|
63 | }
|
---|
64 |
|
---|
65 | bool
|
---|
66 | Environment::CheckType(const char *value,
|
---|
67 | const EOptType type) const
|
---|
68 | {
|
---|
69 | char *s, *t, *u;
|
---|
70 |
|
---|
71 | switch (type) {
|
---|
72 | case optInt: {
|
---|
73 | strtol(value, &t, 10);
|
---|
74 | if (value + strlen(value) != t)
|
---|
75 | return false;
|
---|
76 | else
|
---|
77 | return true;
|
---|
78 | }
|
---|
79 | case optFloat: {
|
---|
80 | strtod(value, &t);
|
---|
81 | if (value + strlen(value) != t)
|
---|
82 | return false;
|
---|
83 | else
|
---|
84 | return true;
|
---|
85 | }
|
---|
86 | case optBool: {
|
---|
87 | if (!strcasecmp(value, "true") ||
|
---|
88 | !strcasecmp(value, "false") ||
|
---|
89 | !strcasecmp(value, "YES") ||
|
---|
90 | !strcasecmp(value, "NO") ||
|
---|
91 | !strcmp(value, "+") ||
|
---|
92 | !strcmp(value, "-") ||
|
---|
93 | !strcasecmp(value, "ON") ||
|
---|
94 | !strcasecmp(value, "OFF"))
|
---|
95 | return true;
|
---|
96 | return false;
|
---|
97 | }
|
---|
98 | case optVector:{
|
---|
99 | strtod(value, &s);
|
---|
100 | if (*s == ' ' || *s == '\t') {
|
---|
101 | while (*s == ' ' || *s == '\t')
|
---|
102 | s++;
|
---|
103 | if (*s != ',')
|
---|
104 | s--;
|
---|
105 | }
|
---|
106 | if ((*s != ',' && *s != ' ' && *s != '\t') || value == s)
|
---|
107 | return false;
|
---|
108 | t = s;
|
---|
109 | strtod(s + 1, &u);
|
---|
110 | if (*u == ' ' || *u == '\t') {
|
---|
111 | while (*u == ' ' || *u == '\t')
|
---|
112 | u++;
|
---|
113 | if (*u != ',')
|
---|
114 | u--;
|
---|
115 | }
|
---|
116 | if ((*u != ',' && *s != ' ' && *s != '\t') || t == u)
|
---|
117 | return false;
|
---|
118 | t = u;
|
---|
119 | strtod(u + 1, &s);
|
---|
120 | if (t == s || value + strlen(value) != s)
|
---|
121 | return false;
|
---|
122 | return true;
|
---|
123 | }
|
---|
124 | case optString: {
|
---|
125 | return true;
|
---|
126 | }
|
---|
127 | default: {
|
---|
128 | Debug << "Internal error: Unknown type of option.\n" << flush;
|
---|
129 | exit(1);
|
---|
130 | }
|
---|
131 | }
|
---|
132 | return false;
|
---|
133 | }
|
---|
134 |
|
---|
135 | void
|
---|
136 | Environment::ReadCmdlineParams(const int argc,
|
---|
137 | char **argv,
|
---|
138 | const char *optParams)
|
---|
139 | {
|
---|
140 | int i;
|
---|
141 |
|
---|
142 | // Make sure we are called for the first time
|
---|
143 | if (optionalParams != NULL)
|
---|
144 | return;
|
---|
145 |
|
---|
146 | numParams = (int)strlen(optParams) + 1;
|
---|
147 | optionalParams = new char[numParams];
|
---|
148 | strcpy(optionalParams, optParams);
|
---|
149 |
|
---|
150 | // First, count all non-optional parameters on the command line
|
---|
151 | for (i = 1; i < argc; i++)
|
---|
152 | if (argv[i][0] != '-')
|
---|
153 | paramRows++;
|
---|
154 |
|
---|
155 | // if there is no non-optional parameter add a default one...
|
---|
156 | if (paramRows == 0)
|
---|
157 | paramRows = 1;
|
---|
158 |
|
---|
159 | // allocate and initialize the table for parameters
|
---|
160 | params = new char **[numParams];
|
---|
161 | for (i = 0; i < numParams; i++) {
|
---|
162 | params[i] = new char *[paramRows];
|
---|
163 | for (int j = 0; j < paramRows; j++)
|
---|
164 | params[i][j] = NULL;
|
---|
165 | }
|
---|
166 | // Now read all non-optional and optional parameters into the table
|
---|
167 | curRow = -1;
|
---|
168 | for (i = 1; i < argc; i++) {
|
---|
169 | if (argv[i][0] != '-') {
|
---|
170 | // non-optional parameter encountered
|
---|
171 | curRow++;
|
---|
172 | params[0][curRow] = new char[strlen(argv[i]) + 1];
|
---|
173 | strcpy(params[0][curRow], argv[i]);
|
---|
174 | }
|
---|
175 | else {
|
---|
176 | // option encountered
|
---|
177 | char *t = strchr(optionalParams, argv[i][1]);
|
---|
178 | if (t != NULL) {
|
---|
179 | // this option is optional parameter
|
---|
180 | int index = t - optionalParams + 1;
|
---|
181 | if (curRow < 0) {
|
---|
182 | // it's a global parameter
|
---|
183 | for (int j = 0; j < paramRows; j++) {
|
---|
184 | params[index][j] = new char[strlen(argv[i] + 2) + 1];
|
---|
185 | strcpy(params[index][j], argv[i] + 2);
|
---|
186 | }
|
---|
187 | }
|
---|
188 | else {
|
---|
189 | // it's a scene parameter
|
---|
190 | if (params[index][curRow] != NULL) {
|
---|
191 | delete[] params[index][curRow];
|
---|
192 | }
|
---|
193 | params[index][curRow] = new char[strlen(argv[i] + 2) + 1];
|
---|
194 | strcpy(params[index][curRow], argv[i] + 2);
|
---|
195 | }
|
---|
196 | }
|
---|
197 | }
|
---|
198 | }
|
---|
199 | curRow = 0;
|
---|
200 |
|
---|
201 | #ifdef _DEBUG_PARAMS
|
---|
202 | // write out the parameter table
|
---|
203 | cerr << "Parameter table for " << numParams << " columns and "
|
---|
204 | << paramRows << " rows:\n";
|
---|
205 | for (int j = 0; j < paramRows; j++) {
|
---|
206 | for (i = 0; i < numParams; i++) {
|
---|
207 | if (params[i][j] != NULL)
|
---|
208 | cerr << params[i][j];
|
---|
209 | else
|
---|
210 | cerr << "NULL";
|
---|
211 | cerr << "\t";
|
---|
212 | }
|
---|
213 | cerr << "\n";
|
---|
214 | }
|
---|
215 | cerr << "Params done.\n" << flush;
|
---|
216 | #endif // _DEBUG_PARAMS
|
---|
217 | }
|
---|
218 |
|
---|
219 | bool
|
---|
220 | Environment::GetParam(const char name,
|
---|
221 | const int index,
|
---|
222 | char *value) const
|
---|
223 | {
|
---|
224 | int column;
|
---|
225 |
|
---|
226 | if (index >= paramRows || index < 0)
|
---|
227 | return false;
|
---|
228 | if (name == ' ')
|
---|
229 | column = 0;
|
---|
230 | else {
|
---|
231 | char *t = strchr(optionalParams, name);
|
---|
232 |
|
---|
233 | if (t == NULL)
|
---|
234 | return false;
|
---|
235 | column = t - optionalParams + 1;
|
---|
236 | }
|
---|
237 |
|
---|
238 | if (params[column][index] == NULL)
|
---|
239 | return false;
|
---|
240 | // value = new char[strlen(params[column][index]) + 1];
|
---|
241 | strcpy(value, params[column][index]);
|
---|
242 | return true;
|
---|
243 | }
|
---|
244 |
|
---|
245 | void
|
---|
246 | Environment::RegisterOption(const char *name,
|
---|
247 | const EOptType type,
|
---|
248 | const char *abbrev,
|
---|
249 | const char *defValue)
|
---|
250 | {
|
---|
251 | int i;
|
---|
252 |
|
---|
253 | // make sure this option was not yet registered
|
---|
254 | for (i = 0; i < numOptions; i++)
|
---|
255 | if (!strcmp(name, options[i].name)) {
|
---|
256 | Debug << "Error: Option " << name << " registered twice.\n";
|
---|
257 | exit(1);
|
---|
258 | }
|
---|
259 | // make sure we have enough room in memory
|
---|
260 | if (numOptions >= maxOptions) {
|
---|
261 | Debug << "Error: Too many options. Try enlarge the maxOptions "
|
---|
262 | << "definition.\n";
|
---|
263 | exit(1);
|
---|
264 | }
|
---|
265 |
|
---|
266 | // make sure the abbreviation doesn't start with 'D'
|
---|
267 | if (abbrev != NULL && (abbrev[0] == 'D' )) {
|
---|
268 | Debug << "Internal error: reserved switch " << abbrev
|
---|
269 | << " used as an abbreviation.\n";
|
---|
270 | exit(1);
|
---|
271 | }
|
---|
272 | // new option
|
---|
273 | options[numOptions].type = type;
|
---|
274 | options[numOptions].name = ::strdup(name);
|
---|
275 | // assign abbreviation, if requested
|
---|
276 | if (abbrev != NULL) {
|
---|
277 | options[numOptions].abbrev = ::strdup(abbrev);
|
---|
278 | }
|
---|
279 | // assign default value, if requested
|
---|
280 | if (defValue != NULL) {
|
---|
281 | options[numOptions].defaultValue = ::strdup(defValue);
|
---|
282 | if (!CheckType(defValue, type)) {
|
---|
283 | Debug << "Internal error: Inconsistent type and default value in option "
|
---|
284 | << name << ".\n";
|
---|
285 | exit(1);
|
---|
286 | }
|
---|
287 | }
|
---|
288 | // new option registered
|
---|
289 | numOptions++;
|
---|
290 | }
|
---|
291 |
|
---|
292 | bool
|
---|
293 | Environment::OptionPresent(const char *name) const
|
---|
294 | {
|
---|
295 | bool found = false;
|
---|
296 | int i;
|
---|
297 |
|
---|
298 | for (i = 0; i < numOptions; i++)
|
---|
299 | if (!strcmp(options[i].name, name)) {
|
---|
300 | found = true;
|
---|
301 | break;
|
---|
302 | }
|
---|
303 | if (!found) {
|
---|
304 | Debug << "Internal error: Option " << name << " not registered.\n" << flush;
|
---|
305 | exit(1);
|
---|
306 | }
|
---|
307 | if (options[i].value != NULL || options[i].defaultValue != NULL)
|
---|
308 | return true;
|
---|
309 | else
|
---|
310 | return false;
|
---|
311 | }
|
---|
312 |
|
---|
313 | int
|
---|
314 | Environment::FindOption(const char *name, const bool isFatal) const
|
---|
315 | {
|
---|
316 | int i;
|
---|
317 | bool found = false;
|
---|
318 | // is this option registered ?
|
---|
319 | for (i = 0; i < numOptions; i++)
|
---|
320 | if (!strcmp(options[i].name, name)) {
|
---|
321 | found = true;
|
---|
322 | break;
|
---|
323 | }
|
---|
324 | if (!found) {
|
---|
325 | // no registration found
|
---|
326 | Debug << "Internal error: Required option " << name
|
---|
327 | << " not registered.\n" << flush;
|
---|
328 | exit(1);
|
---|
329 | }
|
---|
330 | if (options[i].value == NULL && options[i].defaultValue == NULL)
|
---|
331 | // this option was not initialised to some value
|
---|
332 | if (isFatal) {
|
---|
333 | Debug << "Error: Required option " << name << " not found.\n" << flush;
|
---|
334 | exit(1);
|
---|
335 | }
|
---|
336 | else {
|
---|
337 | Debug << "Error: Required option " << name << " not found.\n" << flush;
|
---|
338 | return -1;
|
---|
339 | }
|
---|
340 | return i;
|
---|
341 | }
|
---|
342 |
|
---|
343 | bool
|
---|
344 | Environment::GetIntValue(const char *name,
|
---|
345 | int &value,
|
---|
346 | const bool isFatal) const
|
---|
347 | {
|
---|
348 | int i = FindOption(name, isFatal);
|
---|
349 |
|
---|
350 | if (i<0)
|
---|
351 | return false;
|
---|
352 |
|
---|
353 | if (options[i].value != NULL) {
|
---|
354 | // option was explicitly specified
|
---|
355 | value = strtol(options[i].value, NULL, 10);
|
---|
356 | } else {
|
---|
357 | // option was not read, so use the default
|
---|
358 | value = strtol(options[i].defaultValue, NULL, 10);
|
---|
359 | }
|
---|
360 |
|
---|
361 | return true;
|
---|
362 | }
|
---|
363 |
|
---|
364 | bool
|
---|
365 | Environment::GetDoubleValue(const char *name,
|
---|
366 | double &value,
|
---|
367 | const bool isFatal) const
|
---|
368 | {
|
---|
369 | int i = FindOption(name, isFatal);
|
---|
370 |
|
---|
371 | if (i<0)
|
---|
372 | return false;
|
---|
373 |
|
---|
374 | if (options[i].value != NULL) {
|
---|
375 | // option was explicitly specified
|
---|
376 | value = strtod(options[i].value, NULL);
|
---|
377 | } else {
|
---|
378 | // option was not read, so use the default
|
---|
379 | value = strtod(options[i].defaultValue, NULL);
|
---|
380 | }
|
---|
381 | return true;
|
---|
382 | }
|
---|
383 |
|
---|
384 | bool
|
---|
385 | Environment::GetRealValue(const char *name,
|
---|
386 | Real &value,
|
---|
387 | const bool isFatal) const
|
---|
388 | {
|
---|
389 | int i = FindOption(name, isFatal);
|
---|
390 |
|
---|
391 | if (i<0)
|
---|
392 | return false;
|
---|
393 |
|
---|
394 | if (options[i].value != NULL) {
|
---|
395 | // option was explicitly specified
|
---|
396 | value = (Real)strtod(options[i].value, NULL);
|
---|
397 | } else {
|
---|
398 | // option was not read, so use the default
|
---|
399 | value = (Real)strtod(options[i].defaultValue, NULL);
|
---|
400 | }
|
---|
401 | return true;
|
---|
402 | }
|
---|
403 |
|
---|
404 | bool
|
---|
405 | Environment::GetFloatValue(const char *name,
|
---|
406 | float &value,
|
---|
407 | const bool isFatal) const
|
---|
408 | {
|
---|
409 | int i = FindOption(name, isFatal);
|
---|
410 |
|
---|
411 | if (i<0)
|
---|
412 | return false;
|
---|
413 |
|
---|
414 | if (options[i].value != NULL) {
|
---|
415 | // option was explicitly specified
|
---|
416 | value = (float)strtod(options[i].value, NULL);
|
---|
417 | } else {
|
---|
418 | // option was not read, so use the default
|
---|
419 | value = (float)strtod(options[i].defaultValue, NULL);
|
---|
420 | }
|
---|
421 | return true;
|
---|
422 | }
|
---|
423 |
|
---|
424 | bool
|
---|
425 | Environment::GetBool(const char *name,
|
---|
426 | const bool isFatal) const
|
---|
427 | {
|
---|
428 | bool ret;
|
---|
429 | if (GetBoolValue(name, ret, isFatal))
|
---|
430 | return ret;
|
---|
431 | else
|
---|
432 | return false;
|
---|
433 | }
|
---|
434 |
|
---|
435 | bool
|
---|
436 | Environment::ParseBool(const char *name) const
|
---|
437 | {
|
---|
438 |
|
---|
439 | bool value = true;
|
---|
440 |
|
---|
441 | if (!strcasecmp(name, "false") ||
|
---|
442 | !strcasecmp(name, "NO") ||
|
---|
443 | !strcmp(name, "-") ||
|
---|
444 | !strcasecmp(name, "OFF"))
|
---|
445 | value = false;
|
---|
446 |
|
---|
447 | return value;
|
---|
448 | }
|
---|
449 |
|
---|
450 | void
|
---|
451 | Environment::ParseVector(const char *name, Vector3 &v) const
|
---|
452 | {
|
---|
453 | // option was not read, so use the default
|
---|
454 | char *s, *t;
|
---|
455 |
|
---|
456 | v.x = (Real)strtod(name, &s);
|
---|
457 | v.y = (Real)strtod(s + 1, &t);
|
---|
458 | v.z = (Real)strtod(t + 1, NULL);
|
---|
459 |
|
---|
460 | }
|
---|
461 |
|
---|
462 | bool
|
---|
463 | Environment::GetBoolValue(const char *name,
|
---|
464 | bool &value,
|
---|
465 | const bool isFatal) const
|
---|
466 | {
|
---|
467 | int i = FindOption(name, isFatal);
|
---|
468 |
|
---|
469 | if (i<0)
|
---|
470 | return false;
|
---|
471 |
|
---|
472 |
|
---|
473 | if (options[i].value != NULL)
|
---|
474 | value = ParseBool(options[i].value);
|
---|
475 | else
|
---|
476 | value = ParseBool(options[i].defaultValue);
|
---|
477 |
|
---|
478 | return true;
|
---|
479 | }
|
---|
480 |
|
---|
481 | bool
|
---|
482 | Environment::GetVectorValue(const char *name,
|
---|
483 | Vector3 &v,
|
---|
484 | const bool isFatal) const
|
---|
485 | {
|
---|
486 | int i = FindOption(name, isFatal);
|
---|
487 | if (i<0)
|
---|
488 | return false;
|
---|
489 |
|
---|
490 | if (options[i].value != NULL)
|
---|
491 |
|
---|
492 |
|
---|
493 | if (options[i].value != NULL) {
|
---|
494 | ParseVector(options[i].value, v);
|
---|
495 | }
|
---|
496 | else {
|
---|
497 | ParseVector(options[i].defaultValue, v);
|
---|
498 | }
|
---|
499 | return true;
|
---|
500 | }
|
---|
501 |
|
---|
502 | bool
|
---|
503 | Environment::GetStringValue(const char *name,
|
---|
504 | char *value,
|
---|
505 | const bool isFatal) const
|
---|
506 | {
|
---|
507 | int i = FindOption(name, isFatal);
|
---|
508 |
|
---|
509 | if (i<0)
|
---|
510 | return false;
|
---|
511 |
|
---|
512 |
|
---|
513 | if (options[i].value != NULL) {
|
---|
514 | // option was not read, so use the default
|
---|
515 | strcpy(value, options[i].value);
|
---|
516 | }
|
---|
517 | else {
|
---|
518 | // option was explicitly specified
|
---|
519 | strcpy(value, options[i].defaultValue);
|
---|
520 | }
|
---|
521 | return true;
|
---|
522 | }
|
---|
523 |
|
---|
524 | void
|
---|
525 | Environment::SetInt(const char *name, const int value)
|
---|
526 | {
|
---|
527 |
|
---|
528 | int i = FindOption(name);
|
---|
529 | if (i<0)
|
---|
530 | return;
|
---|
531 |
|
---|
532 | if (options[i].type == optInt) {
|
---|
533 | delete options[i].value;
|
---|
534 | options[i].value = new char[16];
|
---|
535 | sprintf(options[i].value, "%.15d", value);
|
---|
536 | }
|
---|
537 | else {
|
---|
538 | Debug << "Internal error: Trying to set non-integer option " << name
|
---|
539 | << " to integral value.\n" << flush;
|
---|
540 | exit(1);
|
---|
541 | }
|
---|
542 | }
|
---|
543 |
|
---|
544 | void
|
---|
545 | Environment::SetFloat(const char *name, const Real value)
|
---|
546 | {
|
---|
547 | int i = FindOption(name);
|
---|
548 | if (i<0)
|
---|
549 | return;
|
---|
550 |
|
---|
551 | if (options[i].type == optFloat) {
|
---|
552 | delete options[i].value;
|
---|
553 | options[i].value = new char[25];
|
---|
554 | sprintf(options[i].value, "%.15e", value);
|
---|
555 | }
|
---|
556 | else {
|
---|
557 | Debug << "Internal error: Trying to set non-Real option " << name
|
---|
558 | << " to Real value.\n" << flush;
|
---|
559 | exit(1);
|
---|
560 | }
|
---|
561 | }
|
---|
562 |
|
---|
563 | void
|
---|
564 | Environment::SetBool(const char *name, const bool value)
|
---|
565 | {
|
---|
566 | int i = FindOption(name);
|
---|
567 | if (i<0)
|
---|
568 | return;
|
---|
569 |
|
---|
570 | if (options[i].type == optBool) {
|
---|
571 | delete options[i].value;
|
---|
572 | options[i].value = new char[6];
|
---|
573 | if (value)
|
---|
574 | sprintf(options[i].value, "true");
|
---|
575 | else
|
---|
576 | sprintf(options[i].value, "false");
|
---|
577 | }
|
---|
578 | else {
|
---|
579 | Debug << "Internal error: Trying to set non-bool option " << name
|
---|
580 | << " to boolean value.\n" << flush;
|
---|
581 | exit(1);
|
---|
582 | }
|
---|
583 | }
|
---|
584 |
|
---|
585 | void
|
---|
586 | Environment::SetVector(const char *name,
|
---|
587 | const Vector3 &v)
|
---|
588 | {
|
---|
589 | int i = FindOption(name);
|
---|
590 | if (i<0)
|
---|
591 | return;
|
---|
592 |
|
---|
593 | if (options[i].type == optVector) {
|
---|
594 | delete options[i].value;
|
---|
595 | options[i].value = new char[128];
|
---|
596 | sprintf(options[i].value, "%.15e,%.15e,%.15e", v.x, v.y, v.z);
|
---|
597 | }
|
---|
598 | else {
|
---|
599 | Debug << "Internal error: Trying to set non-vector option " << name
|
---|
600 | << " to vector value.\n" << flush;
|
---|
601 | exit(1);
|
---|
602 | }
|
---|
603 | }
|
---|
604 |
|
---|
605 | void
|
---|
606 | Environment::SetString(const char *name, const char *value)
|
---|
607 | {
|
---|
608 | int i = FindOption(name);
|
---|
609 | if (i<0)
|
---|
610 | return;
|
---|
611 |
|
---|
612 | if (options[i].type == optString) {
|
---|
613 | delete options[i].value;
|
---|
614 | options[i].value = ::strdup(value);
|
---|
615 | }
|
---|
616 | else {
|
---|
617 | Debug << "Internal error: Trying to set non-string option " << name
|
---|
618 | << " to string value.\n" << flush;
|
---|
619 | exit(1);
|
---|
620 | }
|
---|
621 | }
|
---|
622 |
|
---|
623 | void
|
---|
624 | Environment::ParseCmdline(const int argc,
|
---|
625 | char **argv,
|
---|
626 | const int index)
|
---|
627 | {
|
---|
628 | int curIndex = -1;
|
---|
629 |
|
---|
630 | for (int i = 1; i < argc; i++) {
|
---|
631 | // if this parameter is non-optional, skip it and increment the counter
|
---|
632 | if (argv[i][0] != '-') {
|
---|
633 | curIndex++;
|
---|
634 | continue;
|
---|
635 | }
|
---|
636 | // make sure to skip all non-optional parameters
|
---|
637 | char *t = strchr(optionalParams, argv[i][1]);
|
---|
638 | if (t != NULL)
|
---|
639 | continue;
|
---|
640 |
|
---|
641 | // if we are in the scope of the current parameter, parse it
|
---|
642 | if (curIndex == -1 || curIndex == index) {
|
---|
643 | if (argv[i][1] == 'D') {
|
---|
644 | // it's a full name definition
|
---|
645 | bool found = false;
|
---|
646 | int j;
|
---|
647 |
|
---|
648 | char *t = strchr(argv[i] + 2, '=');
|
---|
649 | if (t == NULL) {
|
---|
650 | Debug << "Error: Missing '=' in option. "
|
---|
651 | << "Syntax is -D<name>=<value>.\n" << flush;
|
---|
652 | exit(1);
|
---|
653 | }
|
---|
654 | for (j = 0; j < numOptions; j++)
|
---|
655 | if (!strncmp(options[j].name, argv[i] + 2, t - argv[i] - 2) &&
|
---|
656 | (unsigned)(t - argv[i] - 2) == strlen(options[j].name)) {
|
---|
657 | found = true;
|
---|
658 | break;
|
---|
659 | }
|
---|
660 | if (!found) {
|
---|
661 | Debug << "Warning: Unregistered option " << argv[i] << ".\n" << flush;
|
---|
662 | // exit(1);
|
---|
663 | }
|
---|
664 | if (found) {
|
---|
665 | if (!CheckType(t + 1, options[j].type)) {
|
---|
666 | Debug << "Error: invalid type of value " << t + 1 << " in option "
|
---|
667 | << options[j].name << ".\n";
|
---|
668 | exit(1);
|
---|
669 | }
|
---|
670 | if (options[j].value != NULL)
|
---|
671 | delete options[j].value;
|
---|
672 | options[j].value = strdup(t + 1);
|
---|
673 | }
|
---|
674 | }
|
---|
675 | else {
|
---|
676 | // it's an abbreviation
|
---|
677 | bool found = false;
|
---|
678 | int j;
|
---|
679 |
|
---|
680 | for (j = 0; j < numOptions; j++)
|
---|
681 | if (options[j].abbrev != NULL &&
|
---|
682 | !strncmp(options[j].abbrev, argv[i] + 1, strlen(options[j].abbrev))) {
|
---|
683 | found = true;
|
---|
684 | break;
|
---|
685 | }
|
---|
686 | if (!found) {
|
---|
687 | Debug << "Warning: Unregistered option " << argv[i] << ".\n" << flush;
|
---|
688 | // exit(1);
|
---|
689 | }
|
---|
690 | if (found) {
|
---|
691 | if (!CheckType(argv[i] + 1 + strlen(options[j].abbrev), options[j].type)) {
|
---|
692 | Debug << "Error: invalid type of value "
|
---|
693 | << argv[i] + 1 + strlen(options[j].abbrev) << "in option "
|
---|
694 | << options[j].name << ".\n";
|
---|
695 | exit(1);
|
---|
696 | }
|
---|
697 | if (options[j].value != NULL)
|
---|
698 | delete options[j].value;
|
---|
699 | options[j].value = strdup(argv[i] + 1 + strlen(options[j].abbrev));
|
---|
700 | }
|
---|
701 | }
|
---|
702 | }
|
---|
703 | }
|
---|
704 | #ifdef _DEBUG_PARAMS
|
---|
705 | // write out the options table
|
---|
706 | cerr << "Options table for " << numOptions << " options:\n";
|
---|
707 | for (int j = 0; j < numOptions; j++) {
|
---|
708 | cerr << options[j];
|
---|
709 | cerr << "\n";
|
---|
710 | }
|
---|
711 | cerr << "Options done.\n" << flush;
|
---|
712 | #endif // _DEBUG_PARAMS
|
---|
713 | }
|
---|
714 |
|
---|
715 |
|
---|
716 | char *
|
---|
717 | Environment::ParseString(char *buffer, char *string) const
|
---|
718 | {
|
---|
719 | char *s = buffer;
|
---|
720 | char *t = string + strlen(string);
|
---|
721 |
|
---|
722 | // skip leading whitespaces
|
---|
723 | while (*s == ' ' || *s == '\t')
|
---|
724 | s++;
|
---|
725 | if (*s == '\0')
|
---|
726 | return NULL;
|
---|
727 | while ((*s >= 'a' && *s <= 'z') ||
|
---|
728 | (*s >= 'A' && *s <= 'Z') ||
|
---|
729 | (*s >= '0' && *s <= '9') ||
|
---|
730 | *s == '_')
|
---|
731 | *t++ = *s++;
|
---|
732 | *t = '\0';
|
---|
733 | // skip trailing whitespaces
|
---|
734 | while (*s == ' ' || *s == '\t')
|
---|
735 | s++;
|
---|
736 | return s;
|
---|
737 | }
|
---|
738 |
|
---|
739 | const char code[] = "JIDHipewhfdhyd74387hHO&{WK:DOKQEIDKJPQ*H#@USX:#FWCQ*EJMQAHPQP(@G#RD";
|
---|
740 |
|
---|
741 | void
|
---|
742 | Environment::DecodeString(char *buff, int max)
|
---|
743 | {
|
---|
744 | buff[max] = 0;
|
---|
745 | char *p = buff;
|
---|
746 | const char *cp = code;
|
---|
747 | for (; *p; p++) {
|
---|
748 | if (*p != '\n')
|
---|
749 | *p = *p ^ *cp;
|
---|
750 | ++cp;
|
---|
751 | if (*cp == 0)
|
---|
752 | cp = code;
|
---|
753 | }
|
---|
754 | }
|
---|
755 |
|
---|
756 | void
|
---|
757 | Environment::CodeString(char *buff, int max)
|
---|
758 | {
|
---|
759 | buff[max] = 0;
|
---|
760 | char *p = buff;
|
---|
761 | const char *cp = code;
|
---|
762 | for (; *p; p++) {
|
---|
763 | if (*p != '\n')
|
---|
764 | *p = *p ^ *cp;
|
---|
765 | ++cp;
|
---|
766 | if (*cp == 0)
|
---|
767 | cp = code;
|
---|
768 | }
|
---|
769 | }
|
---|
770 |
|
---|
771 | void
|
---|
772 | Environment::SaveCodedFile(char *filenameText,
|
---|
773 | char *filenameCoded)
|
---|
774 | {
|
---|
775 | ifstream envStream(filenameText);
|
---|
776 |
|
---|
777 | // some error had occured
|
---|
778 | if (envStream.fail()) {
|
---|
779 | cerr << "Error: Can't open file " << filenameText << " for reading (err. "
|
---|
780 | << envStream.rdstate() << ").\n";
|
---|
781 | return;
|
---|
782 | }
|
---|
783 | char buff[256];
|
---|
784 | envStream.getline(buff, 255);
|
---|
785 | buff[8] = 0;
|
---|
786 | if (strcmp(buff, "CGX_CF10") == 0)
|
---|
787 | return;
|
---|
788 |
|
---|
789 | ofstream cStream(filenameCoded);
|
---|
790 | cStream<<"CGX_CF10";
|
---|
791 |
|
---|
792 | // main loop
|
---|
793 | for (;;) {
|
---|
794 | // read in one line
|
---|
795 | envStream.getline(buff, 255);
|
---|
796 | if (!envStream)
|
---|
797 | break;
|
---|
798 | CodeString(buff, 255);
|
---|
799 | cStream<<buff;
|
---|
800 | }
|
---|
801 |
|
---|
802 | }
|
---|
803 |
|
---|
804 | bool
|
---|
805 | Environment::ReadEnvFile(const char *envFilename)
|
---|
806 | {
|
---|
807 | char buff[MaxStringLength], name[MaxStringLength];
|
---|
808 | char *s, *t;
|
---|
809 | int i, line = 0;
|
---|
810 | bool found;
|
---|
811 | igzstream envStream(envFilename);
|
---|
812 |
|
---|
813 | // some error had occured
|
---|
814 | if (envStream.fail()) {
|
---|
815 | cerr << "Error: Can't open file " << envFilename << " for reading (err. "
|
---|
816 | << envStream.rdstate() << ").\n";
|
---|
817 | return false;
|
---|
818 | }
|
---|
819 |
|
---|
820 | name[0] = '\0';
|
---|
821 |
|
---|
822 | // bool coded;
|
---|
823 | // envStream.getline(buff, 255);
|
---|
824 | // buff[8] = 0;
|
---|
825 | // if (strcmp(buff, "CGX_CF10") == 0)
|
---|
826 | // coded = true;
|
---|
827 | // else {
|
---|
828 | // coded = false;
|
---|
829 | // envStream.Rewind();
|
---|
830 | // }
|
---|
831 |
|
---|
832 | // main loop
|
---|
833 | for (;;) {
|
---|
834 | // read in one line
|
---|
835 | envStream.getline(buff, 255);
|
---|
836 |
|
---|
837 | if (!envStream)
|
---|
838 | break;
|
---|
839 |
|
---|
840 | // if (coded)
|
---|
841 | // DecodeString(buff, 255);
|
---|
842 |
|
---|
843 | line++;
|
---|
844 | // get rid of comments
|
---|
845 | s = strchr(buff, '#');
|
---|
846 | if (s != NULL)
|
---|
847 | *s = '\0';
|
---|
848 |
|
---|
849 | // get one identifier
|
---|
850 | s = ParseString(buff, name);
|
---|
851 | // parse line
|
---|
852 | while (s != NULL) {
|
---|
853 | // it's a group name - make the full name
|
---|
854 | if (*s == '{') {
|
---|
855 | strcat(name, ".");
|
---|
856 | s++;
|
---|
857 | s = ParseString(s, name);
|
---|
858 | continue;
|
---|
859 | }
|
---|
860 | // end of group
|
---|
861 | if (*s == '}') {
|
---|
862 | if (strlen(name) == 0) {
|
---|
863 | cerr << "Error: unpaired } in " << envFilename << " (line "
|
---|
864 | << line << ").\n";
|
---|
865 | envStream.close();
|
---|
866 | return false;
|
---|
867 | }
|
---|
868 | name[strlen(name) - 1] = '\0';
|
---|
869 | t = strrchr(name, '.');
|
---|
870 | if (t == NULL)
|
---|
871 | name[0] = '\0';
|
---|
872 | else
|
---|
873 | *(t + 1) = '\0';
|
---|
874 | s++;
|
---|
875 | s = ParseString(s, name);
|
---|
876 | continue;
|
---|
877 | }
|
---|
878 | // find variable name in the table
|
---|
879 | found = false;
|
---|
880 | for (i = 0; i < numOptions; i++)
|
---|
881 | if (!strcmp(name, options[i].name)) {
|
---|
882 | found = true;
|
---|
883 | break;
|
---|
884 | }
|
---|
885 | if (!found) {
|
---|
886 | cerr << "Warning: unknown option " << name << " in environment file "
|
---|
887 | << envFilename << " (line " << line << ").\n";
|
---|
888 | } else
|
---|
889 | switch (options[i].type) {
|
---|
890 | case optInt: {
|
---|
891 | strtol(s, &t, 10);
|
---|
892 | if (t == s || (*t != ' ' && *t != '\t' &&
|
---|
893 | *t != '\0' && *t != '}')) {
|
---|
894 | cerr << "Error: Mismatch in int variable " << name << " in "
|
---|
895 | << "environment file " << envFilename << " (line "
|
---|
896 | << line << ").\n";
|
---|
897 | envStream.close();
|
---|
898 | return false;
|
---|
899 | }
|
---|
900 | if (options[i].value != NULL)
|
---|
901 | delete options[i].value;
|
---|
902 | options[i].value = new char[t - s + 1];
|
---|
903 | strncpy(options[i].value, s, t - s);
|
---|
904 | options[i].value[t - s] = '\0';
|
---|
905 | s = t;
|
---|
906 | break;
|
---|
907 | }
|
---|
908 | case optFloat: {
|
---|
909 | strtod(s, &t);
|
---|
910 | if (t == s || (*t != ' ' && *t != '\t' &&
|
---|
911 | *t != '\0' && *t != '}')) {
|
---|
912 | cerr << "Error: Mismatch in Real variable " << name << " in "
|
---|
913 | << "environment file " << envFilename << " (line "
|
---|
914 | << line << ").\n";
|
---|
915 | envStream.close();
|
---|
916 | return false;
|
---|
917 | }
|
---|
918 | if (options[i].value != NULL)
|
---|
919 | delete options[i].value;
|
---|
920 | options[i].value = new char[t - s + 1];
|
---|
921 | strncpy(options[i].value, s, t - s);
|
---|
922 | options[i].value[t - s] = '\0';
|
---|
923 | s = t;
|
---|
924 | break;
|
---|
925 | }
|
---|
926 | case optBool: {
|
---|
927 | t = s;
|
---|
928 | while ((*t >= 'a' && *t <= 'z') ||
|
---|
929 | (*t >= 'A' && *t <= 'Z') ||
|
---|
930 | *t == '+' || *t == '-')
|
---|
931 | t++;
|
---|
932 | if (((!strncasecmp(s, "true", t - s) && t - s == 4) ||
|
---|
933 | (!strncasecmp(s, "false", t - s) && t - s == 5) ||
|
---|
934 | (!strncasecmp(s, "YES", t -s) && t - s == 3) ||
|
---|
935 | (!strncasecmp(s, "NO", t - s) && t - s == 2) ||
|
---|
936 | (!strncasecmp(s, "ON", t - s) && t - s == 2) ||
|
---|
937 | (!strncasecmp(s, "OFF", t - s) && t - s == 3) ||
|
---|
938 | (t - s == 1 && (*s == '+' || *s == '-'))) &&
|
---|
939 | (*t == ' ' || *t == '\t' || *t == '\0' || *t == '}')) {
|
---|
940 | if (options[i].value != NULL)
|
---|
941 | delete options[i].value;
|
---|
942 | options[i].value = new char[t - s + 1];
|
---|
943 | strncpy(options[i].value, s, t - s);
|
---|
944 | options[i].value[t - s] = '\0';
|
---|
945 | s = t;
|
---|
946 | }
|
---|
947 | else {
|
---|
948 | cerr << "Error: Mismatch in bool variable " << name << " in "
|
---|
949 | << "environment file " << envFilename << " (line "
|
---|
950 | << line << ").\n";
|
---|
951 | envStream.close();
|
---|
952 | return false;
|
---|
953 | }
|
---|
954 | break;
|
---|
955 | }
|
---|
956 | case optVector:{
|
---|
957 | strtod(s, &t);
|
---|
958 | if (*t == ' ' || *t == '\t') {
|
---|
959 | while (*t == ' ' || *t == '\t')
|
---|
960 | t++;
|
---|
961 | if (*t != ',')
|
---|
962 | t--;
|
---|
963 | }
|
---|
964 | if (t == s || (*t != ' ' && *t != '\t' && *t != ',')) {
|
---|
965 | cerr << "Error: Mismatch in vector variable " << name << " in "
|
---|
966 | << "environment file " << envFilename << " (line "
|
---|
967 | << line << ").\n";
|
---|
968 | envStream.close();
|
---|
969 | return false;
|
---|
970 | }
|
---|
971 | char *u;
|
---|
972 | strtod(t, &u);
|
---|
973 | t = u;
|
---|
974 | if (*t == ' ' || *t == '\t') {
|
---|
975 | while (*t == ' ' || *t == '\t')
|
---|
976 | t++;
|
---|
977 | if (*t != ',')
|
---|
978 | t--;
|
---|
979 | }
|
---|
980 | if (t == s || (*t != ' ' && *t != '\t' && *t != ',')) {
|
---|
981 | cerr << "Error: Mismatch in vector variable " << name << " in "
|
---|
982 | << "environment file " << envFilename << " (line "
|
---|
983 | << line << ").\n";
|
---|
984 | envStream.close();
|
---|
985 | return false;
|
---|
986 | }
|
---|
987 | strtod(t, &u);
|
---|
988 | t = u;
|
---|
989 | if (t == s || (*t != ' ' && *t != '\t' &&
|
---|
990 | *t != '\0' && *t != '}')) {
|
---|
991 | cerr << "Error: Mismatch in vector variable " << name << " in "
|
---|
992 | << "environment file " << envFilename << " (line "
|
---|
993 | << line << ").\n";
|
---|
994 | envStream.close();
|
---|
995 | return false;
|
---|
996 | }
|
---|
997 | if (options[i].value != NULL)
|
---|
998 | delete options[i].value;
|
---|
999 | options[i].value = new char[t - s + 1];
|
---|
1000 | strncpy(options[i].value, s, t - s);
|
---|
1001 | options[i].value[t - s] = '\0';
|
---|
1002 | s = t;
|
---|
1003 | break;
|
---|
1004 | }
|
---|
1005 | case optString: {
|
---|
1006 | if (options[i].value != NULL)
|
---|
1007 | delete options[i].value;
|
---|
1008 | options[i].value = new char[strlen(s) + 1];
|
---|
1009 | strcpy(options[i].value, s);
|
---|
1010 | s += strlen(s);
|
---|
1011 | break;
|
---|
1012 | }
|
---|
1013 | default: {
|
---|
1014 | Debug << "Internal error: Unknown type of option.\n" << flush;
|
---|
1015 | exit(1);
|
---|
1016 | }
|
---|
1017 | }
|
---|
1018 | // prepare the variable name for next pass
|
---|
1019 | t = strrchr(name, '.');
|
---|
1020 | if (t == NULL)
|
---|
1021 | name[0] = '\0';
|
---|
1022 | else
|
---|
1023 | *(t + 1) = '\0';
|
---|
1024 | // get next identifier
|
---|
1025 | s = ParseString(s, name);
|
---|
1026 | }
|
---|
1027 | }
|
---|
1028 | envStream.close();
|
---|
1029 | return true;
|
---|
1030 | }
|
---|
1031 |
|
---|
1032 | void
|
---|
1033 | Environment::PrintUsage(ostream &s) const
|
---|
1034 | {
|
---|
1035 | // Print out all environment variable names
|
---|
1036 | s << "Registered options:\n";
|
---|
1037 | for (int j = 0; j < numOptions; j++)
|
---|
1038 | s << options[j] << "\n";
|
---|
1039 | s << flush;
|
---|
1040 | }
|
---|
1041 |
|
---|
1042 | /**
|
---|
1043 | Input scene filename. Currently simplified X3D (.x3d), Unigraphics (.dat),
|
---|
1044 | and UNC (.ply) formats are supported.
|
---|
1045 | */
|
---|
1046 |
|
---|
1047 | Environment::Environment()
|
---|
1048 | {
|
---|
1049 | optionalParams = NULL;
|
---|
1050 | paramRows = 0;
|
---|
1051 | numParams = 0;
|
---|
1052 | params = NULL;
|
---|
1053 | maxOptions = 500;
|
---|
1054 |
|
---|
1055 |
|
---|
1056 | // this is maximal nuber of options.
|
---|
1057 | numOptions = 0;
|
---|
1058 |
|
---|
1059 | options = new COption[maxOptions];
|
---|
1060 |
|
---|
1061 | if (options == NULL ) {
|
---|
1062 | Debug << "Error: Memory allocation failed.\n";
|
---|
1063 | exit(1);
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | // register all basic options
|
---|
1067 |
|
---|
1068 | RegisterOption("Limits.threshold", optFloat, NULL, "0.01");
|
---|
1069 | RegisterOption("Limits.small", optFloat, NULL, "1e-6");
|
---|
1070 | RegisterOption("Limits.infinity", optFloat, NULL, "1e6");
|
---|
1071 |
|
---|
1072 | RegisterOption("Scene.filename",
|
---|
1073 | optString,
|
---|
1074 | "scene_filename=",
|
---|
1075 | "atlanta2.x3d");
|
---|
1076 |
|
---|
1077 |
|
---|
1078 | RegisterOption("Unigraphics.meshGrouping",
|
---|
1079 | optInt,
|
---|
1080 | "unigraphics_mesh_grouping=",
|
---|
1081 | "0");
|
---|
1082 |
|
---|
1083 |
|
---|
1084 | RegisterOption("KdTree.Termination.minCost",
|
---|
1085 | optInt,
|
---|
1086 | "kd_term_min_cost=",
|
---|
1087 | "10");
|
---|
1088 |
|
---|
1089 | RegisterOption("KdTree.Termination.maxNodes",
|
---|
1090 | optInt,
|
---|
1091 | "kd_term_max_nodes=",
|
---|
1092 | "200000");
|
---|
1093 |
|
---|
1094 | RegisterOption("KdTree.Termination.maxDepth",
|
---|
1095 | optInt,
|
---|
1096 | "kd_term_max_depth=",
|
---|
1097 | "20");
|
---|
1098 |
|
---|
1099 | RegisterOption("KdTree.Termination.maxCostRatio",
|
---|
1100 | optFloat,
|
---|
1101 | "kd_term_max_cost_ratio=",
|
---|
1102 | "1.5");
|
---|
1103 |
|
---|
1104 | RegisterOption("KdTree.Termination.ct_div_ci",
|
---|
1105 | optFloat,
|
---|
1106 | "kd_term_ct_div_ci=",
|
---|
1107 | "1.0");
|
---|
1108 |
|
---|
1109 | RegisterOption("KdTree.splitMethod",
|
---|
1110 | optString,
|
---|
1111 | "kd_split_method=",
|
---|
1112 | "spatialMedian");
|
---|
1113 |
|
---|
1114 | RegisterOption("KdTree.splitBorder",
|
---|
1115 | optFloat,
|
---|
1116 | "kd_split_border=",
|
---|
1117 | "0.1");
|
---|
1118 |
|
---|
1119 | RegisterOption("KdTree.sahUseFaces",
|
---|
1120 | optBool,
|
---|
1121 | "kd_sah_use_faces=",
|
---|
1122 | "true");
|
---|
1123 |
|
---|
1124 |
|
---|
1125 | RegisterOption("MeshKdTree.Termination.minCost",
|
---|
1126 | optInt,
|
---|
1127 | "kd_term_min_cost=",
|
---|
1128 | "10");
|
---|
1129 |
|
---|
1130 | RegisterOption("MeshKdTree.Termination.maxDepth",
|
---|
1131 | optInt,
|
---|
1132 | "kd_term_max_depth=",
|
---|
1133 | "20");
|
---|
1134 |
|
---|
1135 | RegisterOption("MeshKdTree.Termination.maxCostRatio",
|
---|
1136 | optFloat,
|
---|
1137 | "kd_term_max_cost_ratio=",
|
---|
1138 | "1.5");
|
---|
1139 |
|
---|
1140 | RegisterOption("MeshKdTree.Termination.ct_div_ci",
|
---|
1141 | optFloat,
|
---|
1142 | "kd_term_ct_div_ci=",
|
---|
1143 | "1.0");
|
---|
1144 |
|
---|
1145 | RegisterOption("MeshKdTree.splitMethod",
|
---|
1146 | optString,
|
---|
1147 | "kd_split_method=",
|
---|
1148 | "spatialMedian");
|
---|
1149 |
|
---|
1150 | RegisterOption("MeshKdTree.splitBorder",
|
---|
1151 | optFloat,
|
---|
1152 | "kd_split_border=",
|
---|
1153 | "0.1");
|
---|
1154 |
|
---|
1155 | RegisterOption("SamplingPreprocessor.totalSamples",
|
---|
1156 | optInt,
|
---|
1157 | "total_samples=",
|
---|
1158 | "1000000");
|
---|
1159 |
|
---|
1160 | RegisterOption("SamplingPreprocessor.samplesPerPass",
|
---|
1161 | optInt,
|
---|
1162 | "samples_per_pass=",
|
---|
1163 | "10");
|
---|
1164 |
|
---|
1165 | RegisterOption("RenderSampler.samples",
|
---|
1166 | optInt,
|
---|
1167 | "render_sampler_samples=",
|
---|
1168 | "1000");
|
---|
1169 |
|
---|
1170 | RegisterOption("VssPreprocessor.initialSamples",
|
---|
1171 | optInt,
|
---|
1172 | "initial_samples=",
|
---|
1173 | "100000");
|
---|
1174 |
|
---|
1175 | RegisterOption("VssPreprocessor.testBeamSampling", optBool, "beam_sampling", "false");
|
---|
1176 |
|
---|
1177 | RegisterOption("VssPreprocessor.vssSamples",
|
---|
1178 | optInt,
|
---|
1179 | "vss_samples=",
|
---|
1180 | "1000000");
|
---|
1181 |
|
---|
1182 | RegisterOption("VssPreprocessor.vssSamplesPerPass",
|
---|
1183 | optInt,
|
---|
1184 | "vss_samples_per_pass=",
|
---|
1185 | "1000");
|
---|
1186 |
|
---|
1187 | RegisterOption("VssPreprocessor.samplesPerPass",
|
---|
1188 | optInt,
|
---|
1189 | "samples_per_pass=",
|
---|
1190 | "100000");
|
---|
1191 |
|
---|
1192 | RegisterOption("VssPreprocessor.useImportanceSampling",
|
---|
1193 | optBool,
|
---|
1194 | "vss_use_importance=",
|
---|
1195 | "true");
|
---|
1196 |
|
---|
1197 | RegisterOption("VssPreprocessor.enlargeViewSpace",
|
---|
1198 | optBool,
|
---|
1199 | "vss_enlarge_viewspace=",
|
---|
1200 | "false");
|
---|
1201 |
|
---|
1202 | RegisterOption("VssPreprocessor.loadInitialSamples",
|
---|
1203 | optBool,
|
---|
1204 | "vss_load_loadInitialSamples=",
|
---|
1205 | "false");
|
---|
1206 |
|
---|
1207 | RegisterOption("VssPreprocessor.storeInitialSamples",
|
---|
1208 | optBool,
|
---|
1209 | "vss_store_storedInitialSamples=",
|
---|
1210 | "false");
|
---|
1211 |
|
---|
1212 |
|
---|
1213 | RegisterOption("VssPreprocessor.useViewSpaceBox",
|
---|
1214 | optBool,
|
---|
1215 | "vss_use_viewspace_box=",
|
---|
1216 | "false");
|
---|
1217 |
|
---|
1218 |
|
---|
1219 | /************************************************************************************/
|
---|
1220 | /* View cells related options */
|
---|
1221 | /************************************************************************************/
|
---|
1222 |
|
---|
1223 |
|
---|
1224 | RegisterOption("ViewCells.type",
|
---|
1225 | optString,
|
---|
1226 | "view_cells_type=",
|
---|
1227 | "vspBspTree");
|
---|
1228 |
|
---|
1229 | RegisterOption("ViewCells.samplingType",
|
---|
1230 | optString,
|
---|
1231 | "view_cells_sampling_type=",
|
---|
1232 | "box");
|
---|
1233 |
|
---|
1234 | RegisterOption("ViewCells.mergeStats",
|
---|
1235 | optString,
|
---|
1236 | "view_cells_merge_stats=",
|
---|
1237 | "mergeStats.log");
|
---|
1238 |
|
---|
1239 | RegisterOption("ViewCells.Evaluation.statsPrefix",
|
---|
1240 | optString,
|
---|
1241 | "view_cells_evaluation_stats_prefix=",
|
---|
1242 | "viewCells");
|
---|
1243 |
|
---|
1244 | RegisterOption("ViewCells.Evaluation.histogram",
|
---|
1245 | optBool,
|
---|
1246 | "view_cells_evaluation_histogram=",
|
---|
1247 | "false");
|
---|
1248 |
|
---|
1249 | RegisterOption("ViewCells.Evaluation.histoPasses",
|
---|
1250 | optInt,
|
---|
1251 | "view_cells_evaluation_histo_passes=",
|
---|
1252 | "5000");
|
---|
1253 |
|
---|
1254 | RegisterOption("ViewCells.renderCostEvaluationType",
|
---|
1255 | optString,
|
---|
1256 | "view_cells_render_cost_evaluation=",
|
---|
1257 | "perobject");
|
---|
1258 |
|
---|
1259 | RegisterOption("ViewCells.active",
|
---|
1260 | optInt,
|
---|
1261 | "view_cells_active=",
|
---|
1262 | "1000");
|
---|
1263 |
|
---|
1264 | RegisterOption("ViewCells.Construction.samples",
|
---|
1265 | optInt,
|
---|
1266 | "view_cells_construction_samples=",
|
---|
1267 | "5000000");
|
---|
1268 |
|
---|
1269 | RegisterOption("ViewCells.Construction.samplesPerPass",
|
---|
1270 | optInt,
|
---|
1271 | "view_cells_construction_samples_per_pass=",
|
---|
1272 | "500000");
|
---|
1273 |
|
---|
1274 | RegisterOption("ViewCells.PostProcess.samples",
|
---|
1275 | optInt,
|
---|
1276 | "view_cells_post_process_samples=",
|
---|
1277 | "200000");
|
---|
1278 |
|
---|
1279 | RegisterOption("ViewCells.Visualization.samples",
|
---|
1280 | optInt,
|
---|
1281 | "view_cells_visualization_samples=",
|
---|
1282 | "20000");
|
---|
1283 |
|
---|
1284 | RegisterOption("ViewCells.Filter.maxSize",
|
---|
1285 | optInt,
|
---|
1286 | "view_cells_filter_max_size=",
|
---|
1287 | "4");
|
---|
1288 |
|
---|
1289 | RegisterOption("ViewCells.Filter.width",
|
---|
1290 | optFloat,
|
---|
1291 | "view_cells_filter_width=",
|
---|
1292 | "200.0");
|
---|
1293 |
|
---|
1294 | RegisterOption("ViewCells.loadFromFile",
|
---|
1295 | optBool,
|
---|
1296 | "view_cells_load_from_file=",
|
---|
1297 | "false");
|
---|
1298 |
|
---|
1299 | RegisterOption("ViewCells.PostProcess.refine",
|
---|
1300 | optBool,
|
---|
1301 | "view_cells_refine=",
|
---|
1302 | "false");
|
---|
1303 |
|
---|
1304 | RegisterOption("ViewCells.PostProcess.compress",
|
---|
1305 | optBool,
|
---|
1306 | "view_cells_post_process_compress=",
|
---|
1307 | "false");
|
---|
1308 |
|
---|
1309 | RegisterOption("ViewCells.Evaluation.samples",
|
---|
1310 | optInt,
|
---|
1311 | "view_cells_evaluation_samples=",
|
---|
1312 | "8000000");
|
---|
1313 |
|
---|
1314 | RegisterOption("ViewCells.Evaluation.samplingType",
|
---|
1315 | optString,
|
---|
1316 | "view_cells_evaluation_sampling_type=",
|
---|
1317 | "box");
|
---|
1318 |
|
---|
1319 | RegisterOption("ViewCells.Evaluation.samplesPerPass",
|
---|
1320 | optInt,
|
---|
1321 | "view_cells_evaluation_samples_per_pass=",
|
---|
1322 | "300000");
|
---|
1323 |
|
---|
1324 | RegisterOption("ViewCells.exportToFile",
|
---|
1325 | optBool,
|
---|
1326 | "view_cells_export_to_file=",
|
---|
1327 | "false");
|
---|
1328 |
|
---|
1329 | RegisterOption("ViewCells.exportPvs",
|
---|
1330 | optBool,
|
---|
1331 | "view_cells_export_pvs=",
|
---|
1332 | "false");
|
---|
1333 |
|
---|
1334 | RegisterOption("ViewCells.exportBboxesForPvs",
|
---|
1335 | optBool,
|
---|
1336 | "view_cells_export_bounding_boxes=",
|
---|
1337 | "true");
|
---|
1338 |
|
---|
1339 | RegisterOption("ViewCells.boxesFilename",
|
---|
1340 | optString,
|
---|
1341 | "view_cells_boxes_filename=",
|
---|
1342 | "boxes.out");
|
---|
1343 |
|
---|
1344 | RegisterOption("ViewCells.PostProcess.emptyViewCellsMerge",
|
---|
1345 | optBool,
|
---|
1346 | "view_cells_merge_empty=",
|
---|
1347 | "true");
|
---|
1348 |
|
---|
1349 | RegisterOption("ViewCells.evaluateViewCells",
|
---|
1350 | optBool,
|
---|
1351 | "view_cells_evaluate=",
|
---|
1352 | "false");
|
---|
1353 |
|
---|
1354 | RegisterOption("ViewCells.maxViewCells",
|
---|
1355 | optInt,
|
---|
1356 | "view_cells_max_view_cells=",
|
---|
1357 | "0");
|
---|
1358 |
|
---|
1359 | RegisterOption("ViewCells.maxPvsRatio",
|
---|
1360 | optFloat,
|
---|
1361 | "view_cells_max_pvs_ratio=",
|
---|
1362 | "0.1");
|
---|
1363 |
|
---|
1364 | RegisterOption("ViewCells.filename",
|
---|
1365 | optString,
|
---|
1366 | "view_cells_filename=",
|
---|
1367 | "atlanta_viewcells_large.x3d");
|
---|
1368 |
|
---|
1369 | RegisterOption("ViewCells.height",
|
---|
1370 | optFloat,
|
---|
1371 | "view_cells_height=",
|
---|
1372 | "5.0");
|
---|
1373 |
|
---|
1374 | RegisterOption("ViewCells.Visualization.colorCode",
|
---|
1375 | optString,
|
---|
1376 | "view_cells_visualization_color_code=",
|
---|
1377 | "PVS");
|
---|
1378 |
|
---|
1379 | RegisterOption("ViewCells.Visualization.clipPlanePos",
|
---|
1380 | optFloat,
|
---|
1381 | "view_cells_visualization_clip_plane_pos=",
|
---|
1382 | "0.35");
|
---|
1383 |
|
---|
1384 | RegisterOption("ViewCells.Visualization.exportGeometry",
|
---|
1385 | optBool,
|
---|
1386 | "view_cells_visualization_export_geometry=",
|
---|
1387 | "false");
|
---|
1388 |
|
---|
1389 | RegisterOption("ViewCells.Visualization.exportRays",
|
---|
1390 | optBool,
|
---|
1391 | "view_cells_visualization_export_rays=",
|
---|
1392 | "false");
|
---|
1393 |
|
---|
1394 | RegisterOption("ViewCells.pruneEmptyViewCells",
|
---|
1395 | optBool,
|
---|
1396 | "view_cells_prune_empty=",
|
---|
1397 | "false");
|
---|
1398 |
|
---|
1399 | RegisterOption("ViewCells.processOnlyValidViewCells",
|
---|
1400 | optBool,
|
---|
1401 | "view_cells_process_only_valid_view_cells=",
|
---|
1402 | "false");
|
---|
1403 |
|
---|
1404 |
|
---|
1405 | RegisterOption("ViewCells.PostProcess.maxCostRatio",
|
---|
1406 | optFloat,
|
---|
1407 | "view_cells_post_process_max_cost_ratio=",
|
---|
1408 | "0.9");
|
---|
1409 |
|
---|
1410 | RegisterOption("ViewCells.PostProcess.renderCostWeight",
|
---|
1411 | optFloat,
|
---|
1412 | "view_cells_post_process_render_cost_weight",
|
---|
1413 | "0.5");
|
---|
1414 |
|
---|
1415 | RegisterOption("ViewCells.PostProcess.avgCostMaxDeviation",
|
---|
1416 | optFloat,
|
---|
1417 | "vsp_bsp_avgcost_max_deviations",
|
---|
1418 | "0.5");
|
---|
1419 |
|
---|
1420 | RegisterOption("ViewCells.PostProcess.maxMergesPerPass",
|
---|
1421 | optInt,
|
---|
1422 | "view_cells_post_process_max_merges_per_pass=",
|
---|
1423 | "500");
|
---|
1424 |
|
---|
1425 | RegisterOption("ViewCells.PostProcess.minViewCells",
|
---|
1426 | optInt,
|
---|
1427 | "view_cells_post_process_min_view_cells=",
|
---|
1428 | "1000");
|
---|
1429 |
|
---|
1430 | RegisterOption("ViewCells.PostProcess.useRaysForMerge",
|
---|
1431 | optBool,
|
---|
1432 | "view_cells_post_process_use_rays_for_merge=",
|
---|
1433 | "false");
|
---|
1434 |
|
---|
1435 | RegisterOption("ViewCells.PostProcess.merge",
|
---|
1436 | optBool,
|
---|
1437 | "view_cells_post_process_merge=",
|
---|
1438 | "true");
|
---|
1439 |
|
---|
1440 | RegisterOption("ViewCells.Visualization.exportMergedViewCells",
|
---|
1441 | optBool,
|
---|
1442 | "view_cells_viz_export_merged_viewcells=",
|
---|
1443 | "false");
|
---|
1444 |
|
---|
1445 | RegisterOption("ViewCells.maxStaticMemory",
|
---|
1446 | optFloat,
|
---|
1447 | "view_cells_max_static_mem=",
|
---|
1448 | "8.0");
|
---|
1449 |
|
---|
1450 | RegisterOption("ViewCells.Visualization.useClipPlane",
|
---|
1451 | optBool,
|
---|
1452 | "view_cells_viz_use_clip_plane=",
|
---|
1453 | "false");
|
---|
1454 |
|
---|
1455 | RegisterOption("ViewCells.showVisualization",
|
---|
1456 | optBool,
|
---|
1457 | "view_cells_show_visualization=",
|
---|
1458 | "false");
|
---|
1459 |
|
---|
1460 | RegisterOption("ViewCells.Visualization.clipPlaneAxis",
|
---|
1461 | optInt,
|
---|
1462 | "view_cells_viz_clip_plane_axis=",
|
---|
1463 | "0");
|
---|
1464 |
|
---|
1465 |
|
---|
1466 | /************************************************************************************/
|
---|
1467 | /* Render simulation related options */
|
---|
1468 | /************************************************************************************/
|
---|
1469 |
|
---|
1470 |
|
---|
1471 | RegisterOption("Simulation.objRenderCost",
|
---|
1472 | optFloat,
|
---|
1473 | "simulation_obj_render_cost",
|
---|
1474 | "1.0");
|
---|
1475 |
|
---|
1476 | RegisterOption("Simulation.vcOverhead",
|
---|
1477 | optFloat,
|
---|
1478 | "simulation_vc_overhead",
|
---|
1479 | "0.05");
|
---|
1480 |
|
---|
1481 | RegisterOption("Simulation.moveSpeed",
|
---|
1482 | optFloat,
|
---|
1483 | "simulation_moveSpeed",
|
---|
1484 | "1.0");
|
---|
1485 |
|
---|
1486 |
|
---|
1487 |
|
---|
1488 |
|
---|
1489 | /************************************************************************************/
|
---|
1490 | /* Bsp tree related options */
|
---|
1491 | /************************************************************************************/
|
---|
1492 |
|
---|
1493 |
|
---|
1494 | RegisterOption("BspTree.Construction.input",
|
---|
1495 | optString,
|
---|
1496 | "bsp_construction_input=",
|
---|
1497 | "fromViewCells");
|
---|
1498 |
|
---|
1499 | RegisterOption("BspTree.subdivisionStats",
|
---|
1500 | optString,
|
---|
1501 | "bsp_subdivision_stats=",
|
---|
1502 | "bspSubdivisionStats.log");
|
---|
1503 |
|
---|
1504 | RegisterOption("BspTree.Construction.samples",
|
---|
1505 | optInt,
|
---|
1506 | "bsp_construction_samples=",
|
---|
1507 | "100000");
|
---|
1508 |
|
---|
1509 | RegisterOption("BspTree.Construction.epsilon",
|
---|
1510 | optFloat,
|
---|
1511 | "bsp_construction_side_tolerance=",
|
---|
1512 | "0.002");
|
---|
1513 |
|
---|
1514 | RegisterOption("BspTree.Termination.minPolygons",
|
---|
1515 | optInt,
|
---|
1516 | "bsp_term_min_polygons=",
|
---|
1517 | "5");
|
---|
1518 |
|
---|
1519 | RegisterOption("BspTree.Termination.minPvs",
|
---|
1520 | optInt,
|
---|
1521 | "bsp_term_min_pvs=",
|
---|
1522 | "20");
|
---|
1523 |
|
---|
1524 | RegisterOption("BspTree.Termination.minProbability",
|
---|
1525 | optFloat,
|
---|
1526 | "bsp_term_min_probability=",
|
---|
1527 | "0.001");
|
---|
1528 |
|
---|
1529 | RegisterOption("BspTree.Termination.maxRayContribution",
|
---|
1530 | optFloat,
|
---|
1531 | "bsp_term_ray_contribution=",
|
---|
1532 | "0.005");
|
---|
1533 |
|
---|
1534 | RegisterOption("BspTree.Termination.minAccRayLenght",
|
---|
1535 | optFloat,
|
---|
1536 | "bsp_term_min_acc_ray_length=",
|
---|
1537 | "50");
|
---|
1538 |
|
---|
1539 | RegisterOption("BspTree.Termination.minRays",
|
---|
1540 | optInt,
|
---|
1541 | "bsp_term_min_rays=",
|
---|
1542 | "-1");
|
---|
1543 |
|
---|
1544 | RegisterOption("BspTree.Termination.ct_div_ci",
|
---|
1545 | optFloat,
|
---|
1546 | "bsp_term_ct_div_ci=",
|
---|
1547 | "0.0");
|
---|
1548 |
|
---|
1549 | RegisterOption("BspTree.Termination.maxDepth",
|
---|
1550 | optInt,
|
---|
1551 | "bsp_term_max_depth=",
|
---|
1552 | "100");
|
---|
1553 |
|
---|
1554 | RegisterOption("BspTree.Termination.maxCostRatio",
|
---|
1555 | optFloat,
|
---|
1556 | "bsp_term_axis_aligned_max_cost_ratio=",
|
---|
1557 | "1.5");
|
---|
1558 |
|
---|
1559 | RegisterOption("BspTree.Termination.AxisAligned.ct_div_ci",
|
---|
1560 | optFloat,
|
---|
1561 | "bsp_term_axis_aligned_ct_div_ci=",
|
---|
1562 | "0.5");
|
---|
1563 |
|
---|
1564 | RegisterOption("BspTree.AxisAligned.splitBorder",
|
---|
1565 | optFloat,
|
---|
1566 | "bsp__axis_aligned_split_border=",
|
---|
1567 | "0.1");
|
---|
1568 |
|
---|
1569 | RegisterOption("BspTree.Termination.AxisAligned.minPolys",
|
---|
1570 | optInt,
|
---|
1571 | "bsp_term_axis_aligned_max_polygons=",
|
---|
1572 | "50");
|
---|
1573 |
|
---|
1574 | RegisterOption("BspTree.Termination.AxisAligned.minObjects",
|
---|
1575 | optInt,
|
---|
1576 | "bsp_term_min_objects=",
|
---|
1577 | "3");
|
---|
1578 |
|
---|
1579 | RegisterOption("BspTree.Termination.AxisAligned.minRays",
|
---|
1580 | optInt,
|
---|
1581 | "bsp_term_axis_aligned_min_rays=",
|
---|
1582 | "-1");
|
---|
1583 |
|
---|
1584 | RegisterOption("BspTree.splitPlaneStrategy",
|
---|
1585 | optString,
|
---|
1586 | "bsp_split_method=",
|
---|
1587 | "leastSplits");
|
---|
1588 |
|
---|
1589 | RegisterOption("BspTree.maxPolyCandidates",
|
---|
1590 | optInt,
|
---|
1591 | "bsp_max_poly_candidates=",
|
---|
1592 | "20");
|
---|
1593 |
|
---|
1594 | RegisterOption("BspTree.maxRayCandidates",
|
---|
1595 | optInt,
|
---|
1596 | "bsp_max_plane_candidates=",
|
---|
1597 | "20");
|
---|
1598 |
|
---|
1599 | RegisterOption("BspTree.maxTests",
|
---|
1600 | optInt,
|
---|
1601 | "bsp_max_tests=",
|
---|
1602 | "5000");
|
---|
1603 |
|
---|
1604 | RegisterOption("BspTree.Termination.maxViewCells",
|
---|
1605 | optInt,
|
---|
1606 | "bsp_max_view_cells=",
|
---|
1607 | "5000");
|
---|
1608 |
|
---|
1609 | RegisterOption("BspTree.Visualization.exportSplits",
|
---|
1610 | optBool,
|
---|
1611 | "bsp_visualization.export_splits",
|
---|
1612 | "false");
|
---|
1613 |
|
---|
1614 | RegisterOption("BspTree.Factor.verticalSplits", optFloat, "bsp_factor_vertical=", "1.0");
|
---|
1615 | RegisterOption("BspTree.Factor.largestPolyArea", optFloat, "bsp_factor_largest_poly=", "1.0");
|
---|
1616 | RegisterOption("BspTree.Factor.blockedRays", optFloat, "bsp_factor_blocked=", "1.0");
|
---|
1617 | RegisterOption("BspTree.Factor.leastSplits", optFloat, "bsp_factor_least_splits=", "1.0");
|
---|
1618 | RegisterOption("BspTree.Factor.balancedPolys", optFloat, "bsp_factor_balanced_polys=", "1.0");
|
---|
1619 | RegisterOption("BspTree.Factor.balancedViewCells", optFloat, "bsp_factor_balanced_view_cells=", "1.0");
|
---|
1620 | RegisterOption("BspTree.Factor.leastRaySplits", optFloat, "bsp_factor_least_ray_splits=", "1.0");
|
---|
1621 | RegisterOption("BspTree.Factor.balancedRays", optFloat, "bsp_factor_balanced_rays=", "1.0");
|
---|
1622 | RegisterOption("BspTree.Factor.pvs", optFloat, "bsp_factor_pvs=", "1.0");
|
---|
1623 |
|
---|
1624 | /************************************************************************************/
|
---|
1625 | /* Preprocessor related options */
|
---|
1626 | /************************************************************************************/
|
---|
1627 |
|
---|
1628 | RegisterOption("Preprocessor.type",
|
---|
1629 | optString,
|
---|
1630 | "preprocessor=",
|
---|
1631 | "sampling");
|
---|
1632 |
|
---|
1633 | RegisterOption("Preprocessor.samplesFilename",
|
---|
1634 | optString,
|
---|
1635 | "preprocessor_samples_filename=",
|
---|
1636 | "rays.out");
|
---|
1637 |
|
---|
1638 | RegisterOption("Preprocessor.loadPolygonsAsMeshes",
|
---|
1639 | optBool,
|
---|
1640 | "loadPolygonsAsMeshes=",
|
---|
1641 | "false");
|
---|
1642 |
|
---|
1643 | RegisterOption("Preprocessor.pvsRenderErrorSamples",
|
---|
1644 | optInt,
|
---|
1645 | "pvsRenderErrorSamples=",
|
---|
1646 | "10000");
|
---|
1647 |
|
---|
1648 |
|
---|
1649 | RegisterOption("Preprocessor.useGlRenderer",
|
---|
1650 | optBool,
|
---|
1651 | "preprocessor_use_gl_renderer=",
|
---|
1652 | "false");
|
---|
1653 |
|
---|
1654 | RegisterOption("Preprocessor.useGlDebugger",
|
---|
1655 | optBool,
|
---|
1656 | "preprocessor_use_gl_debugger=",
|
---|
1657 | "false");
|
---|
1658 |
|
---|
1659 | RegisterOption("Preprocessor.detectEmptyViewSpace",
|
---|
1660 | optBool,
|
---|
1661 | "preprocessor_detect_empty_viewspace=",
|
---|
1662 | "false");
|
---|
1663 |
|
---|
1664 | RegisterOption("Preprocessor.quitOnFinish",
|
---|
1665 | optBool,
|
---|
1666 | "preprocessor_quit_on_finish=",
|
---|
1667 | "true");
|
---|
1668 |
|
---|
1669 | RegisterOption("Preprocessor.computeVisibility",
|
---|
1670 | optBool,
|
---|
1671 | "preprocessor_compute_visibility=",
|
---|
1672 | "true");
|
---|
1673 |
|
---|
1674 | RegisterOption("Preprocessor.exportVisibility",
|
---|
1675 | optBool,
|
---|
1676 | "preprocessor_export_visibility",
|
---|
1677 | "true");
|
---|
1678 |
|
---|
1679 | RegisterOption("Preprocessor.visibilityFile",
|
---|
1680 | optString,
|
---|
1681 | "preprocessor_visibility_file=",
|
---|
1682 | "visibility.xml");
|
---|
1683 |
|
---|
1684 | RegisterOption("Preprocessor.applyVisibilityFilter",
|
---|
1685 | optBool,
|
---|
1686 | "preprocessor_apply_filter",
|
---|
1687 | "true");
|
---|
1688 |
|
---|
1689 | RegisterOption("Preprocessor.applyVisibilitySpatialFilter",
|
---|
1690 | optBool,
|
---|
1691 | "preprocessor_apply_spatial_filter",
|
---|
1692 | "true");
|
---|
1693 |
|
---|
1694 | RegisterOption("Preprocessor.visibilityFilterWidth",
|
---|
1695 | optFloat,
|
---|
1696 | "preprocessor_visibility_filter_width=",
|
---|
1697 | "0.02");
|
---|
1698 |
|
---|
1699 |
|
---|
1700 |
|
---|
1701 |
|
---|
1702 | /**************************************************************************************/
|
---|
1703 | /* View space partition KD tree related options */
|
---|
1704 | /**************************************************************************************/
|
---|
1705 |
|
---|
1706 | RegisterOption("VspKdTree.Construction.samples",
|
---|
1707 | optInt,
|
---|
1708 | "vsp_kd_construction_samples=",
|
---|
1709 | "100000");
|
---|
1710 |
|
---|
1711 | RegisterOption("VspKdTree.Termination.maxDepth",
|
---|
1712 | optInt,
|
---|
1713 | "vsp_term_maxdepth=", "30");
|
---|
1714 |
|
---|
1715 | RegisterOption("VspKdTree.Termination.minPvs",
|
---|
1716 | optInt,
|
---|
1717 | "vsp_minpvs=",
|
---|
1718 | "1");
|
---|
1719 |
|
---|
1720 | RegisterOption("VspKdTree.Termination.minRays",
|
---|
1721 | optInt,
|
---|
1722 | "vsp_term_minrays=",
|
---|
1723 | "10");
|
---|
1724 |
|
---|
1725 | RegisterOption("VspKdTree.Termination.minSize",
|
---|
1726 | optFloat,
|
---|
1727 | "vsp_term_minsize=",
|
---|
1728 | "0.001");
|
---|
1729 |
|
---|
1730 | RegisterOption("VspKdTree.Termination.maxCostRatio",
|
---|
1731 | optFloat,
|
---|
1732 | "vsp_term_maxcost=",
|
---|
1733 | "0.95");
|
---|
1734 |
|
---|
1735 | RegisterOption("VspKdTree.Termination.maxRayContribution",
|
---|
1736 | optFloat,
|
---|
1737 | "vsp_term_max_ray_contrib=",
|
---|
1738 | "0.5");
|
---|
1739 |
|
---|
1740 | RegisterOption("VspKdTree.epsilon",
|
---|
1741 | optFloat,
|
---|
1742 | "kd_eps=",
|
---|
1743 | "1e-6");
|
---|
1744 |
|
---|
1745 | RegisterOption("VspKdTree.ct_div_ci",
|
---|
1746 | optFloat,
|
---|
1747 | "vsp_ctdivci=", "1.0");
|
---|
1748 |
|
---|
1749 | RegisterOption("VspKdTree.splitType",
|
---|
1750 | optString,
|
---|
1751 | "split=",
|
---|
1752 | "queries");
|
---|
1753 |
|
---|
1754 | RegisterOption("VspKdTree.splitAxis",
|
---|
1755 | optString,
|
---|
1756 | "split=",
|
---|
1757 | "drivingAxis");
|
---|
1758 |
|
---|
1759 | RegisterOption("VspKdTree.splitUseOnlyDrivingAxis",
|
---|
1760 | optBool,
|
---|
1761 | "vsp_kd_splitdriving=",
|
---|
1762 | "false");
|
---|
1763 |
|
---|
1764 | RegisterOption("VspKdTree.numberOfEndPointDomains",
|
---|
1765 | optInt,
|
---|
1766 | "endpoints=",
|
---|
1767 | "10000");
|
---|
1768 |
|
---|
1769 | RegisterOption("VspKdTree.maxTotalMemory",
|
---|
1770 | optFloat,
|
---|
1771 | "vsp_max_total_mem=",
|
---|
1772 | "60.0");
|
---|
1773 |
|
---|
1774 | RegisterOption("VspKdTree.maxStaticMemory",
|
---|
1775 | optFloat,
|
---|
1776 | "vsp_max_static_mem=",
|
---|
1777 | "8.0");
|
---|
1778 |
|
---|
1779 | RegisterOption("VspKdTree.queryType",
|
---|
1780 | optString,
|
---|
1781 | "qtype=",
|
---|
1782 | "static");
|
---|
1783 |
|
---|
1784 | RegisterOption("VspKdTree.queryPosWeight",
|
---|
1785 | optFloat,
|
---|
1786 | "vsp_kd_qposweight=",
|
---|
1787 | "0.0");
|
---|
1788 |
|
---|
1789 | RegisterOption("VspKdTree.accessTimeThreshold",
|
---|
1790 | optInt,
|
---|
1791 | "vsp_kd_accesstime=",
|
---|
1792 | "1000");
|
---|
1793 |
|
---|
1794 | RegisterOption("VspKdTree.minCollapseDepth",
|
---|
1795 | optInt,
|
---|
1796 | "vsp_kd_min_colldepth=",
|
---|
1797 | "4");
|
---|
1798 |
|
---|
1799 | RegisterOption("VspKdTree.PostProcess.maxCostRatio",
|
---|
1800 | optFloat,
|
---|
1801 | "vsp_kd_post_process_max_cost_ratio=",
|
---|
1802 | "0.9");
|
---|
1803 |
|
---|
1804 | RegisterOption("VspKdTree.PostProcess.minViewCells",
|
---|
1805 | optInt,
|
---|
1806 | "vsp_kd_term_post_process_min_view_cells=",
|
---|
1807 | "1000");
|
---|
1808 |
|
---|
1809 | RegisterOption("VspKdTree.Termination.maxViewCells",
|
---|
1810 | optInt,
|
---|
1811 | "vsp_kd_term_post_process_min_view_cells=",
|
---|
1812 | "300");
|
---|
1813 |
|
---|
1814 | RegisterOption("VspKdTree.PostProcess.maxPvsSize",
|
---|
1815 | optInt,
|
---|
1816 | "vsp_kd_term_post_process_max_pvs_size=",
|
---|
1817 | "100");
|
---|
1818 |
|
---|
1819 | RegisterOption("VspKdTree.Termination.missTolerance",
|
---|
1820 | optInt,
|
---|
1821 | "vsp_kd_term_miss_tolerance=",
|
---|
1822 | "4");
|
---|
1823 |
|
---|
1824 | /************************************************************************************/
|
---|
1825 | /* VSS Preprocessor cells related options */
|
---|
1826 | /************************************************************************************/
|
---|
1827 |
|
---|
1828 | RegisterOption("VssTree.maxDepth", optInt, "kd_depth=", "12");
|
---|
1829 | RegisterOption("VssTree.minPvs", optInt, "kd_minpvs=", "1");
|
---|
1830 | RegisterOption("VssTree.minRays", optInt, "kd_minrays=", "10");
|
---|
1831 | RegisterOption("VssTree.maxCostRatio", optFloat, "maxcost=", "0.95");
|
---|
1832 | RegisterOption("VssTree.maxRayContribution", optFloat, "maxraycontrib=", "0.5");
|
---|
1833 |
|
---|
1834 | RegisterOption("VssTree.epsilon", optFloat, "kd_eps=", "1e-6");
|
---|
1835 | RegisterOption("VssTree.ct_div_ci", optFloat, "kd_ctdivci=", "1.0");
|
---|
1836 | RegisterOption("VssTree.randomize", optBool, "randomize", "false");
|
---|
1837 | RegisterOption("VssTree.splitType", optString, "split=", "queries");
|
---|
1838 | RegisterOption("VssTree.splitUseOnlyDrivingAxis", optBool, "splitdriving=", "false");
|
---|
1839 | RegisterOption("VssTree.useRss", optBool, "rss=", "false");
|
---|
1840 | RegisterOption("VssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000");
|
---|
1841 |
|
---|
1842 | RegisterOption("VssTree.minSize", optFloat, "minsize=", "0.001");
|
---|
1843 |
|
---|
1844 | RegisterOption("VssTree.maxTotalMemory", optFloat, "mem=", "60.0");
|
---|
1845 | RegisterOption("VssTree.maxStaticMemory", optFloat, "statmem=", "8.0");
|
---|
1846 |
|
---|
1847 | RegisterOption("VssTree.queryType", optString, "qtype=", "static");
|
---|
1848 |
|
---|
1849 |
|
---|
1850 |
|
---|
1851 | RegisterOption("VssTree.queryPosWeight", optFloat, "qposweight=", "0.0");
|
---|
1852 | RegisterOption("VssTree.useRefDirSplits", optBool, "refdir", "false");
|
---|
1853 | RegisterOption("VssTree.refDirAngle", optFloat, "refangle=", "10");
|
---|
1854 | RegisterOption("VssTree.refDirBoxMaxSize", optFloat, "refboxsize=", "0.1");
|
---|
1855 | RegisterOption("VssTree.accessTimeThreshold", optInt, "accesstime=", "1000");
|
---|
1856 | RegisterOption("VssTree.minCollapseDepth", optInt, "colldepth=", "4");
|
---|
1857 |
|
---|
1858 | RegisterOption("VssTree.interleaveDirSplits", optBool, "interleavedirsplits", "true");
|
---|
1859 | RegisterOption("VssTree.dirSplitDepth", optInt, "dirsplidepth=", "10");
|
---|
1860 |
|
---|
1861 |
|
---|
1862 | RegisterOption("RssPreprocessor.initialSamples",
|
---|
1863 | optInt,
|
---|
1864 | "initial_samples=",
|
---|
1865 | "100000");
|
---|
1866 |
|
---|
1867 | RegisterOption("RssPreprocessor.vssSamples",
|
---|
1868 | optInt,
|
---|
1869 | "rss_vss_samples=",
|
---|
1870 | "1000000");
|
---|
1871 |
|
---|
1872 | RegisterOption("RssPreprocessor.vssSamplesPerPass",
|
---|
1873 | optInt,
|
---|
1874 | "rss_vss_samples_per_pass=",
|
---|
1875 | "1000");
|
---|
1876 |
|
---|
1877 | RegisterOption("RssPreprocessor.samplesPerPass",
|
---|
1878 | optInt,
|
---|
1879 | "rss_samples_per_pass=",
|
---|
1880 | "100000");
|
---|
1881 |
|
---|
1882 | RegisterOption("RssPreprocessor.useImportanceSampling",
|
---|
1883 | optBool,
|
---|
1884 | "rss_use_importance",
|
---|
1885 | "true");
|
---|
1886 |
|
---|
1887 | RegisterOption("RssPreprocessor.objectBasedSampling",
|
---|
1888 | optBool,
|
---|
1889 | "rss_object_based_sampling",
|
---|
1890 | "true");
|
---|
1891 |
|
---|
1892 | RegisterOption("RssPreprocessor.directionalSampling",
|
---|
1893 | optBool,
|
---|
1894 | "rss_directional_sampling",
|
---|
1895 | "false");
|
---|
1896 |
|
---|
1897 | RegisterOption("RssTree.maxDepth", optInt, "kd_depth=", "12");
|
---|
1898 | RegisterOption("RssTree.minPvs", optInt, "kd_minpvs=", "1");
|
---|
1899 | RegisterOption("RssTree.minRays", optInt, "kd_minrays=", "10");
|
---|
1900 | RegisterOption("RssTree.maxCostRatio", optFloat, "maxcost=", "0.95");
|
---|
1901 | RegisterOption("RssTree.maxRayContribution", optFloat, "maxraycontrib=", "0.5");
|
---|
1902 |
|
---|
1903 | RegisterOption("RssTree.epsilon", optFloat, "kd_eps=", "1e-6");
|
---|
1904 | RegisterOption("RssTree.ct_div_ci", optFloat, "kd_ctdivci=", "1.0");
|
---|
1905 | RegisterOption("RssTree.randomize", optBool, "randomize", "false");
|
---|
1906 | RegisterOption("RssTree.splitType", optString, "split=", "queries");
|
---|
1907 | RegisterOption("RssTree.splitUseOnlyDrivingAxis", optBool, "splitdriving=", "false");
|
---|
1908 |
|
---|
1909 | RegisterOption("RssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000");
|
---|
1910 |
|
---|
1911 | RegisterOption("RssTree.minSize", optFloat, "minsize=", "0.001");
|
---|
1912 |
|
---|
1913 | RegisterOption("RssTree.maxTotalMemory", optFloat, "mem=", "60.0");
|
---|
1914 | RegisterOption("RssTree.maxStaticMemory", optFloat, "statmem=", "8.0");
|
---|
1915 |
|
---|
1916 | RegisterOption("RssTree.queryType", optString, "qtype=", "static");
|
---|
1917 |
|
---|
1918 | RegisterOption("RssTree.queryPosWeight", optFloat, "qposweight=", "0.0");
|
---|
1919 | RegisterOption("RssTree.useRefDirSplits", optBool, "refdir", "false");
|
---|
1920 | RegisterOption("RssTree.refDirAngle", optFloat, "refangle=", "10");
|
---|
1921 | RegisterOption("RssTree.refDirBoxMaxSize", optFloat, "refboxsize=", "0.1");
|
---|
1922 | RegisterOption("RssTree.accessTimeThreshold", optInt, "accesstime=", "1000");
|
---|
1923 | RegisterOption("RssTree.minCollapseDepth", optInt, "colldepth=", "4");
|
---|
1924 |
|
---|
1925 | RegisterOption("RssTree.interleaveDirSplits", optBool, "interleavedirsplits", "true");
|
---|
1926 | RegisterOption("RssTree.dirSplitDepth", optInt, "dirsplidepth=", "10");
|
---|
1927 | RegisterOption("RssTree.importanceBasedCost", optBool, "importance_based_cost", "true");
|
---|
1928 | RegisterOption("RssTree.maxRays", optInt, "rss_max_rays=", "2000000");
|
---|
1929 |
|
---|
1930 | RegisterOption("RssTree.perObjectTree", optBool, "rss_per_object_tree", "false");
|
---|
1931 |
|
---|
1932 | RegisterOption("RssPreprocessor.Export.pvs", optBool, "rss_export_pvs", "false");
|
---|
1933 | RegisterOption("RssPreprocessor.Export.rssTree", optBool, "rss_export_rss_tree", "false");
|
---|
1934 | RegisterOption("RssPreprocessor.Export.rays", optBool, "rss_export_rays", "false");
|
---|
1935 | RegisterOption("RssPreprocessor.Export.numRays", optInt, "rss_export_num_rays=", "5000");
|
---|
1936 | RegisterOption("RssPreprocessor.useViewcells", optBool, "rss_use_viewcells", "false");
|
---|
1937 | RegisterOption("RssPreprocessor.updateSubdivision",
|
---|
1938 | optBool,
|
---|
1939 | "rss_update_subdivision",
|
---|
1940 | "false");
|
---|
1941 |
|
---|
1942 |
|
---|
1943 | /************************************************************************************/
|
---|
1944 | /* View space partition BSP tree related options */
|
---|
1945 | /************************************************************************************/
|
---|
1946 |
|
---|
1947 |
|
---|
1948 | RegisterOption("RssPreprocessor.loadInitialSamples",
|
---|
1949 | optBool,
|
---|
1950 | "vss_load_loadInitialSamples=",
|
---|
1951 | "false");
|
---|
1952 |
|
---|
1953 | RegisterOption("RssPreprocessor.storeInitialSamples",
|
---|
1954 | optBool,
|
---|
1955 | "vss_store_storeInitialSamples=",
|
---|
1956 | "false");
|
---|
1957 |
|
---|
1958 |
|
---|
1959 | /************************************************************************************/
|
---|
1960 | /* View space partition BSP tree related options */
|
---|
1961 | /************************************************************************************/
|
---|
1962 |
|
---|
1963 | RegisterOption("VspBspTree.Termination.minGlobalCostRatio",
|
---|
1964 | optFloat,
|
---|
1965 | "vsp_bsp_term_min_global_cost_ratio",
|
---|
1966 | "0.0001");
|
---|
1967 |
|
---|
1968 | RegisterOption("VspBspTree.useSplitCostQueue",
|
---|
1969 | optBool,
|
---|
1970 | "vsp_bsp_use_split_cost_queue=",
|
---|
1971 | "true");
|
---|
1972 |
|
---|
1973 | RegisterOption("VspBspTree.Termination.globalCostMissTolerance",
|
---|
1974 | optInt,
|
---|
1975 | "vsp_bsp_term_global_cost_miss_tolerance",
|
---|
1976 | "4");
|
---|
1977 |
|
---|
1978 | RegisterOption("VspBspTree.Termination.minPolygons",
|
---|
1979 | optInt,
|
---|
1980 | "vsp_bsp_term_min_polygons=",
|
---|
1981 | "5");
|
---|
1982 |
|
---|
1983 | RegisterOption("VspBspTree.Termination.minPvs",
|
---|
1984 | optInt,
|
---|
1985 | "vsp_bsp_term_min_pvs=",
|
---|
1986 | "20");
|
---|
1987 |
|
---|
1988 | RegisterOption("VspBspTree.Termination.minProbability",
|
---|
1989 | optFloat,
|
---|
1990 | "vsp_bsp_term_min_probability=",
|
---|
1991 | "0.001");
|
---|
1992 |
|
---|
1993 | RegisterOption("VspBspTree.subdivisionStats",
|
---|
1994 | optString,
|
---|
1995 | "vsp_bsp_subdivision_stats=",
|
---|
1996 | "vspBspSubdivisionStats.log");
|
---|
1997 |
|
---|
1998 | RegisterOption("VspBspTree.Termination.maxRayContribution",
|
---|
1999 | optFloat,
|
---|
2000 | "vsp_bsp_term_ray_contribution=",
|
---|
2001 | "0.005");
|
---|
2002 |
|
---|
2003 | RegisterOption("VspBspTree.Termination.minAccRayLenght",
|
---|
2004 | optFloat,
|
---|
2005 | "vsp_bsp_term_min_acc_ray_length=",
|
---|
2006 | "50");
|
---|
2007 |
|
---|
2008 | RegisterOption("VspBspTree.Termination.minRays",
|
---|
2009 | optInt,
|
---|
2010 | "vsp_bsp_term_min_rays=",
|
---|
2011 | "-1");
|
---|
2012 |
|
---|
2013 | RegisterOption("VspBspTree.Termination.ct_div_ci",
|
---|
2014 | optFloat,
|
---|
2015 | "vsp_bsp_term_ct_div_ci=",
|
---|
2016 | "0.0");
|
---|
2017 |
|
---|
2018 | RegisterOption("VspBspTree.Termination.maxDepth",
|
---|
2019 | optInt,
|
---|
2020 | "vsp_bsp_term_max_depth=",
|
---|
2021 | "100");
|
---|
2022 |
|
---|
2023 | RegisterOption("VspBspTree.Termination.AxisAligned.maxCostRatio",
|
---|
2024 | optFloat,
|
---|
2025 | "vsp_bsp_term_axis_aligned_max_cost_ratio=",
|
---|
2026 | "1.5");
|
---|
2027 |
|
---|
2028 | RegisterOption("VspBspTree.useCostHeuristics",
|
---|
2029 | optBool,
|
---|
2030 | "vsp_bsp_use_cost_heuristics=",
|
---|
2031 | "false");
|
---|
2032 |
|
---|
2033 | RegisterOption("VspBspTree.Termination.maxViewCells",
|
---|
2034 | optInt,
|
---|
2035 | "vsp_bsp_term_max_view_cells=",
|
---|
2036 | "10000");
|
---|
2037 |
|
---|
2038 | RegisterOption("VspBspTree.Termination.maxCostRatio",
|
---|
2039 | optFloat,
|
---|
2040 | "vsp_bsp_term_max_cost_ratio=",
|
---|
2041 | "1.5");
|
---|
2042 |
|
---|
2043 | RegisterOption("VspBspTree.Termination.missTolerance",
|
---|
2044 | optInt,
|
---|
2045 | "vsp_bsp_term_miss_tolerance=",
|
---|
2046 | "4");
|
---|
2047 | RegisterOption("VspBspTree.splitPlaneStrategy",
|
---|
2048 | optString,
|
---|
2049 | "vsp_bsp_split_method=",
|
---|
2050 | "leastSplits");
|
---|
2051 |
|
---|
2052 | RegisterOption("VspBspTree.maxPolyCandidates",
|
---|
2053 | optInt,
|
---|
2054 | "vsp_bsp_max_poly_candidates=",
|
---|
2055 | "20");
|
---|
2056 | RegisterOption("VspBspTree.maxRayCandidates",
|
---|
2057 | optInt,
|
---|
2058 | "vsp_bsp_max_plane_candidates=",
|
---|
2059 | "20");
|
---|
2060 |
|
---|
2061 | RegisterOption("VspBspTree.maxTests",
|
---|
2062 | optInt,
|
---|
2063 | "vsp_bsp_max_tests=",
|
---|
2064 | "5000");
|
---|
2065 |
|
---|
2066 | RegisterOption("VspBspTree.Construction.samples",
|
---|
2067 | optInt,
|
---|
2068 | "vsp_bsp_construction_samples=",
|
---|
2069 | "100000");
|
---|
2070 |
|
---|
2071 | RegisterOption("VspBspTree.Construction.minBand",
|
---|
2072 | optFloat,
|
---|
2073 | "vsp_bsp_construction_min_band=",
|
---|
2074 | "0.1");
|
---|
2075 |
|
---|
2076 | RegisterOption("VspBspTree.Construction.maxBand",
|
---|
2077 | optFloat,
|
---|
2078 | "vsp_bsp_construction_min_band=",
|
---|
2079 | "0.9");
|
---|
2080 |
|
---|
2081 | RegisterOption("VspBspTree.Construction.useDrivingAxisForMaxCost",
|
---|
2082 | optBool,
|
---|
2083 | "vsp_bsp_construction_use_drivingaxis_for_maxcost=",
|
---|
2084 | "false");
|
---|
2085 |
|
---|
2086 | RegisterOption("VspBspTree.Construction.epsilon",
|
---|
2087 | optFloat,
|
---|
2088 | "vsp_bsp_construction_side_tolerance=",
|
---|
2089 | "0.002");
|
---|
2090 |
|
---|
2091 | RegisterOption("VspBspTree.Visualization.exportSplits",
|
---|
2092 | optBool,
|
---|
2093 | "vsp_bsp_visualization.export_splits",
|
---|
2094 | "false");
|
---|
2095 |
|
---|
2096 | RegisterOption("VspBspTree.splitUseOnlyDrivingAxis",
|
---|
2097 | optBool,
|
---|
2098 | "vsp_bsp_split_only_driving_axis=",
|
---|
2099 | "false");
|
---|
2100 |
|
---|
2101 | RegisterOption("VspBspTree.usePolygonSplitIfAvailable",
|
---|
2102 | optBool,
|
---|
2103 | "vsp_bsp_usePolygonSplitIfAvailable=",
|
---|
2104 | "false");
|
---|
2105 |
|
---|
2106 | RegisterOption("VspBspTree.Termination.AxisAligned.minRays",
|
---|
2107 | optInt,
|
---|
2108 | "bsp_term_axis_aligned_min_rays=",
|
---|
2109 | "100");
|
---|
2110 |
|
---|
2111 | RegisterOption("VspBspTree.Termination.AxisAligned.maxRayContribution",
|
---|
2112 | optFloat,
|
---|
2113 | "bsp_term_axis_aligned_min_rays=",
|
---|
2114 | "0.1");
|
---|
2115 |
|
---|
2116 | RegisterOption("VspBspTree.Factor.leastRaySplits",
|
---|
2117 | optFloat,
|
---|
2118 | "vsp_bsp_factor_least_ray_splits=",
|
---|
2119 | "1.0");
|
---|
2120 |
|
---|
2121 | RegisterOption("VspBspTree.Factor.balancedRays",
|
---|
2122 | optFloat,
|
---|
2123 | "vsp_bsp_factor_balanced_rays=",
|
---|
2124 | "1.0");
|
---|
2125 |
|
---|
2126 | RegisterOption("VspBspTree.Factor.pvs",
|
---|
2127 | optFloat,
|
---|
2128 | "vsp_bsp_factor_pvs=",
|
---|
2129 | "1.0");
|
---|
2130 |
|
---|
2131 | RegisterOption("VspBspTree.Construction.renderCostWeight",
|
---|
2132 | optFloat,
|
---|
2133 | "-vsp_bsp_post_process_render_cost_weight",
|
---|
2134 | "0.5");
|
---|
2135 |
|
---|
2136 | RegisterOption("VspBspTree.Construction.randomize",
|
---|
2137 | optBool,
|
---|
2138 | "vsp_bsp_construction_randomize=",
|
---|
2139 | "false");
|
---|
2140 |
|
---|
2141 | RegisterOption("VspBspTree.simulateOctree",
|
---|
2142 | optBool,
|
---|
2143 | "vsp_bsp_simulate_octree=",
|
---|
2144 | "false");
|
---|
2145 |
|
---|
2146 | RegisterOption("VspBspTree.nodePriorityQueueType",
|
---|
2147 | optInt,
|
---|
2148 | "vsp_bsp_node_queue_type=",
|
---|
2149 | "0");
|
---|
2150 |
|
---|
2151 | RegisterOption("VspBspTree.useRandomAxis",
|
---|
2152 | optBool,
|
---|
2153 | "-vsp_bsp_use_random_axis=",
|
---|
2154 | "false");
|
---|
2155 |
|
---|
2156 | RegisterOption("VspBspTree.maxTotalMemory",
|
---|
2157 | optFloat,
|
---|
2158 | "vsp_bsp_max_total_mem=",
|
---|
2159 | "60.0");
|
---|
2160 |
|
---|
2161 | RegisterOption("VspBspTree.maxStaticMemory",
|
---|
2162 | optFloat,
|
---|
2163 | "vsp_bsp_max_static_mem=",
|
---|
2164 | "8.0");
|
---|
2165 |
|
---|
2166 |
|
---|
2167 |
|
---|
2168 |
|
---|
2169 | //////////////////////////////////////////////////////////////////////////////////
|
---|
2170 | }
|
---|
2171 |
|
---|
2172 | void
|
---|
2173 | Environment::SetStaticOptions()
|
---|
2174 | {
|
---|
2175 |
|
---|
2176 | // get Global option values
|
---|
2177 | GetRealValue("Limits.threshold", Limits::Threshold);
|
---|
2178 | GetRealValue("Limits.small", Limits::Small);
|
---|
2179 | GetRealValue("Limits.infinity", Limits::Infinity);
|
---|
2180 |
|
---|
2181 |
|
---|
2182 | }
|
---|
2183 |
|
---|
2184 | bool
|
---|
2185 | Environment::Parse(const int argc, char **argv, bool useExePath)
|
---|
2186 | {
|
---|
2187 | bool result = true;
|
---|
2188 | // Read the names of the scene, environment and output files
|
---|
2189 | ReadCmdlineParams(argc, argv, "");
|
---|
2190 |
|
---|
2191 | char *envFilename = new char[128];
|
---|
2192 |
|
---|
2193 | char filename[64];
|
---|
2194 |
|
---|
2195 | // Get the environment file name
|
---|
2196 | if (!GetParam(' ', 0, filename)) {
|
---|
2197 | // user didn't specified environment file explicitly, so
|
---|
2198 | strcpy(filename, "default.env");
|
---|
2199 | }
|
---|
2200 |
|
---|
2201 | if (useExePath) {
|
---|
2202 | char *path = GetPath(argv[0]);
|
---|
2203 | if (*path != 0)
|
---|
2204 | sprintf(envFilename, "%s/%s", path, filename);
|
---|
2205 | else
|
---|
2206 | strcpy(envFilename, filename);
|
---|
2207 |
|
---|
2208 | delete path;
|
---|
2209 | }
|
---|
2210 | else
|
---|
2211 | strcpy(envFilename, filename);
|
---|
2212 |
|
---|
2213 |
|
---|
2214 | // Now it's time to read in environment file.
|
---|
2215 | if (!ReadEnvFile(envFilename)) {
|
---|
2216 | // error - bad input file name specified ?
|
---|
2217 | cerr<<"Error parsing environment file "<<envFilename<<endl;
|
---|
2218 | result = false;
|
---|
2219 | }
|
---|
2220 | delete envFilename;
|
---|
2221 |
|
---|
2222 | // Parse the command line; options given on the command line subsume
|
---|
2223 | // stuff specified in the input environment file.
|
---|
2224 | ParseCmdline(argc, argv, 0);
|
---|
2225 |
|
---|
2226 | SetStaticOptions();
|
---|
2227 |
|
---|
2228 | // Check for request for help
|
---|
2229 | if (CheckForSwitch(argc, argv, '?')) {
|
---|
2230 | PrintUsage(cout);
|
---|
2231 | exit(0);
|
---|
2232 | }
|
---|
2233 |
|
---|
2234 | return true;
|
---|
2235 | }
|
---|
2236 |
|
---|
2237 | }
|
---|