{"action":"created","comment":{"url":"https://api.github.com/repos/highfidelity/hifi/pulls/comments/35505499","id":35505499,"diff_hunk":"@@ -0,0 +1,289 @@\n+//\n+//  Leaves.js\n+//  examples\n+//\n+//  Created by Bing Shearer on 14 Jul 2015\n+//  Copyright 2015 High Fidelity, Inc.\n+//\n+//  Distributed under the Apache License, Version 2.0.\n+//  See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html\n+//\n+var leafName = \"scriptLeaf\";\n+var leafSquall = function (properties) {\n+    var // Properties\n+        squallOrigin,\n+        squallRadius,\n+        leavesPerMinute = 60,\n+        leafSize = { x: 0.1, y: 0.1, z: 0.1 },\n+        leafFallSpeed = 1,                                      // m/s\n+        leafLifetime = 60,                                      // Seconds\n+        leafSpinMax = 0,                                        // Maximum angular velocity per axis; deg/s\n+        debug = false,                                          // Display origin circle; don't use running on Stack Manager\n+        // Other\n+        squallCircle,\n+        SQUALL_CIRCLE_COLOR = { red: 255, green: 0, blue: 0 },\n+        SQUALL_CIRCLE_ALPHA = 0.5,\n+        SQUALL_CIRCLE_ROTATION = Quat.fromPitchYawRollDegrees(90, 0, 0),\n+        leafProperties,\n+        leaf_MODEL_URL = \"https://hifi-public.s3.amazonaws.com/ozan/support/forBing/palmLeaf.fbx\",\n+        leafTimer,\n+        leaves = [],                                         // HACK: Work around leaves not always getting velocities\n+        leafVelocities = [],                                // HACK: Work around leaves not always getting velocities\n+        DEGREES_TO_RADIANS = Math.PI / 180,\n+        leafDeleteOnTearDown = true,\n+        maxLeaves,\n+        leafCount,\n+        nearbyEntities,\n+        complexMovement = false,\n+        movementTime = 0,\n+        maxSpinRadians = properties.leafSpinMax * DEGREES_TO_RADIANS,\n+        windFactor,\n+        leafDeleteOnGround = false,\n+        floorHeight = null;\n+\n+\n+    function processProperties() {\n+        if (!properties.hasOwnProperty(\"origin\")) {\n+            print(\"ERROR: Leaf squall origin must be specified\");\n+            return;\n+        }\n+        squallOrigin = properties.origin;\n+\n+        if (!properties.hasOwnProperty(\"radius\")) {\n+            print(\"ERROR: Leaf squall radius must be specified\");\n+            return;\n+        }\n+        squallRadius = properties.radius;\n+\n+        if (properties.hasOwnProperty(\"leavesPerMinute\")) {\n+            leavesPerMinute = properties.leavesPerMinute;\n+        }\n+\n+        if (properties.hasOwnProperty(\"leafSize\")) {\n+            leafSize = properties.leafSize;\n+        }\n+\n+        if (properties.hasOwnProperty(\"leafFallSpeed\")) {\n+            leafFallSpeed = properties.leafFallSpeed;\n+        }\n+\n+        if (properties.hasOwnProperty(\"leafLifetime\")) {\n+            leafLifetime = properties.leafLifetime;\n+        }\n+\n+        if (properties.hasOwnProperty(\"leafSpinMax\")) {\n+            leafSpinMax = properties.leafSpinMax;\n+        }\n+\n+        if (properties.hasOwnProperty(\"debug\")) {\n+            debug = properties.debug;\n+        }\n+        if (properties.hasOwnProperty(\"floorHeight\")) {\n+            floorHeight = properties.floorHeight;\n+        }\n+        if (properties.hasOwnProperty(\"maxLeaves\")) {\n+            maxLeaves = properties.maxLeaves;\n+        }\n+        if (properties.hasOwnProperty(\"complexMovement\")) {\n+            complexMovement = properties.complexMovement;\n+        }\n+        if (properties.hasOwnProperty(\"leafDeleteOnGround\")) {\n+            leafDeleteOnGround = properties.leafDeleteOnGround;\n+        }\n+        if (properties.hasOwnProperty(\"windFactor\")) {\n+            windFactor = properties.windFactor;\n+        }\n+        else {\n+            print(\"ERROR: Wind Factor must be defined for complex movement\")\n+        }\n+\n+        leafProperties = {\n+            type: \"Model\",\n+            name: leafName,\n+            modelURL: leaf_MODEL_URL,\n+            lifetime: leafLifetime,\n+            dimensions: leafSize,\n+            velocity: { x: 0, y: -leafFallSpeed, z: 0 },\n+            damping: 0,\n+            angularDamping: 0,\n+            ignoreForCollisions: true\n+\n+        };\n+    }\n+\n+    function createleaf() {\n+        var angle,\n+            radius,\n+            offset,\n+            leaf,\n+            spin = { x: 0, y: 0, z: 0 },           \n+            i;\n+\n+        // HACK: Work around leaves not always getting velocities set at creation\n+        for (i = 0; i < leaves.length; i += 1) {\n+            Entities.editEntity(leaves[i], leafVelocities[i]);\n+        }\n+\n+        angle = Math.random() * 10;\n+        radius = Math.random() * squallRadius;\n+        offset = Vec3.multiplyQbyV(Quat.fromPitchYawRollDegrees(0, angle, 0), { x: 0, y: -0.1, z: radius });\n+        leafProperties.position = Vec3.sum(squallOrigin, offset);\n+        if (properties.leafSpinMax > 0 && !complexMovement) {\n+            spin = {\n+                x: Math.random() * maxSpinRadians,\n+                y: Math.random() * maxSpinRadians,\n+                z: Math.random() * maxSpinRadians\n+            };\n+            leafProperties.angularVelocity = spin;\n+        }","path":"examples/leaves.js","position":138,"original_position":138,"commit_id":"3cac781cdca985a1a81891f0af40bab61debba4f","original_commit_id":"3cac781cdca985a1a81891f0af40bab61debba4f","user":{"login":"ZappoMan","id":2093195,"avatar_url":"https://avatars.githubusercontent.com/u/2093195?v=3","gravatar_id":"","url":"https://api.github.com/users/ZappoMan","html_url":"https://github.com/ZappoMan","followers_url":"https://api.github.com/users/ZappoMan/followers","following_url":"https://api.github.com/users/ZappoMan/following{/other_user}","gists_url":"https://api.github.com/users/ZappoMan/gists{/gist_id}","starred_url":"https://api.github.com/users/ZappoMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZappoMan/subscriptions","organizations_url":"https://api.github.com/users/ZappoMan/orgs","repos_url":"https://api.github.com/users/ZappoMan/repos","events_url":"https://api.github.com/users/ZappoMan/events{/privacy}","received_events_url":"https://api.github.com/users/ZappoMan/received_events","type":"User","site_admin":false},"body":"coding standard: brace placement...","created_at":"2015-07-27T04:49:04Z","updated_at":"2015-07-27T04:49:04Z","html_url":"https://github.com/highfidelity/hifi/pull/5360#discussion_r35505499","pull_request_url":"https://api.github.com/repos/highfidelity/hifi/pulls/5360","_links":{"self":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/comments/35505499"},"html":{"href":"https://github.com/highfidelity/hifi/pull/5360#discussion_r35505499"},"pull_request":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/5360"}}},"pull_request":{"url":"https://api.github.com/repos/highfidelity/hifi/pulls/5360","id":40280414,"html_url":"https://github.com/highfidelity/hifi/pull/5360","diff_url":"https://github.com/highfidelity/hifi/pull/5360.diff","patch_url":"https://github.com/highfidelity/hifi/pull/5360.patch","issue_url":"https://api.github.com/repos/highfidelity/hifi/issues/5360","number":5360,"state":"open","locked":false,"title":"New falling leaf script based on the existing rain.js","user":{"login":"BingShearer","id":8042652,"avatar_url":"https://avatars.githubusercontent.com/u/8042652?v=3","gravatar_id":"","url":"https://api.github.com/users/BingShearer","html_url":"https://github.com/BingShearer","followers_url":"https://api.github.com/users/BingShearer/followers","following_url":"https://api.github.com/users/BingShearer/following{/other_user}","gists_url":"https://api.github.com/users/BingShearer/gists{/gist_id}","starred_url":"https://api.github.com/users/BingShearer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BingShearer/subscriptions","organizations_url":"https://api.github.com/users/BingShearer/orgs","repos_url":"https://api.github.com/users/BingShearer/repos","events_url":"https://api.github.com/users/BingShearer/events{/privacy}","received_events_url":"https://api.github.com/users/BingShearer/received_events","type":"User","site_admin":false},"body":"Pushing falling leaves script for Entry to codebase as requested by Chris.","created_at":"2015-07-17T23:25:47Z","updated_at":"2015-07-27T04:49:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a54093a649d3c9f68adac8c6324f7d8e2fb1de1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/highfidelity/hifi/pulls/5360/commits","review_comments_url":"https://api.github.com/repos/highfidelity/hifi/pulls/5360/comments","review_comment_url":"https://api.github.com/repos/highfidelity/hifi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/highfidelity/hifi/issues/5360/comments","statuses_url":"https://api.github.com/repos/highfidelity/hifi/statuses/3cac781cdca985a1a81891f0af40bab61debba4f","head":{"label":"BingShearer:Leaves","ref":"Leaves","sha":"3cac781cdca985a1a81891f0af40bab61debba4f","user":{"login":"BingShearer","id":8042652,"avatar_url":"https://avatars.githubusercontent.com/u/8042652?v=3","gravatar_id":"","url":"https://api.github.com/users/BingShearer","html_url":"https://github.com/BingShearer","followers_url":"https://api.github.com/users/BingShearer/followers","following_url":"https://api.github.com/users/BingShearer/following{/other_user}","gists_url":"https://api.github.com/users/BingShearer/gists{/gist_id}","starred_url":"https://api.github.com/users/BingShearer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BingShearer/subscriptions","organizations_url":"https://api.github.com/users/BingShearer/orgs","repos_url":"https://api.github.com/users/BingShearer/repos","events_url":"https://api.github.com/users/BingShearer/events{/privacy}","received_events_url":"https://api.github.com/users/BingShearer/received_events","type":"User","site_admin":false},"repo":{"id":36476007,"name":"hifi","full_name":"BingShearer/hifi","owner":{"login":"BingShearer","id":8042652,"avatar_url":"https://avatars.githubusercontent.com/u/8042652?v=3","gravatar_id":"","url":"https://api.github.com/users/BingShearer","html_url":"https://github.com/BingShearer","followers_url":"https://api.github.com/users/BingShearer/followers","following_url":"https://api.github.com/users/BingShearer/following{/other_user}","gists_url":"https://api.github.com/users/BingShearer/gists{/gist_id}","starred_url":"https://api.github.com/users/BingShearer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BingShearer/subscriptions","organizations_url":"https://api.github.com/users/BingShearer/orgs","repos_url":"https://api.github.com/users/BingShearer/repos","events_url":"https://api.github.com/users/BingShearer/events{/privacy}","received_events_url":"https://api.github.com/users/BingShearer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BingShearer/hifi","description":"Open source software for shared virtual worlds using HMDs and dynamically assigned devices as servers.  San Francisco based startup, we are hiring: http://highfidelity.com/jobs  Documentation at http://docs.highfidelity.com  Contribute by reporting bugs & doing jobs on http://worklist.net","fork":true,"url":"https://api.github.com/repos/BingShearer/hifi","forks_url":"https://api.github.com/repos/BingShearer/hifi/forks","keys_url":"https://api.github.com/repos/BingShearer/hifi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BingShearer/hifi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BingShearer/hifi/teams","hooks_url":"https://api.github.com/repos/BingShearer/hifi/hooks","issue_events_url":"https://api.github.com/repos/BingShearer/hifi/issues/events{/number}","events_url":"https://api.github.com/repos/BingShearer/hifi/events","assignees_url":"https://api.github.com/repos/BingShearer/hifi/assignees{/user}","branches_url":"https://api.github.com/repos/BingShearer/hifi/branches{/branch}","tags_url":"https://api.github.com/repos/BingShearer/hifi/tags","blobs_url":"https://api.github.com/repos/BingShearer/hifi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BingShearer/hifi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BingShearer/hifi/git/refs{/sha}","trees_url":"https://api.github.com/repos/BingShearer/hifi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BingShearer/hifi/statuses/{sha}","languages_url":"https://api.github.com/repos/BingShearer/hifi/languages","stargazers_url":"https://api.github.com/repos/BingShearer/hifi/stargazers","contributors_url":"https://api.github.com/repos/BingShearer/hifi/contributors","subscribers_url":"https://api.github.com/repos/BingShearer/hifi/subscribers","subscription_url":"https://api.github.com/repos/BingShearer/hifi/subscription","commits_url":"https://api.github.com/repos/BingShearer/hifi/commits{/sha}","git_commits_url":"https://api.github.com/repos/BingShearer/hifi/git/commits{/sha}","comments_url":"https://api.github.com/repos/BingShearer/hifi/comments{/number}","issue_comment_url":"https://api.github.com/repos/BingShearer/hifi/issues/comments{/number}","contents_url":"https://api.github.com/repos/BingShearer/hifi/contents/{+path}","compare_url":"https://api.github.com/repos/BingShearer/hifi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BingShearer/hifi/merges","archive_url":"https://api.github.com/repos/BingShearer/hifi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BingShearer/hifi/downloads","issues_url":"https://api.github.com/repos/BingShearer/hifi/issues{/number}","pulls_url":"https://api.github.com/repos/BingShearer/hifi/pulls{/number}","milestones_url":"https://api.github.com/repos/BingShearer/hifi/milestones{/number}","notifications_url":"https://api.github.com/repos/BingShearer/hifi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BingShearer/hifi/labels{/name}","releases_url":"https://api.github.com/repos/BingShearer/hifi/releases{/id}","created_at":"2015-05-29T01:29:04Z","updated_at":"2015-05-29T01:29:09Z","pushed_at":"2015-07-22T17:55:49Z","git_url":"git://github.com/BingShearer/hifi.git","ssh_url":"git@github.com:BingShearer/hifi.git","clone_url":"https://github.com/BingShearer/hifi.git","svn_url":"https://github.com/BingShearer/hifi","homepage":"","size":161451,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"highfidelity:master","ref":"master","sha":"7accc53c0e65d930aa798576875d57296cfe9d60","user":{"login":"highfidelity","id":1565370,"avatar_url":"https://avatars.githubusercontent.com/u/1565370?v=3","gravatar_id":"","url":"https://api.github.com/users/highfidelity","html_url":"https://github.com/highfidelity","followers_url":"https://api.github.com/users/highfidelity/followers","following_url":"https://api.github.com/users/highfidelity/following{/other_user}","gists_url":"https://api.github.com/users/highfidelity/gists{/gist_id}","starred_url":"https://api.github.com/users/highfidelity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/highfidelity/subscriptions","organizations_url":"https://api.github.com/users/highfidelity/orgs","repos_url":"https://api.github.com/users/highfidelity/repos","events_url":"https://api.github.com/users/highfidelity/events{/privacy}","received_events_url":"https://api.github.com/users/highfidelity/received_events","type":"Organization","site_admin":false},"repo":{"id":5372872,"name":"hifi","full_name":"highfidelity/hifi","owner":{"login":"highfidelity","id":1565370,"avatar_url":"https://avatars.githubusercontent.com/u/1565370?v=3","gravatar_id":"","url":"https://api.github.com/users/highfidelity","html_url":"https://github.com/highfidelity","followers_url":"https://api.github.com/users/highfidelity/followers","following_url":"https://api.github.com/users/highfidelity/following{/other_user}","gists_url":"https://api.github.com/users/highfidelity/gists{/gist_id}","starred_url":"https://api.github.com/users/highfidelity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/highfidelity/subscriptions","organizations_url":"https://api.github.com/users/highfidelity/orgs","repos_url":"https://api.github.com/users/highfidelity/repos","events_url":"https://api.github.com/users/highfidelity/events{/privacy}","received_events_url":"https://api.github.com/users/highfidelity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/highfidelity/hifi","description":"Open source software for shared virtual worlds using HMDs and dynamically assigned devices as servers.  San Francisco based startup, we are hiring: http://highfidelity.com/jobs  Documentation at http://docs.highfidelity.com  Contribute by reporting bugs & doing jobs on http://worklist.net","fork":false,"url":"https://api.github.com/repos/highfidelity/hifi","forks_url":"https://api.github.com/repos/highfidelity/hifi/forks","keys_url":"https://api.github.com/repos/highfidelity/hifi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/highfidelity/hifi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/highfidelity/hifi/teams","hooks_url":"https://api.github.com/repos/highfidelity/hifi/hooks","issue_events_url":"https://api.github.com/repos/highfidelity/hifi/issues/events{/number}","events_url":"https://api.github.com/repos/highfidelity/hifi/events","assignees_url":"https://api.github.com/repos/highfidelity/hifi/assignees{/user}","branches_url":"https://api.github.com/repos/highfidelity/hifi/branches{/branch}","tags_url":"https://api.github.com/repos/highfidelity/hifi/tags","blobs_url":"https://api.github.com/repos/highfidelity/hifi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/highfidelity/hifi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/highfidelity/hifi/git/refs{/sha}","trees_url":"https://api.github.com/repos/highfidelity/hifi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/highfidelity/hifi/statuses/{sha}","languages_url":"https://api.github.com/repos/highfidelity/hifi/languages","stargazers_url":"https://api.github.com/repos/highfidelity/hifi/stargazers","contributors_url":"https://api.github.com/repos/highfidelity/hifi/contributors","subscribers_url":"https://api.github.com/repos/highfidelity/hifi/subscribers","subscription_url":"https://api.github.com/repos/highfidelity/hifi/subscription","commits_url":"https://api.github.com/repos/highfidelity/hifi/commits{/sha}","git_commits_url":"https://api.github.com/repos/highfidelity/hifi/git/commits{/sha}","comments_url":"https://api.github.com/repos/highfidelity/hifi/comments{/number}","issue_comment_url":"https://api.github.com/repos/highfidelity/hifi/issues/comments{/number}","contents_url":"https://api.github.com/repos/highfidelity/hifi/contents/{+path}","compare_url":"https://api.github.com/repos/highfidelity/hifi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/highfidelity/hifi/merges","archive_url":"https://api.github.com/repos/highfidelity/hifi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/highfidelity/hifi/downloads","issues_url":"https://api.github.com/repos/highfidelity/hifi/issues{/number}","pulls_url":"https://api.github.com/repos/highfidelity/hifi/pulls{/number}","milestones_url":"https://api.github.com/repos/highfidelity/hifi/milestones{/number}","notifications_url":"https://api.github.com/repos/highfidelity/hifi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/highfidelity/hifi/labels{/name}","releases_url":"https://api.github.com/repos/highfidelity/hifi/releases{/id}","created_at":"2012-08-10T18:26:22Z","updated_at":"2015-07-14T07:31:45Z","pushed_at":"2015-07-27T00:28:45Z","git_url":"git://github.com/highfidelity/hifi.git","ssh_url":"git@github.com:highfidelity/hifi.git","clone_url":"https://github.com/highfidelity/hifi.git","svn_url":"https://github.com/highfidelity/hifi","homepage":"","size":223547,"stargazers_count":285,"watchers_count":285,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":164,"mirror_url":null,"open_issues_count":61,"forks":164,"open_issues":61,"watchers":285,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/5360"},"html":{"href":"https://github.com/highfidelity/hifi/pull/5360"},"issue":{"href":"https://api.github.com/repos/highfidelity/hifi/issues/5360"},"comments":{"href":"https://api.github.com/repos/highfidelity/hifi/issues/5360/comments"},"review_comments":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/5360/comments"},"review_comment":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/5360/commits"},"statuses":{"href":"https://api.github.com/repos/highfidelity/hifi/statuses/3cac781cdca985a1a81891f0af40bab61debba4f"}}}}