{"id":265747,"date":"2015-09-16T13:31:05","date_gmt":"2015-09-16T09:31:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=265747"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=265747","title":{"rendered":"\u0423\u0440\u043e\u043a \u043f\u043e BabylonJS \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0441\u0446\u0435\u043d\u044b"},"content":{"rendered":"<p>       \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0442\u044b \u043d\u0430\u0441\u043b\u044b\u0448\u0430\u043d \u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 <a href=\"http:\/\/developer.mozilla.org\/ru\/docs\/Web\/WebGL\">WebGL<\/a>. \u041f\u043e\u0437\u0432\u043e\u043b\u044c \u043c\u043d\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c \u0442\u0435\u0431\u044f \u0441 \u043e\u0434\u043d\u0438\u043c \u0447\u0443\u0434\u0435\u0441\u043d\u044b\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u2014 BabylonJS. \u042d\u0442\u043e open-source \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0438 \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 HTML5-\u044d\u043b\u0435\u043c\u0435\u043d\u0442 Canvas.<\/p>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0442\u0435\u0431\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0446\u0435\u043d\u043a\u0443 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. <\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0442\u0435\u0431\u0435 \u2014 \u044d\u0442\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u2014 <a href=\"https:\/\/github.com\/BabylonJS\/Babylon.js\">\u043b\u044e\u0431\u0435\u0437\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430<\/a>. \u0418\u0437 \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0442\u0435\u0431\u0435 \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e babylon.2.1.js \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 dist.<\/p>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0435 \u2014 \u043b\u044e\u0431\u043e\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043a\u043e\u0434\u0430, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e Notepad++.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0434\u0430\u0432\u0430\u0439 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0441\u0446\u0435\u043d\u043a\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/91e\/f06\/a05\/91ef06a0560642d797a7bb93ed547cf2.png\"\/><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 HTML 5. \u041d\u0430\u0437\u043e\u0432\u0451\u043c \u0435\u0451 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u2014 index.html <\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043c\u044b \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c:  <\/p>\n<ul>\n<li>\u041a\u0430\u0440\u043a\u0430\u0441 <i>(\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b html, head, body)<\/i><\/li>\n<li>\u0422\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0438\u043b\u0435\u0439 <i>(\u044d\u043b\u0435\u043c\u0435\u043d\u0442 style \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 head)<\/i><\/li>\n<li>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <i>(\u044d\u043b\u0435\u043c\u0435\u043d\u0442 script, \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 head, \u0441\u043e \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 js-\u0444\u0430\u0439\u043b)<\/i><\/li>\n<li>\u0425\u043e\u043b\u0441\u0442 <i>(\u044d\u043b\u0435\u043c\u0435\u043d\u0442 canvas \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 body)<\/i><\/li>\n<li>\u0421\u0446\u0435\u043d\u0443 <i>(\u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 script \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 body)<\/i><\/li>\n<\/ul>\n<p>  <b>\u041a\u0430\u0440\u043a\u0430\u0441<\/b><\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;&gt; \t&lt;head&gt; \t\t&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html&quot; charset=&quot;utf-8&quot;&gt; \t\t&lt;title&gt;BabylonJS&lt;\/title&gt; \t&lt;\/head&gt; \t&lt;body&gt;  \t&lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  <b>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0442\u0438\u043b\u0435\u0439<\/b><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 head \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 style \u0438 \u0440\u0430\u0441\u043a\u0440\u043e\u0435\u043c \u0435\u0433\u043e, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0442\u0443\u0434\u0430 \u0441\u0442\u0438\u043b\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0445\u043e\u043b\u0441\u0442\u0430:<\/p>\n<pre><code class=\"html\">\t\t&lt;style&gt; \t\t\thtml. body { \t\t\toverflow: hidden; \t\t\twidth: 100%; \t\t\theight: 100%; \t\t\tmargin: 0; \t\t\tpadding: 0; \t\t\t} \t\t\t \t\t\t#renderCanvas { \t\t\twidth: 100%; \t\t\theight: 100%; \t\t\ttouch-action: none; \t\t\t} \t\t&lt;\/style&gt; <\/code><\/pre>\n<p>  <b>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430<\/b><\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435, \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0444\u043e\u0440\u043a \u2014 \u044d\u0442\u043e JS-\u0444\u0430\u0439\u043b \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c: <\/p>\n<pre><code class=\"html\">\t&lt;script src=&quot;babylon.js&quot;&gt;&lt;\/script&gt; <\/code><\/pre>\n<p>  <b>\u0425\u043e\u043b\u0441\u0442<\/b><\/p>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0442\u0435\u043b\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b (\u044d\u043b\u0435\u043c\u0435\u043d\u0442 body). \u0412\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 canvas \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c #renderCanvas:<\/p>\n<pre><code class=\"html\">\t&lt;canvas id=&quot;renderCanvas&quot;&gt;&lt;\/canvas&gt; <\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0432\u043e\u0435\u0433\u043e \u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041d\u0438\u0436\u0435, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 script \u0438 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e:<\/p>\n<pre><code class=\"html\">\t&lt;script&gt; \t \t&lt;\/script&gt; <\/code><\/pre>\n<p>  \u0418 \u0434\u0430\u0432\u0430\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u0444\u0440\u0435\u0439\u043c\u043e\u0432\u043e\u0440\u043a\u043e\u043c.<\/p>\n<p>  \u0421\u0446\u0435\u043d\u0430.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u043c\u0443 \u0441 \u043a\u0430\u043a\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c canvas \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c: <\/p>\n<pre><code class=\"javascript\">\tvar canvas = document.querySelector(&quot;#renderCanvas&quot;); \tvar engine = new BABYLON.Engine(canvas, true);  <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0442\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b BabylonJS \u0438 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0435\u043c\u0443, \u0433\u0434\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e createScene \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0446\u0435\u043d\u044b:<\/p>\n<pre><code class=\"javascript\">\tvar createScene = function (){ \t\tvar scene = new BABYLON.Scene(engine); \t\tscene.clearColor = new BABYLON.Color3(0, 0, 1); <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0442\u044b \u043c\u043e\u0436\u0435\u0448\u044c \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u044f\u0432\u043d\u043e \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0446\u0435\u043d\u044b. \u0424\u0443\u043d\u043a\u0446\u0438\u0435\u0439 clearColor \u043c\u044b \u043e\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0441\u0446\u0435\u043d\u0443 \u0432 \u0441\u0438\u043d\u0438\u0439 \u0446\u0432\u0435\u0442. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0440\u043e\u043a\u0430\u0445.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0435\u0431\u0435 \u043d\u0443\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0447\u0442\u043e-\u0442\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0446\u0435\u043d\u0443, \u0432\u0435\u0440\u043d\u043e? \u041a\u0430\u043c\u0435\u0440\u0430!<\/p>\n<pre><code class=\"javascript\">var camera = new BABYLON.FreeCamera(&quot;camera1&quot;, new BABYLON.Vector3(0, 5, -10), scene); camera.setTarget(BABYLON.Vector3.Zero()); \t\tcamera.attachControl(canvas, false); <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0430\u044f \u043a\u0430\u043c\u0435\u0440\u0430, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0430\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u0438 \u043c\u044b\u0448\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u043a\u0430\u043c\u0435\u0440\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0440\u043e\u043a\u0430\u0445.<\/p>\n<p>  \u0418 \u043a\u043e\u043d\u0435\u0447\u043d\u043e-\u0436\u0435 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435! \u0418\u043d\u0430\u0447\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u043d\u043e:<\/p>\n<pre><code class=\"javascript\">var light = new BABYLON.HemisphericLight(&quot;light1&quot;, new BABYLON.Vector3(0, 1, 0), scene); light.intensity = 0.5; <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u0432 \u044d\u0442\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438, \u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0448\u044c \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0440\u043e\u043a\u0430\u0445 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0442\u0435\u0431\u0435 \u043e\u0431 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u0430\u0445 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f. \u041f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u043c.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0444\u0435\u0440\u0443 \u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043d\u0430 \u0441\u0446\u0435\u043d\u0443:<\/p>\n<pre><code class=\"javascript\">var sphere = BABYLON.Mesh.CreateSphere(&quot;sphere1&quot;, 16, 2, scene); sphere.position.y = 1;  var ground = BABYLON.Mesh.CreateGround(&quot;ground1&quot;, 6, 6, 2, scene); <\/code><\/pre>\n<p>  \u0421\u0446\u0435\u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u0430! \u041d\u043e \u043d\u0435 \u0441\u043f\u0435\u0448\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0444\u0430\u0439\u043b \u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0442\u043e \u0442\u044b \u0442\u0430\u043c \u043d\u0430\u043a\u043e\u0434\u0438\u043b. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0435\u0449\u0451 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0446\u0435\u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u0430. \u0422\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0439 \u044d\u0442\u043e:<\/p>\n<pre><code class=\"javascript\">\treturn scene; \t};  \tvar scene = createScene(); \tengine.runRenderLoop(function (){ \t\tscene.render(); \t}); <\/code><\/pre>\n<p>  \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0434\u043e\u0431\u0430\u0432\u044c \u044d\u0442\u0438 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u044b \u043f\u043e\u0434 \u043b\u044e\u0431\u044b\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">\twindow.addEventListener(&quot;resize&quot;, function (){ \t\tengine.resize(); \t}) <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;&gt; \t&lt;head&gt; \t\t&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html&quot; charset=&quot;utf-8&quot;&gt; \t\t&lt;title&gt;BabylonJS&lt;\/title&gt;  \t\t&lt;style&gt; \t\t\thtml. body { \t\t\toverflow: hidden; \t\t\twidth: 100%; \t\t\theight: 100%; \t\t\tmargin: 0; \t\t\tpadding: 0; \t\t\t} \t\t\t \t\t\t#renderCanvas { \t\t\twidth: 100%; \t\t\theight: 100%; \t\t\ttouch-action: none; \t\t\t} \t\t&lt;\/style&gt; \t \t&lt;script src=&quot;babylon.js&quot;&gt;&lt;\/script&gt;  \t&lt;\/head&gt; \t&lt;body&gt; \t\t&lt;canvas id=&quot;renderCanvas&quot;&gt;&lt;\/canvas&gt; \t\t&lt;script&gt; \t\t\t\/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u0432\u0438\u0436\u043e\u043a \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441 \u043a\u0430\u043a\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c &lt;canvas&gt; \u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \t\t\t\tvar canvas = document.querySelector(&quot;#renderCanvas&quot;); \t\t\t\tvar engine = new BABYLON.Engine(canvas, true); \t\t\t\/\/ ------------------------------------------------------------- \t\t\t\/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0446\u0435\u043d\u044b. \u0418 \u043e\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0435\u0451 \u0432 \u0441\u0438\u043d\u0438\u0439 \u0446\u0432\u0435\u0442 \t\t\tvar createScene = function (){ \t\t\t\tvar scene = new BABYLON.Scene(engine); \t\t\t\tscene.clearColor = new BABYLON.Color3(0, 0, 1); \t\t\t\/\/ \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u043c\u0435\u0440\u0443 \t\t\tvar camera = new BABYLON.FreeCamera(&quot;camera1&quot;, new BABYLON.Vector3(0, 5, -10), scene); \t\t\t\tcamera.setTarget(BABYLON.Vector3.Zero()); \t\t\t\tcamera.attachControl(canvas, false); \t\t\t\/\/ \u041e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \t\t\tvar light = new BABYLON.HemisphericLight(&quot;light1&quot;, new BABYLON.Vector3(0, 1, 0), scene); \t\t\t\tlight.intensity = 0.5; \t\t\t\/\/ \u0421\u0444\u0435\u0440\u0430 \t\t\tvar sphere = BABYLON.Mesh.CreateSphere(&quot;sphere1&quot;, 16, 2, scene); \t\t\tsphere.position.y = 1; \t\t\t\/\/ \u041f\u043b\u043e\u0449\u0430\u0434\u043a\u0430 \t\t\tvar ground = BABYLON.Mesh.CreateGround(&quot;ground1&quot;, 6, 6, 2, scene); \t\t\treturn scene; \t\t\t}; \t\t\t\/\/ ------------------------------------------------------------- \t\t\t\/\/ \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0443, \u0447\u0442\u043e \u0441\u0446\u0435\u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0451 \u043d\u0430 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \t\t\tvar scene = createScene(); \t\t\tengine.runRenderLoop(function (){ \t\t\t\tscene.render(); \t\t\t}); \t\t\t\/\/ \u041c\u0430\u0441\u0448\u0430\u0431\u0438\u0440\u0443\u0435\u043c \u0441\u0446\u0435\u043d\u044b \u043f\u043e\u0434 \u043b\u044e\u0431\u044b\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \t\t\twindow.addEventListener(&quot;resize&quot;, function (){ \t\t\t\tengine.resize(); \t\t\t}) \t\t&lt;\/script&gt; \t&lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e! \u0414\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0440\u043e\u043a\u0430\u0445!       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/266959\/\"> http:\/\/habrahabr.ru\/post\/266959\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0442\u044b \u043d\u0430\u0441\u043b\u044b\u0448\u0430\u043d \u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 <a href=\"http:\/\/developer.mozilla.org\/ru\/docs\/Web\/WebGL\">WebGL<\/a>. \u041f\u043e\u0437\u0432\u043e\u043b\u044c \u043c\u043d\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c \u0442\u0435\u0431\u044f \u0441 \u043e\u0434\u043d\u0438\u043c \u0447\u0443\u0434\u0435\u0441\u043d\u044b\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u2014 BabylonJS. \u042d\u0442\u043e open-source \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0438 \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 HTML5-\u044d\u043b\u0435\u043c\u0435\u043d\u0442 Canvas.<\/p>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0442\u0435\u0431\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0446\u0435\u043d\u043a\u0443 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. <\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0442\u0435\u0431\u0435 \u2014 \u044d\u0442\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u2014 <a href=\"https:\/\/github.com\/BabylonJS\/Babylon.js\">\u043b\u044e\u0431\u0435\u0437\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430<\/a>. \u0418\u0437 \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0442\u0435\u0431\u0435 \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e babylon.2.1.js \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 dist.<\/p>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0435 \u2014 \u043b\u044e\u0431\u043e\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043a\u043e\u0434\u0430, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e Notepad++.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0434\u0430\u0432\u0430\u0439 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0441\u0446\u0435\u043d\u043a\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/91e\/f06\/a05\/91ef06a0560642d797a7bb93ed547cf2.png\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-265747","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=265747"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265747\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}