| 454 | } |
| 455 | |
| 456 | void SphericalProjection::SetJsonValue(const Json::Value root) |
| 457 | { |
| 458 | EffectBase::SetJsonValue(root); |
| 459 | |
| 460 | if (!root["yaw"].isNull()) yaw.SetJsonValue(root["yaw"]); |
| 461 | if (!root["pitch"].isNull()) pitch.SetJsonValue(root["pitch"]); |
| 462 | if (!root["roll"].isNull()) roll.SetJsonValue(root["roll"]); |
| 463 | if (!root["fov"].isNull()) fov.SetJsonValue(root["fov"]); |
| 464 | if (!root["in_fov"].isNull()) in_fov.SetJsonValue(root["in_fov"]); |
| 465 | |
| 466 | if (!root["projection_mode"].isNull()) |
| 467 | projection_mode = root["projection_mode"].asInt(); |
| 468 | |
| 469 | if (!root["invert"].isNull()) |
| 470 | invert = root["invert"].asInt(); |
| 471 | |
| 472 | if (!root["input_model"].isNull()) |
| 473 | input_model = root["input_model"].asInt(); |
| 474 | |
| 475 | if (!root["interpolation"].isNull()) |
| 476 | interpolation = root["interpolation"].asInt(); |
| 477 | |
| 478 | // Clamp to enum options |
| 479 | projection_mode = std::clamp(projection_mode, |
| 480 | (int)MODE_RECT_SPHERE, |
| 481 | (int)MODE_FISHEYE_ORTHOGRAPHIC); |
| 482 | invert = std::clamp(invert, (int)INVERT_NORMAL, (int)INVERT_BACK); |
| 483 | input_model = std::clamp(input_model, (int)INPUT_EQUIRECT, (int)INPUT_FEQ_ORTHOGRAPHIC); |
| 484 | interpolation = std::clamp(interpolation, (int)INTERP_NEAREST, (int)INTERP_AUTO); |
| 485 | |
| 486 | // any property change should invalidate cached UV map |
| 487 | uv_map.clear(); |
| 488 | |
| 489 | |
| 490 | // any property change should invalidate cached UV map |
| 491 | uv_map.clear(); |
| 492 | } |
| 493 | std::string SphericalProjection::PropertiesJSON(int64_t requested_frame) const |
| 494 | { |
| 495 | Json::Value root = BasePropertiesJSON(requested_frame); |