{"id":4508,"date":"2018-09-01T13:34:34","date_gmt":"2018-09-01T05:34:34","guid":{"rendered":"http:\/\/www.bookcard.net\/wordpress\/?p=4508"},"modified":"2018-09-01T13:34:34","modified_gmt":"2018-09-01T05:34:34","slug":"android_game_camera_euler","status":"publish","type":"post","link":"https:\/\/www.bookcard.net\/wordpress\/android_game_camera_euler\/","title":{"rendered":"Android\u904a\u6232\u4e4b\u7b2c\u4e00\u4eba\u7a31\u76f8\u6a5f(\u6b50\u62c9\u76f8\u6a5f)"},"content":{"rendered":"<figure id=\"attachment_4509\" aria-describedby=\"caption-attachment-4509\" style=\"width: 1200px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/09\/Android_Game_Camera_Euler.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4509\" src=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/09\/Android_Game_Camera_Euler.jpg\" alt=\"\" width=\"1200\" height=\"800\" srcset=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/09\/Android_Game_Camera_Euler.jpg 1200w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/09\/Android_Game_Camera_Euler-300x200.jpg 300w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/09\/Android_Game_Camera_Euler-768x512.jpg 768w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/09\/Android_Game_Camera_Euler-1024x683.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><figcaption id=\"caption-attachment-4509\" class=\"wp-caption-text\">Android\u904a\u6232\u4e4b\u7b2c\u4e00\u4eba\u7a31\u76f8\u6a5f(\u6b50\u62c9\u76f8\u6a5f)<\/figcaption><\/figure>\n<p>\u6b50\u62c9\u76f8\u6a5f\u5373\u7b2c\u4e00\u7a31\u5c04\u64ca\u904a\u6232\u4e2d\u6642\u7528\u76f8\u6a5f.\u4f60\u9700\u8981\u5b9a\u7fa9\u4ee5\u4e0b\u5c6c\u6027<\/p>\n<p>\u300e\u8996\u5834\u300f\u5373\u8996\u53e3\u89d2\u5ea6fieldOfView<\/p>\n<p>\u8996\u53e3\u7e31\u6a6b\u6bd4aspectRatio<\/p>\n<p>\u9060\u88c1\u526a\u9762far<\/p>\n<p>\u8fd1\u88c1\u526a\u9762near<\/p>\n<p>3D\u7a7a\u9593\u4f4d\u7f6eposition<\/p>\n<p>\u7e5ey\u8ef8\u65cb\u8f49\u89d2yaw<\/p>\n<p>\u7e5ex\u8ef8\u65cb\u8f49\u89d2pitch.\u89d2\u5ea6\u503c-90~+90\u5ea6\u4e4b\u9593.\u9019\u985e\u4f3c\u65bc\u982d\u90e8\u50be\u659c\u89d2.\u82e5\u8d85\u904e\u9019\u89d2\u5ea6\u5247\u9020\u6210\u9aa8\u6298.<\/p>\n<p>&nbsp;<\/p>\n<p>\u8a2d\u5b9a\u6b50\u62c9\u76f8\u6a5f\u8996\u53e3,\u5bec\u8207\u9ad8\u70ba\u5c4f\u5e55\u5206\u8fa8\u7387<\/p>\n<p>gl.glViewport(0,0,width,height);<\/p>\n<p>\u8a2d\u7f6e\u6b50\u62c9\u76f8\u6a5f\u77e9\u9663.\u9996\u5148\u5c07\u7576\u524d\u5806\u68e7\u8a2d\u70ba\u6295\u5f71\u77e9\u9663<\/p>\n<p>gl.glMatrixMode(GL10.GL_PROJECTION);<\/p>\n<p>\u68e7\u9802\u8f09\u5165\u55ae\u4f4d\u77e9\u9663<\/p>\n<p>gl.glLoadIdentity();<\/p>\n<p>\u8a2d\u7f6e\u6295\u5f71\u77e9\u9663.\u4f60\u9700\u5b9a\u7fa9\u8981\u8996\u9310\u9ad4<\/p>\n<p>GLU.gluPerspective(gl, fieldOfView, aspectRatio, near, far);<\/p>\n<p>\u8a2d\u70ba\u6a21\u578b\u8996\u5716\u77e9\u9663<\/p>\n<p>gl.glMatrixMode(GL10.GL_MODELVIEW);<\/p>\n<p>\u68e7\u9802\u8f09\u5165\u55ae\u4f4d\u77e9\u9663<\/p>\n<p>gl.glLoadIdentity();<\/p>\n<p>\u7e5ex\u8ef8\u65cb\u8f49\u89d2\u5ea6<\/p>\n<p>gl.glRotatef(-pitch,1,0,0);<\/p>\n<p>\u7e5eY\u8ef8\u65cb\u8f49\u89d2\u5ea6<\/p>\n<p>gl.glRotatef(-yaw,0,1,0);<\/p>\n<p>\u79fb\u52d5\u76f8\u6a5f,\u76f8\u6a5f\u4f4d\u65bc\u539f\u9ede\u4e14\u93e1\u982d\u6307\u5411z\u8ef8\u8ca0\u65b9\u5411<\/p>\n<p>gl.glTranslatef(-position.x,-position.y,-position.z);<\/p>\n<p>&nbsp;<\/p>\n<p>\u7372\u53d6\u76f8\u6a5f\u65b9\u5411<\/p>\n<p>\u76f8\u6a5f\u672a\u65cb\u8f49\u6642\u6307\u5411z\u8ef8\u8ca0\u5411<\/p>\n<p>float[] inVec = {0,0,-1,1};<\/p>\n<p>float[] outVec = {0,0,0,0};<\/p>\n<p>\u8a2d\u7f6e\u55ae\u4f4d\u77e9\u9663<\/p>\n<p>float[] matrix = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};<\/p>\n<p>Matrix.setIdentityM(matrix,0);<\/p>\n<p>\u7e5ex\u8ef8\u4fef\u4ef0<\/p>\n<p>Matrix.rotateM(matrix, 0, yaw,0,1,0);<\/p>\n<p>\u7e5eY\u8ef8\u65cb\u8f49<\/p>\n<p>Matrix.rotateM(matrix, 0, pitch,1,0,0);<\/p>\n<p>\u5c07\u77e9\u9663\u548c\u5411\u91cf\u76f8\u4e58\u7684\u55ae\u4f4d\u65b9\u5411\u5411\u91cf<\/p>\n<p>Matrix.multiplyMV(outVec, 0, matrix, 0, inVec, 0);<\/p>\n<p>direcion.set(outVec[0],outVec[1],outVec[2]);<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b50\u62c9\u76f8\u6a5f\u5373\u7b2c\u4e00\u7a31\u5c04\u64ca\u904a\u6232\u4e2d\u6642\u7528\u76f8\u6a5f.\u4f60\u9700\u8981\u5b9a\u7fa9\u4ee5\u4e0b\u5c6c\u6027 \u300e\u8996\u5834\u300f\u5373\u8996\u53e3\u89d2\u5ea6fieldOfView \u8996\u53e3\u7e31\u6a6b\u6bd4a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/android_game_camera_euler\/\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80 <span class=\"screen-reader-text\">Android\u904a\u6232\u4e4b\u7b2c\u4e00\u4eba\u7a31\u76f8\u6a5f(\u6b50\u62c9\u76f8\u6a5f)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[2,50],"class_list":["post-4508","post","type-post","status-publish","format-standard","hentry","category-android","tag-android","tag-opengl","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/4508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/comments?post=4508"}],"version-history":[{"count":1,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/4508\/revisions"}],"predecessor-version":[{"id":4510,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/4508\/revisions\/4510"}],"wp:attachment":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/media?parent=4508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/categories?post=4508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/tags?post=4508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}