{"id":733,"date":"2007-04-19T02:00:00","date_gmt":"2007-04-18T17:00:00","guid":{"rendered":"https:\/\/ecoop.net\/memo\/2007-04-19-2.html"},"modified":"2007-04-19T02:00:00","modified_gmt":"2007-04-18T17:00:00","slug":"2007-04-19-2","status":"publish","type":"post","link":"https:\/\/www.ecoop.net\/memo\/archives\/2007-04-19-2.html","title":{"rendered":"3D\u3067\u306e\u30ab\u30e1\u30e9\u8a2d\u5b9a"},"content":{"rendered":"<p>\n\u30c7\u30d0\u30a4\u30b9\u306e\u30d7\u30ed\u30d1\u30c6\u30a3 Device.Transform.View \u306b\u3001Matrix \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u8a2d\u5b9a\u53ef\u80fd\u3002\n<\/p>\n<blockquote><p>\/\/ \u5de6\u624b\u5ea7\u6a19\u306e\u8996\u70b9\u30de\u30c8\u30ea\u30af\u30b9\u3092\u69cb\u7bc9\u3059\u308b<br \/>\npublic static Matrix <a href=\"http:\/\/msdn2.microsoft.com\/ja-jp\/library\/microsoft.windowsmobile.directx.matrix.lookatlh(VS.80).aspx\">Matrix.LookAtLH<\/a>(<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;Vector3 cameraPosition, \/\/ \u30ab\u30e1\u30e9\u306e\u4f4d\u7f6e\u3002<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;Vector3 cameraTarget,   \/\/ \u30ab\u30e1\u30e9\u306e\u898b\u3066\u3044\u308b\u4f4d\u7f6e\u3002<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;Vector3 cameraUpVector \/\/ \u30ab\u30e1\u30e9\u306e\u982d\u306e\u65b9\u5411(\u4f8b: \u6b63\u7acb\u306f new Vector3(0f,1f,0f), \u5012\u7acb\u306f new Vector3(0f,-1f,0f)). \u65b9\u5411\u3092\u6307\u5b9a\u3059\u308b\u76ee\u7684\u306a\u306e\u3067\u3001\u30d9\u30af\u30c8\u30eb\u306e\u5927\u304d\u3055\u306f\u554f\u308f\u306a\u3044<br \/>\n)\n<\/p><\/blockquote>\n<p>\u4f8b:\n<\/p>\n<blockquote><p>Device device;<br \/>\n&nbsp;<br \/>\n\/\/ ..\u4e2d\u7565..<br \/>\n&nbsp;<br \/>\n\/\/ \u5ea7\u6a19 (0,0,-10) \u304b\u3089\u6b63\u7acb\u72b6\u614b\u3067 \u5ea7\u6a19 (0,0,0) \u3092\u898b\u308b<br \/>\ndevice.Transform.View = Matrix.LookAtLH(<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;new Vector3(0f, 0f, -10.0f),<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;new Vector3(0f,0f,0f),<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;new Vector3(0f,1f,0f) );<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n);\n<\/p><\/blockquote>\n<p>\u5b9f\u969b\u306b\u8868\u793a\u3059\u308b\u306b\u306f\u3001\u3055\u3089\u306b 3D \u304b\u3089 2D \u3078\u306e\u6295\u5f71\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3053\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u306b\u306f Device.Transform.Projection \u30d7\u30ed\u30d1\u30c6\u30a3\u306b Matrix \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\n<\/p>\n<blockquote><p>\/\/ \u5de6\u624b\u5ea7\u6a19\u306e\u30d1\u30fc\u30b9\u30da\u30af\u30c6\u30a3\u30d6\u30de\u30c8\u30ea\u30af\u30b9\u3092\u69cb\u7bc9\u3059\u308b<br \/>\npublic Matrix Matrix.<a href=\"http:\/\/msdn2.microsoft.com\/ja-jp\/library\/microsoft.windowsmobile.directx.matrix.perspectivefovlh(VS.80).aspx\">PerspectiveFovLH<\/a>(<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;float fieldOfViewY, \/\/ (\u30ab\u30e1\u30e9\u304b\u3089\u898b\u3066) Y\u8ef8\u65b9\u5411\u306e\u8996\u91ce\u3002\u30e9\u30b8\u30a2\u30f3\u3067\u6307\u5b9a\u3059\u308b\u3002(1\/4 \u03c0 == 45\u5ea6 \u304f\u3089\u3044\u304c\u9069\u5207)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;float aspectRatio,  \/\/ 2D\u306b\u5909\u63db\u5f8c\u306e\u753b\u9762\u306e\u30a2\u30b9\u30da\u30af\u30c8\u6bd4(\u6a2a\u5e45 \u00f7 \u7e26\u5e45) (\u4f8b: \u9ad8\u3055\u3082\u5e45\u3082\u540c\u3058\u306a\u3089 1.0f, \u6c4e\u7528:(float)device.Viewport.Width \/ (float)device.Viewport.Height )<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;float znearPlane,   \/\/ (\u30ab\u30e1\u30e9\u304b\u3089\u898b\u305f)\u53ef\u8996\u7bc4\u56f2\u306e\u3046\u3061\u3001\u6700\u3082\u8fd1\u3044\u8ddd\u96e2(1.0f)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;float zfarPlane     \/\/ (\u30ab\u30e1\u30e9\u304b\u3089\u898b\u305f)\u53ef\u8996\u7bc4\u56f2\u306e\u3046\u3061\u3001\u6700\u3082\u9060\u3044\u8ddd\u96e2 (100.0f)<br \/>\n);\n<\/p><\/blockquote>\n<p>\u4f8b:\n<\/p>\n<blockquote><p>Device device;<br \/>\n\/\/ &#8230;\u4e2d\u7565&#8230;<br \/>\n&nbsp;<br \/>\ndevice.Transform.View = &#8230; \/\/ \u7565<br \/>\n&nbsp;<br \/>\n\/\/ \u4e0a\u4e0b\u89d2\u5ea645\u5ea6\u3067\u5965\u884c\u304d 1.0f \u524d\u65b9\u304b\u3089 100.0f \u524d\u65b9\u307e\u3067\u306e\u7bc4\u56f2\u3092\u8868\u793a\u3059\u308b<br \/>\ndevice.Transform.Projection = Matrix.PerspectiveFovLH(<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;(float) Math.PI \/ 4, <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;(float) device.Viewport.Width \/ device.Viewport.Height,<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;1.0f, 100.0f );\n<\/p><\/blockquote>\n<p>\u3061\u306a\u307f\u306b\u3001Matrix.PerspectiveForLH \u3067\u306f\u306a\u304f\u3066 Matrix.PerspectiveFovLH \u306a\u306e\u3067\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002for \u3067\u306a\u304f fov \u3067\u3059\u3002<br \/>\n&nbsp;<br \/>\n\u53c2\u8003:<br \/>\n&#8211; <a href=\"http:\/\/msdn.microsoft.com\/library\/ja\/default.asp?url=\/library\/ja\/directx9_m\/directx\/direct3d\/tutorials\/tutorial3.asp\">\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\uff13 \u884c\u5217\u306e\u4f7f\u3044\u65b9<\/a>(MSDN Direct3D)<br \/>\n&#8211; <a href=\"http:\/\/msdn2.microsoft.com\/ja-jp\/library\/microsoft.windowsmobile.directx.matrix.lookatlh(VS.80).aspx\">Matrix.LookAtLH \u30e1\u30bd\u30c3\u30c9<\/a>(MSDN)<br \/>\n&#8211; <a href=\"http:\/\/msdn.microsoft.com\/library\/ja\/default.asp?url=\/library\/ja\/directx9_m\/directx\/direct3d\/tasks\/setupviewmatrix.asp\">\u30d3\u30e5\u30fc\u884c\u5217\u3092\u8a2d\u5b9a\u3059\u308b<\/a>(MSDN)<br \/>\n&#8211; <a href=\"http:\/\/msdn2.microsoft.com\/ja-jp\/library\/microsoft.windowsmobile.directx.matrix.perspectivefovlh(VS.80).aspx\">Matrix.PerspectiveFovLH \u30e1\u30bd\u30c3\u30c9<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30c7\u30d0\u30a4\u30b9\u306e\u30d7\u30ed\u30d1\u30c6\u30a3 Device.Transform.View \u306b\u3001Matrix \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u8a2d\u5b9a\u53ef\u80fd\u3002 \/\/ \u5de6\u624b\u5ea7\u6a19\u306e\u8996\u70b9\u30de\u30c8\u30ea\u30af\u30b9\u3092\u69cb\u7bc9\u3059\u308b public static Matrix Matrix &hellip; <a href=\"https:\/\/www.ecoop.net\/memo\/archives\/2007-04-19-2.html\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">3D\u3067\u306e\u30ab\u30e1\u30e9\u8a2d\u5b9a<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[72,58],"class_list":["post-733","post","type-post","status-publish","format-standard","hentry","tag-c23","tag-directx"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/comments?post=733"}],"version-history":[{"count":0,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/733\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/media?parent=733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/categories?post=733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/tags?post=733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}