2309 |
// get the corresponding velocity table from the table map or create & calculate that table if it doesn't exist yet |
// get the corresponding velocity table from the table map or create & calculate that table if it doesn't exist yet |
2310 |
double* DimensionRegion::GetVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling) |
double* DimensionRegion::GetVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling) |
2311 |
{ |
{ |
2312 |
|
// sanity check input parameters |
2313 |
|
// (fallback to some default parameters on ill input) |
2314 |
|
switch (curveType) { |
2315 |
|
case curve_type_nonlinear: |
2316 |
|
case curve_type_linear: |
2317 |
|
if (depth > 4) { |
2318 |
|
printf("Warning: Invalid depth (0x%x) for velocity curve type (0x%x).\n", depth, curveType); |
2319 |
|
depth = 0; |
2320 |
|
scaling = 0; |
2321 |
|
} |
2322 |
|
break; |
2323 |
|
case curve_type_special: |
2324 |
|
if (depth > 5) { |
2325 |
|
printf("Warning: Invalid depth (0x%x) for velocity curve type 'special'.\n", depth); |
2326 |
|
depth = 0; |
2327 |
|
scaling = 0; |
2328 |
|
} |
2329 |
|
break; |
2330 |
|
case curve_type_unknown: |
2331 |
|
default: |
2332 |
|
printf("Warning: Unknown velocity curve type (0x%x).\n", curveType); |
2333 |
|
curveType = curve_type_linear; |
2334 |
|
depth = 0; |
2335 |
|
scaling = 0; |
2336 |
|
break; |
2337 |
|
} |
2338 |
|
|
2339 |
double* table; |
double* table; |
2340 |
uint32_t tableKey = (curveType<<16) | (depth<<8) | scaling; |
uint32_t tableKey = (curveType<<16) | (depth<<8) | scaling; |
2341 |
if (pVelocityTables->count(tableKey)) { // if key exists |
if (pVelocityTables->count(tableKey)) { // if key exists |