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