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 | bool
|
---|
542 | Environment::GetStringValue(const char *name,
|
---|
543 | string &stringVariable,
|
---|
544 | const bool isFatal) const
|
---|
545 | {
|
---|
546 | int i = FindOption(name, isFatal);
|
---|
547 |
|
---|
548 | if (i<0)
|
---|
549 | return false;
|
---|
550 |
|
---|
551 |
|
---|
552 | if (options[i].value != NULL) {
|
---|
553 | // option was not read, so use the default
|
---|
554 | stringVariable = options[i].value;
|
---|
555 | }
|
---|
556 | else {
|
---|
557 | // option was explicitly specified
|
---|
558 | stringVariable = options[i].defaultValue;
|
---|
559 | }
|
---|
560 | return true;
|
---|
561 | }
|
---|
562 |
|
---|
563 |
|
---|
564 | void
|
---|
565 | Environment::SetInt(const char *name, const int value)
|
---|
566 | {
|
---|
567 |
|
---|
568 | int i = FindOption(name);
|
---|
569 | if (i<0)
|
---|
570 | return;
|
---|
571 |
|
---|
572 | if (options[i].type == optInt) {
|
---|
573 | delete options[i].value;
|
---|
574 | options[i].value = new char[16];
|
---|
575 | sprintf(options[i].value, "%.15d", value);
|
---|
576 | }
|
---|
577 | else {
|
---|
578 | Debug << "Internal error: Trying to set non-integer option " << name
|
---|
579 | << " to integral value.\n" << flush;
|
---|
580 | exit(1);
|
---|
581 | }
|
---|
582 | }
|
---|
583 |
|
---|
584 | void
|
---|
585 | Environment::SetFloat(const char *name, const Real value)
|
---|
586 | {
|
---|
587 | int i = FindOption(name);
|
---|
588 | if (i<0)
|
---|
589 | return;
|
---|
590 |
|
---|
591 | if (options[i].type == optFloat) {
|
---|
592 | delete options[i].value;
|
---|
593 | options[i].value = new char[25];
|
---|
594 | sprintf(options[i].value, "%.15e", value);
|
---|
595 | }
|
---|
596 | else {
|
---|
597 | Debug << "Internal error: Trying to set non-Real option " << name
|
---|
598 | << " to Real value.\n" << flush;
|
---|
599 | exit(1);
|
---|
600 | }
|
---|
601 | }
|
---|
602 |
|
---|
603 | void
|
---|
604 | Environment::SetBool(const char *name, const bool value)
|
---|
605 | {
|
---|
606 | int i = FindOption(name);
|
---|
607 | if (i<0)
|
---|
608 | return;
|
---|
609 |
|
---|
610 | if (options[i].type == optBool) {
|
---|
611 | delete options[i].value;
|
---|
612 | options[i].value = new char[6];
|
---|
613 | if (value)
|
---|
614 | sprintf(options[i].value, "true");
|
---|
615 | else
|
---|
616 | sprintf(options[i].value, "false");
|
---|
617 | }
|
---|
618 | else {
|
---|
619 | Debug << "Internal error: Trying to set non-bool option " << name
|
---|
620 | << " to boolean value.\n" << flush;
|
---|
621 | exit(1);
|
---|
622 | }
|
---|
623 | }
|
---|
624 |
|
---|
625 | void
|
---|
626 | Environment::SetVector(const char *name,
|
---|
627 | const Vector3 &v)
|
---|
628 | {
|
---|
629 | int i = FindOption(name);
|
---|
630 | if (i<0)
|
---|
631 | return;
|
---|
632 |
|
---|
633 | if (options[i].type == optVector) {
|
---|
634 | delete options[i].value;
|
---|
635 | options[i].value = new char[128];
|
---|
636 | sprintf(options[i].value, "%.15e,%.15e,%.15e", v.x, v.y, v.z);
|
---|
637 | }
|
---|
638 | else {
|
---|
639 | Debug << "Internal error: Trying to set non-vector option " << name
|
---|
640 | << " to vector value.\n" << flush;
|
---|
641 | exit(1);
|
---|
642 | }
|
---|
643 | }
|
---|
644 |
|
---|
645 | void
|
---|
646 | Environment::SetString(const char *name, const char *value)
|
---|
647 | {
|
---|
648 | int i = FindOption(name);
|
---|
649 | if (i<0)
|
---|
650 | return;
|
---|
651 |
|
---|
652 | if (options[i].type == optString) {
|
---|
653 | delete options[i].value;
|
---|
654 | options[i].value = ::strdup(value);
|
---|
655 | }
|
---|
656 | else {
|
---|
657 | Debug << "Internal error: Trying to set non-string option " << name
|
---|
658 | << " to string value.\n" << flush;
|
---|
659 | exit(1);
|
---|
660 | }
|
---|
661 | }
|
---|
662 |
|
---|
663 | void
|
---|
664 | Environment::ParseCmdline(const int argc,
|
---|
665 | char **argv,
|
---|
666 | const int index)
|
---|
667 | {
|
---|
668 | int curIndex = -1;
|
---|
669 |
|
---|
670 | for (int i = 1; i < argc; i++) {
|
---|
671 | // if this parameter is non-optional, skip it and increment the counter
|
---|
672 | if (argv[i][0] != '-') {
|
---|
673 | curIndex++;
|
---|
674 | continue;
|
---|
675 | }
|
---|
676 | // make sure to skip all non-optional parameters
|
---|
677 | char *t = strchr(optionalParams, argv[i][1]);
|
---|
678 | if (t != NULL)
|
---|
679 | continue;
|
---|
680 |
|
---|
681 | // if we are in the scope of the current parameter, parse it
|
---|
682 | if (curIndex == -1 || curIndex == index) {
|
---|
683 | if (argv[i][1] == 'D') {
|
---|
684 | // it's a full name definition
|
---|
685 | bool found = false;
|
---|
686 | int j;
|
---|
687 |
|
---|
688 | char *t = strchr(argv[i] + 2, '=');
|
---|
689 | if (t == NULL) {
|
---|
690 | Debug << "Error: Missing '=' in option. "
|
---|
691 | << "Syntax is -D<name>=<value>.\n" << flush;
|
---|
692 | exit(1);
|
---|
693 | }
|
---|
694 | for (j = 0; j < numOptions; j++)
|
---|
695 | if (!strncmp(options[j].name, argv[i] + 2, t - argv[i] - 2) &&
|
---|
696 | (unsigned)(t - argv[i] - 2) == strlen(options[j].name)) {
|
---|
697 | found = true;
|
---|
698 | break;
|
---|
699 | }
|
---|
700 | if (!found) {
|
---|
701 | Debug << "Warning: Unregistered option " << argv[i] << ".\n" << flush;
|
---|
702 | // exit(1);
|
---|
703 | }
|
---|
704 | if (found) {
|
---|
705 | if (!CheckType(t + 1, options[j].type)) {
|
---|
706 | Debug << "Error: invalid type of value " << t + 1 << " in option "
|
---|
707 | << options[j].name << ".\n";
|
---|
708 | exit(1);
|
---|
709 | }
|
---|
710 | if (options[j].value != NULL)
|
---|
711 | delete options[j].value;
|
---|
712 | options[j].value = strdup(t + 1);
|
---|
713 | }
|
---|
714 | }
|
---|
715 | else {
|
---|
716 | // it's an abbreviation
|
---|
717 | bool found = false;
|
---|
718 | int j;
|
---|
719 |
|
---|
720 | for (j = 0; j < numOptions; j++)
|
---|
721 | if (options[j].abbrev != NULL &&
|
---|
722 | !strncmp(options[j].abbrev, argv[i] + 1, strlen(options[j].abbrev))) {
|
---|
723 | found = true;
|
---|
724 | break;
|
---|
725 | }
|
---|
726 | if (!found) {
|
---|
727 | Debug << "Warning: Unregistered option " << argv[i] << ".\n" << flush;
|
---|
728 | // exit(1);
|
---|
729 | }
|
---|
730 | if (found) {
|
---|
731 | if (!CheckType(argv[i] + 1 + strlen(options[j].abbrev), options[j].type)) {
|
---|
732 | Debug << "Error: invalid type of value "
|
---|
733 | << argv[i] + 1 + strlen(options[j].abbrev) << "in option "
|
---|
734 | << options[j].name << ".\n";
|
---|
735 | exit(1);
|
---|
736 | }
|
---|
737 | if (options[j].value != NULL)
|
---|
738 | delete options[j].value;
|
---|
739 | options[j].value = strdup(argv[i] + 1 + strlen(options[j].abbrev));
|
---|
740 | }
|
---|
741 | }
|
---|
742 | }
|
---|
743 | }
|
---|
744 | #ifdef _DEBUG_PARAMS
|
---|
745 | // write out the options table
|
---|
746 | cerr << "Options table for " << numOptions << " options:\n";
|
---|
747 | for (int j = 0; j < numOptions; j++) {
|
---|
748 | cerr << options[j];
|
---|
749 | cerr << "\n";
|
---|
750 | }
|
---|
751 | cerr << "Options done.\n" << flush;
|
---|
752 | #endif // _DEBUG_PARAMS
|
---|
753 | }
|
---|
754 |
|
---|
755 |
|
---|
756 | char *
|
---|
757 | Environment::ParseString(char *buffer, char *string) const
|
---|
758 | {
|
---|
759 | char *s = buffer;
|
---|
760 | char *t = string + strlen(string);
|
---|
761 |
|
---|
762 | // skip leading whitespaces
|
---|
763 | while (*s == ' ' || *s == '\t')
|
---|
764 | s++;
|
---|
765 | if (*s == '\0')
|
---|
766 | return NULL;
|
---|
767 | while ((*s >= 'a' && *s <= 'z') ||
|
---|
768 | (*s >= 'A' && *s <= 'Z') ||
|
---|
769 | (*s >= '0' && *s <= '9') ||
|
---|
770 | *s == '_')
|
---|
771 | *t++ = *s++;
|
---|
772 | *t = '\0';
|
---|
773 | // skip trailing whitespaces
|
---|
774 | while (*s == ' ' || *s == '\t')
|
---|
775 | s++;
|
---|
776 | return s;
|
---|
777 | }
|
---|
778 |
|
---|
779 | const char code[] = "JIDHipewhfdhyd74387hHO&{WK:DOKQEIDKJPQ*H#@USX:#FWCQ*EJMQAHPQP(@G#RD";
|
---|
780 |
|
---|
781 | void
|
---|
782 | Environment::DecodeString(char *buff, int max)
|
---|
783 | {
|
---|
784 | buff[max] = 0;
|
---|
785 | char *p = buff;
|
---|
786 | const char *cp = code;
|
---|
787 | for (; *p; p++) {
|
---|
788 | if (*p != '\n')
|
---|
789 | *p = *p ^ *cp;
|
---|
790 | ++cp;
|
---|
791 | if (*cp == 0)
|
---|
792 | cp = code;
|
---|
793 | }
|
---|
794 | }
|
---|
795 |
|
---|
796 | void
|
---|
797 | Environment::CodeString(char *buff, int max)
|
---|
798 | {
|
---|
799 | buff[max] = 0;
|
---|
800 | char *p = buff;
|
---|
801 | const char *cp = code;
|
---|
802 | for (; *p; p++) {
|
---|
803 | if (*p != '\n')
|
---|
804 | *p = *p ^ *cp;
|
---|
805 | ++cp;
|
---|
806 | if (*cp == 0)
|
---|
807 | cp = code;
|
---|
808 | }
|
---|
809 | }
|
---|
810 |
|
---|
811 | void
|
---|
812 | Environment::SaveCodedFile(char *filenameText,
|
---|
813 | char *filenameCoded)
|
---|
814 | {
|
---|
815 | ifstream envStream(filenameText);
|
---|
816 |
|
---|
817 | // some error had occured
|
---|
818 | if (envStream.fail()) {
|
---|
819 | cerr << "Error: Can't open file " << filenameText << " for reading (err. "
|
---|
820 | << envStream.rdstate() << ").\n";
|
---|
821 | return;
|
---|
822 | }
|
---|
823 |
|
---|
824 | char buff[256];
|
---|
825 | envStream.getline(buff, 255);
|
---|
826 | buff[8] = 0;
|
---|
827 | if (strcmp(buff, "CGX_CF10") == 0)
|
---|
828 | return;
|
---|
829 |
|
---|
830 | ofstream cStream(filenameCoded);
|
---|
831 | cStream<<"CGX_CF10";
|
---|
832 |
|
---|
833 | // main loop
|
---|
834 | for (;;) {
|
---|
835 | // read in one line
|
---|
836 | envStream.getline(buff, 255);
|
---|
837 | if (!envStream)
|
---|
838 | break;
|
---|
839 | CodeString(buff, 255);
|
---|
840 | cStream<<buff;
|
---|
841 | }
|
---|
842 |
|
---|
843 | }
|
---|
844 |
|
---|
845 | bool
|
---|
846 | Environment::ReadEnvFile(const char *envFilename)
|
---|
847 | {
|
---|
848 | char buff[MaxStringLength], name[MaxStringLength];
|
---|
849 | char *s, *t;
|
---|
850 | int i, line = 0;
|
---|
851 | bool found;
|
---|
852 | igzstream envStream(envFilename);
|
---|
853 |
|
---|
854 | // some error had occured
|
---|
855 | if (envStream.fail()) {
|
---|
856 | cerr << "Error: Can't open file " << envFilename << " for reading (err. "
|
---|
857 | << envStream.rdstate() << ").\n";
|
---|
858 | return false;
|
---|
859 | }
|
---|
860 |
|
---|
861 | name[0] = '\0';
|
---|
862 |
|
---|
863 | // bool coded;
|
---|
864 | // envStream.getline(buff, 255);
|
---|
865 | // buff[8] = 0;
|
---|
866 | // if (strcmp(buff, "CGX_CF10") == 0)
|
---|
867 | // coded = true;
|
---|
868 | // else {
|
---|
869 | // coded = false;
|
---|
870 | // envStream.Rewind();
|
---|
871 | // }
|
---|
872 |
|
---|
873 | // main loop
|
---|
874 | for (;;) {
|
---|
875 | // read in one line
|
---|
876 | envStream.getline(buff, MaxStringLength-1);
|
---|
877 |
|
---|
878 | if (!envStream)
|
---|
879 | break;
|
---|
880 |
|
---|
881 | // if (coded)
|
---|
882 | // DecodeString(buff, 255);
|
---|
883 |
|
---|
884 | line++;
|
---|
885 | // get rid of comments
|
---|
886 | s = strchr(buff, '#');
|
---|
887 | if (s != NULL)
|
---|
888 | *s = '\0';
|
---|
889 |
|
---|
890 | // get one identifier
|
---|
891 | s = ParseString(buff, name);
|
---|
892 | // parse line
|
---|
893 | while (s != NULL) {
|
---|
894 | // it's a group name - make the full name
|
---|
895 | if (*s == '{') {
|
---|
896 | strcat(name, ".");
|
---|
897 | s++;
|
---|
898 | s = ParseString(s, name);
|
---|
899 | continue;
|
---|
900 | }
|
---|
901 | // end of group
|
---|
902 | if (*s == '}') {
|
---|
903 | if (strlen(name) == 0) {
|
---|
904 | cerr << "Error: unpaired } in " << envFilename << " (line "
|
---|
905 | << line << ").\n";
|
---|
906 | envStream.close();
|
---|
907 | return false;
|
---|
908 | }
|
---|
909 | name[strlen(name) - 1] = '\0';
|
---|
910 | t = strrchr(name, '.');
|
---|
911 | if (t == NULL)
|
---|
912 | name[0] = '\0';
|
---|
913 | else
|
---|
914 | *(t + 1) = '\0';
|
---|
915 | s++;
|
---|
916 | s = ParseString(s, name);
|
---|
917 | continue;
|
---|
918 | }
|
---|
919 | // find variable name in the table
|
---|
920 | found = false;
|
---|
921 | for (i = 0; i < numOptions; i++)
|
---|
922 | if (!strcmp(name, options[i].name)) {
|
---|
923 | found = true;
|
---|
924 | break;
|
---|
925 | }
|
---|
926 | if (!found) {
|
---|
927 | cerr << "Warning: unknown option " << name << " in environment file "
|
---|
928 | << envFilename << " (line " << line << ").\n";
|
---|
929 | } else
|
---|
930 | switch (options[i].type) {
|
---|
931 | case optInt: {
|
---|
932 | strtol(s, &t, 10);
|
---|
933 | if (t == s || (*t != ' ' && *t != '\t' &&
|
---|
934 | *t != '\0' && *t != '}')) {
|
---|
935 | cerr << "Error: Mismatch in int variable " << name << " in "
|
---|
936 | << "environment file " << envFilename << " (line "
|
---|
937 | << line << ").\n";
|
---|
938 | envStream.close();
|
---|
939 | return false;
|
---|
940 | }
|
---|
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 | break;
|
---|
948 | }
|
---|
949 | case optFloat: {
|
---|
950 | strtod(s, &t);
|
---|
951 | if (t == s || (*t != ' ' && *t != '\t' &&
|
---|
952 | *t != '\0' && *t != '}')) {
|
---|
953 | cerr << "Error: Mismatch in Real variable " << name << " in "
|
---|
954 | << "environment file " << envFilename << " (line "
|
---|
955 | << line << ").\n";
|
---|
956 | envStream.close();
|
---|
957 | return false;
|
---|
958 | }
|
---|
959 | if (options[i].value != NULL)
|
---|
960 | delete options[i].value;
|
---|
961 | options[i].value = new char[t - s + 1];
|
---|
962 | strncpy(options[i].value, s, t - s);
|
---|
963 | options[i].value[t - s] = '\0';
|
---|
964 | s = t;
|
---|
965 | break;
|
---|
966 | }
|
---|
967 | case optBool: {
|
---|
968 | t = s;
|
---|
969 | while ((*t >= 'a' && *t <= 'z') ||
|
---|
970 | (*t >= 'A' && *t <= 'Z') ||
|
---|
971 | *t == '+' || *t == '-')
|
---|
972 | t++;
|
---|
973 | if (((!strncasecmp(s, "true", t - s) && t - s == 4) ||
|
---|
974 | (!strncasecmp(s, "false", t - s) && t - s == 5) ||
|
---|
975 | (!strncasecmp(s, "YES", t -s) && t - s == 3) ||
|
---|
976 | (!strncasecmp(s, "NO", t - s) && t - s == 2) ||
|
---|
977 | (!strncasecmp(s, "ON", t - s) && t - s == 2) ||
|
---|
978 | (!strncasecmp(s, "OFF", t - s) && t - s == 3) ||
|
---|
979 | (t - s == 1 && (*s == '+' || *s == '-'))) &&
|
---|
980 | (*t == ' ' || *t == '\t' || *t == '\0' || *t == '}')) {
|
---|
981 | if (options[i].value != NULL)
|
---|
982 | delete options[i].value;
|
---|
983 | options[i].value = new char[t - s + 1];
|
---|
984 | strncpy(options[i].value, s, t - s);
|
---|
985 | options[i].value[t - s] = '\0';
|
---|
986 | s = t;
|
---|
987 | }
|
---|
988 | else {
|
---|
989 | cerr << "Error: Mismatch in bool variable " << name << " in "
|
---|
990 | << "environment file " << envFilename << " (line "
|
---|
991 | << line << ").\n";
|
---|
992 | envStream.close();
|
---|
993 | return false;
|
---|
994 | }
|
---|
995 | break;
|
---|
996 | }
|
---|
997 | case optVector:{
|
---|
998 | strtod(s, &t);
|
---|
999 | if (*t == ' ' || *t == '\t') {
|
---|
1000 | while (*t == ' ' || *t == '\t')
|
---|
1001 | t++;
|
---|
1002 | if (*t != ',')
|
---|
1003 | t--;
|
---|
1004 | }
|
---|
1005 | if (t == s || (*t != ' ' && *t != '\t' && *t != ',')) {
|
---|
1006 | cerr << "Error: Mismatch in vector variable " << name << " in "
|
---|
1007 | << "environment file " << envFilename << " (line "
|
---|
1008 | << line << ").\n";
|
---|
1009 | envStream.close();
|
---|
1010 | return false;
|
---|
1011 | }
|
---|
1012 | char *u;
|
---|
1013 | strtod(t, &u);
|
---|
1014 | t = u;
|
---|
1015 | if (*t == ' ' || *t == '\t') {
|
---|
1016 | while (*t == ' ' || *t == '\t')
|
---|
1017 | t++;
|
---|
1018 | if (*t != ',')
|
---|
1019 | t--;
|
---|
1020 | }
|
---|
1021 | if (t == s || (*t != ' ' && *t != '\t' && *t != ',')) {
|
---|
1022 | cerr << "Error: Mismatch in vector variable " << name << " in "
|
---|
1023 | << "environment file " << envFilename << " (line "
|
---|
1024 | << line << ").\n";
|
---|
1025 | envStream.close();
|
---|
1026 | return false;
|
---|
1027 | }
|
---|
1028 | strtod(t, &u);
|
---|
1029 | t = u;
|
---|
1030 | if (t == s || (*t != ' ' && *t != '\t' &&
|
---|
1031 | *t != '\0' && *t != '}')) {
|
---|
1032 | cerr << "Error: Mismatch in vector variable " << name << " in "
|
---|
1033 | << "environment file " << envFilename << " (line "
|
---|
1034 | << line << ").\n";
|
---|
1035 | envStream.close();
|
---|
1036 | return false;
|
---|
1037 | }
|
---|
1038 | if (options[i].value != NULL)
|
---|
1039 | delete options[i].value;
|
---|
1040 | options[i].value = new char[t - s + 1];
|
---|
1041 | strncpy(options[i].value, s, t - s);
|
---|
1042 | options[i].value[t - s] = '\0';
|
---|
1043 | s = t;
|
---|
1044 | break;
|
---|
1045 | }
|
---|
1046 | case optString: {
|
---|
1047 | if (options[i].value != NULL)
|
---|
1048 | delete options[i].value;
|
---|
1049 | options[i].value = new char[strlen(s) + 1];
|
---|
1050 | strcpy(options[i].value, s);
|
---|
1051 | s += strlen(s);
|
---|
1052 | break;
|
---|
1053 | }
|
---|
1054 | default: {
|
---|
1055 | Debug << "Internal error: Unknown type of option.\n" << flush;
|
---|
1056 | exit(1);
|
---|
1057 | }
|
---|
1058 | }
|
---|
1059 | // prepare the variable name for next pass
|
---|
1060 | t = strrchr(name, '.');
|
---|
1061 | if (t == NULL)
|
---|
1062 | name[0] = '\0';
|
---|
1063 | else
|
---|
1064 | *(t + 1) = '\0';
|
---|
1065 | // get next identifier
|
---|
1066 | s = ParseString(s, name);
|
---|
1067 | }
|
---|
1068 | }
|
---|
1069 | envStream.close();
|
---|
1070 | return true;
|
---|
1071 | }
|
---|
1072 |
|
---|
1073 | void
|
---|
1074 | Environment::PrintUsage(ostream &s) const
|
---|
1075 | {
|
---|
1076 | // Print out all environment variable names
|
---|
1077 | s << "Registered options:\n";
|
---|
1078 | for (int j = 0; j < numOptions; j++)
|
---|
1079 | s << options[j] << "\n";
|
---|
1080 | s << flush;
|
---|
1081 | }
|
---|
1082 |
|
---|
1083 | /**
|
---|
1084 | Input scene filename. Currently simplified X3D (.x3d), Unigraphics (.dat),
|
---|
1085 | and UNC (.ply) formats are supported.
|
---|
1086 | */
|
---|
1087 |
|
---|
1088 | Environment::Environment()
|
---|
1089 | {
|
---|
1090 | optionalParams = NULL;
|
---|
1091 | paramRows = 0;
|
---|
1092 | numParams = 0;
|
---|
1093 | params = NULL;
|
---|
1094 | maxOptions = 600;
|
---|
1095 |
|
---|
1096 |
|
---|
1097 | // this is maximal nuber of options.
|
---|
1098 | numOptions = 0;
|
---|
1099 |
|
---|
1100 | options = new COption[maxOptions];
|
---|
1101 |
|
---|
1102 | if (options == NULL ) {
|
---|
1103 | Debug << "Error: Memory allocation failed.\n";
|
---|
1104 | exit(1);
|
---|
1105 | }
|
---|
1106 |
|
---|
1107 | // register all basic options
|
---|
1108 |
|
---|
1109 | RegisterOption("Limits.threshold", optFloat, NULL, "0.01");
|
---|
1110 | RegisterOption("Limits.small", optFloat, NULL, "1e-6");
|
---|
1111 | RegisterOption("Limits.infinity", optFloat, NULL, "1e6");
|
---|
1112 |
|
---|
1113 | RegisterOption("Scene.filename",
|
---|
1114 | optString,
|
---|
1115 | "scene_filename=",
|
---|
1116 | "atlanta2.x3d");
|
---|
1117 |
|
---|
1118 | RegisterOption("Unigraphics.meshGrouping",
|
---|
1119 | optInt,
|
---|
1120 | "unigraphics_mesh_grouping=",
|
---|
1121 | "0");
|
---|
1122 |
|
---|
1123 | RegisterOption("ObjParser.meshGrouping",
|
---|
1124 | optInt,
|
---|
1125 | "objparser_mesh_grouping=",
|
---|
1126 | "0");
|
---|
1127 |
|
---|
1128 | RegisterOption("KdTree.Termination.minCost",
|
---|
1129 | optInt,
|
---|
1130 | "kd_term_min_cost=",
|
---|
1131 | "10");
|
---|
1132 |
|
---|
1133 | RegisterOption("KdTree.Termination.maxNodes",
|
---|
1134 | optInt,
|
---|
1135 | "kd_term_max_nodes=",
|
---|
1136 | "200000");
|
---|
1137 |
|
---|
1138 | RegisterOption("KdTree.Termination.maxDepth",
|
---|
1139 | optInt,
|
---|
1140 | "kd_term_max_depth=",
|
---|
1141 | "20");
|
---|
1142 |
|
---|
1143 | RegisterOption("KdTree.Termination.maxCostRatio",
|
---|
1144 | optFloat,
|
---|
1145 | "kd_term_max_cost_ratio=",
|
---|
1146 | "1.5");
|
---|
1147 |
|
---|
1148 | RegisterOption("KdTree.Termination.ct_div_ci",
|
---|
1149 | optFloat,
|
---|
1150 | "kd_term_ct_div_ci=",
|
---|
1151 | "1.0");
|
---|
1152 |
|
---|
1153 | RegisterOption("KdTree.splitMethod",
|
---|
1154 | optString,
|
---|
1155 | "kd_split_method=",
|
---|
1156 | "spatialMedian");
|
---|
1157 |
|
---|
1158 | RegisterOption("KdTree.pvsArea",
|
---|
1159 | optFloat,
|
---|
1160 | "kd_pvs_area=",
|
---|
1161 | "1e-5");
|
---|
1162 |
|
---|
1163 | RegisterOption("KdTree.splitBorder",
|
---|
1164 | optFloat,
|
---|
1165 | "kd_split_border=",
|
---|
1166 | "0.1");
|
---|
1167 |
|
---|
1168 | RegisterOption("KdTree.sahUseFaces",
|
---|
1169 | optBool,
|
---|
1170 | "kd_sah_use_faces=",
|
---|
1171 | "true");
|
---|
1172 |
|
---|
1173 | RegisterOption("MeshKdTree.Termination.minCost",
|
---|
1174 | optInt,
|
---|
1175 | "kd_term_min_cost=",
|
---|
1176 | "10");
|
---|
1177 |
|
---|
1178 | RegisterOption("MeshKdTree.Termination.maxDepth",
|
---|
1179 | optInt,
|
---|
1180 | "kd_term_max_depth=",
|
---|
1181 | "20");
|
---|
1182 |
|
---|
1183 | RegisterOption("MeshKdTree.Termination.maxCostRatio",
|
---|
1184 | optFloat,
|
---|
1185 | "kd_term_max_cost_ratio=",
|
---|
1186 | "1.5");
|
---|
1187 |
|
---|
1188 | RegisterOption("MeshKdTree.Termination.ct_div_ci",
|
---|
1189 | optFloat,
|
---|
1190 | "kd_term_ct_div_ci=",
|
---|
1191 | "1.0");
|
---|
1192 |
|
---|
1193 | RegisterOption("MeshKdTree.splitMethod",
|
---|
1194 | optString,
|
---|
1195 | "kd_split_method=",
|
---|
1196 | "spatialMedian");
|
---|
1197 |
|
---|
1198 | RegisterOption("MeshKdTree.splitBorder",
|
---|
1199 | optFloat,
|
---|
1200 | "kd_split_border=",
|
---|
1201 | "0.1");
|
---|
1202 |
|
---|
1203 | RegisterOption("Preprocessor.totalSamples",
|
---|
1204 | optInt,
|
---|
1205 | "total_samples=",
|
---|
1206 | "10000000");
|
---|
1207 |
|
---|
1208 | RegisterOption("Preprocessor.totalTime",
|
---|
1209 | optInt,
|
---|
1210 | "total_time=",
|
---|
1211 | "-1");
|
---|
1212 |
|
---|
1213 | RegisterOption("Preprocessor.samplesPerPass",
|
---|
1214 | optInt,
|
---|
1215 | "samples_per_pass=",
|
---|
1216 | "100000");
|
---|
1217 |
|
---|
1218 | RegisterOption("Preprocessor.samplesPerEvaluation",
|
---|
1219 | optInt,
|
---|
1220 | "samples_per_evaluation=",
|
---|
1221 | "1000000");
|
---|
1222 |
|
---|
1223 | RegisterOption("Preprocessor.useHwGlobalLines",
|
---|
1224 | optBool,
|
---|
1225 | "preprocessor_use_hw_global_lines=",
|
---|
1226 | "false");
|
---|
1227 |
|
---|
1228 | RegisterOption("Preprocessor.HwGlobalLines.texHeight",
|
---|
1229 | optInt,
|
---|
1230 | "preprocessor_hw_global_lines_texheight=",
|
---|
1231 | "128");
|
---|
1232 |
|
---|
1233 | RegisterOption("Preprocessor.HwGlobalLines.texWidth",
|
---|
1234 | optInt,
|
---|
1235 | "preprocessor_hw_global_lines_texwidth=",
|
---|
1236 | "128");
|
---|
1237 |
|
---|
1238 | RegisterOption("Preprocessor.HwGlobalLines.stepSize",
|
---|
1239 | optFloat,
|
---|
1240 | "preprocessor_hw_global_lines_stepsize=",
|
---|
1241 | "0.0001");
|
---|
1242 |
|
---|
1243 | RegisterOption("Preprocessor.HwGlobalLines.maxDepth",
|
---|
1244 | optInt,
|
---|
1245 | "preprocessor_hw_global_lines_max_depth=",
|
---|
1246 | "50");
|
---|
1247 |
|
---|
1248 | RegisterOption("Preprocessor.HwGlobalLines.sampleReverse",
|
---|
1249 | optBool,
|
---|
1250 | "preprocessor_hw_global_lines_sample_reverse=",
|
---|
1251 | "true");
|
---|
1252 |
|
---|
1253 | RegisterOption("RenderSampler.samples",
|
---|
1254 | optInt,
|
---|
1255 | "render_sampler_samples=",
|
---|
1256 | "1000");
|
---|
1257 |
|
---|
1258 | RegisterOption("RenderSampler.visibleThreshold",
|
---|
1259 | optInt,
|
---|
1260 | "render_sampler_visible_threshold=",
|
---|
1261 | "0");
|
---|
1262 |
|
---|
1263 | RegisterOption("RenderSampler.useOcclusionQueries",
|
---|
1264 | optBool,
|
---|
1265 | "render_sampler_use_occlusion_queries=",
|
---|
1266 | "true");
|
---|
1267 |
|
---|
1268 | RegisterOption("VssPreprocessor.testBeamSampling",
|
---|
1269 | optBool,
|
---|
1270 | "vss_beam_sampling=",
|
---|
1271 | "false");
|
---|
1272 |
|
---|
1273 | RegisterOption("VssPreprocessor.useImportanceSampling",
|
---|
1274 | optBool,
|
---|
1275 | "vss_use_importance=",
|
---|
1276 | "true");
|
---|
1277 |
|
---|
1278 |
|
---|
1279 | RegisterOption("VssPreprocessor.enlargeViewSpace",
|
---|
1280 | optBool,
|
---|
1281 | "vss_enlarge_viewspace=",
|
---|
1282 | "false");
|
---|
1283 |
|
---|
1284 | RegisterOption("VssPreprocessor.loadInitialSamples",
|
---|
1285 | optBool,
|
---|
1286 | "vss_load_loadInitialSamples=",
|
---|
1287 | "false");
|
---|
1288 |
|
---|
1289 | RegisterOption("VssPreprocessor.storeInitialSamples",
|
---|
1290 | optBool,
|
---|
1291 | "vss_store_storedInitialSamples=",
|
---|
1292 | "false");
|
---|
1293 |
|
---|
1294 |
|
---|
1295 |
|
---|
1296 | /*************************************************************************/
|
---|
1297 | /* Mutation strategy related options */
|
---|
1298 | /*************************************************************************/
|
---|
1299 |
|
---|
1300 | RegisterOption("Mutation.bufferSize",
|
---|
1301 | optInt,
|
---|
1302 | "mutation_buffer_size=",
|
---|
1303 | "500000");
|
---|
1304 |
|
---|
1305 | RegisterOption("Mutation.radiusOrigin",
|
---|
1306 | optFloat,
|
---|
1307 | "mutation_radius_origin=",
|
---|
1308 | "0.5");
|
---|
1309 |
|
---|
1310 | RegisterOption("Mutation.radiusTermination",
|
---|
1311 | optFloat,
|
---|
1312 | "mutation_radius_termination=",
|
---|
1313 | "0.5");
|
---|
1314 |
|
---|
1315 | RegisterOption("Mutation.useReverseSamples",
|
---|
1316 | optBool,
|
---|
1317 | "mutation_use_reverse_samples",
|
---|
1318 | "true");
|
---|
1319 |
|
---|
1320 | RegisterOption("Mutation.reverseSamplesDistance",
|
---|
1321 | optFloat,
|
---|
1322 | "mutation_reverse_samples_distance=",
|
---|
1323 | "3.0");
|
---|
1324 |
|
---|
1325 | RegisterOption("Mutation.useSilhouetteSamples",
|
---|
1326 | optBool,
|
---|
1327 | "mutation_use_silhouette_samples",
|
---|
1328 | "true");
|
---|
1329 |
|
---|
1330 | RegisterOption("Mutation.silhouetteSearchSteps",
|
---|
1331 | optInt,
|
---|
1332 | "mutation_silhouette_search_steps=",
|
---|
1333 | "3");
|
---|
1334 |
|
---|
1335 | RegisterOption("Mutation.silhouetteProb",
|
---|
1336 | optFloat,
|
---|
1337 | "mutation_silhouette_prob=",
|
---|
1338 | "0.8");
|
---|
1339 |
|
---|
1340 | RegisterOption("Mutation.usePassImportance",
|
---|
1341 | optBool,
|
---|
1342 | "mutation_use_pass_importance",
|
---|
1343 | "true");
|
---|
1344 |
|
---|
1345 | RegisterOption("Mutation.useUnsuccCountImportance",
|
---|
1346 | optBool,
|
---|
1347 | "mutation_use_unsucc_count_importance",
|
---|
1348 | "false");
|
---|
1349 |
|
---|
1350 |
|
---|
1351 | /*************************************************************************/
|
---|
1352 | /* GvsPrerpocessor related options */
|
---|
1353 | /*************************************************************************/
|
---|
1354 |
|
---|
1355 |
|
---|
1356 | RegisterOption("GvsPreprocessor.totalSamples",
|
---|
1357 | optInt,
|
---|
1358 | "gvs_total_samples=",
|
---|
1359 | "1000000");
|
---|
1360 |
|
---|
1361 | RegisterOption("GvsPreprocessor.gvsSamplesPerPass",
|
---|
1362 | optInt,
|
---|
1363 | "gvs_samples_per_pass=",
|
---|
1364 | "100000");
|
---|
1365 |
|
---|
1366 | RegisterOption("GvsPreprocessor.initialSamples",
|
---|
1367 | optInt,
|
---|
1368 | "gvs_initial_samples=",
|
---|
1369 | "256");
|
---|
1370 |
|
---|
1371 | RegisterOption("GvsPreprocessor.epsilon",
|
---|
1372 | optFloat,
|
---|
1373 | "gvs_epsilon=",
|
---|
1374 | "0.00001");
|
---|
1375 |
|
---|
1376 | RegisterOption("GvsPreprocessor.threshold",
|
---|
1377 | optFloat,
|
---|
1378 | "gvs_threshold=",
|
---|
1379 | "1.5");
|
---|
1380 |
|
---|
1381 | RegisterOption("GvsPreprocessor.perViewCell",
|
---|
1382 | optBool,
|
---|
1383 | "gvs_per_viewcell=",
|
---|
1384 | "true");
|
---|
1385 |
|
---|
1386 | RegisterOption("GvsPreprocessor.stats",
|
---|
1387 | optString,
|
---|
1388 | "gvs_stats=",
|
---|
1389 | "gvsStats.log");
|
---|
1390 |
|
---|
1391 | RegisterOption("GvsPreprocessor.minContribution",
|
---|
1392 | optInt,
|
---|
1393 | "gvs_min_contribution=",
|
---|
1394 | "50");
|
---|
1395 |
|
---|
1396 | RegisterOption("GvsPreprocessor.maxViewCells",
|
---|
1397 | optInt,
|
---|
1398 | "gvs_max_viewcells=",
|
---|
1399 | "5");
|
---|
1400 |
|
---|
1401 |
|
---|
1402 | /**********************************************************************/
|
---|
1403 | /* View cells related options */
|
---|
1404 | /**********************************************************************/
|
---|
1405 |
|
---|
1406 |
|
---|
1407 | RegisterOption("ViewCells.type",
|
---|
1408 | optString,
|
---|
1409 | "view_cells_type=",
|
---|
1410 | "vspBspTree");
|
---|
1411 |
|
---|
1412 | RegisterOption("ViewCells.samplingType",
|
---|
1413 | optString,
|
---|
1414 | "view_cells_sampling_type=",
|
---|
1415 | "box");
|
---|
1416 |
|
---|
1417 | RegisterOption("ViewCells.mergeStats",
|
---|
1418 | optString,
|
---|
1419 | "view_cells_merge_stats=",
|
---|
1420 | "mergeStats.log");
|
---|
1421 |
|
---|
1422 | RegisterOption("ViewCells.Evaluation.statsPrefix",
|
---|
1423 | optString,
|
---|
1424 | "view_cells_evaluation_stats_prefix=",
|
---|
1425 | "viewCells");
|
---|
1426 |
|
---|
1427 | RegisterOption("ViewCells.Evaluation.histogram",
|
---|
1428 | optBool,
|
---|
1429 | "view_cells_evaluation_histogram=",
|
---|
1430 | "false");
|
---|
1431 |
|
---|
1432 | RegisterOption("ViewCells.Evaluation.histoStepSize",
|
---|
1433 | optInt,
|
---|
1434 | "view_cells_evaluation_histo_step_size=",
|
---|
1435 | "5000");
|
---|
1436 |
|
---|
1437 | RegisterOption("ViewCells.Evaluation.histoMem",
|
---|
1438 | optInt,
|
---|
1439 | "view_cells_evaluation_histo_mem=",
|
---|
1440 | "50");
|
---|
1441 |
|
---|
1442 | RegisterOption("ViewCells.active",
|
---|
1443 | optInt,
|
---|
1444 | "view_cells_active=",
|
---|
1445 | "1000");
|
---|
1446 |
|
---|
1447 | RegisterOption("ViewCells.Construction.samples",
|
---|
1448 | optInt,
|
---|
1449 | "view_cells_construction_samples=",
|
---|
1450 | "0");
|
---|
1451 |
|
---|
1452 | RegisterOption("ViewCells.Construction.samplesPerPass",
|
---|
1453 | optInt,
|
---|
1454 | "view_cells_construction_samples_per_pass=",
|
---|
1455 | "500000");
|
---|
1456 |
|
---|
1457 | RegisterOption("ViewCells.PostProcess.samples",
|
---|
1458 | optInt,
|
---|
1459 | "view_cells_post_process_samples=",
|
---|
1460 | "0");
|
---|
1461 |
|
---|
1462 | RegisterOption("ViewCells.Visualization.samples",
|
---|
1463 | optInt,
|
---|
1464 | "view_cells_visualization_samples=",
|
---|
1465 | "0");
|
---|
1466 |
|
---|
1467 | RegisterOption("ViewCells.Visualization.maxOutput",
|
---|
1468 | optInt,
|
---|
1469 | "view_cells_visualization_max_output=",
|
---|
1470 | "20");
|
---|
1471 |
|
---|
1472 | RegisterOption("ViewCells.Filter.maxSize",
|
---|
1473 | optInt,
|
---|
1474 | "view_cells_filter_max_size=",
|
---|
1475 | "4");
|
---|
1476 |
|
---|
1477 | RegisterOption("ViewCells.Filter.width",
|
---|
1478 | optFloat,
|
---|
1479 | "view_cells_filter_width=",
|
---|
1480 | "1.0");
|
---|
1481 |
|
---|
1482 | RegisterOption("ViewCells.loadFromFile",
|
---|
1483 | optBool,
|
---|
1484 | "view_cells_load_from_file=",
|
---|
1485 | "false");
|
---|
1486 |
|
---|
1487 | RegisterOption("ViewCells.PostProcess.refine",
|
---|
1488 | optBool,
|
---|
1489 | "view_cells_refine=",
|
---|
1490 | "false");
|
---|
1491 |
|
---|
1492 | RegisterOption("ViewCells.PostProcess.compress",
|
---|
1493 | optBool,
|
---|
1494 | "view_cells_post_process_compress=",
|
---|
1495 | "false");
|
---|
1496 |
|
---|
1497 | RegisterOption("ViewCells.Evaluation.samples",
|
---|
1498 | optInt,
|
---|
1499 | "view_cells_evaluation_samples=",
|
---|
1500 | "8000000");
|
---|
1501 |
|
---|
1502 | RegisterOption("ViewCells.Evaluation.samplingType",
|
---|
1503 | optString,
|
---|
1504 | "view_cells_evaluation_sampling_type=",
|
---|
1505 | "box");
|
---|
1506 |
|
---|
1507 | RegisterOption("ViewCells.Evaluation.samplesPerPass",
|
---|
1508 | optInt,
|
---|
1509 | "view_cells_evaluation_samples_per_pass=",
|
---|
1510 | "300000");
|
---|
1511 |
|
---|
1512 | RegisterOption("ViewCells.Evaluation.samplesForStats",
|
---|
1513 | optInt,
|
---|
1514 | "view_cells_evaluation_samples_for_stats=",
|
---|
1515 | "300000");
|
---|
1516 |
|
---|
1517 | RegisterOption("ViewCells.exportToFile",
|
---|
1518 | optBool,
|
---|
1519 | "view_cells_export_to_file=",
|
---|
1520 | "false");
|
---|
1521 |
|
---|
1522 | RegisterOption("ViewCells.exportPvs",
|
---|
1523 | optBool,
|
---|
1524 | "view_cells_export_pvs=",
|
---|
1525 | "false");
|
---|
1526 |
|
---|
1527 | RegisterOption("ViewCells.exportBboxesForPvs",
|
---|
1528 | optBool,
|
---|
1529 | "view_cells_export_bounding_boxes=",
|
---|
1530 | "true");
|
---|
1531 |
|
---|
1532 | RegisterOption("ViewCells.boxesFilename",
|
---|
1533 | optString,
|
---|
1534 | "view_cells_boxes_filename=",
|
---|
1535 | "boxes.out");
|
---|
1536 |
|
---|
1537 | RegisterOption("ViewCells.evaluateViewCells",
|
---|
1538 | optBool,
|
---|
1539 | "view_cells_evaluate=",
|
---|
1540 | "false");
|
---|
1541 |
|
---|
1542 | RegisterOption("ViewCells.maxViewCells",
|
---|
1543 | optInt,
|
---|
1544 | "view_cells_max_view_cells=",
|
---|
1545 | "0");
|
---|
1546 |
|
---|
1547 | RegisterOption("ViewCells.Evaluation.stepSize",
|
---|
1548 | optInt,
|
---|
1549 | "view_cells_evaluation_step_size=",
|
---|
1550 | "100");
|
---|
1551 |
|
---|
1552 | RegisterOption("ViewCells.maxPvsRatio",
|
---|
1553 | optFloat,
|
---|
1554 | "view_cells_max_pvs_ratio=",
|
---|
1555 | "0.1");
|
---|
1556 |
|
---|
1557 | RegisterOption("ViewCells.triangleWeight",
|
---|
1558 | optFloat,
|
---|
1559 | "view_cells_triangle_weight=",
|
---|
1560 | "1.0");
|
---|
1561 |
|
---|
1562 | RegisterOption("ViewCells.objectWeight",
|
---|
1563 | optFloat,
|
---|
1564 | "view_cells_object_weight=",
|
---|
1565 | "0.0");
|
---|
1566 |
|
---|
1567 | RegisterOption("ViewCells.filename",
|
---|
1568 | optString,
|
---|
1569 | "view_cells_filename=",
|
---|
1570 | "atlanta_viewcells_large.x3d");
|
---|
1571 |
|
---|
1572 | RegisterOption("ViewCells.height",
|
---|
1573 | optFloat,
|
---|
1574 | "view_cells_height=",
|
---|
1575 | "5.0");
|
---|
1576 |
|
---|
1577 | RegisterOption("ViewCells.Visualization.colorCode",
|
---|
1578 | optString,
|
---|
1579 | "view_cells_visualization_color_code=",
|
---|
1580 | "PVS");
|
---|
1581 |
|
---|
1582 | RegisterOption("ViewCells.Visualization.clipPlanePos",
|
---|
1583 | optFloat,
|
---|
1584 | "view_cells_visualization_clip_plane_pos=",
|
---|
1585 | "0.35");
|
---|
1586 |
|
---|
1587 | RegisterOption("ViewCells.Visualization.exportGeometry",
|
---|
1588 | optBool,
|
---|
1589 | "view_cells_visualization_export_geometry=",
|
---|
1590 | "false");
|
---|
1591 |
|
---|
1592 | RegisterOption("ViewCells.Visualization.exportRays",
|
---|
1593 | optBool,
|
---|
1594 | "view_cells_visualization_export_rays=",
|
---|
1595 | "false");
|
---|
1596 |
|
---|
1597 | RegisterOption("ViewCells.processOnlyValidViewCells",
|
---|
1598 | optBool,
|
---|
1599 | "view_cells_process_only_valid_view_cells",
|
---|
1600 | "false");
|
---|
1601 |
|
---|
1602 | RegisterOption("ViewCells.PostProcess.maxCostRatio",
|
---|
1603 | optFloat,
|
---|
1604 | "view_cells_post_process_max_cost_ratio=",
|
---|
1605 | "0.9");
|
---|
1606 |
|
---|
1607 | RegisterOption("ViewCells.PostProcess.renderCostWeight",
|
---|
1608 | optFloat,
|
---|
1609 | "view_cells_post_process_render_cost_weight",
|
---|
1610 | "0.5");
|
---|
1611 |
|
---|
1612 | RegisterOption("ViewCells.PostProcess.avgCostMaxDeviation",
|
---|
1613 | optFloat,
|
---|
1614 | "view_cells_avgcost_max_deviations",
|
---|
1615 | "0.5");
|
---|
1616 |
|
---|
1617 | RegisterOption("ViewCells.PostProcess.maxMergesPerPass",
|
---|
1618 | optInt,
|
---|
1619 | "view_cells_post_process_max_merges_per_pass=",
|
---|
1620 | "500");
|
---|
1621 |
|
---|
1622 | RegisterOption("ViewCells.PostProcess.minViewCells",
|
---|
1623 | optInt,
|
---|
1624 | "view_cells_post_process_min_view_cells=",
|
---|
1625 | "1000");
|
---|
1626 |
|
---|
1627 | RegisterOption("ViewCells.PostProcess.useRaysForMerge",
|
---|
1628 | optBool,
|
---|
1629 | "view_cells_post_process_use_rays_for_merge=",
|
---|
1630 | "false");
|
---|
1631 |
|
---|
1632 | RegisterOption("ViewCells.PostProcess.merge",
|
---|
1633 | optBool,
|
---|
1634 | "view_cells_post_process_merge=",
|
---|
1635 | "true");
|
---|
1636 |
|
---|
1637 | RegisterOption("ViewCells.Visualization.exportMergedViewCells",
|
---|
1638 | optBool,
|
---|
1639 | "view_cells_viz_export_merged_viewcells=",
|
---|
1640 | "false");
|
---|
1641 |
|
---|
1642 | RegisterOption("ViewCells.maxStaticMemory",
|
---|
1643 | optFloat,
|
---|
1644 | "view_cells_max_static_mem=",
|
---|
1645 | "8.0");
|
---|
1646 |
|
---|
1647 | RegisterOption("ViewCells.Visualization.useClipPlane",
|
---|
1648 | optBool,
|
---|
1649 | "view_cells_viz_use_clip_plane=",
|
---|
1650 | "false");
|
---|
1651 |
|
---|
1652 | RegisterOption("ViewCells.showVisualization",
|
---|
1653 | optBool,
|
---|
1654 | "view_cells_show_visualization=",
|
---|
1655 | "false");
|
---|
1656 |
|
---|
1657 | RegisterOption("ViewCells.Visualization.clipPlaneAxis",
|
---|
1658 | optInt,
|
---|
1659 | "view_cells_viz_clip_plane_axis=",
|
---|
1660 | "0");
|
---|
1661 |
|
---|
1662 | RegisterOption("ViewCells.loadGeometry",
|
---|
1663 | optBool,
|
---|
1664 | "view_cells_load_geometry=",
|
---|
1665 | "false");
|
---|
1666 |
|
---|
1667 | RegisterOption("ViewCells.geometryFilename",
|
---|
1668 | optString,
|
---|
1669 | "view_cells_geometry_filename=",
|
---|
1670 | "viewCellsGeometry.x3d");
|
---|
1671 |
|
---|
1672 | RegisterOption("ViewCells.useBaseTrianglesAsGeometry",
|
---|
1673 | optBool,
|
---|
1674 | "view_cells_use_base_triangles_as_geometry=",
|
---|
1675 | "false");
|
---|
1676 |
|
---|
1677 | RegisterOption("ViewCells.compressObjects",
|
---|
1678 | optBool,
|
---|
1679 | "view_cells_compress_objects=",
|
---|
1680 | "false");
|
---|
1681 |
|
---|
1682 | RegisterOption("ViewCells.useKdPvs",
|
---|
1683 | optBool,
|
---|
1684 | "view_cells_use_kd_pvs",
|
---|
1685 | "false");
|
---|
1686 |
|
---|
1687 | RegisterOption("ViewCells.useKdPvsAfterFiltering",
|
---|
1688 | optBool,
|
---|
1689 | "af_use_kd_pvs",
|
---|
1690 | "false");
|
---|
1691 |
|
---|
1692 | RegisterOption("ViewCells.importRandomViewCells",
|
---|
1693 | optBool,
|
---|
1694 | "view_cells_import_random_viewcells",
|
---|
1695 | "false");
|
---|
1696 |
|
---|
1697 | RegisterOption("ViewCells.exportRandomViewCells",
|
---|
1698 | optBool,
|
---|
1699 | "view_cells_export_random_viewcells",
|
---|
1700 | "false");
|
---|
1701 |
|
---|
1702 |
|
---|
1703 |
|
---|
1704 |
|
---|
1705 | /****************************************************************************/
|
---|
1706 | /* Render simulation related options */
|
---|
1707 | /****************************************************************************/
|
---|
1708 |
|
---|
1709 |
|
---|
1710 | RegisterOption("Simulation.objRenderCost",
|
---|
1711 | optFloat,
|
---|
1712 | "simulation_obj_render_cost",
|
---|
1713 | "1.0");
|
---|
1714 |
|
---|
1715 | RegisterOption("Simulation.vcOverhead",
|
---|
1716 | optFloat,
|
---|
1717 | "simulation_vc_overhead",
|
---|
1718 | "0.05");
|
---|
1719 |
|
---|
1720 | RegisterOption("Simulation.moveSpeed",
|
---|
1721 | optFloat,
|
---|
1722 | "simulation_moveSpeed",
|
---|
1723 | "1.0");
|
---|
1724 |
|
---|
1725 |
|
---|
1726 |
|
---|
1727 | /******************************************************************/
|
---|
1728 | /* Bsp tree related options */
|
---|
1729 | /******************************************************************/
|
---|
1730 |
|
---|
1731 |
|
---|
1732 | RegisterOption("BspTree.Construction.input",
|
---|
1733 | optString,
|
---|
1734 | "bsp_construction_input=",
|
---|
1735 | "fromViewCells");
|
---|
1736 |
|
---|
1737 | RegisterOption("BspTree.subdivisionStats",
|
---|
1738 | optString,
|
---|
1739 | "bsp_subdivision_stats=",
|
---|
1740 | "bspSubdivisionStats.log");
|
---|
1741 |
|
---|
1742 | RegisterOption("BspTree.Construction.samples",
|
---|
1743 | optInt,
|
---|
1744 | "bsp_construction_samples=",
|
---|
1745 | "100000");
|
---|
1746 |
|
---|
1747 | RegisterOption("BspTree.Construction.epsilon",
|
---|
1748 | optFloat,
|
---|
1749 | "bsp_construction_epsilon=",
|
---|
1750 | "0.002");
|
---|
1751 |
|
---|
1752 | RegisterOption("BspTree.Termination.minPolygons",
|
---|
1753 | optInt,
|
---|
1754 | "bsp_term_min_polygons=",
|
---|
1755 | "5");
|
---|
1756 |
|
---|
1757 | RegisterOption("BspTree.Termination.minPvs",
|
---|
1758 | optInt,
|
---|
1759 | "bsp_term_min_pvs=",
|
---|
1760 | "20");
|
---|
1761 |
|
---|
1762 | RegisterOption("BspTree.Termination.minProbability",
|
---|
1763 | optFloat,
|
---|
1764 | "bsp_term_min_probability=",
|
---|
1765 | "0.001");
|
---|
1766 |
|
---|
1767 | RegisterOption("BspTree.Termination.maxRayContribution",
|
---|
1768 | optFloat,
|
---|
1769 | "bsp_term_ray_contribution=",
|
---|
1770 | "0.005");
|
---|
1771 |
|
---|
1772 | RegisterOption("BspTree.Termination.minAccRayLenght",
|
---|
1773 | optFloat,
|
---|
1774 | "bsp_term_min_acc_ray_length=",
|
---|
1775 | "50");
|
---|
1776 |
|
---|
1777 | RegisterOption("BspTree.Termination.minRays",
|
---|
1778 | optInt,
|
---|
1779 | "bsp_term_min_rays=",
|
---|
1780 | "-1");
|
---|
1781 |
|
---|
1782 | RegisterOption("BspTree.Termination.ct_div_ci",
|
---|
1783 | optFloat,
|
---|
1784 | "bsp_term_ct_div_ci=",
|
---|
1785 | "0.0");
|
---|
1786 |
|
---|
1787 | RegisterOption("BspTree.Termination.maxDepth",
|
---|
1788 | optInt,
|
---|
1789 | "bsp_term_max_depth=",
|
---|
1790 | "100");
|
---|
1791 |
|
---|
1792 | RegisterOption("BspTree.Termination.maxCostRatio",
|
---|
1793 | optFloat,
|
---|
1794 | "bsp_term_axis_aligned_max_cost_ratio=",
|
---|
1795 | "1.5");
|
---|
1796 |
|
---|
1797 | RegisterOption("BspTree.Termination.AxisAligned.ct_div_ci",
|
---|
1798 | optFloat,
|
---|
1799 | "bsp_term_axis_aligned_ct_div_ci=",
|
---|
1800 | "0.5");
|
---|
1801 |
|
---|
1802 | RegisterOption("BspTree.AxisAligned.splitBorder",
|
---|
1803 | optFloat,
|
---|
1804 | "bsp__axis_aligned_split_border=",
|
---|
1805 | "0.1");
|
---|
1806 |
|
---|
1807 | RegisterOption("BspTree.Termination.AxisAligned.minPolys",
|
---|
1808 | optInt,
|
---|
1809 | "bsp_term_axis_aligned_max_polygons=",
|
---|
1810 | "50");
|
---|
1811 |
|
---|
1812 | RegisterOption("BspTree.Termination.AxisAligned.minObjects",
|
---|
1813 | optInt,
|
---|
1814 | "bsp_term_min_objects=",
|
---|
1815 | "3");
|
---|
1816 |
|
---|
1817 | RegisterOption("BspTree.Termination.AxisAligned.minRays",
|
---|
1818 | optInt,
|
---|
1819 | "bsp_term_axis_aligned_min_rays=",
|
---|
1820 | "-1");
|
---|
1821 |
|
---|
1822 | RegisterOption("BspTree.splitPlaneStrategy",
|
---|
1823 | optString,
|
---|
1824 | "bsp_split_method=",
|
---|
1825 | "leastSplits");
|
---|
1826 |
|
---|
1827 | RegisterOption("BspTree.maxPolyCandidates",
|
---|
1828 | optInt,
|
---|
1829 | "bsp_max_poly_candidates=",
|
---|
1830 | "20");
|
---|
1831 |
|
---|
1832 | RegisterOption("BspTree.maxRayCandidates",
|
---|
1833 | optInt,
|
---|
1834 | "bsp_max_plane_candidates=",
|
---|
1835 | "20");
|
---|
1836 |
|
---|
1837 | RegisterOption("BspTree.maxTests",
|
---|
1838 | optInt,
|
---|
1839 | "bsp_max_tests=",
|
---|
1840 | "5000");
|
---|
1841 |
|
---|
1842 | RegisterOption("BspTree.Termination.maxViewCells",
|
---|
1843 | optInt,
|
---|
1844 | "bsp_max_view_cells=",
|
---|
1845 | "5000");
|
---|
1846 |
|
---|
1847 | RegisterOption("BspTree.Visualization.exportSplits",
|
---|
1848 | optBool,
|
---|
1849 | "bsp_visualization.export_splits=",
|
---|
1850 | "false");
|
---|
1851 |
|
---|
1852 | RegisterOption("BspTree.Factor.verticalSplits", optFloat, "bsp_factor_vertical=", "1.0");
|
---|
1853 | RegisterOption("BspTree.Factor.largestPolyArea", optFloat, "bsp_factor_largest_poly=", "1.0");
|
---|
1854 | RegisterOption("BspTree.Factor.blockedRays", optFloat, "bsp_factor_blocked=", "1.0");
|
---|
1855 | RegisterOption("BspTree.Factor.leastSplits", optFloat, "bsp_factor_least_splits=", "1.0");
|
---|
1856 | RegisterOption("BspTree.Factor.balancedPolys", optFloat, "bsp_factor_balanced_polys=", "1.0");
|
---|
1857 | RegisterOption("BspTree.Factor.balancedViewCells", optFloat, "bsp_factor_balanced_view_cells=", "1.0");
|
---|
1858 | RegisterOption("BspTree.Factor.leastRaySplits", optFloat, "bsp_factor_least_ray_splits=", "1.0");
|
---|
1859 | RegisterOption("BspTree.Factor.balancedRays", optFloat, "bsp_factor_balanced_rays=", "1.0");
|
---|
1860 | RegisterOption("BspTree.Factor.pvs", optFloat, "bsp_factor_pvs=", "1.0");
|
---|
1861 |
|
---|
1862 |
|
---|
1863 |
|
---|
1864 |
|
---|
1865 | /**********************************************************************/
|
---|
1866 | /* Preprocessor related options */
|
---|
1867 | /**********************************************************************/
|
---|
1868 |
|
---|
1869 | RegisterOption("Preprocessor.type",
|
---|
1870 | optString,
|
---|
1871 | "preprocessor=",
|
---|
1872 | "sampling");
|
---|
1873 |
|
---|
1874 | RegisterOption("Preprocessor.stats",
|
---|
1875 | optString,
|
---|
1876 | "preprocessor_stats=",
|
---|
1877 | "stats.log");
|
---|
1878 |
|
---|
1879 | RegisterOption("Preprocessor.samplesFilename",
|
---|
1880 | optString,
|
---|
1881 | "preprocessor_samples_filename=",
|
---|
1882 | "rays.out");
|
---|
1883 |
|
---|
1884 | RegisterOption("Preprocessor.loadMeshes",
|
---|
1885 | optBool,
|
---|
1886 | "preprocessor_load_meshes",
|
---|
1887 | "true");
|
---|
1888 |
|
---|
1889 | RegisterOption("Preprocessor.evaluateFilter",
|
---|
1890 | optBool,
|
---|
1891 | "preprocessor_evaluate_filter",
|
---|
1892 | "false");
|
---|
1893 |
|
---|
1894 | RegisterOption("Preprocessor.delayVisibilityComputation",
|
---|
1895 | optBool,
|
---|
1896 | "preprocessor_delay_computation",
|
---|
1897 | "true");
|
---|
1898 |
|
---|
1899 | RegisterOption("Preprocessor.pvsRenderErrorSamples",
|
---|
1900 | optInt,
|
---|
1901 | "preprocessor_pvs_rendererror_samples=",
|
---|
1902 | "10000");
|
---|
1903 |
|
---|
1904 | RegisterOption("Preprocessor.useGlRenderer",
|
---|
1905 | optBool,
|
---|
1906 | "preprocessor_use_gl_renderer",
|
---|
1907 | "false");
|
---|
1908 |
|
---|
1909 | RegisterOption("Preprocessor.useGlDebugger",
|
---|
1910 | optBool,
|
---|
1911 | "preprocessor_use_gl_debugger",
|
---|
1912 | "false");
|
---|
1913 |
|
---|
1914 | RegisterOption("Preprocessor.detectEmptyViewSpace",
|
---|
1915 | optBool,
|
---|
1916 | "preprocessor_detect_empty_viewspace",
|
---|
1917 | "false");
|
---|
1918 |
|
---|
1919 | RegisterOption("Preprocessor.quitOnFinish",
|
---|
1920 | optBool,
|
---|
1921 | "preprocessor_quit_on_finish",
|
---|
1922 | "true");
|
---|
1923 |
|
---|
1924 | RegisterOption("Preprocessor.computeVisibility",
|
---|
1925 | optBool,
|
---|
1926 | "preprocessor_compute_visibility",
|
---|
1927 | "true");
|
---|
1928 |
|
---|
1929 | RegisterOption("Preprocessor.exportVisibility",
|
---|
1930 | optBool,
|
---|
1931 | "preprocessor_export_visibility",
|
---|
1932 | "true");
|
---|
1933 |
|
---|
1934 | RegisterOption("Preprocessor.visibilityFile",
|
---|
1935 | optString,
|
---|
1936 | "preprocessor_visibility_file=",
|
---|
1937 | "visibility.xml");
|
---|
1938 |
|
---|
1939 | RegisterOption("Preprocessor.applyVisibilityFilter",
|
---|
1940 | optBool,
|
---|
1941 | "preprocessor_apply_filter",
|
---|
1942 | "false");
|
---|
1943 |
|
---|
1944 | RegisterOption("Preprocessor.evaluatePixelError",
|
---|
1945 | optBool,
|
---|
1946 | "preprocessor_evaluatePixelError",
|
---|
1947 | "false");
|
---|
1948 |
|
---|
1949 | RegisterOption("Preprocessor.applyVisibilitySpatialFilter",
|
---|
1950 | optBool,
|
---|
1951 | "preprocessor_apply_spatial_filter",
|
---|
1952 | "false");
|
---|
1953 |
|
---|
1954 | RegisterOption("Preprocessor.visibilityFilterWidth",
|
---|
1955 | optFloat,
|
---|
1956 | "preprocessor_visibility_filter_width=",
|
---|
1957 | "0.02");
|
---|
1958 |
|
---|
1959 | RegisterOption("Preprocessor.histogram.maxValue",
|
---|
1960 | optInt,
|
---|
1961 | "preprocessor_histogram_max_value=",
|
---|
1962 | "1000");
|
---|
1963 |
|
---|
1964 | RegisterOption("Preprocessor.rayCastMethod",
|
---|
1965 | optInt,
|
---|
1966 | "preprocessor_ray_cast_method=",
|
---|
1967 | "0");
|
---|
1968 |
|
---|
1969 | RegisterOption("Preprocessor.histogram.intervals",
|
---|
1970 | optInt,
|
---|
1971 | "preprocessor_histogram_intervals=",
|
---|
1972 | "20");
|
---|
1973 |
|
---|
1974 | RegisterOption("Preprocessor.histogram.file",
|
---|
1975 | optString,
|
---|
1976 | "preprocessor_histogram_file=",
|
---|
1977 | "histogram.log");
|
---|
1978 |
|
---|
1979 | RegisterOption("Preprocessor.exportKdTree",
|
---|
1980 | optBool,
|
---|
1981 | "preprocessor_export_kd_tree=",
|
---|
1982 | "false");
|
---|
1983 |
|
---|
1984 | RegisterOption("Preprocessor.loadKdTree",
|
---|
1985 | optBool,
|
---|
1986 | "preprocessor_load_kd_tree=",
|
---|
1987 | "false");
|
---|
1988 |
|
---|
1989 | RegisterOption("Preprocessor.kdTreeFilename",
|
---|
1990 | optString,
|
---|
1991 | "preprocessor_kd_tree_filename=",
|
---|
1992 | "vienna_kdtree.bin.gz");
|
---|
1993 |
|
---|
1994 | RegisterOption("Preprocessor.exportObj",
|
---|
1995 | optBool,
|
---|
1996 | "preprocessor_export_obj=",
|
---|
1997 | "false");
|
---|
1998 |
|
---|
1999 | RegisterOption("Preprocessor.useViewSpaceBox",
|
---|
2000 | optBool,
|
---|
2001 | "preprocessor_use_viewspace_box=",
|
---|
2002 | "false");
|
---|
2003 |
|
---|
2004 | RegisterOption("Preprocessor.Export.rays", optBool, "export_rays", "false");
|
---|
2005 | RegisterOption("Preprocessor.Export.animation", optBool, "export_animation", "false");
|
---|
2006 | RegisterOption("Preprocessor.Export.numRays", optInt, "export_num_rays=", "5000");
|
---|
2007 |
|
---|
2008 | /*************************************************************************/
|
---|
2009 | /* VSS Preprocessor cells related options */
|
---|
2010 | /*************************************************************************/
|
---|
2011 |
|
---|
2012 | RegisterOption("VssTree.maxDepth", optInt, "kd_depth=", "12");
|
---|
2013 | RegisterOption("VssTree.minPvs", optInt, "kd_minpvs=", "1");
|
---|
2014 | RegisterOption("VssTree.minRays", optInt, "kd_minrays=", "10");
|
---|
2015 | RegisterOption("VssTree.maxCostRatio", optFloat, "maxcost=", "0.95");
|
---|
2016 | RegisterOption("VssTree.maxRayContribution", optFloat, "maxraycontrib=", "0.5");
|
---|
2017 |
|
---|
2018 | RegisterOption("VssTree.epsilon", optFloat, "kd_eps=", "1e-6");
|
---|
2019 | RegisterOption("VssTree.ct_div_ci", optFloat, "kd_ctdivci=", "1.0");
|
---|
2020 | RegisterOption("VssTree.randomize", optBool, "randomize", "false");
|
---|
2021 | RegisterOption("VssTree.splitType", optString, "split=", "queries");
|
---|
2022 | RegisterOption("VssTree.splitUseOnlyDrivingAxis", optBool, "splitdriving=", "false");
|
---|
2023 | RegisterOption("VssTree.useRss", optBool, "rss=", "false");
|
---|
2024 | RegisterOption("VssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000");
|
---|
2025 |
|
---|
2026 | RegisterOption("VssTree.minSize", optFloat, "minsize=", "0.001");
|
---|
2027 |
|
---|
2028 | RegisterOption("VssTree.maxTotalMemory", optFloat, "mem=", "60.0");
|
---|
2029 | RegisterOption("VssTree.maxStaticMemory", optFloat, "statmem=", "8.0");
|
---|
2030 |
|
---|
2031 | RegisterOption("VssTree.queryType", optString, "qtype=", "static");
|
---|
2032 |
|
---|
2033 |
|
---|
2034 |
|
---|
2035 | RegisterOption("VssTree.queryPosWeight", optFloat, "qposweight=", "0.0");
|
---|
2036 | RegisterOption("VssTree.useRefDirSplits", optBool, "refdir=", "false");
|
---|
2037 | RegisterOption("VssTree.refDirAngle", optFloat, "refangle=", "10");
|
---|
2038 | RegisterOption("VssTree.refDirBoxMaxSize", optFloat, "refboxsize=", "0.1");
|
---|
2039 | RegisterOption("VssTree.accessTimeThreshold", optInt, "accesstime=", "1000");
|
---|
2040 | RegisterOption("VssTree.minCollapseDepth", optInt, "colldepth=", "4");
|
---|
2041 |
|
---|
2042 | RegisterOption("VssTree.interleaveDirSplits", optBool, "interleavedirsplits", "true");
|
---|
2043 | RegisterOption("VssTree.dirSplitDepth", optInt, "dirsplidepth=", "10");
|
---|
2044 |
|
---|
2045 |
|
---|
2046 | // RegisterOption("RssPreprocessor.initialSamples",
|
---|
2047 | // optInt,
|
---|
2048 | // "rss_initial_samples=",
|
---|
2049 | // "100000");
|
---|
2050 |
|
---|
2051 | // RegisterOption("RssPreprocessor.vssSamples",
|
---|
2052 | // optInt,
|
---|
2053 | // "rss_vss_samples=",
|
---|
2054 | // "1000000");
|
---|
2055 |
|
---|
2056 | // RegisterOption("RssPreprocessor.vssSamplesPerPass",
|
---|
2057 | // optInt,
|
---|
2058 | // "rss_vss_samples_per_pass=",
|
---|
2059 | // "1000");
|
---|
2060 |
|
---|
2061 | // RegisterOption("RssPreprocessor.samplesPerPass",
|
---|
2062 | // optInt,
|
---|
2063 | // "rss_samples_per_pass=",
|
---|
2064 | // "100000");
|
---|
2065 |
|
---|
2066 | RegisterOption("RssPreprocessor.useImportanceSampling",
|
---|
2067 | optBool,
|
---|
2068 | "rss_use_importance",
|
---|
2069 | "true");
|
---|
2070 |
|
---|
2071 | RegisterOption("RssPreprocessor.useRssTree",
|
---|
2072 | optBool,
|
---|
2073 | "rss_use_rss_tree",
|
---|
2074 | "true");
|
---|
2075 |
|
---|
2076 | RegisterOption("RssPreprocessor.objectBasedSampling",
|
---|
2077 | optBool,
|
---|
2078 | "rss_object_based_sampling",
|
---|
2079 | "true");
|
---|
2080 |
|
---|
2081 | RegisterOption("RssPreprocessor.directionalSampling",
|
---|
2082 | optBool,
|
---|
2083 | "rss_directional_sampling",
|
---|
2084 | "false");
|
---|
2085 |
|
---|
2086 | RegisterOption("RssPreprocessor.distributions",
|
---|
2087 | optString,
|
---|
2088 | "rss_distributions=",
|
---|
2089 | "rss+spatial+object");
|
---|
2090 |
|
---|
2091 | RegisterOption("RssTree.hybridDepth", optInt, "hybrid_depth=", "10");
|
---|
2092 | RegisterOption("RssTree.maxDepth", optInt, "kd_depth=", "12");
|
---|
2093 | RegisterOption("RssTree.minPvs", optInt, "kd_minpvs=", "1");
|
---|
2094 | RegisterOption("RssTree.minRays", optInt, "kd_minrays=", "10");
|
---|
2095 | RegisterOption("RssTree.maxCostRatio", optFloat, "maxcost=", "0.95");
|
---|
2096 | RegisterOption("RssTree.maxRayContribution", optFloat, "maxraycontrib=", "0.5");
|
---|
2097 |
|
---|
2098 | RegisterOption("RssTree.epsilon", optFloat, "kd_eps=", "1e-6");
|
---|
2099 | RegisterOption("RssTree.ct_div_ci", optFloat, "kd_ctdivci=", "1.0");
|
---|
2100 | RegisterOption("RssTree.randomize", optBool, "randomize=", "false");
|
---|
2101 | RegisterOption("RssTree.splitType", optString, "rss_split=", "queries");
|
---|
2102 | RegisterOption("RssTree.splitUseOnlyDrivingAxis", optBool, "splitdriving=", "false");
|
---|
2103 |
|
---|
2104 | RegisterOption("RssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000");
|
---|
2105 |
|
---|
2106 | RegisterOption("RssTree.minSize", optFloat, "minsize=", "0.001");
|
---|
2107 |
|
---|
2108 | RegisterOption("RssTree.maxTotalMemory", optFloat, "mem=", "60.0");
|
---|
2109 | RegisterOption("RssTree.maxStaticMemory", optFloat, "statmem=", "8.0");
|
---|
2110 |
|
---|
2111 | RegisterOption("RssTree.queryType", optString, "qtype=", "static");
|
---|
2112 |
|
---|
2113 | RegisterOption("RssTree.queryPosWeight", optFloat, "qposweight=", "0.0");
|
---|
2114 | RegisterOption("RssTree.useRefDirSplits", optBool, "refdir", "false");
|
---|
2115 | RegisterOption("RssTree.refDirAngle", optFloat, "refangle=", "10");
|
---|
2116 | RegisterOption("RssTree.refDirBoxMaxSize", optFloat, "refboxsize=", "0.1");
|
---|
2117 | RegisterOption("RssTree.accessTimeThreshold", optInt, "accesstime=", "1000");
|
---|
2118 | RegisterOption("RssTree.minCollapseDepth", optInt, "colldepth=", "4");
|
---|
2119 |
|
---|
2120 | RegisterOption("RssTree.interleaveDirSplits", optBool, "interleavedirsplits=", "true");
|
---|
2121 | RegisterOption("RssTree.dirSplitDepth", optInt, "dirsplidepth=", "10");
|
---|
2122 | RegisterOption("RssTree.importanceBasedCost", optBool, "importance_based_cost=", "true");
|
---|
2123 | RegisterOption("RssTree.maxRays", optInt, "rss_max_rays=", "2000000");
|
---|
2124 |
|
---|
2125 | RegisterOption("RssTree.perObjectTree", optBool, "rss_per_object_tree", "false");
|
---|
2126 |
|
---|
2127 | RegisterOption("RssPreprocessor.Export.pvs", optBool, "rss_export_pvs=", "false");
|
---|
2128 | RegisterOption("RssPreprocessor.Export.rssTree", optBool, "rss_export_rss_tree=", "false");
|
---|
2129 |
|
---|
2130 | RegisterOption("RssPreprocessor.useViewcells", optBool, "rss_use_viewcells=", "false");
|
---|
2131 | RegisterOption("RssPreprocessor.updateSubdivision",
|
---|
2132 | optBool,
|
---|
2133 | "rss_update_subdivision=",
|
---|
2134 | "false");
|
---|
2135 |
|
---|
2136 |
|
---|
2137 | /************************************************************************************/
|
---|
2138 | /* Rss preprocessor related options */
|
---|
2139 | /************************************************************************************/
|
---|
2140 |
|
---|
2141 |
|
---|
2142 | RegisterOption("RssPreprocessor.loadInitialSamples",
|
---|
2143 | optBool,
|
---|
2144 | "vss_load_loadInitialSamples=",
|
---|
2145 | "false");
|
---|
2146 |
|
---|
2147 | RegisterOption("RssPreprocessor.storeInitialSamples",
|
---|
2148 | optBool,
|
---|
2149 | "vss_store_storeInitialSamples=",
|
---|
2150 | "false");
|
---|
2151 |
|
---|
2152 |
|
---|
2153 | /************************************************************************************/
|
---|
2154 | /* View space partition BSP tree related options */
|
---|
2155 | /************************************************************************************/
|
---|
2156 |
|
---|
2157 | RegisterOption("VspBspTree.Termination.minGlobalCostRatio",
|
---|
2158 | optFloat,
|
---|
2159 | "vsp_bsp_term_min_global_cost_ratio=",
|
---|
2160 | "0.0001");
|
---|
2161 |
|
---|
2162 | RegisterOption("VspBspTree.useSplitCostQueue",
|
---|
2163 | optBool,
|
---|
2164 | "vsp_bsp_use_split_cost_queue=",
|
---|
2165 | "true");
|
---|
2166 |
|
---|
2167 | RegisterOption("VspBspTree.Termination.globalCostMissTolerance",
|
---|
2168 | optInt,
|
---|
2169 | "vsp_bsp_term_global_cost_miss_tolerance=",
|
---|
2170 | "4");
|
---|
2171 |
|
---|
2172 | RegisterOption("VspBspTree.Termination.minPolygons",
|
---|
2173 | optInt,
|
---|
2174 | "vsp_bsp_term_min_polygons=",
|
---|
2175 | "-1");
|
---|
2176 |
|
---|
2177 | RegisterOption("VspBspTree.Termination.minPvs",
|
---|
2178 | optInt,
|
---|
2179 | "vsp_bsp_term_min_pvs=",
|
---|
2180 | "20");
|
---|
2181 |
|
---|
2182 | RegisterOption("VspBspTree.Termination.minProbability",
|
---|
2183 | optFloat,
|
---|
2184 | "vsp_bsp_term_min_probability=",
|
---|
2185 | "0.001");
|
---|
2186 |
|
---|
2187 | RegisterOption("VspBspTree.subdivisionStats",
|
---|
2188 | optString,
|
---|
2189 | "vsp_bsp_subdivision_stats=",
|
---|
2190 | "vspBspSubdivisionStats.log");
|
---|
2191 |
|
---|
2192 | RegisterOption("VspBspTree.Termination.maxRayContribution",
|
---|
2193 | optFloat,
|
---|
2194 | "vsp_bsp_term_ray_contribution=",
|
---|
2195 | "2");
|
---|
2196 |
|
---|
2197 | RegisterOption("VspBspTree.Termination.minAccRayLenght",
|
---|
2198 | optFloat,
|
---|
2199 | "vsp_bsp_term_min_acc_ray_length=",
|
---|
2200 | "50");
|
---|
2201 |
|
---|
2202 | RegisterOption("VspBspTree.Termination.minRays",
|
---|
2203 | optInt,
|
---|
2204 | "vsp_bsp_term_min_rays=",
|
---|
2205 | "-1");
|
---|
2206 |
|
---|
2207 | RegisterOption("VspBspTree.Termination.ct_div_ci",
|
---|
2208 | optFloat,
|
---|
2209 | "vsp_bsp_term_ct_div_ci=",
|
---|
2210 | "0.0");
|
---|
2211 |
|
---|
2212 | RegisterOption("VspBspTree.Termination.maxDepth",
|
---|
2213 | optInt,
|
---|
2214 | "vsp_bsp_term_max_depth=",
|
---|
2215 | "50");
|
---|
2216 |
|
---|
2217 | RegisterOption("VspBspTree.Termination.AxisAligned.maxCostRatio",
|
---|
2218 | optFloat,
|
---|
2219 | "vsp_bsp_term_axis_aligned_max_cost_ratio=",
|
---|
2220 | "1.5");
|
---|
2221 |
|
---|
2222 | RegisterOption("VspBspTree.useCostHeuristics",
|
---|
2223 | optBool,
|
---|
2224 | "vsp_bsp_use_cost_heuristics=",
|
---|
2225 | "false");
|
---|
2226 |
|
---|
2227 | RegisterOption("VspBspTree.Termination.maxViewCells",
|
---|
2228 | optInt,
|
---|
2229 | "vsp_bsp_term_max_view_cells=",
|
---|
2230 | "10000");
|
---|
2231 |
|
---|
2232 | RegisterOption("VspBspTree.Termination.maxCostRatio",
|
---|
2233 | optFloat,
|
---|
2234 | "vsp_bsp_term_max_cost_ratio=",
|
---|
2235 | "1.5");
|
---|
2236 |
|
---|
2237 | RegisterOption("VspBspTree.Termination.missTolerance",
|
---|
2238 | optInt,
|
---|
2239 | "vsp_bsp_term_miss_tolerance=",
|
---|
2240 | "4");
|
---|
2241 |
|
---|
2242 | RegisterOption("VspBspTree.splitPlaneStrategy",
|
---|
2243 | optInt,
|
---|
2244 | "vsp_bsp_split_method=",
|
---|
2245 | "1026");
|
---|
2246 |
|
---|
2247 | RegisterOption("VspBspTree.maxPolyCandidates",
|
---|
2248 | optInt,
|
---|
2249 | "vsp_bsp_max_poly_candidates=",
|
---|
2250 | "20");
|
---|
2251 |
|
---|
2252 | RegisterOption("VspBspTree.maxRayCandidates",
|
---|
2253 | optInt,
|
---|
2254 | "vsp_bsp_max_plane_candidates=",
|
---|
2255 | "20");
|
---|
2256 |
|
---|
2257 | RegisterOption("VspBspTree.maxTests",
|
---|
2258 | optInt,
|
---|
2259 | "vsp_bsp_max_tests=",
|
---|
2260 | "5000");
|
---|
2261 |
|
---|
2262 | RegisterOption("VspBspTree.Construction.samples",
|
---|
2263 | optInt,
|
---|
2264 | "vsp_bsp_construction_samples=",
|
---|
2265 | "100000");
|
---|
2266 |
|
---|
2267 | RegisterOption("VspBspTree.Construction.minBand",
|
---|
2268 | optFloat,
|
---|
2269 | "vsp_bsp_construction_min_band=",
|
---|
2270 | "0.01");
|
---|
2271 |
|
---|
2272 | RegisterOption("VspBspTree.Construction.maxBand",
|
---|
2273 | optFloat,
|
---|
2274 | "vsp_bsp_construction_max_band=",
|
---|
2275 | "0.99");
|
---|
2276 |
|
---|
2277 | RegisterOption("VspBspTree.Construction.useDrivingAxisForMaxCost",
|
---|
2278 | optBool,
|
---|
2279 | "vsp_bsp_construction_use_drivingaxis_for_maxcost=",
|
---|
2280 | "false");
|
---|
2281 |
|
---|
2282 | RegisterOption("VspBspTree.Construction.epsilon",
|
---|
2283 | optFloat,
|
---|
2284 | "vsp_bsp_construction_epsilon=",
|
---|
2285 | "0.002");
|
---|
2286 |
|
---|
2287 | RegisterOption("VspBspTree.Visualization.exportSplits",
|
---|
2288 | optBool,
|
---|
2289 | "vsp_bsp_visualization.export_splits",
|
---|
2290 | "false");
|
---|
2291 |
|
---|
2292 | RegisterOption("VspBspTree.splitUseOnlyDrivingAxis",
|
---|
2293 | optBool,
|
---|
2294 | "vsp_bsp_split_only_driving_axis=",
|
---|
2295 | "false");
|
---|
2296 |
|
---|
2297 | RegisterOption("VspBspTree.usePolygonSplitIfAvailable",
|
---|
2298 | optBool,
|
---|
2299 | "vsp_bsp_usePolygonSplitIfAvailable=",
|
---|
2300 | "false");
|
---|
2301 |
|
---|
2302 | RegisterOption("VspBspTree.Termination.AxisAligned.minRays",
|
---|
2303 | optInt,
|
---|
2304 | "bsp_term_axis_aligned_min_rays=",
|
---|
2305 | "0");
|
---|
2306 |
|
---|
2307 | RegisterOption("VspBspTree.Termination.AxisAligned.maxRayContribution",
|
---|
2308 | optFloat,
|
---|
2309 | "bsp_term_axis_aligned_min_rays=",
|
---|
2310 | "2");
|
---|
2311 |
|
---|
2312 | RegisterOption("VspBspTree.Factor.leastRaySplits",
|
---|
2313 | optFloat,
|
---|
2314 | "vsp_bsp_factor_least_ray_splits=",
|
---|
2315 | "1.0");
|
---|
2316 |
|
---|
2317 | RegisterOption("VspBspTree.Factor.balancedRays",
|
---|
2318 | optFloat,
|
---|
2319 | "vsp_bsp_factor_balanced_rays=",
|
---|
2320 | "1.0");
|
---|
2321 |
|
---|
2322 | RegisterOption("VspBspTree.Factor.pvs",
|
---|
2323 | optFloat,
|
---|
2324 | "vsp_bsp_factor_pvs=",
|
---|
2325 | "1.0");
|
---|
2326 |
|
---|
2327 | RegisterOption("VspBspTree.Construction.renderCostWeight",
|
---|
2328 | optFloat,
|
---|
2329 | "vsp_bsp_post_process_render_cost_weight=",
|
---|
2330 | "1.0");
|
---|
2331 |
|
---|
2332 | RegisterOption("VspBspTree.Construction.renderCostDecreaseWeight",
|
---|
2333 | optFloat,
|
---|
2334 | "vsp_bsp_construction_render_cost_decrease_weight=",
|
---|
2335 | "0.99");
|
---|
2336 |
|
---|
2337 | RegisterOption("VspBspTree.Construction.randomize",
|
---|
2338 | optBool,
|
---|
2339 | "vsp_bsp_construction_randomize=",
|
---|
2340 | "false");
|
---|
2341 |
|
---|
2342 | RegisterOption("VspBspTree.simulateOctree",
|
---|
2343 | optBool,
|
---|
2344 | "vsp_bsp_simulate_octree=",
|
---|
2345 | "false");
|
---|
2346 |
|
---|
2347 | RegisterOption("VspBspTree.nodePriorityQueueType",
|
---|
2348 | optInt,
|
---|
2349 | "vsp_bsp_node_queue_type=",
|
---|
2350 | "0");
|
---|
2351 |
|
---|
2352 | RegisterOption("VspBspTree.useRandomAxis",
|
---|
2353 | optBool,
|
---|
2354 | "-vsp_bsp_use_random_axis=",
|
---|
2355 | "false");
|
---|
2356 |
|
---|
2357 | RegisterOption("VspBspTree.maxTotalMemory",
|
---|
2358 | optFloat,
|
---|
2359 | "vsp_bsp_max_total_mem=",
|
---|
2360 | "60.0");
|
---|
2361 |
|
---|
2362 | RegisterOption("VspBspTree.maxStaticMemory",
|
---|
2363 | optFloat,
|
---|
2364 | "vsp_bsp_max_static_mem=",
|
---|
2365 | "8.0");
|
---|
2366 |
|
---|
2367 |
|
---|
2368 |
|
---|
2369 | /***************************************************************************/
|
---|
2370 | /* View space partition tree related options */
|
---|
2371 | /***************************************************************************/
|
---|
2372 |
|
---|
2373 |
|
---|
2374 | RegisterOption("VspTree.Construction.samples",
|
---|
2375 | optInt,
|
---|
2376 | "vsp_construction_samples=",
|
---|
2377 | "10000");
|
---|
2378 |
|
---|
2379 | RegisterOption("VspTree.Construction.renderCostDecreaseWeight",
|
---|
2380 | optFloat,
|
---|
2381 | "vsp_construction_render_cost_decrease_weight=",
|
---|
2382 | "0.99");
|
---|
2383 |
|
---|
2384 | RegisterOption("VspTree.Termination.maxDepth",
|
---|
2385 | optInt,
|
---|
2386 | "vsp_term_max_depth=",
|
---|
2387 | "100");
|
---|
2388 |
|
---|
2389 | RegisterOption("VspTree.Termination.minRays",
|
---|
2390 | optInt,
|
---|
2391 | "vsp_term_min_rays=",
|
---|
2392 | "-1");
|
---|
2393 |
|
---|
2394 |
|
---|
2395 | RegisterOption("VspTree.Termination.minPvs",
|
---|
2396 | optInt,
|
---|
2397 | "vsp_term_min_pvs=",
|
---|
2398 | "20");
|
---|
2399 |
|
---|
2400 | RegisterOption("VspTree.Termination.minProbability",
|
---|
2401 | optFloat,
|
---|
2402 | "vsp_term_min_probability=",
|
---|
2403 | "0.0000001");
|
---|
2404 |
|
---|
2405 | RegisterOption("VspTree.Termination.maxRayContribution",
|
---|
2406 | optFloat,
|
---|
2407 | "vsp_term_ray_contribution=",
|
---|
2408 | "0.9");
|
---|
2409 |
|
---|
2410 | RegisterOption("VspTree.Termination.maxCostRatio",
|
---|
2411 | optFloat,
|
---|
2412 | "vsp_term_max_cost_ratio=",
|
---|
2413 | "1.5");
|
---|
2414 |
|
---|
2415 | RegisterOption("VspTree.Termination.maxViewCells",
|
---|
2416 | optInt,
|
---|
2417 | "vsp_term_max_view_cells=",
|
---|
2418 | "10000");
|
---|
2419 |
|
---|
2420 | RegisterOption("VspTree.Termination.missTolerance",
|
---|
2421 | optInt,
|
---|
2422 | "vsp_term_miss_tolerance=",
|
---|
2423 | "4");
|
---|
2424 |
|
---|
2425 | RegisterOption("VspTree.Termination.minGlobalCostRatio",
|
---|
2426 | optFloat,
|
---|
2427 | "vsp_term_min_global_cost_ratio=",
|
---|
2428 | "0.0001");
|
---|
2429 |
|
---|
2430 | RegisterOption("VspTree.Termination.globalCostMissTolerance",
|
---|
2431 | optInt,
|
---|
2432 | "vsp_term_global_cost_miss_tolerance=",
|
---|
2433 | "4");
|
---|
2434 |
|
---|
2435 | RegisterOption("VspTree.Termination.ct_div_ci",
|
---|
2436 | optFloat,
|
---|
2437 | "vsp_term_ct_div_ci=",
|
---|
2438 | "0.0");
|
---|
2439 |
|
---|
2440 | RegisterOption("VspTree.Construction.epsilon",
|
---|
2441 | optFloat,
|
---|
2442 | "vsp_construction_epsilon=",
|
---|
2443 | "0.002");
|
---|
2444 |
|
---|
2445 | RegisterOption("VspTree.splitUseOnlyDrivingAxis",
|
---|
2446 | optBool,
|
---|
2447 | "vsp_split_only_driving_axis=",
|
---|
2448 | "false");
|
---|
2449 |
|
---|
2450 | RegisterOption("VspTree.maxStaticMemory",
|
---|
2451 | optFloat,
|
---|
2452 | "vsp_max_static_mem=",
|
---|
2453 | "8.0");
|
---|
2454 |
|
---|
2455 | RegisterOption("VspTree.useCostHeuristics",
|
---|
2456 | optBool,
|
---|
2457 | "vsp_use_cost_heuristics=",
|
---|
2458 | "false");
|
---|
2459 |
|
---|
2460 | RegisterOption("VspTree.simulateOctree",
|
---|
2461 | optBool,
|
---|
2462 | "vsp_simulate_octree=",
|
---|
2463 | "false");
|
---|
2464 |
|
---|
2465 | RegisterOption("VspTree.Construction.randomize",
|
---|
2466 | optBool,
|
---|
2467 | "vsp_construction_randomize=",
|
---|
2468 | "false");
|
---|
2469 |
|
---|
2470 | RegisterOption("VspTree.subdivisionStats",
|
---|
2471 | optString,
|
---|
2472 | "vsp_subdivision_stats=",
|
---|
2473 | "vspSubdivisionStats.log");
|
---|
2474 |
|
---|
2475 | RegisterOption("VspTree.Construction.minBand",
|
---|
2476 | optFloat,
|
---|
2477 | "vsp_construction_min_band=",
|
---|
2478 | "0.01");
|
---|
2479 |
|
---|
2480 | RegisterOption("VspTree.Construction.maxBand",
|
---|
2481 | optFloat,
|
---|
2482 | "vsp_construction_max_band=",
|
---|
2483 | "0.99");
|
---|
2484 |
|
---|
2485 | RegisterOption("VspTree.maxTests",
|
---|
2486 | optInt,
|
---|
2487 | "vsp_max_tests=",
|
---|
2488 | "5000");
|
---|
2489 |
|
---|
2490 |
|
---|
2491 |
|
---|
2492 | /***********************************************************************/
|
---|
2493 | /* Object space partition tree related options */
|
---|
2494 | /***********************************************************************/
|
---|
2495 |
|
---|
2496 |
|
---|
2497 | RegisterOption("OspTree.Construction.randomize",
|
---|
2498 | optBool,
|
---|
2499 | "osp_construction_randomize=",
|
---|
2500 | "false");
|
---|
2501 |
|
---|
2502 | RegisterOption("OspTree.Termination.maxDepth",
|
---|
2503 | optInt,
|
---|
2504 | "osp_term_max_depth=",
|
---|
2505 | "30");
|
---|
2506 |
|
---|
2507 | RegisterOption("OspTree.Termination.maxLeaves",
|
---|
2508 | optInt,
|
---|
2509 | "osp_term_max_leaves=",
|
---|
2510 | "1000");
|
---|
2511 |
|
---|
2512 | RegisterOption("OspTree.Termination.minObjects",
|
---|
2513 | optInt,
|
---|
2514 | "osp_term_min_objects=",
|
---|
2515 | "1");
|
---|
2516 |
|
---|
2517 | RegisterOption("OspTree.Termination.minProbability",
|
---|
2518 | optFloat,
|
---|
2519 | "osp_term_min_objects=",
|
---|
2520 | "0.00001");
|
---|
2521 |
|
---|
2522 | RegisterOption("OspTree.Termination.missTolerance",
|
---|
2523 | optInt,
|
---|
2524 | "osp_term_miss_tolerance=",
|
---|
2525 | "8");
|
---|
2526 |
|
---|
2527 | RegisterOption("OspTree.Termination.maxCostRatio",
|
---|
2528 | optFloat,
|
---|
2529 | "osp_term_max_cost_ratio=",
|
---|
2530 | "0.99");
|
---|
2531 |
|
---|
2532 | RegisterOption("OspTree.Termination.minGlobalCostRatio",
|
---|
2533 | optFloat,
|
---|
2534 | "osp_term_min_global_cost_ratio=",
|
---|
2535 | "0.00001");
|
---|
2536 |
|
---|
2537 | RegisterOption("OspTree.Termination.globalCostMissTolerance",
|
---|
2538 | optInt,
|
---|
2539 | "osp_term_global_cost_miss_tolerance=",
|
---|
2540 | "4");
|
---|
2541 |
|
---|
2542 | RegisterOption("OspTree.Termination.ct_div_ci",
|
---|
2543 | optFloat,
|
---|
2544 | "osp_term_ct_div_ci=",
|
---|
2545 | "0");
|
---|
2546 |
|
---|
2547 | RegisterOption("OspTree.Construction.epsilon",
|
---|
2548 | optFloat,
|
---|
2549 | "osp_construction_epsilon=",
|
---|
2550 | "0.00001");
|
---|
2551 |
|
---|
2552 | // if only the driving axis is used for axis aligned split
|
---|
2553 | RegisterOption("OspTree.splitUseOnlyDrivingAxis",
|
---|
2554 | optBool,
|
---|
2555 | "osp_split_only_driving_axis=",
|
---|
2556 | "false");
|
---|
2557 |
|
---|
2558 | RegisterOption("OspTree.maxStaticMemory",
|
---|
2559 | optFloat,
|
---|
2560 | "osp_max_static_mem=",
|
---|
2561 | "8.0");
|
---|
2562 |
|
---|
2563 | RegisterOption("OspTree.useCostHeuristics",
|
---|
2564 | optBool,
|
---|
2565 | "osp_use_cost_heuristics=",
|
---|
2566 | "true");
|
---|
2567 |
|
---|
2568 | RegisterOption("OspTree.subdivisionStats",
|
---|
2569 | optString,
|
---|
2570 | "osp_subdivision_stats=",
|
---|
2571 | "ospSubdivisionStats.log");
|
---|
2572 |
|
---|
2573 | RegisterOption("OspTree.Construction.splitBorder",
|
---|
2574 | optFloat,
|
---|
2575 | "osp_construction_split_border=",
|
---|
2576 | "0.01");
|
---|
2577 |
|
---|
2578 | RegisterOption("OspTree.Construction.renderCostDecreaseWeight",
|
---|
2579 | optFloat,
|
---|
2580 | "osp_construction_render_cost_decrease_weight=",
|
---|
2581 | "0.99");
|
---|
2582 |
|
---|
2583 |
|
---|
2584 |
|
---|
2585 | /**********************************************************************/
|
---|
2586 | /* Bounding Volume Hierarchy related options */
|
---|
2587 | /**********************************************************************/
|
---|
2588 |
|
---|
2589 | RegisterOption("BvHierarchy.Construction.randomize",
|
---|
2590 | optBool,
|
---|
2591 | "bvh_construction_randomize=",
|
---|
2592 | "false");
|
---|
2593 |
|
---|
2594 | RegisterOption("BvHierarchy.Termination.maxDepth",
|
---|
2595 | optInt,
|
---|
2596 | "bvh_term_max_depth=",
|
---|
2597 | "30");
|
---|
2598 |
|
---|
2599 | RegisterOption("BvHierarchy.Termination.maxLeaves",
|
---|
2600 | optInt,
|
---|
2601 | "bvh_term_max_leaves=",
|
---|
2602 | "1000");
|
---|
2603 |
|
---|
2604 | RegisterOption("BvHierarchy.Termination.minObjects",
|
---|
2605 | optInt,
|
---|
2606 | "bvh_term_min_objects=",
|
---|
2607 | "1");
|
---|
2608 |
|
---|
2609 | RegisterOption("BvHierarchy.Termination.minProbability",
|
---|
2610 | optFloat,
|
---|
2611 | "bvh_term_min_objects=",
|
---|
2612 | "0.0000001");
|
---|
2613 |
|
---|
2614 | RegisterOption("BvHierarchy.Termination.minRays",
|
---|
2615 | optInt,
|
---|
2616 | "bvh_term_min_rays=",
|
---|
2617 | "0");
|
---|
2618 |
|
---|
2619 | RegisterOption("BvHierarchy.Termination.missTolerance",
|
---|
2620 | optInt,
|
---|
2621 | "osp_term_miss_tolerance=",
|
---|
2622 | "8");
|
---|
2623 |
|
---|
2624 | RegisterOption("BvHierarchy.Termination.maxCostRatio",
|
---|
2625 | optFloat,
|
---|
2626 | "bvh_term_max_cost_ratio=",
|
---|
2627 | "0.99");
|
---|
2628 |
|
---|
2629 | RegisterOption("BvHierarchy.Termination.minGlobalCostRatio",
|
---|
2630 | optFloat,
|
---|
2631 | "bvh_term_min_global_cost_ratio=",
|
---|
2632 | "0.00001");
|
---|
2633 |
|
---|
2634 | RegisterOption("BvHierarchy.Termination.globalCostMissTolerance",
|
---|
2635 | optInt,
|
---|
2636 | "bvh_term_global_cost_miss_tolerance=",
|
---|
2637 | "4");
|
---|
2638 |
|
---|
2639 | // if only the driving axis is used for axis aligned split
|
---|
2640 | RegisterOption("BvHierarchy.splitUseOnlyDrivingAxis",
|
---|
2641 | optBool,
|
---|
2642 | "bvh_split_only_driving_axis=",
|
---|
2643 | "false");
|
---|
2644 |
|
---|
2645 | RegisterOption("BvHierarchy.maxStaticMemory",
|
---|
2646 | optFloat,
|
---|
2647 | "bvh_max_static_mem=",
|
---|
2648 | "8.0");
|
---|
2649 |
|
---|
2650 | RegisterOption("BvHierarchy.useCostHeuristics",
|
---|
2651 | optBool,
|
---|
2652 | "bvh_use_cost_heuristics=",
|
---|
2653 | "true");
|
---|
2654 |
|
---|
2655 | RegisterOption("BvHierarchy.useSah",
|
---|
2656 | optBool,
|
---|
2657 | "bvh_use_sah=",
|
---|
2658 | "false");
|
---|
2659 |
|
---|
2660 | RegisterOption("BvHierarchy.subdivisionStats",
|
---|
2661 | optString,
|
---|
2662 | "bvh_subdivision_stats=",
|
---|
2663 | "bvhSubdivisionStats.log");
|
---|
2664 |
|
---|
2665 | RegisterOption("BvHierarchy.Construction.renderCostDecreaseWeight",
|
---|
2666 | optFloat,
|
---|
2667 | "bvh_construction_render_cost_decrease_weight=",
|
---|
2668 | "0.99");
|
---|
2669 |
|
---|
2670 | RegisterOption("BvHierarchy.Construction.useGlobalSorting",
|
---|
2671 | optBool,
|
---|
2672 | "bvh_construction_use_global_sorting=",
|
---|
2673 | "true");
|
---|
2674 |
|
---|
2675 | RegisterOption("BvHierarchy.Construction.useInitialSubdivision",
|
---|
2676 | optBool,
|
---|
2677 | "bvh_construction_use_initial_subdivision=",
|
---|
2678 | "false");
|
---|
2679 |
|
---|
2680 | RegisterOption("BvHierarchy.Construction.Initial.minObjects",
|
---|
2681 | optInt,
|
---|
2682 | "bvh_construction_use_initial_min_objects=",
|
---|
2683 | "100000");
|
---|
2684 |
|
---|
2685 | RegisterOption("BvHierarchy.Construction.Initial.minArea",
|
---|
2686 | optFloat,
|
---|
2687 | "bvh_construction_use_initial_min_area=",
|
---|
2688 | "0.0001");
|
---|
2689 |
|
---|
2690 | RegisterOption("BvHierarchy.Construction.Initial.maxAreaRatio",
|
---|
2691 | optFloat,
|
---|
2692 | "bvh_construction_use_initial_max_area_ratio=",
|
---|
2693 | "0.9");
|
---|
2694 |
|
---|
2695 | RegisterOption("BvHierarchy.minRaysForVisibility",
|
---|
2696 | optInt,
|
---|
2697 | "bvh_min_rays_for_vis=",
|
---|
2698 | "0");
|
---|
2699 |
|
---|
2700 | RegisterOption("BvHierarchy.maxTests",
|
---|
2701 | optInt,
|
---|
2702 | "bvh_max_tests=",
|
---|
2703 | "50000");
|
---|
2704 |
|
---|
2705 |
|
---|
2706 | /*******************************************************************/
|
---|
2707 | /* Hierarchy Manager related options */
|
---|
2708 | /*******************************************************************/
|
---|
2709 |
|
---|
2710 | RegisterOption("Hierarchy.Construction.samples",
|
---|
2711 | optInt,
|
---|
2712 | "hierarchy_construction_samples=",
|
---|
2713 | "100000");
|
---|
2714 |
|
---|
2715 | RegisterOption("Hierarchy.minRenderCost",
|
---|
2716 | optFloat,
|
---|
2717 | "hierarchy_minRenderCost=",
|
---|
2718 | "0");
|
---|
2719 |
|
---|
2720 | RegisterOption("Hierarchy.subdivisionStats",
|
---|
2721 | optString,
|
---|
2722 | "hierarchy_subdivision_stats=",
|
---|
2723 | "hierarchySubdivisionStats.log");
|
---|
2724 |
|
---|
2725 | RegisterOption("Hierarchy.type",
|
---|
2726 | optString,
|
---|
2727 | "hierarchy_type=",
|
---|
2728 | "bvh");
|
---|
2729 |
|
---|
2730 | RegisterOption("Hierarchy.Termination.minGlobalCostRatio",
|
---|
2731 | optFloat,
|
---|
2732 | "hierarchy_term_min_global_cost_ratio=",
|
---|
2733 | "0.000000001");
|
---|
2734 |
|
---|
2735 | RegisterOption("Hierarchy.Termination.globalCostMissTolerance",
|
---|
2736 | optInt,
|
---|
2737 | "hierarchy_term_global_cost_miss_tolerance=",
|
---|
2738 | "4");
|
---|
2739 |
|
---|
2740 | RegisterOption("Hierarchy.Termination.maxLeaves",
|
---|
2741 | optInt,
|
---|
2742 | "hierarchy_term_max_leaves=",
|
---|
2743 | "1000");
|
---|
2744 |
|
---|
2745 | RegisterOption("Hierarchy.Construction.type",
|
---|
2746 | optInt,
|
---|
2747 | "hierarchy_construction_type=",
|
---|
2748 | "0");
|
---|
2749 |
|
---|
2750 | RegisterOption("Hierarchy.Construction.minDepthForOsp",
|
---|
2751 | optInt,
|
---|
2752 | "hierarchy_construction_min_depth_for_osp=",
|
---|
2753 | "-1");
|
---|
2754 |
|
---|
2755 | RegisterOption("Hierarchy.Construction.startWithObjectSpace",
|
---|
2756 | optBool,
|
---|
2757 | "hierarchy_construction_start_with_osp=",
|
---|
2758 | "true");
|
---|
2759 |
|
---|
2760 | RegisterOption("Hierarchy.Construction.considerMemory",
|
---|
2761 | optBool,
|
---|
2762 | "hierarchy_construction_consider_memory=",
|
---|
2763 | "true");
|
---|
2764 |
|
---|
2765 | RegisterOption("Hierarchy.Construction.repairQueue",
|
---|
2766 | optBool,
|
---|
2767 | "hierarchy_construction_repair_queue=",
|
---|
2768 | "true");
|
---|
2769 |
|
---|
2770 | RegisterOption("Hierarchy.Construction.minDepthForVsp",
|
---|
2771 | optInt,
|
---|
2772 | "hierarchy_construction_min_depth_for_vsp=",
|
---|
2773 | "-1");
|
---|
2774 |
|
---|
2775 | RegisterOption("Hierarchy.Termination.maxMemory",
|
---|
2776 | optFloat,
|
---|
2777 | "hierarchy_term_max_memory=",
|
---|
2778 | "1");
|
---|
2779 |
|
---|
2780 | RegisterOption("Hierarchy.Termination.memoryConst",
|
---|
2781 | optFloat,
|
---|
2782 | "hierarchy_term_memory_const=",
|
---|
2783 | "1.0");
|
---|
2784 |
|
---|
2785 | RegisterOption("Hierarchy.Construction.useMultiLevel",
|
---|
2786 | optBool,
|
---|
2787 | "hierarchy_construction_multilevel=",
|
---|
2788 | "false");
|
---|
2789 |
|
---|
2790 | RegisterOption("Hierarchy.Construction.levels",
|
---|
2791 | optInt,
|
---|
2792 | "hierarchy_construction_levels=",
|
---|
2793 | "4");
|
---|
2794 |
|
---|
2795 | RegisterOption("Hierarchy.Construction.maxRepairs",
|
---|
2796 | optInt,
|
---|
2797 | "hierarchy_construction_max_repairs=",
|
---|
2798 | "1000");
|
---|
2799 |
|
---|
2800 | RegisterOption("Hierarchy.Construction.minStepsOfSameType",
|
---|
2801 | optInt,
|
---|
2802 | "hierarchy_construction_min_steps_same_type=",
|
---|
2803 | "200");
|
---|
2804 |
|
---|
2805 | RegisterOption("Hierarchy.Construction.maxStepsOfSameType",
|
---|
2806 | optInt,
|
---|
2807 | "hierarchy_construction_max_steps_same_type=",
|
---|
2808 | "700");
|
---|
2809 |
|
---|
2810 | RegisterOption("Hierarchy.Construction.recomputeSplitPlaneOnRepair",
|
---|
2811 | optBool,
|
---|
2812 | "hierarchy_construction_recompute_split_on_repair=",
|
---|
2813 | "true");
|
---|
2814 |
|
---|
2815 | RegisterOption("Hierarchy.Construction.maxAvgRaysPerObject",
|
---|
2816 | optFloat,
|
---|
2817 | "hierarchy_construction_max_avg_rays_per_object=",
|
---|
2818 | "0");
|
---|
2819 |
|
---|
2820 | RegisterOption("Hierarchy.Construction.minAvgRaysPerObject",
|
---|
2821 | optFloat,
|
---|
2822 | "hierarchy_construction_min_avg_rays_per_object=",
|
---|
2823 | "0");
|
---|
2824 |
|
---|
2825 | RegisterOption("Hierarchy.useTraversalTree",
|
---|
2826 | optBool,
|
---|
2827 | "hierarchy_use_traversal_tree=",
|
---|
2828 | "false");
|
---|
2829 |
|
---|
2830 | ///////////////////////////////////////////////////////
|
---|
2831 |
|
---|
2832 | RegisterOption("TraversalTree.Termination.minCost",
|
---|
2833 | optInt,
|
---|
2834 | "kd_term_min_cost=",
|
---|
2835 | "1");
|
---|
2836 |
|
---|
2837 | RegisterOption("TraversalTree.Termination.maxNodes",
|
---|
2838 | optInt,
|
---|
2839 | "kd_term_max_nodes=",
|
---|
2840 | "200000");
|
---|
2841 |
|
---|
2842 | RegisterOption("TraversalTree.Termination.maxDepth",
|
---|
2843 | optInt,
|
---|
2844 | "kd_term_max_depth=",
|
---|
2845 | "20");
|
---|
2846 |
|
---|
2847 | RegisterOption("TraversalTree.Termination.maxCostRatio",
|
---|
2848 | optFloat,
|
---|
2849 | "kd_term_max_cost_ratio=",
|
---|
2850 | "1.5");
|
---|
2851 |
|
---|
2852 | RegisterOption("TraversalTree.Termination.ct_div_ci",
|
---|
2853 | optFloat,
|
---|
2854 | "kd_term_ct_div_ci=",
|
---|
2855 | "1.0");
|
---|
2856 |
|
---|
2857 | RegisterOption("TraversalTree.splitMethod",
|
---|
2858 | optString,
|
---|
2859 | "kd_split_method=",
|
---|
2860 | "spatialMedian");
|
---|
2861 |
|
---|
2862 | RegisterOption("TraversalTree.splitBorder",
|
---|
2863 | optFloat,
|
---|
2864 | "kd_split_border=",
|
---|
2865 | "0.1");
|
---|
2866 |
|
---|
2867 | RegisterOption("TraversalTree.sahUseFaces",
|
---|
2868 | optBool,
|
---|
2869 | "kd_sah_use_faces=",
|
---|
2870 | "true");
|
---|
2871 |
|
---|
2872 | /////////////////////////////////////////////////////////////////
|
---|
2873 | // By Vlastimil Havran
|
---|
2874 | RegisterOption("BSP.splitclip", optBool,
|
---|
2875 | "kd_splitclip=", "false");
|
---|
2876 | RegisterOption("BSP.emptyCut", optBool,
|
---|
2877 | "kd_emptycut=", "true");
|
---|
2878 | RegisterOption("BSP.termCrit", optString,
|
---|
2879 | "kd_termcrit=", "auto");
|
---|
2880 | RegisterOption("BSP.maxDepthAllowed", optInt,
|
---|
2881 | "kd_maxDepth=", "16");
|
---|
2882 | RegisterOption("BSP.maxEmptyCutDepth", optInt,
|
---|
2883 | "kd_maxEmptyCutDepth=", "4");
|
---|
2884 | RegisterOption("BSP.absMaxAllowedDepth", optInt,
|
---|
2885 | "kd_absMaxAllowedDepth=", "20");
|
---|
2886 | RegisterOption("BSP.maxListLength", optInt,
|
---|
2887 | "kd_maxListLength=", "16");
|
---|
2888 | RegisterOption("BSP.useRadixSort", optBool,
|
---|
2889 | "kd_useRadixSort=", "false");
|
---|
2890 | RegisterOption("BSP.printCuts", optBool,
|
---|
2891 | "kd_printCuts=", "false");
|
---|
2892 | RegisterOption("BSP.algAutoTermination", optInt,
|
---|
2893 | "kd_algAutoTermination=", "0");
|
---|
2894 | RegisterOption("BSP.axisSelectionAlg", optInt,
|
---|
2895 | "kd_axisSelectAlg=", "0");
|
---|
2896 |
|
---|
2897 | RegisterOption("BSP.decisionCost", optFloat,
|
---|
2898 | "kd_decCost=", "0.3");
|
---|
2899 | RegisterOption("BSP.intersectionCost", optFloat,
|
---|
2900 | "kd_intersectCost=", "0.9");
|
---|
2901 | RegisterOption("BSP.traversalCost", optFloat,
|
---|
2902 | "kd_travCost=", "0.2");
|
---|
2903 | RegisterOption("BSP.biasFreeCuts", optFloat,
|
---|
2904 | "kd_biasFreeCuts=", "0.9");
|
---|
2905 |
|
---|
2906 | RegisterOption("BSP.minBoxes.use", optBool,
|
---|
2907 | "kd_minBoxesUse=", "false");
|
---|
2908 | RegisterOption("BSP.minBoxes.tight", optBool,
|
---|
2909 | "kd_minBoxesTight=", "false");
|
---|
2910 | RegisterOption("BSP.minBoxes.minObjects", optInt,
|
---|
2911 | "kd_minBoxesMinObjects=", "10");
|
---|
2912 | RegisterOption("BSP.minBoxes.minDepthDistance", optInt,
|
---|
2913 | "kd_minBoxesMinDist=", "3");
|
---|
2914 | RegisterOption("BSP.minBoxes.minSA2ratio", optFloat,
|
---|
2915 | "kd_minBoxesSA2ratio=", "1.0");
|
---|
2916 |
|
---|
2917 | // The object used for testing
|
---|
2918 | RegisterOption("Rays.file",
|
---|
2919 | optString,
|
---|
2920 | "rays_filename=",
|
---|
2921 | "data/fileRays_arena.txt");
|
---|
2922 | RegisterOption("Rays.cnt",
|
---|
2923 | optInt,
|
---|
2924 | "rays_cnt=", "100000");
|
---|
2925 |
|
---|
2926 | RegisterOption("TestDoubleRays", optBool,
|
---|
2927 | "test_doublrays=", "false");
|
---|
2928 |
|
---|
2929 | /////////////////////////////////////////////////////////////////
|
---|
2930 | }
|
---|
2931 |
|
---|
2932 | void
|
---|
2933 | Environment::SetStaticOptions()
|
---|
2934 | {
|
---|
2935 |
|
---|
2936 | // get Global option values
|
---|
2937 | GetRealValue("Limits.threshold", Limits::Threshold);
|
---|
2938 | GetRealValue("Limits.small", Limits::Small);
|
---|
2939 | GetRealValue("Limits.infinity", Limits::Infinity);
|
---|
2940 |
|
---|
2941 |
|
---|
2942 | }
|
---|
2943 |
|
---|
2944 | bool
|
---|
2945 | Environment::Parse(const int argc, char **argv, bool useExePath)
|
---|
2946 | {
|
---|
2947 | bool result = true;
|
---|
2948 | // Read the names of the scene, environment and output files
|
---|
2949 | ReadCmdlineParams(argc, argv, "");
|
---|
2950 |
|
---|
2951 | char *envFilename = new char[128];
|
---|
2952 |
|
---|
2953 | char filename[64];
|
---|
2954 |
|
---|
2955 | // Get the environment file name
|
---|
2956 | if (!GetParam(' ', 0, filename)) {
|
---|
2957 | // user didn't specified environment file explicitly, so
|
---|
2958 | strcpy(filename, "default.env");
|
---|
2959 | }
|
---|
2960 |
|
---|
2961 |
|
---|
2962 | if (useExePath) {
|
---|
2963 | char *path = GetPath(argv[0]);
|
---|
2964 | if (*path != 0)
|
---|
2965 | sprintf(envFilename, "%s/%s", path, filename);
|
---|
2966 | else
|
---|
2967 | strcpy(envFilename, filename);
|
---|
2968 |
|
---|
2969 | delete path;
|
---|
2970 | }
|
---|
2971 | else
|
---|
2972 | strcpy(envFilename, filename);
|
---|
2973 |
|
---|
2974 |
|
---|
2975 | // Now it's time to read in environment file.
|
---|
2976 | if (!ReadEnvFile(envFilename)) {
|
---|
2977 | // error - bad input file name specified ?
|
---|
2978 | cerr<<"Error parsing environment file "<<envFilename<<endl;
|
---|
2979 | result = false;
|
---|
2980 | }
|
---|
2981 | delete [] envFilename;
|
---|
2982 |
|
---|
2983 | // Parse the command line; options given on the command line subsume
|
---|
2984 | // stuff specified in the input environment file.
|
---|
2985 | ParseCmdline(argc, argv, 0);
|
---|
2986 |
|
---|
2987 | SetStaticOptions();
|
---|
2988 |
|
---|
2989 | // Check for request for help
|
---|
2990 | if (CheckForSwitch(argc, argv, '?')) {
|
---|
2991 | PrintUsage(cout);
|
---|
2992 | exit(0);
|
---|
2993 | }
|
---|
2994 |
|
---|
2995 | return true;
|
---|
2996 | }
|
---|
2997 |
|
---|
2998 | }
|
---|