{"action":"created","comment":{"url":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments/30035972","id":30035972,"diff_hunk":"@@ -0,0 +1,268 @@\n+#include \"sceneLoader.h\"\n+\n+#include \"scene.h\"\n+#include \"tileManager.h\"\n+#include \"view.h\"\n+#include \"lights.h\"\n+#include \"geoJsonSource.h\"\n+#include \"protobufSource.h\"\n+\n+#include \"yaml-cpp/yaml.h\"\n+\n+using namespace YAML;\n+\n+void loadSources(Node sources, TileManager& tileManager);\n+void loadLights(Node lights, Scene& scene);\n+void loadCameras(Node cameras, View& view);\n+\n+void SceneLoader::loadScene(const std::string& _file, Scene& _scene, TileManager& _tileManager, View& _view) {\n+\n+    Node config = YAML::LoadFile(_file);\n+    \n+    loadSources(config[\"sources\"], _tileManager);\n+    loadLights(config[\"lights\"], _scene);\n+    loadCameras(config[\"cameras\"], _view);\n+    \n+}\n+\n+glm::vec4 parseVec4(const Node& node) {\n+    glm::vec4 vec;\n+    int i = 0;\n+    for (auto it = node.begin(); it != node.end(); ++it) {\n+        if (i < 4) {\n+            vec[i++] = it->as<float>();\n+        } else {\n+            break;\n+        }\n+    }\n+    return vec;\n+}\n+\n+glm::vec3 parseVec3(const Node& node) {\n+    glm::vec3 vec;\n+    int i = 0;\n+    for (auto it = node.begin(); it != node.end(); ++it) {\n+        if (i < 3) {\n+            vec[i++] = it->as<float>();\n+        } else {\n+            break;\n+        }\n+    }\n+    return vec;\n+}\n+\n+void loadSources(Node sources, TileManager& tileManager) {\n+    \n+    if(!sources) {\n+        logMsg(\"Warning: No source defined in the yaml scene configuration.\\n\");\n+        return;\n+    }\n+    \n+    for (auto it = sources.begin(); it != sources.end(); ++it) {\n+        \n+        const Node source = it->second;\n+        std::string type = source[\"type\"].as<std::string>();\n+        std::string url = source[\"url\"].as<std::string>();\n+        \n+        std::unique_ptr<DataSource> sourcePtr;\n+        \n+        if (type == \"GeoJSONTiles\") {\n+            sourcePtr = std::unique_ptr<DataSource>(new GeoJsonSource());","path":"core/src/scene/sceneLoader.cpp","position":70,"original_position":70,"commit_id":"2caf691983391131e33b3d5e7a0470638d6c9b6d","original_commit_id":"2caf691983391131e33b3d5e7a0470638d6c9b6d","user":{"login":"tallytalwar","id":360641,"avatar_url":"https://avatars.githubusercontent.com/u/360641?v=3","gravatar_id":"","url":"https://api.github.com/users/tallytalwar","html_url":"https://github.com/tallytalwar","followers_url":"https://api.github.com/users/tallytalwar/followers","following_url":"https://api.github.com/users/tallytalwar/following{/other_user}","gists_url":"https://api.github.com/users/tallytalwar/gists{/gist_id}","starred_url":"https://api.github.com/users/tallytalwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tallytalwar/subscriptions","organizations_url":"https://api.github.com/users/tallytalwar/orgs","repos_url":"https://api.github.com/users/tallytalwar/repos","events_url":"https://api.github.com/users/tallytalwar/events{/privacy}","received_events_url":"https://api.github.com/users/tallytalwar/received_events","type":"User","site_admin":false},"body":"Will \"sourcePtr.reset(new GeoJsonSource())\" be a better choice over the assignment operator!. \r\nHowever that being said, based on the documentation it seems they both perform the same and are more or less analogous. ","created_at":"2015-05-11T13:08:50Z","updated_at":"2015-05-11T13:08:50Z","html_url":"https://github.com/tangrams/tangram-es/pull/112#discussion_r30035972","pull_request_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/112","_links":{"self":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments/30035972"},"html":{"href":"https://github.com/tangrams/tangram-es/pull/112#discussion_r30035972"},"pull_request":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/112"}}},"pull_request":{"url":"https://api.github.com/repos/tangrams/tangram-es/pulls/112","id":35056052,"html_url":"https://github.com/tangrams/tangram-es/pull/112","diff_url":"https://github.com/tangrams/tangram-es/pull/112.diff","patch_url":"https://github.com/tangrams/tangram-es/pull/112.patch","issue_url":"https://api.github.com/repos/tangrams/tangram-es/issues/112","number":112,"state":"open","locked":false,"title":"Configuration with Yaml file","user":{"login":"blair1618","id":3371850,"avatar_url":"https://avatars.githubusercontent.com/u/3371850?v=3","gravatar_id":"","url":"https://api.github.com/users/blair1618","html_url":"https://github.com/blair1618","followers_url":"https://api.github.com/users/blair1618/followers","following_url":"https://api.github.com/users/blair1618/following{/other_user}","gists_url":"https://api.github.com/users/blair1618/gists{/gist_id}","starred_url":"https://api.github.com/users/blair1618/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blair1618/subscriptions","organizations_url":"https://api.github.com/users/blair1618/orgs","repos_url":"https://api.github.com/users/blair1618/repos","events_url":"https://api.github.com/users/blair1618/events{/privacy}","received_events_url":"https://api.github.com/users/blair1618/received_events","type":"User","site_admin":false},"body":"At long last, we can reconfigure Tangram ES without recompiling!\r\n\r\nScene file parsing is obviously not done, but I'd like to get the basics merged so that the more involved aspects (e.g. filtering) can be worked on independently using this as a foundation. \r\n\r\nThe changes here enable configuring data sources, lights, and cameras (though we don't support non-perspective cameras yet). This adds config.yaml file that I stole from one of the Tangram demos. We don't support everything in that file yet, it's an aspirational configuration :)\r\n","created_at":"2015-05-08T23:47:40Z","updated_at":"2015-05-11T13:08:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d21088a689cb4a02c8a9b40d416c5682e15707af","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/112/commits","review_comments_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/112/comments","review_comment_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tangrams/tangram-es/issues/112/comments","statuses_url":"https://api.github.com/repos/tangrams/tangram-es/statuses/2caf691983391131e33b3d5e7a0470638d6c9b6d","head":{"label":"tangrams:yaml-cpp","ref":"yaml-cpp","sha":"2caf691983391131e33b3d5e7a0470638d6c9b6d","user":{"login":"tangrams","id":8495302,"avatar_url":"https://avatars.githubusercontent.com/u/8495302?v=3","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"repo":{"id":23391501,"name":"tangram-es","full_name":"tangrams/tangram-es","owner":{"login":"tangrams","id":8495302,"avatar_url":"https://avatars.githubusercontent.com/u/8495302?v=3","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tangrams/tangram-es","description":"2D and 3D map renderer using OpenGL ES","fork":false,"url":"https://api.github.com/repos/tangrams/tangram-es","forks_url":"https://api.github.com/repos/tangrams/tangram-es/forks","keys_url":"https://api.github.com/repos/tangrams/tangram-es/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tangrams/tangram-es/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tangrams/tangram-es/teams","hooks_url":"https://api.github.com/repos/tangrams/tangram-es/hooks","issue_events_url":"https://api.github.com/repos/tangrams/tangram-es/issues/events{/number}","events_url":"https://api.github.com/repos/tangrams/tangram-es/events","assignees_url":"https://api.github.com/repos/tangrams/tangram-es/assignees{/user}","branches_url":"https://api.github.com/repos/tangrams/tangram-es/branches{/branch}","tags_url":"https://api.github.com/repos/tangrams/tangram-es/tags","blobs_url":"https://api.github.com/repos/tangrams/tangram-es/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tangrams/tangram-es/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tangrams/tangram-es/git/refs{/sha}","trees_url":"https://api.github.com/repos/tangrams/tangram-es/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tangrams/tangram-es/statuses/{sha}","languages_url":"https://api.github.com/repos/tangrams/tangram-es/languages","stargazers_url":"https://api.github.com/repos/tangrams/tangram-es/stargazers","contributors_url":"https://api.github.com/repos/tangrams/tangram-es/contributors","subscribers_url":"https://api.github.com/repos/tangrams/tangram-es/subscribers","subscription_url":"https://api.github.com/repos/tangrams/tangram-es/subscription","commits_url":"https://api.github.com/repos/tangrams/tangram-es/commits{/sha}","git_commits_url":"https://api.github.com/repos/tangrams/tangram-es/git/commits{/sha}","comments_url":"https://api.github.com/repos/tangrams/tangram-es/comments{/number}","issue_comment_url":"https://api.github.com/repos/tangrams/tangram-es/issues/comments{/number}","contents_url":"https://api.github.com/repos/tangrams/tangram-es/contents/{+path}","compare_url":"https://api.github.com/repos/tangrams/tangram-es/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tangrams/tangram-es/merges","archive_url":"https://api.github.com/repos/tangrams/tangram-es/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tangrams/tangram-es/downloads","issues_url":"https://api.github.com/repos/tangrams/tangram-es/issues{/number}","pulls_url":"https://api.github.com/repos/tangrams/tangram-es/pulls{/number}","milestones_url":"https://api.github.com/repos/tangrams/tangram-es/milestones{/number}","notifications_url":"https://api.github.com/repos/tangrams/tangram-es/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tangrams/tangram-es/labels{/name}","releases_url":"https://api.github.com/repos/tangrams/tangram-es/releases{/id}","created_at":"2014-08-27T13:56:56Z","updated_at":"2015-05-07T21:56:12Z","pushed_at":"2015-05-11T13:02:29Z","git_url":"git://github.com/tangrams/tangram-es.git","ssh_url":"git@github.com:tangrams/tangram-es.git","clone_url":"https://github.com/tangrams/tangram-es.git","svn_url":"https://github.com/tangrams/tangram-es","homepage":"","size":28360,"stargazers_count":46,"watchers_count":46,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":5,"forks":5,"open_issues":5,"watchers":46,"default_branch":"master"}},"base":{"label":"tangrams:master","ref":"master","sha":"86c59f8cb5b6b3cd2b1f93e45bb4ce018badbf80","user":{"login":"tangrams","id":8495302,"avatar_url":"https://avatars.githubusercontent.com/u/8495302?v=3","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"repo":{"id":23391501,"name":"tangram-es","full_name":"tangrams/tangram-es","owner":{"login":"tangrams","id":8495302,"avatar_url":"https://avatars.githubusercontent.com/u/8495302?v=3","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tangrams/tangram-es","description":"2D and 3D map renderer using OpenGL ES","fork":false,"url":"https://api.github.com/repos/tangrams/tangram-es","forks_url":"https://api.github.com/repos/tangrams/tangram-es/forks","keys_url":"https://api.github.com/repos/tangrams/tangram-es/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tangrams/tangram-es/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tangrams/tangram-es/teams","hooks_url":"https://api.github.com/repos/tangrams/tangram-es/hooks","issue_events_url":"https://api.github.com/repos/tangrams/tangram-es/issues/events{/number}","events_url":"https://api.github.com/repos/tangrams/tangram-es/events","assignees_url":"https://api.github.com/repos/tangrams/tangram-es/assignees{/user}","branches_url":"https://api.github.com/repos/tangrams/tangram-es/branches{/branch}","tags_url":"https://api.github.com/repos/tangrams/tangram-es/tags","blobs_url":"https://api.github.com/repos/tangrams/tangram-es/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tangrams/tangram-es/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tangrams/tangram-es/git/refs{/sha}","trees_url":"https://api.github.com/repos/tangrams/tangram-es/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tangrams/tangram-es/statuses/{sha}","languages_url":"https://api.github.com/repos/tangrams/tangram-es/languages","stargazers_url":"https://api.github.com/repos/tangrams/tangram-es/stargazers","contributors_url":"https://api.github.com/repos/tangrams/tangram-es/contributors","subscribers_url":"https://api.github.com/repos/tangrams/tangram-es/subscribers","subscription_url":"https://api.github.com/repos/tangrams/tangram-es/subscription","commits_url":"https://api.github.com/repos/tangrams/tangram-es/commits{/sha}","git_commits_url":"https://api.github.com/repos/tangrams/tangram-es/git/commits{/sha}","comments_url":"https://api.github.com/repos/tangrams/tangram-es/comments{/number}","issue_comment_url":"https://api.github.com/repos/tangrams/tangram-es/issues/comments{/number}","contents_url":"https://api.github.com/repos/tangrams/tangram-es/contents/{+path}","compare_url":"https://api.github.com/repos/tangrams/tangram-es/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tangrams/tangram-es/merges","archive_url":"https://api.github.com/repos/tangrams/tangram-es/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tangrams/tangram-es/downloads","issues_url":"https://api.github.com/repos/tangrams/tangram-es/issues{/number}","pulls_url":"https://api.github.com/repos/tangrams/tangram-es/pulls{/number}","milestones_url":"https://api.github.com/repos/tangrams/tangram-es/milestones{/number}","notifications_url":"https://api.github.com/repos/tangrams/tangram-es/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tangrams/tangram-es/labels{/name}","releases_url":"https://api.github.com/repos/tangrams/tangram-es/releases{/id}","created_at":"2014-08-27T13:56:56Z","updated_at":"2015-05-07T21:56:12Z","pushed_at":"2015-05-11T13:02:29Z","git_url":"git://github.com/tangrams/tangram-es.git","ssh_url":"git@github.com:tangrams/tangram-es.git","clone_url":"https://github.com/tangrams/tangram-es.git","svn_url":"https://github.com/tangrams/tangram-es","homepage":"","size":28360,"stargazers_count":46,"watchers_count":46,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":5,"forks":5,"open_issues":5,"watchers":46,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/112"},"html":{"href":"https://github.com/tangrams/tangram-es/pull/112"},"issue":{"href":"https://api.github.com/repos/tangrams/tangram-es/issues/112"},"comments":{"href":"https://api.github.com/repos/tangrams/tangram-es/issues/112/comments"},"review_comments":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/112/comments"},"review_comment":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/112/commits"},"statuses":{"href":"https://api.github.com/repos/tangrams/tangram-es/statuses/2caf691983391131e33b3d5e7a0470638d6c9b6d"}}}}