{"action":"created","comment":{"url":"https://api.github.com/repos/super626/cocos2d-x/pulls/comments/23820900","id":23820900,"diff_hunk":"@@ -264,27 +266,56 @@ float cocos2d::Terrain::getHeight(float x, float y ,float z)\n     float v =image_y - (int)image_y;\n     float i = (int)image_x;\n     float j = (int)image_y;\n+\n+\n     if(image_x>=imageWidth-1 || image_y >=imageHeight-1 || image_x<0 || image_y<0)\n     {\n-       return y;\n+        return y;\n     }else\n     {\n+        float a = getImageHeight(i,j)*getScaleY();\n+        float b = getImageHeight(i,j+1)*getScaleY();\n+        float c = getImageHeight(i+1,j)*getScaleY();\n+        float d = getImageHeight(i+1,j+1)*getScaleY();\n+        if(normal)\n+        {\n+            normal->x = c - b;\n+            normal->y = 2;\n+            normal->z = d - a;\n+            normal->normalize();\n+            //(*normal) = (1-u)*(1-v)*getNormal(i,j)+ (1-u)*v*getNormal(i,j+1) + u*(1-v)*getNormal(i+1,j)+ u*v*getNormal(i+1,j+1);\n+        }\n         float reuslt =  (1-u)*(1-v)*getImageHeight(i,j)*getScaleY() + (1-u)*v*getImageHeight(i,j+1)*getScaleY() + u*(1-v)*getImageHeight(i+1,j)*getScaleY() + u*v*getImageHeight(i+1,j+1)*getScaleY();\n         return reuslt;\n     }\n }\n \n-float cocos2d::Terrain::getHeight(Vec3 pos)\n+float Terrain::getHeight(Vec3 pos,Vec3*Normal)","path":"cocos/3d/CCTerrain.cpp","position":287,"original_position":287,"commit_id":"89cff149fcae19025ab4362105a42a1d882f29fb","original_commit_id":"89cff149fcae19025ab4362105a42a1d882f29fb","user":{"login":"super626","id":4159090,"avatar_url":"https://avatars.githubusercontent.com/u/4159090?v=3","gravatar_id":"","url":"https://api.github.com/users/super626","html_url":"https://github.com/super626","followers_url":"https://api.github.com/users/super626/followers","following_url":"https://api.github.com/users/super626/following{/other_user}","gists_url":"https://api.github.com/users/super626/gists{/gist_id}","starred_url":"https://api.github.com/users/super626/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/super626/subscriptions","organizations_url":"https://api.github.com/users/super626/orgs","repos_url":"https://api.github.com/users/super626/repos","events_url":"https://api.github.com/users/super626/events{/privacy}","received_events_url":"https://api.github.com/users/super626/received_events","type":"User","site_admin":false},"body":"It is better that pos is Vec2","created_at":"2015-01-30T02:39:05Z","updated_at":"2015-01-30T02:39:05Z","html_url":"https://github.com/super626/cocos2d-x/pull/221#discussion_r23820900","pull_request_url":"https://api.github.com/repos/super626/cocos2d-x/pulls/221","_links":{"self":{"href":"https://api.github.com/repos/super626/cocos2d-x/pulls/comments/23820900"},"html":{"href":"https://github.com/super626/cocos2d-x/pull/221#discussion_r23820900"},"pull_request":{"href":"https://api.github.com/repos/super626/cocos2d-x/pulls/221"}}},"pull_request":{"url":"https://api.github.com/repos/super626/cocos2d-x/pulls/221","id":27913437,"html_url":"https://github.com/super626/cocos2d-x/pull/221","diff_url":"https://github.com/super626/cocos2d-x/pull/221.diff","patch_url":"https://github.com/super626/cocos2d-x/pull/221.patch","issue_url":"https://api.github.com/repos/super626/cocos2d-x/issues/221","number":221,"state":"open","locked":false,"title":"Terrain tzw","user":{"login":"tangziwen","id":3488056,"avatar_url":"https://avatars.githubusercontent.com/u/3488056?v=3","gravatar_id":"","url":"https://api.github.com/users/tangziwen","html_url":"https://github.com/tangziwen","followers_url":"https://api.github.com/users/tangziwen/followers","following_url":"https://api.github.com/users/tangziwen/following{/other_user}","gists_url":"https://api.github.com/users/tangziwen/gists{/gist_id}","starred_url":"https://api.github.com/users/tangziwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangziwen/subscriptions","organizations_url":"https://api.github.com/users/tangziwen/orgs","repos_url":"https://api.github.com/users/tangziwen/repos","events_url":"https://api.github.com/users/tangziwen/events{/privacy}","received_events_url":"https://api.github.com/users/tangziwen/received_events","type":"User","site_admin":false},"body":"add new Terrain Test ,fix memory leak,add some parmeters check","created_at":"2015-01-23T10:18:07Z","updated_at":"2015-01-30T02:39:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"92b896da466734fdd5181b09205a3118acbc2004","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/super626/cocos2d-x/pulls/221/commits","review_comments_url":"https://api.github.com/repos/super626/cocos2d-x/pulls/221/comments","review_comment_url":"https://api.github.com/repos/super626/cocos2d-x/pulls/comments/{number}","comments_url":"https://api.github.com/repos/super626/cocos2d-x/issues/221/comments","statuses_url":"https://api.github.com/repos/super626/cocos2d-x/statuses/89cff149fcae19025ab4362105a42a1d882f29fb","head":{"label":"tangziwen:terrain_tzw","ref":"terrain_tzw","sha":"89cff149fcae19025ab4362105a42a1d882f29fb","user":{"login":"tangziwen","id":3488056,"avatar_url":"https://avatars.githubusercontent.com/u/3488056?v=3","gravatar_id":"","url":"https://api.github.com/users/tangziwen","html_url":"https://github.com/tangziwen","followers_url":"https://api.github.com/users/tangziwen/followers","following_url":"https://api.github.com/users/tangziwen/following{/other_user}","gists_url":"https://api.github.com/users/tangziwen/gists{/gist_id}","starred_url":"https://api.github.com/users/tangziwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangziwen/subscriptions","organizations_url":"https://api.github.com/users/tangziwen/orgs","repos_url":"https://api.github.com/users/tangziwen/repos","events_url":"https://api.github.com/users/tangziwen/events{/privacy}","received_events_url":"https://api.github.com/users/tangziwen/received_events","type":"User","site_admin":false},"repo":{"id":24621473,"name":"cocos2d-x","full_name":"tangziwen/cocos2d-x","owner":{"login":"tangziwen","id":3488056,"avatar_url":"https://avatars.githubusercontent.com/u/3488056?v=3","gravatar_id":"","url":"https://api.github.com/users/tangziwen","html_url":"https://github.com/tangziwen","followers_url":"https://api.github.com/users/tangziwen/followers","following_url":"https://api.github.com/users/tangziwen/following{/other_user}","gists_url":"https://api.github.com/users/tangziwen/gists{/gist_id}","starred_url":"https://api.github.com/users/tangziwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangziwen/subscriptions","organizations_url":"https://api.github.com/users/tangziwen/orgs","repos_url":"https://api.github.com/users/tangziwen/repos","events_url":"https://api.github.com/users/tangziwen/events{/privacy}","received_events_url":"https://api.github.com/users/tangziwen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tangziwen/cocos2d-x","description":"cocos2d-x for C++","fork":true,"url":"https://api.github.com/repos/tangziwen/cocos2d-x","forks_url":"https://api.github.com/repos/tangziwen/cocos2d-x/forks","keys_url":"https://api.github.com/repos/tangziwen/cocos2d-x/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tangziwen/cocos2d-x/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tangziwen/cocos2d-x/teams","hooks_url":"https://api.github.com/repos/tangziwen/cocos2d-x/hooks","issue_events_url":"https://api.github.com/repos/tangziwen/cocos2d-x/issues/events{/number}","events_url":"https://api.github.com/repos/tangziwen/cocos2d-x/events","assignees_url":"https://api.github.com/repos/tangziwen/cocos2d-x/assignees{/user}","branches_url":"https://api.github.com/repos/tangziwen/cocos2d-x/branches{/branch}","tags_url":"https://api.github.com/repos/tangziwen/cocos2d-x/tags","blobs_url":"https://api.github.com/repos/tangziwen/cocos2d-x/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tangziwen/cocos2d-x/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tangziwen/cocos2d-x/git/refs{/sha}","trees_url":"https://api.github.com/repos/tangziwen/cocos2d-x/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tangziwen/cocos2d-x/statuses/{sha}","languages_url":"https://api.github.com/repos/tangziwen/cocos2d-x/languages","stargazers_url":"https://api.github.com/repos/tangziwen/cocos2d-x/stargazers","contributors_url":"https://api.github.com/repos/tangziwen/cocos2d-x/contributors","subscribers_url":"https://api.github.com/repos/tangziwen/cocos2d-x/subscribers","subscription_url":"https://api.github.com/repos/tangziwen/cocos2d-x/subscription","commits_url":"https://api.github.com/repos/tangziwen/cocos2d-x/commits{/sha}","git_commits_url":"https://api.github.com/repos/tangziwen/cocos2d-x/git/commits{/sha}","comments_url":"https://api.github.com/repos/tangziwen/cocos2d-x/comments{/number}","issue_comment_url":"https://api.github.com/repos/tangziwen/cocos2d-x/issues/comments/{number}","contents_url":"https://api.github.com/repos/tangziwen/cocos2d-x/contents/{+path}","compare_url":"https://api.github.com/repos/tangziwen/cocos2d-x/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tangziwen/cocos2d-x/merges","archive_url":"https://api.github.com/repos/tangziwen/cocos2d-x/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tangziwen/cocos2d-x/downloads","issues_url":"https://api.github.com/repos/tangziwen/cocos2d-x/issues{/number}","pulls_url":"https://api.github.com/repos/tangziwen/cocos2d-x/pulls{/number}","milestones_url":"https://api.github.com/repos/tangziwen/cocos2d-x/milestones{/number}","notifications_url":"https://api.github.com/repos/tangziwen/cocos2d-x/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tangziwen/cocos2d-x/labels{/name}","releases_url":"https://api.github.com/repos/tangziwen/cocos2d-x/releases{/id}","created_at":"2014-09-30T02:34:41Z","updated_at":"2014-10-29T14:04:00Z","pushed_at":"2015-01-29T10:06:17Z","git_url":"git://github.com/tangziwen/cocos2d-x.git","ssh_url":"git@github.com:tangziwen/cocos2d-x.git","clone_url":"https://github.com/tangziwen/cocos2d-x.git","svn_url":"https://github.com/tangziwen/cocos2d-x","homepage":"http://www.cocos2d-x.org","size":849936,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"v3_merge"}},"base":{"label":"super626:terrain","ref":"terrain","sha":"174bd11894a88494948baa9e66bb50dcc1cce294","user":{"login":"super626","id":4159090,"avatar_url":"https://avatars.githubusercontent.com/u/4159090?v=3","gravatar_id":"","url":"https://api.github.com/users/super626","html_url":"https://github.com/super626","followers_url":"https://api.github.com/users/super626/followers","following_url":"https://api.github.com/users/super626/following{/other_user}","gists_url":"https://api.github.com/users/super626/gists{/gist_id}","starred_url":"https://api.github.com/users/super626/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/super626/subscriptions","organizations_url":"https://api.github.com/users/super626/orgs","repos_url":"https://api.github.com/users/super626/repos","events_url":"https://api.github.com/users/super626/events{/privacy}","received_events_url":"https://api.github.com/users/super626/received_events","type":"User","site_admin":false},"repo":{"id":18664943,"name":"cocos2d-x","full_name":"super626/cocos2d-x","owner":{"login":"super626","id":4159090,"avatar_url":"https://avatars.githubusercontent.com/u/4159090?v=3","gravatar_id":"","url":"https://api.github.com/users/super626","html_url":"https://github.com/super626","followers_url":"https://api.github.com/users/super626/followers","following_url":"https://api.github.com/users/super626/following{/other_user}","gists_url":"https://api.github.com/users/super626/gists{/gist_id}","starred_url":"https://api.github.com/users/super626/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/super626/subscriptions","organizations_url":"https://api.github.com/users/super626/orgs","repos_url":"https://api.github.com/users/super626/repos","events_url":"https://api.github.com/users/super626/events{/privacy}","received_events_url":"https://api.github.com/users/super626/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/super626/cocos2d-x","description":"cocos2d-x for C++","fork":true,"url":"https://api.github.com/repos/super626/cocos2d-x","forks_url":"https://api.github.com/repos/super626/cocos2d-x/forks","keys_url":"https://api.github.com/repos/super626/cocos2d-x/keys{/key_id}","collaborators_url":"https://api.github.com/repos/super626/cocos2d-x/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/super626/cocos2d-x/teams","hooks_url":"https://api.github.com/repos/super626/cocos2d-x/hooks","issue_events_url":"https://api.github.com/repos/super626/cocos2d-x/issues/events{/number}","events_url":"https://api.github.com/repos/super626/cocos2d-x/events","assignees_url":"https://api.github.com/repos/super626/cocos2d-x/assignees{/user}","branches_url":"https://api.github.com/repos/super626/cocos2d-x/branches{/branch}","tags_url":"https://api.github.com/repos/super626/cocos2d-x/tags","blobs_url":"https://api.github.com/repos/super626/cocos2d-x/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/super626/cocos2d-x/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/super626/cocos2d-x/git/refs{/sha}","trees_url":"https://api.github.com/repos/super626/cocos2d-x/git/trees{/sha}","statuses_url":"https://api.github.com/repos/super626/cocos2d-x/statuses/{sha}","languages_url":"https://api.github.com/repos/super626/cocos2d-x/languages","stargazers_url":"https://api.github.com/repos/super626/cocos2d-x/stargazers","contributors_url":"https://api.github.com/repos/super626/cocos2d-x/contributors","subscribers_url":"https://api.github.com/repos/super626/cocos2d-x/subscribers","subscription_url":"https://api.github.com/repos/super626/cocos2d-x/subscription","commits_url":"https://api.github.com/repos/super626/cocos2d-x/commits{/sha}","git_commits_url":"https://api.github.com/repos/super626/cocos2d-x/git/commits{/sha}","comments_url":"https://api.github.com/repos/super626/cocos2d-x/comments{/number}","issue_comment_url":"https://api.github.com/repos/super626/cocos2d-x/issues/comments/{number}","contents_url":"https://api.github.com/repos/super626/cocos2d-x/contents/{+path}","compare_url":"https://api.github.com/repos/super626/cocos2d-x/compare/{base}...{head}","merges_url":"https://api.github.com/repos/super626/cocos2d-x/merges","archive_url":"https://api.github.com/repos/super626/cocos2d-x/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/super626/cocos2d-x/downloads","issues_url":"https://api.github.com/repos/super626/cocos2d-x/issues{/number}","pulls_url":"https://api.github.com/repos/super626/cocos2d-x/pulls{/number}","milestones_url":"https://api.github.com/repos/super626/cocos2d-x/milestones{/number}","notifications_url":"https://api.github.com/repos/super626/cocos2d-x/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/super626/cocos2d-x/labels{/name}","releases_url":"https://api.github.com/repos/super626/cocos2d-x/releases{/id}","created_at":"2014-04-11T06:39:38Z","updated_at":"2015-01-29T09:54:40Z","pushed_at":"2015-01-29T09:54:40Z","git_url":"git://github.com/super626/cocos2d-x.git","ssh_url":"git@github.com:super626/cocos2d-x.git","clone_url":"https://github.com/super626/cocos2d-x.git","svn_url":"https://github.com/super626/cocos2d-x","homepage":"http://www.cocos2d-x.org","size":910868,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":5,"forks":10,"open_issues":5,"watchers":3,"default_branch":"v3"}},"_links":{"self":{"href":"https://api.github.com/repos/super626/cocos2d-x/pulls/221"},"html":{"href":"https://github.com/super626/cocos2d-x/pull/221"},"issue":{"href":"https://api.github.com/repos/super626/cocos2d-x/issues/221"},"comments":{"href":"https://api.github.com/repos/super626/cocos2d-x/issues/221/comments"},"review_comments":{"href":"https://api.github.com/repos/super626/cocos2d-x/pulls/221/comments"},"review_comment":{"href":"https://api.github.com/repos/super626/cocos2d-x/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/super626/cocos2d-x/pulls/221/commits"},"statuses":{"href":"https://api.github.com/repos/super626/cocos2d-x/statuses/89cff149fcae19025ab4362105a42a1d882f29fb"}}}}