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