Add a camera near/far setting in gltf_viewer

This commit is contained in:
Mathias Agopian
2023-02-16 15:03:34 -08:00
committed by Mathias Agopian
parent d9266ba61c
commit 94f121f37d
14 changed files with 83 additions and 35 deletions

View File

@@ -444,6 +444,10 @@ static int parse(jsmntok_t const* tokens, int i, const char* jsonChunk, ViewerOp
i = parse(tokens, i + 1, jsonChunk, &out->cameraSpeed);
} else if (compare(tok, jsonChunk, "cameraISO") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->cameraISO);
} else if (compare(tok, jsonChunk, "cameraNear") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->cameraNear);
} else if (compare(tok, jsonChunk, "cameraFar") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->cameraFar);
} else if (compare(tok, jsonChunk, "groundShadowStrength") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->groundShadowStrength);
} else if (compare(tok, jsonChunk, "groundPlaneEnabled") == 0) {
@@ -773,6 +777,8 @@ static std::ostream& operator<<(std::ostream& out, const ViewerOptions& in) {
<< "\"cameraAperture\": " << (in.cameraAperture) << ",\n"
<< "\"cameraSpeed\": " << (in.cameraSpeed) << ",\n"
<< "\"cameraISO\": " << (in.cameraISO) << ",\n"
<< "\"cameraNear\": " << (in.cameraNear) << ",\n"
<< "\"cameraFar\": " << (in.cameraFar) << ",\n"
<< "\"groundShadowStrength\": " << (in.groundShadowStrength) << ",\n"
<< "\"groundPlaneEnabled\": " << to_string(in.groundPlaneEnabled) << ",\n"
<< "\"skyboxEnabled\": " << to_string(in.skyboxEnabled) << ",\n"