Skip to content

Commit

Permalink
Merge pull request #1394 from chanket/patch-3
Browse files Browse the repository at this point in the history
Fix saving/loading LatLong and Equirectangular lens to/from snapshot
  • Loading branch information
Tom94 committed Jul 4, 2023
2 parents 59cd4d3 + 3a56d9d commit 8ff8075
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/neural-graphics-primitives/json_binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ inline void to_json(nlohmann::json& j, const Lens& lens) {
j["ftheta_p4"] = lens.params[4];
j["w"] = lens.params[5];
j["h"] = lens.params[6];
} else if (lens.mode == ELensMode::LatLong) {
j["latlong"] = true;
} else if (lens.mode == ELensMode::Equirectangular) {
j["equirectangular"] = true;
}
}

Expand Down Expand Up @@ -207,6 +211,10 @@ inline void from_json(const nlohmann::json& j, Lens& lens) {
lens.params[4] = j.at("ftheta_p4");
lens.params[5] = j.at("w");
lens.params[6] = j.at("h");
} else if (j.contains("latlong")) {
lens.mode = ELensMode::LatLong;
} else if (j.contains("equirectangular")) {
lens.mode = ELensMode::Equirectangular;
} else {
lens.mode = ELensMode::Perspective;
}
Expand Down

0 comments on commit 8ff8075

Please sign in to comment.