{"id":335426,"date":"2022-07-07T15:01:09","date_gmt":"2022-07-07T15:01:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=335426"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=335426","title":{"rendered":"<span>\u041e\u0441\u043d\u043e\u0432\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u044b \u0434\u043b\u044f 3D-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0423\u0440\u043e\u043a 3<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u041c\u0430\u0442\u0440\u0438\u0446\u044b \u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/20f\/007\/0f9\/20f0070f9a8e34887834943108de27fd.png\" width=\"1600\" height=\"900\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/20f\/007\/0f9\/20f0070f9a8e34887834943108de27fd.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0438\u0439 \u0443\u0440\u043e\u043a \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0430\u043b\u0433\u0435\u0431\u0440\u0443 \u0434\u043b\u044f 3D-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0442 \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440\u0430 \u041f\u0430\u043d\u0438\u0447\u0435\u0432\u0430 \u2014 \u0432\u0435\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043b\u043e\u0433\u0438\u043a\u0438 \u0432 UNIGINE. \u0412 <a href=\"https:\/\/habr.com\/ru\/company\/unigine\/blog\/672930\/\"><u>\u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0443\u0440\u043e\u043a\u0435<\/u><\/a> \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0443\u0433\u043b\u044b \u042d\u0439\u043b\u0435\u0440\u0430 \u0438 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b, \u0430 \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u0445 \u0438 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438.<\/p>\n<h3>\u041c\u0430\u0442\u0440\u0438\u0446\u044b<\/h3>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432 3D-\u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u2014 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ad6\/60c\/48f\/ad660c48fe25411daf51cc17c4f80a78.png\" width=\"525\" height=\"177\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ad6\/60c\/48f\/ad660c48fe25411daf51cc17c4f80a78.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 3D-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043b\u0438\u0431\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 3\u04453 (\u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f), \u043b\u0438\u0431\u043e 4\u04454 (\u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438). \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 4\u04454 (\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e).<\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u044b\u0445 \u0442\u0440\u0435\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 (<em>Rotation<\/em>), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 \u0442\u0440\u0435\u0445 \u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 (\u043e\u0441\u044c \u0432\u043f\u0440\u0430\u0432\u043e, \u043e\u0441\u044c \u0432\u043f\u0435\u0440\u0435\u0434, \u043e\u0441\u044c \u0432\u0432\u0435\u0440\u0445), \u0430 \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (<em>Scale<\/em>).<\/p>\n<p><em>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a? \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <\/em><a href=\"https:\/\/habr.com\/ru\/company\/unigine\/blog\/672930\/\"><em><u>\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u043b\u0435\u043a\u0446\u0438\u044e<\/u><\/em><\/a><em>. \u0412\u0441\u0435 \u0434\u0435\u043b\u043e \u0432 \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0434\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/em><\/p>\n<p>\u0412 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u2014 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 (<em>Translation<\/em>). \u0410 \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u043f\u043e\u0434 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u2014 \u044d\u0442\u043e \u0433\u043e\u043c\u043e\u0433\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430. \u0415\u0441\u043b\u0438 \u043e\u043d\u0430 \u0440\u0430\u0432\u043d\u0430 1 \u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446. \u0410 \u0435\u0441\u043b\u0438 \u0440\u0430\u0432\u043d\u0430 0 \u2014 <em>Translation<\/em> \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bca\/66b\/945\/bca66b9452182d91857739fcf53c63e1.png\" width=\"779\" height=\"272\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bca\/66b\/945\/bca66b9452182d91857739fcf53c63e1.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438. \u0422\u0430\u043a\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e-\u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c\u0438 \u0441\u0432\u044f\u0437\u044f\u043c\u0438.<\/p>\n<p><em>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043f\u0438\u0441\u0442\u043e\u043b\u0435\u0442 \u0432 \u0440\u0443\u043a\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0433\u0435\u0440\u043e\u044f. \u00ab\u041f\u0438\u0441\u0442\u043e\u043b\u0435\u0442\u00bb \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u00ab\u0433\u0435\u0440\u043e\u0439\u00bb.<\/em><\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 3D-\u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435, \u0432 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043f\u0440\u0430\u0432\u0430 \u0432\u0432\u0435\u0440\u0445\u0443 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0438\u0434\u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 (\u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b). \u0412 \u043d\u0435\u0439 <em>Position<\/em>, <em>Rotation<\/em> \u0438 <em>Scale<\/em> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442.<\/p>\n<ol>\n<li>\n<p>\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e-\u0434\u043e\u0447\u0435\u0440\u043d\u044f\u044f \u0441\u0432\u044f\u0437\u044c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a:<\/p>\n<\/li>\n<\/ol>\n<pre><code>world_B = world_A * local_B local_B = inverse(world_A) * world_B<\/code><\/pre>\n<p>\u0413\u0434\u0435 <code>world_A<\/code> \u2014 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f (\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f) \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0441\u043a\u0430\u0436\u0435\u043c, \u00ab\u0433\u0435\u0440\u043e\u044f\u00bb.<\/p>\n<p><code>local_b<\/code> \u2014 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f (\u0434\u043e\u0447\u0435\u0440\u043d\u044f\u044f) \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u00ab\u043f\u0438\u0441\u0442\u043e\u043b\u0435\u0442\u0430\u00bb.<\/p>\n<p><code>world_b<\/code> \u2014 \u044d\u0442\u043e \u0435\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f (\u043c\u0438\u0440\u043e\u0432\u0430\u044f) \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<ol start=\"2\">\n<li>\n<p>\u0423\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 <code>(vec3_world_position_B)<\/code> \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u00ab\u0433\u043b\u0430\u0437\u00bb \u043e\u0431\u044a\u0435\u043a\u0442\u0430 A:<\/p>\n<\/li>\n<\/ol>\n<pre><code>vec3 relative_pos_B = inverse(world_A) * vec3_world_position_B;<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0421\u0432\u044f\u0437\u044c \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439:<\/p>\n<\/li>\n<\/ol>\n<pre><code>view = inverse(transform)<\/code><\/pre>\n<p>\u0433\u0434\u0435 <code>transform<\/code> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a\u0430\u043c\u0435\u0440\u044b,<\/p>\n<p><code>view<\/code> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u044d\u043a\u0440\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e (\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u0440\u043e \u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 <code>model * view * projection<\/code>).<\/p>\n<ol start=\"4\">\n<li>\n<p>\u0414\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043d\u0442 mat3 \u2014 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0435\u043f\u0438\u043f\u0435\u0434\u0430 \u0438\u0437 XYZ \u043e\u0441\u0435\u0439 <strong>\u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u043d\u0433 mat3 \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u00ab\u0441\u0445\u043b\u043e\u043f\u044b\u0432\u0430\u043d\u0438\u0435\u00bb \u0431\u0430\u0437\u0438\u0441\u0430 \u0432 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c (2) \u0438\u043b\u0438 \u0432 \u043b\u0438\u043d\u0438\u044e (1).<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u2014 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<\/li>\n<\/ol>\n<pre><code>transpose(mat3) == inverse(mat3)<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0431\u0430\u0437\u0438\u0441\u043d\u044b\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b \u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b (\u0442.\u0435., \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 mat4 \u2014 \u0435\u0441\u043b\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043d\u0443\u043b\u0435\u0432\u0430\u044f).<\/p>\n<h3>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0432 \u0434\u0432\u0438\u0436\u043a\u0435 UNIGINE<\/h3>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e \u0442\u043e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 UNIGINE \u0438\u0437\u043d\u0443\u0442\u0440\u0438.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043f\u0443\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/747\/891\/7a7\/7478917a7c5e938912151d34b24d173b.png\" alt=\"12 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, 15 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439\/\u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0439\" title=\"12 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, 15 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439\/\u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0439\" width=\"509\" height=\"516\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/747\/891\/7a7\/7478917a7c5e938912151d34b24d173b.png\"\/><figcaption>12 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, 15 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439\/\u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0439<\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d43\/ac0\/f9f\/d43ac0f9fe701165669eb3f26d29a45e.png\" alt=\"8 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, 15 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439\/\u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0439\" title=\"8 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, 15 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439\/\u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0439\" width=\"643\" height=\"564\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d43\/ac0\/f9f\/d43ac0f9fe701165669eb3f26d29a45e.png\"\/><figcaption>8 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, 15 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439\/\u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0439<\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c <code>mat4(translate() * rotate() * scale())<\/code>!<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p>\u0412 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u0445 \u0435\u0441\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0442\u0430\u043a\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u0430\u043a <code>setScale<\/code> (\u0438\u043b\u0438 <code>setTranslate<\/code>). \u0418\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043e \u043f\u0443\u0442\u0430\u0435\u0442 \u2014 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u0434\u0430\u044e\u0442 \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u043b\u043e\u0432\u043e <code>set<\/code> \u043b\u0438\u0448\u044c \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0438\u043b\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f). \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 set \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3c3\/ec8\/8af\/3c3ec88afea6d1697891a7bb65ccd25b.png\" width=\"689\" height=\"469\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3c3\/ec8\/8af\/3c3ec88afea6d1697891a7bb65ccd25b.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f<\/h4>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e96\/ea4\/81e\/e96ea481e9526e83a538305fba689f88.png\" width=\"344\" height=\"339\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e96\/ea4\/81e\/e96ea481e9526e83a538305fba689f88.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fc7\/eee\/ae1\/fc7eeeae149d0835e6c166c1f3418b79.png\" width=\"364\" height=\"499\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fc7\/eee\/ae1\/fc7eeeae149d0835e6c166c1f3418b79.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u0423\u0433\u043b\u044b \u042d\u0439\u043b\u0435\u0440\u0430 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e52\/b58\/7f2\/e52b587f2a003c0a148a38061a6b7775.png\" alt=\"\u0412 \u0441\u0443\u043c\u043c\u0435 \u043f\u043e \u0442\u0440\u0438 sincos\u2019\u0430, \u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 (\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u2014 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445)\" title=\"\u0412 \u0441\u0443\u043c\u043c\u0435 \u043f\u043e \u0442\u0440\u0438 sincos\u2019\u0430, \u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 (\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u2014 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445)\" width=\"763\" height=\"468\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e52\/b58\/7f2\/e52b587f2a003c0a148a38061a6b7775.png\"\/><figcaption>\u0412 \u0441\u0443\u043c\u043c\u0435 \u043f\u043e \u0442\u0440\u0438 sincos\u2019\u0430, \u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 (\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u2014 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445)<\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1d9\/7fb\/3ed\/1d97fb3ede17b4b55ec56588786ee59b.png\" alt=\"2 atan2, 1 asin\" title=\"2 atan2, 1 asin\" width=\"294\" height=\"359\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1d9\/7fb\/3ed\/1d97fb3ede17b4b55ec56588786ee59b.png\"\/><figcaption>2 atan2, 1 asin<\/figcaption><\/figure>\n<h4>\u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>\u0411\u0435\u0437 SSE: <strong>140<\/strong> \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, <strong>67<\/strong> \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439! \u0427\u0435\u0440\u0435\u0437 SSE: \u0432\u0441\u0435\u0433\u043e 35 _mm_mul_ps. \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0449\u0435:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f98\/8c8\/dc8\/f988c8dc88edcabbc1d0d208b9e93206.png\" width=\"515\" height=\"560\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f98\/8c8\/dc8\/f988c8dc88edcabbc1d0d208b9e93206.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e7e\/e4f\/39a\/e7ee4f39ad5495104edc189a6e7f27e7.png\" width=\"515\" height=\"560\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e7e\/e4f\/39a\/e7ee4f39ad5495104edc189a6e7f27e7.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p><strong><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430:<\/em><\/strong><em> \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0442\u0435\u043a\u0441\u0442 \u0441\u043d\u0438\u0437\u0443 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0430\u043b\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043b\u0435\u043a\u0446\u0438\u0438, \u0433\u0434\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e \u0435\u0449\u0435 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446. \u041d\u043e, \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0445\u043e\u0440\u043e\u0448, \u0447\u0442\u043e\u0431\u044b \u043e\u0442 \u043d\u0435\u0433\u043e \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u043c\u0438\u0433 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0447\u0438\u0442\u0430\u043b\u0438 \u0432\u0441\u0435 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435. \ud83d\ude42<\/em><\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043b\u0435\u043a\u0446\u0438\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u041a\u0430\u043a \u0435\u0435 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c?<\/p>\n<h4>\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430? \u0412\u0430\u0440\u0438\u0430\u043d\u0442 1<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a2d\/32a\/8c2\/a2d32a8c29d4775f1825b6932161a6cc.png\" width=\"1273\" height=\"565\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a2d\/32a\/8c2\/a2d32a8c29d4775f1825b6932161a6cc.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430? \u0412\u0430\u0440\u0438\u0430\u043d\u0442 2<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3f6\/dc2\/2ef\/3f6dc22ef6f1b4f672c408a0d2974895.png\" width=\"1239\" height=\"541\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3f6\/dc2\/2ef\/3f6dc22ef6f1b4f672c408a0d2974895.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u0410 \u043f\u043e\u0447\u0435\u043c\u0443?<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c38\/7d8\/d1c\/c387d8d1ce2403f994fefb8e007427a9.png\" width=\"1084\" height=\"483\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c38\/7d8\/d1c\/c387d8d1ce2403f994fefb8e007427a9.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u0422\u0430\u043a, \u043f\u043e\u0433\u043e\u0434\u0438\u0442\u0435-\u043a\u0430, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u043d\u0443\u0442\u044c&#8230;<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/81a\/51f\/d56\/81a51fd562b704bc371ac6301cf6bdd2.png\" width=\"1272\" height=\"552\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/81a\/51f\/d56\/81a51fd562b704bc371ac6301cf6bdd2.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u0410 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u043b\u0443\u0447\u0448\u0435?<\/h4>\n<p>\u041f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043f\u0440\u043e SIMD (SSE, AVX):<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/14f\/065\/b0f\/14f065b0f4fe7329b769f47b0920b0cd.png\" width=\"1194\" height=\"595\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/14f\/065\/b0f\/14f065b0f4fe7329b769f47b0920b0cd.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u041a\u0430\u043a\u043e\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442?<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cd7\/f80\/b07\/cd7f80b074cbb97f76bc3c7485997eb5.png\" width=\"1600\" height=\"858\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cd7\/f80\/b07\/cd7f80b074cbb97f76bc3c7485997eb5.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u0412\u044b\u0432\u043e\u0434\u044b:<\/h4>\n<ol>\n<li>\n<p><strong>\u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u044e<\/strong> (sin\/cos\/tan) \u0442\u0430\u043c, \u0433\u0434\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c. \u042d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>length2()<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>length()<\/code> \u2014 \u043d\u0435 \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043e\u0442 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438, \u0430 \u043d\u0435 \u043d\u0430\u0434 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432. SIMD \u2014 \u043d\u0430\u0448 \u0441\u043a\u0440\u044b\u0442\u044b\u0439 \u0434\u0440\u0443\u0433, \u0442\u043e\u0432\u0430\u0440\u0438\u0449 \u0438 \u0431\u0440\u0430\u0442!<\/p>\n<\/li>\n<li>\n<p>\u041d\u0443 \u0438, \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435: \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c. \u041f\u0438\u0448\u0435\u043c cache-friendly \u043a\u043e\u0434 \u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u043e\u0435. \u0414\u0430\u0436\u0435 <strong>\u0441\u0430\u043c\u0430\u044f \u0442\u044f\u0436\u0435\u043b\u0430\u044f \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432\u0437\u044f\u0442\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/unigine\/blog\/674540\/\"> https:\/\/habr.com\/ru\/company\/unigine\/blog\/674540\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u041c\u0430\u0442\u0440\u0438\u0446\u044b \u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/h4>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0438\u0439 \u0443\u0440\u043e\u043a \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0430\u043b\u0433\u0435\u0431\u0440\u0443 \u0434\u043b\u044f 3D-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0442 \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440\u0430 \u041f\u0430\u043d\u0438\u0447\u0435\u0432\u0430 \u2014 \u0432\u0435\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043b\u043e\u0433\u0438\u043a\u0438 \u0432 UNIGINE. \u0412 <a href=\"https:\/\/habr.com\/ru\/company\/unigine\/blog\/672930\/\"><u>\u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0443\u0440\u043e\u043a\u0435<\/u><\/a> \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0443\u0433\u043b\u044b \u042d\u0439\u043b\u0435\u0440\u0430 \u0438 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b, \u0430 \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u0445 \u0438 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438.<\/p>\n<h3>\u041c\u0430\u0442\u0440\u0438\u0446\u044b<\/h3>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0432 3D-\u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u2014 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 3D-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043b\u0438\u0431\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 3\u04453 (\u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f), \u043b\u0438\u0431\u043e 4\u04454 (\u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438). \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 4\u04454 (\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e).<\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u044b\u0445 \u0442\u0440\u0435\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 (<em>Rotation<\/em>), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 \u0442\u0440\u0435\u0445 \u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 (\u043e\u0441\u044c \u0432\u043f\u0440\u0430\u0432\u043e, \u043e\u0441\u044c \u0432\u043f\u0435\u0440\u0435\u0434, \u043e\u0441\u044c \u0432\u0432\u0435\u0440\u0445), \u0430 \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (<em>Scale<\/em>).<\/p>\n<p><em>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a? \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <\/em><a href=\"https:\/\/habr.com\/ru\/company\/unigine\/blog\/672930\/\"><em><u>\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u043b\u0435\u043a\u0446\u0438\u044e<\/u><\/em><\/a><em>. \u0412\u0441\u0435 \u0434\u0435\u043b\u043e \u0432 \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0434\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/em><\/p>\n<p>\u0412 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u2014 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 (<em>Translation<\/em>). \u0410 \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u043f\u043e\u0434 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u2014 \u044d\u0442\u043e \u0433\u043e\u043c\u043e\u0433\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430. \u0415\u0441\u043b\u0438 \u043e\u043d\u0430 \u0440\u0430\u0432\u043d\u0430 1 \u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446. \u0410 \u0435\u0441\u043b\u0438 \u0440\u0430\u0432\u043d\u0430 0 \u2014 <em>Translation<\/em> \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438. \u0422\u0430\u043a\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e-\u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c\u0438 \u0441\u0432\u044f\u0437\u044f\u043c\u0438.<\/p>\n<p><em>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043f\u0438\u0441\u0442\u043e\u043b\u0435\u0442 \u0432 \u0440\u0443\u043a\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0433\u0435\u0440\u043e\u044f. \u00ab\u041f\u0438\u0441\u0442\u043e\u043b\u0435\u0442\u00bb \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u00ab\u0433\u0435\u0440\u043e\u0439\u00bb.<\/em><\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 3D-\u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435, \u0432 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043f\u0440\u0430\u0432\u0430 \u0432\u0432\u0435\u0440\u0445\u0443 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0438\u0434\u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 (\u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b). \u0412 \u043d\u0435\u0439 <em>Position<\/em>, <em>Rotation<\/em> \u0438 <em>Scale<\/em> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442.<\/p>\n<ol>\n<li>\n<p>\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e-\u0434\u043e\u0447\u0435\u0440\u043d\u044f\u044f \u0441\u0432\u044f\u0437\u044c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a:<\/p>\n<\/li>\n<\/ol>\n<pre><code>world_B = world_A * local_B local_B = inverse(world_A) * world_B<\/code><\/pre>\n<p>\u0413\u0434\u0435 <code>world_A<\/code> \u2014 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f (\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f) \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0441\u043a\u0430\u0436\u0435\u043c, \u00ab\u0433\u0435\u0440\u043e\u044f\u00bb.<\/p>\n<p><code>local_b<\/code> \u2014 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f (\u0434\u043e\u0447\u0435\u0440\u043d\u044f\u044f) \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u00ab\u043f\u0438\u0441\u0442\u043e\u043b\u0435\u0442\u0430\u00bb.<\/p>\n<p><code>world_b<\/code> \u2014 \u044d\u0442\u043e \u0435\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f (\u043c\u0438\u0440\u043e\u0432\u0430\u044f) \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<ol start=\"2\">\n<li>\n<p>\u0423\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 <code>(vec3_world_position_B)<\/code> \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u00ab\u0433\u043b\u0430\u0437\u00bb \u043e\u0431\u044a\u0435\u043a\u0442\u0430 A:<\/p>\n<\/li>\n<\/ol>\n<pre><code>vec3 relative_pos_B = inverse(world_A) * vec3_world_position_B;<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0421\u0432\u044f\u0437\u044c \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439:<\/p>\n<\/li>\n<\/ol>\n<pre><code>view = inverse(transform)<\/code><\/pre>\n<p>\u0433\u0434\u0435 <code>transform<\/code> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a\u0430\u043c\u0435\u0440\u044b,<\/p>\n<p><code>view<\/code> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u044d\u043a\u0440\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e (\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u0440\u043e \u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 <code>model * view * projection<\/code>).<\/p>\n<ol start=\"4\">\n<li>\n<p>\u0414\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043d\u0442 mat3 \u2014 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0435\u043f\u0438\u043f\u0435\u0434\u0430 \u0438\u0437 XYZ \u043e\u0441\u0435\u0439 <strong>\u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u043d\u0433 mat3 \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u00ab\u0441\u0445\u043b\u043e\u043f\u044b\u0432\u0430\u043d\u0438\u0435\u00bb \u0431\u0430\u0437\u0438\u0441\u0430 \u0432 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c (2) \u0438\u043b\u0438 \u0432 \u043b\u0438\u043d\u0438\u044e (1).<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u2014 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<\/li>\n<\/ol>\n<pre><code>transpose(mat3) == inverse(mat3)<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0431\u0430\u0437\u0438\u0441\u043d\u044b\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b \u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b (\u0442.\u0435., \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 mat4 \u2014 \u0435\u0441\u043b\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043d\u0443\u043b\u0435\u0432\u0430\u044f).<\/p>\n<h3>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0432 \u0434\u0432\u0438\u0436\u043a\u0435 UNIGINE<\/h3>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e \u0442\u043e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 UNIGINE \u0438\u0437\u043d\u0443\u0442\u0440\u0438.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043f\u0443\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446:<\/p>\n<figure class=\"\"><figcaption>12 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, 15 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439\/\u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0439<\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption>8 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, 15 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439\/\u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0439<\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c <code>mat4(translate() * rotate() * scale())<\/code>!<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p>\u0412 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u0445 \u0435\u0441\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0442\u0430\u043a\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u0430\u043a <code>setScale<\/code> (\u0438\u043b\u0438 <code>setTranslate<\/code>). \u0418\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043e \u043f\u0443\u0442\u0430\u0435\u0442 \u2014 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u0434\u0430\u044e\u0442 \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u043b\u043e\u0432\u043e <code>set<\/code> \u043b\u0438\u0448\u044c \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0438\u043b\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f). \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 set \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f<\/h4>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h4>\u0423\u0433\u043b\u044b \u042d\u0439\u043b\u0435\u0440\u0430 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e<\/h4>\n<figure class=\"full-width\"><figcaption>\u0412 \u0441\u0443\u043c\u043c\u0435 \u043f\u043e \u0442\u0440\u0438 sincos\u2019\u0430, \u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 (\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u2014 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445)<\/figcaption><\/figure>\n<figure class=\"\"><figcaption>2 atan2, 1 asin<\/figcaption><\/figure>\n<h4>\u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>\u0411\u0435\u0437 SSE: <strong>140<\/strong> \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, <strong>67<\/strong> \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439! \u0427\u0435\u0440\u0435\u0437 SSE: \u0432\u0441\u0435\u0433\u043e 35 _mm_mul_ps. \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0449\u0435:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p><strong><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430:<\/em><\/strong><em> \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0442\u0435\u043a\u0441\u0442 \u0441\u043d\u0438\u0437\u0443 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0430\u043b\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043b\u0435\u043a\u0446\u0438\u0438, \u0433\u0434\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e \u0435\u0449\u0435 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u0432 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446. \u041d\u043e, \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0445\u043e\u0440\u043e\u0448, \u0447\u0442\u043e\u0431\u044b \u043e\u0442 \u043d\u0435\u0433\u043e \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u043c\u0438\u0433 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0447\u0438\u0442\u0430\u043b\u0438 \u0432\u0441\u0435 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435. \ud83d\ude42<\/em><\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043b\u0435\u043a\u0446\u0438\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u041a\u0430\u043a \u0435\u0435 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c?<\/p>\n<h4>\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430? \u0412\u0430\u0440\u0438\u0430\u043d\u0442 1<\/h4>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430? \u0412\u0430\u0440\u0438\u0430\u043d\u0442 2<\/h4>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u0410 \u043f\u043e\u0447\u0435\u043c\u0443?<\/h4>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u0422\u0430\u043a, \u043f\u043e\u0433\u043e\u0434\u0438\u0442\u0435-\u043a\u0430, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u043d\u0443\u0442\u044c&#8230;<\/h4>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u0410 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u043b\u0443\u0447\u0448\u0435?<\/h4>\n<p>\u041f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043f\u0440\u043e SIMD (SSE, AVX):<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u041a\u0430\u043a\u043e\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442?<\/h4>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u0412\u044b\u0432\u043e\u0434\u044b:<\/h4>\n<ol>\n<li>\n<p><strong>\u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u044e<\/strong> (sin\/cos\/tan) \u0442\u0430\u043c, \u0433\u0434\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c. \u042d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>length2()<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>length()<\/code> \u2014 \u043d\u0435 \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043e\u0442 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438, \u0430 \u043d\u0435 \u043d\u0430\u0434 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432. SIMD \u2014 \u043d\u0430\u0448 \u0441\u043a\u0440\u044b\u0442\u044b\u0439 \u0434\u0440\u0443\u0433, \u0442\u043e\u0432\u0430\u0440\u0438\u0449 \u0438 \u0431\u0440\u0430\u0442!<\/p>\n<\/li>\n<li>\n<p>\u041d\u0443 \u0438, \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435: \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c. \u041f\u0438\u0448\u0435\u043c cache-friendly \u043a\u043e\u0434 \u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u043e\u0435. \u0414\u0430\u0436\u0435 <strong>\u0441\u0430\u043c\u0430\u044f \u0442\u044f\u0436\u0435\u043b\u0430\u044f \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432\u0437\u044f\u0442\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/unigine\/blog\/674540\/\"> https:\/\/habr.com\/ru\/company\/unigine\/blog\/674540\/<\/a><br \/><\/br><\/br><\/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-335426","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/335426","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=335426"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/335426\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=335426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=335426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=335426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}