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