From 3471487aa865f95349d97269334863e99c30b710 Mon Sep 17 00:00:00 2001 From: Alvaro Huarte Date: Thu, 17 May 2018 09:47:28 +0200 Subject: [PATCH] Add 'octvertexnormals' entry to layer.json file --- tools/ctb-tile.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/ctb-tile.cpp b/tools/ctb-tile.cpp index de3bcbd..5fb03ab 100644 --- a/tools/ctb-tile.cpp +++ b/tools/ctb-tile.cpp @@ -435,7 +435,7 @@ class TerrainMetadata { /// http://help.agi.com/TerrainServer/RESTAPIGuide.html /// Example: /// https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles/layer.json - void writeJsonFile(const std::string &filename, const std::string &datasetName, const std::string &outputFormat = "Terrain", const std::string &profile = "geodetic") const { + void writeJsonFile(const std::string &filename, const std::string &datasetName, const std::string &outputFormat = "Terrain", const std::string &profile = "geodetic", bool writeVertexNormals = false) const { FILE *fp = fopen(filename.c_str(), "w"); if (fp == NULL) { @@ -459,6 +459,9 @@ class TerrainMetadata { } fprintf(fp, " \"attribution\": \"\",\n"); fprintf(fp, " \"schema\": \"tms\",\n"); + if (writeVertexNormals) { + fprintf(fp, " \"extensions\": [ \"octvertexnormals\" ],\n"); + } fprintf(fp, " \"tiles\": [ \"{z}/{x}/{y}.terrain?v={version}\" ],\n"); if (strcmp(profile.c_str(), "geodetic") == 0) { @@ -782,7 +785,7 @@ main(int argc, char *argv[]) { const size_t rfindpos = datasetName.rfind('.'); if (std::string::npos != rfindpos) datasetName = datasetName.erase(rfindpos); - metadata->writeJsonFile(filename, datasetName, std::string(command.outputFormat), std::string(command.profile)); + metadata->writeJsonFile(filename, datasetName, std::string(command.outputFormat), std::string(command.profile), command.vertexNormals); delete metadata; }