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