antispam-bee domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/ruwritingagame/public_html/wp-includes/functions.php on line 61313D subject-\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f 3D \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0443\u0433\u043b\u044b \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0438\u043b\u0438 \u0443\u0433\u043b\u044b \u042d\u0439\u043b\u0435\u0440\u0430 – \u0442\u0430\u043d\u0433\u0430\u0436, \u0440\u044b\u0441\u043a\u0430\u043d\u044c\u0435, \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 (pitch, yaw, roll) \u0432 \u0430\u0432\u0438\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438\u043b\u0438 \u043a\u0443\u0440\u0441, \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0442, \u043a\u0440\u0435\u043d (heading, attitude, bank) \u0432 \u043c\u043e\u0440\u0441\u043a\u043e\u0439. \u041c\u044b \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0443\u0433\u043b\u043e\u0432 \u042d\u0439\u043b\u0435\u0440\u0430 \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445 \u0438 \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439 (rotation Matrix<\/em>). \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 Coords<\/strong>.<\/p>\n\n\n\n 1. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c VS. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c C:\\CPP\\a998engine\\p_windows\\p_windows.sln<\/em>.<\/p>\n\n\n\n 2. \u041f\u043e\u0434 xEngine <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 header \u0444\u0430\u0439\u043b Coords.h<\/strong><\/p>\n\n\n\n Location: C:\\CPP\\engine<\/em><\/p>\n\n\n\n \u041a\u043e\u0434:<\/p>\n\n\n <\/p>\n\n\n\n 3. \u041f\u043e\u0434 xEngine <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 C++ \u0444\u0430\u0439\u043b Coords.cpp<\/strong><\/p>\n\n\n\n Location: C:\\CPP\\engine<\/em><\/p>\n\n\n\n \u041a\u043e\u0434:<\/p>\n\n\n <\/p>\n\n\n\n \u0412 GameSubj <\/strong>\u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043a\u043b\u044e\u0447\u0438\u043c 3\u0414 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, 3\u0414 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0441 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0443\u0433\u043b\u043e\u0432\u044b\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438), modelMatrix <\/em>\u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0440\u0438\u043d\u0433\u0430, \u0438 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0432\u043e\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u0435 DrawJobs <\/em>(\u044d\u0442\u043e 2 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435: djStartN <\/em>\u0438 djTotalN<\/em>)<\/p>\n\n\n\n 4. \u041f\u043e\u0434 xEngine <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 header \u0444\u0430\u0439\u043b GameSubj.h<\/strong><\/p>\n\n\n\n Location: C:\\CPP\\engine<\/em><\/p>\n\n\n\n \u041a\u043e\u0434:<\/p>\n\n\n <\/p>\n\n\n\n 5. \u041f\u043e\u0434 xEngine <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 C++ \u0444\u0430\u0439\u043b GameSubj.cpp<\/strong><\/p>\n\n\n\n Location: C:\\CPP\\engine<\/em><\/p>\n\n\n\n \u041a\u043e\u0434:<\/p>\n\n\n <\/p>\n\n\n\n \u0423 \u043d\u0430\u0441 \u0442\u0443\u0442 \u043f\u043e\u043a\u0430 2 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 :<\/p>\n\n\n\n \u041d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 TheGame.h<\/em> \u043c\u0430\u0441\u0441\u0438\u0432 (vector) 3D gameSubjs. <\/p>\n\n\n\n 6. \u0417\u0430\u043c\u0435\u043d\u0438\u043c TheGame.h<\/em> \u043a\u043e\u0434 \u043d\u0430:<\/p>\n\n\n <\/p>\n\n\n\n \u0412 \u043a\u0430\u0447\u0435\u0441\u0438\u0432\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 3\u0414 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432TheGame.cpp<\/em> \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043d\u0430\u0448 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 glEnable(GL_CULL_FACE)<\/em> \u043f\u0440\u043e\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0440\u0443\u0435\u0442 OpenGL \u0440\u0435\u043d\u0434\u0440\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0430 \u043a \u043d\u0430\u043c \u043b\u0438\u0446\u043e\u043c, \u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e (\u0438\u0437\u043d\u0430\u043d\u043e\u0447\u043d\u0443\u044e) \u0441\u0442\u043e\u0440\u043e\u043d\u0443. OpenGL \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u043a “\u043e\u0431\u0440\u0430\u0449\u0435\u043d\u043d\u0443\u044e \u043a \u043d\u0430\u043c \u043b\u0438\u0446\u043e\u043c” \u0435\u0441\u043b\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0438\u0434\u0443\u0442 \u043f\u0440\u043e\u0442\u0438\u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 (counter-clockwise order).<\/p>\n\n\n\n \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 getReady()<\/em> \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c 1GameSubj<\/em> \u0441 \u0434\u0432\u0443\u043c\u044f VBO \u0438 \u0434\u0432\u0443\u043c\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 DrawJobs<\/em>.<\/p>\n\n\n\n \u0424\u0443\u043d\u043a\u0446\u0438\u044f drawFrame()<\/em> \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 gameSubjs <\/em>(\u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 1 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0430), \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e (\u043f\u043e\u043a\u0430 \u043e\u0434\u043d\u043e\u0433\u043e) \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0430, \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e pGS->moveSubj()<\/em> \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0432\u0435\u0440\u043d\u0435\u0442 \u0435\u0433\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442 MVP \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0440\u0438\u043d\u0433\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442 \u0432\u043e\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u0435 DrawJobs<\/em>.<\/p>\n\n\n\n 7. \u041e\u0442\u043a\u0440\u043e\u0435\u043c TheGame.cpp<\/em> \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0434 \u043d\u0430:<\/p>\n\n\n <\/p>\n\n\n\n 8. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n\n\n\n \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043c\u044f\u0433\u043a\u043e \u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c \u0442\u0440\u0435\u043c \u043e\u0441\u044f\u043c, \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0430\u0448\u0438 3D \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e.<\/p>\n\n\n\n \u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b \/ Quaternions<\/strong><\/p>\n\n\n\n \u0425\u043e\u0442\u044f \u043e\u043d\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0438 “\u0432 \u0442\u0440\u0435\u043d\u0434\u0435”, \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u0432\u0438\u0436\u0443 \u0432 \u0447\u0435\u043c \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0434\u0430\u0436\u0435 \u0432 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 3D \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445 \u043f\u043e \u0442\u0440\u0435\u043c \u043e\u0441\u044f\u043c. \u041f\u0440\u043e\u0441\u0442\u043e \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f 3D \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439. \u0418\u043b\u0438 \u044f \u0447\u0442\u043e-\u0442\u043e \u0443\u043f\u0443\u0441\u0442\u0438\u043b? \u041f\u043e\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u043c\u0435\u043d\u044f \u0435\u0441\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432.<\/p>\n\n\n\n <\/p>\n\n\n\n 9. \u041f\u0435\u0440\u0435-\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c VS. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c C:\\CPP\\a998engine\\p_android\\p_android.sln<\/em>.<\/p>\n\n\n\n \u041f\u043e\u0434 xEngine <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c Existing Item,<\/p>\n\n\n\n \u0438\u0437 C:\\CPP\\engine<\/em>,<\/p>\n\n\n\n \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c<\/p>\n\n\n\n Add<\/strong><\/p>\n\n\n\n \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a. \u041d\u043e\u0440\u043c.<\/p>\n\n\n\n <\/p>\n\n\n\n <\/p>\n","protected":false},"excerpt":{"rendered":" 3D subject-\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f 3D \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0443\u0433\u043b\u044b \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0438\u043b\u0438 \u0443\u0433\u043b\u044b \u042d\u0439\u043b\u0435\u0440\u0430 – \u0442\u0430\u043d\u0433\u0430\u0436, \u0440\u044b\u0441\u043a\u0430\u043d\u044c\u0435, \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 (pitch, yaw, roll) \u0432 \u0430\u0432\u0438\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438\u043b\u0438 \u043a\u0443\u0440\u0441, \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0442, \u043a\u0440\u0435\u043d (heading, attitude, bank) \u0432 \u043c\u043e\u0440\u0441\u043a\u043e\u0439. \u041c\u044b \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0443\u0433\u043b\u043e\u0432 \u042d\u0439\u043b\u0435\u0440\u0430 \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445 \u0438 \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439 (rotation Matrix). \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 Coords. Windows 1. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c VS. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c C:\\CPP\\a998engine\\p_windows\\p_windows.sln. […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-522","post","type-post","status-publish","format-standard","hentry","category-cross-platform-3d"],"_links":{"self":[{"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/posts\/522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/comments?post=522"}],"version-history":[{"count":8,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/posts\/522\/revisions"}],"predecessor-version":[{"id":1645,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/posts\/522\/revisions\/1645"}],"wp:attachment":[{"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/media?parent=522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/categories?post=522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/tags?post=522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}Windows<\/h2>\n\n\n\n
\n\n\n\n\n#pragma once\n#include "linmath.h"\n\nclass Coords\n{\nprivate:\n\tfloat eulerDg[3] = { 0,0,0 }; \/\/Euler angles (yaw, pitch, and roll) in degrees\n\tfloat eulerRd[3] = { 0,0,0 }; \/\/Euler angles in radians\n\tmat4x4 rotationMatrix = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };\n\t\/\/mat4x4 rotationMatrix = { {1,0,0,0}, {0,1,0,0}, {0,0,1,0}, {0,0,0,1} };\npublic:\n\tfloat pos[4] = { 0,0,0,0 }; \/\/x,y,z position + 4-th element for compatibility with 3D 4x4 matrices math\npublic:\n\tvoid setDegrees(float ax, float ay, float az) { setDegrees(this, ax, ay, az); };\n\tstatic void setDegrees(Coords* pC, float ax, float ay, float az);\n\tfloat getRd(int i) { return eulerRd[i]; }; \/\/get angle in radians\n\t\/\/float getDg(int i) { return eulerDg[i]; }; \/\/get angle in degrees\n\tvoid setPosition(float kx, float ky, float kz) { setPosition(this, kx, ky, kz); };\n\tstatic void setPosition(Coords* pC, float kx, float ky, float kz);\n\tmat4x4* getRotationMatrix() { return &rotationMatrix; };\n\tvoid setRotationMatrix(mat4x4 m) { setRotationMatrix(this, m); };\n\tstatic void setRotationMatrix(Coords* pC, mat4x4 m);\n\tstatic void eulerRdToMatrix(mat4x4 rotationMatrix, float* eulerRd);\n\tstatic void matrixToEulerRd(float* eulerRd, mat4x4 m);\n};\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#include "Coords.h"\n#include "platform.h"\n#include <string>\n\nfloat PI = 3.141592f;\nfloat degrees2radians = PI \/ 180.0f;\nfloat radians2degrees = 180.0f \/ PI;\n\nvoid Coords::setDegrees(Coords* pC, float ax, float ay, float az) {\n\tif (pC->eulerDg[0] == ax && pC->eulerDg[1] == ay && pC->eulerDg[2] == az)\n\t\treturn;\n\tpC->eulerDg[0] = ax;\n\tpC->eulerDg[1] = ay;\n\tpC->eulerDg[2] = az;\n\t\/\/convert to radians\n\tpC->eulerRd[0] = pC->eulerDg[0] * degrees2radians;\n\tpC->eulerRd[1] = pC->eulerDg[1] * degrees2radians;\n\tpC->eulerRd[2] = pC->eulerDg[2] * degrees2radians;\n\t\/\/re-build rotation matrix\n\teulerRdToMatrix(pC->rotationMatrix, pC->eulerRd);\n}\nvoid Coords::eulerRdToMatrix(mat4x4 rotationMatrix, float* eulerRd){\n\t\/\/builds rotation matrix from Euler angles (in radians)\n\tmat4x4_identity(rotationMatrix);\n\t\/\/rotation order: Z-X-Y\n\tfloat a = eulerRd[1];\n\tif (a != 0)\n\t\tmat4x4_rotate_Y(rotationMatrix, rotationMatrix, a);\n\ta = eulerRd[0];\n\tif (a != 0)\n\t\tmat4x4_rotate_X(rotationMatrix, rotationMatrix, a);\n\ta = eulerRd[2];\n\tif (a != 0)\n\t\tmat4x4_rotate_Z(rotationMatrix, rotationMatrix, a);\n}\nvoid Coords::setPosition(Coords* pC, float kx, float ky, float kz) {\n\tpC->pos[0] = kx;\n\tpC->pos[1] = ky;\n\tpC->pos[2] = kz;\n}\nvoid Coords::setRotationMatrix(Coords* pC, mat4x4 m) {\n\tmemcpy(pC->rotationMatrix, m, sizeof(pC->rotationMatrix));\n\t\/\/update Euler angles\n\tmatrixToEulerRd(pC->eulerRd, pC->rotationMatrix);\n\n\tpC->eulerDg[0] = pC->eulerRd[0] * radians2degrees;\n\tpC->eulerDg[1] = pC->eulerRd[1] * radians2degrees;\n\tpC->eulerDg[2] = pC->eulerRd[2] * radians2degrees;\n}\nvoid Coords::matrixToEulerRd(float* eulerRd, mat4x4 m) {\n\t\/\/calculates Euler angles (in radians) from matrix\n\tfloat yaw, pitch, roll;\n\n\tif (m[1][2] > 0.998 || m[1][2] < -0.998) { \/\/ singularity at south or north pole\n\t\tyaw = atan2f(-m[2][0], m[0][0]);\n\t\troll = 0;\n\t}\n\telse {\n\t\tyaw = atan2f(-m[0][2], m[2][2]);\n\t\troll = atan2f(-m[1][0], m[1][1]);\n\t}\n\tpitch = asinf(m[1][2]);\n\n\teulerRd[0] = pitch;\n\teulerRd[1] = yaw;\n\teulerRd[2] = roll;\n}\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#pragma once\n#include "Coords.h"\n#include "Material.h"\n#include <string>\n\nclass GameSubj\n{\npublic:\n\tstd::string name;\n\tCoords ownCoords;\n\tCoords ownSpeed;\n\tfloat scale[3] = { 1,1,1 };\n\tint djStartN = 0; \/\/first DJ N in DJs array (DrawJob::drawJobs)\n\tint djTotalN = 0; \/\/number of DJs\n\tmat4x4 ownModelMatrix = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };\n\n\tMaterial* pAltMaterial = NULL;\n\npublic:\n\tvirtual ~GameSubj();\n\tvoid buildModelMatrix() { buildModelMatrix(this); };\n\tstatic void buildModelMatrix(GameSubj* pGS);\n\tvirtual int moveSubj() { return moveSubj(this); };\n\tstatic int moveSubj(GameSubj* pGS);\n};\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#include "GameSubj.h"\n#include "platform.h"\n\nGameSubj::~GameSubj() {\n if (pAltMaterial != NULL)\n delete pAltMaterial;\n}\nvoid GameSubj::buildModelMatrix(GameSubj* pGS) {\n mat4x4_translate(pGS->ownModelMatrix, pGS->ownCoords.pos[0], pGS->ownCoords.pos[1], pGS->ownCoords.pos[2]);\n \/\/rotation order: Z-X-Y\n mat4x4_mul(pGS->ownModelMatrix, pGS->ownModelMatrix, *(pGS->ownCoords.getRotationMatrix()));\n\n if (pGS->scale[0] != 1 || pGS->scale[1] != 1 || pGS->scale[2] != 1)\n mat4x4_scale_aniso(pGS->ownModelMatrix, pGS->ownModelMatrix, pGS->scale[0], pGS->scale[1], pGS->scale[2]);\n}\nint GameSubj::moveSubj(GameSubj* pGS) {\n if (pGS->ownSpeed.getRd(0) != 0 || pGS->ownSpeed.getRd(1) != 0 || pGS->ownSpeed.getRd(2) != 0) {\n \/\/apply angle speed\n mat4x4 newRotationMatrix;\n mat4x4_mul(newRotationMatrix, *(pGS->ownCoords.getRotationMatrix()), *(pGS->ownSpeed.getRotationMatrix()));\n pGS->ownCoords.setRotationMatrix(newRotationMatrix);\n }\n return 1;\n}\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#pragma once\n#include <vector>\n#include "GameSubj.h"\n\nclass TheGame\n{\npublic:\n\tint screenSize[2];\n\tfloat screenRatio;\n\tbool bExitGame;\n\n\t\/\/static arrays (vectors) of active GameSubjs\n\tstatic std::vector<GameSubj*> gameSubjs;\npublic:\n\tint run();\n\tint getReady();\n\tint drawFrame();\n\tint cleanUp();\n\tint onScreenResize(int width, int height);\n};\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#include "TheGame.h"\n#include "platform.h"\n#include "linmath.h"\n#include "Texture.h"\n#include "Shader.h"\n#include "DrawJob.h"\n\nextern std::string filesRoot;\n\n\/\/static array (vector) for loaded gameSubjs\nstd::vector<GameSubj*> TheGame::gameSubjs;\n\nstatic const struct\n{\n float x, y, z, tu, tv;\n} frontVertices[4] =\n{\n { -0.5f, 0.5f, 0.f, 0.f, 0.f }, \/\/top-left\n { -0.5f, -0.5f, 0.f, 0.f, 1.f }, \/\/bottom-left\n { 0.5f, 0.5f, 0.f, 1.f, 0.f }, \/\/top-right\n { 0.5f, -0.5f, 0.f, 1.f, 1.f } \/\/bottom-right\n};\n\nint TheGame::getReady() {\n bExitGame = false;\n Shader::loadShaders();\n glEnable(GL_CULL_FACE);\n\n GameSubj* pGS = new GameSubj();\n gameSubjs.push_back(pGS);\n pGS->djStartN = DrawJob::drawJobs.size();\n\n pGS->name.assign("img1");\n \/\/pGS->ownCoords.setPosition(-50, 50, 0);\n pGS->ownSpeed.setDegrees(1, 2, 3);\n pGS->scale[0] = 400;\n pGS->scale[1] = pGS->scale[0] \/ 2;\n\n \/\/face DrawJob\n \/\/build VBO\n unsigned int VBOid = DrawJob::newBufferId();\n glBindBuffer(GL_ARRAY_BUFFER, VBOid);\n glBufferData(GL_ARRAY_BUFFER, sizeof(frontVertices), frontVertices, GL_STATIC_DRAW);\n int stride = sizeof(float) * 5;\n \/\/add DrawJob\n DrawJob* pDJ = new DrawJob();\n pDJ->pointsN = 4; \/\/number of vertices\n \/\/define material\n pDJ->mt.shaderN = Shader::spN_flat_tex;\n pDJ->mt.primitiveType = GL_TRIANGLE_STRIP;\n pDJ->mt.uTex0 = Texture::loadTexture(filesRoot + "\/dt\/sample_img.png");\n \/\/attributes references\n AttribRef* pAR;\n pAR = &pDJ->aPos; pAR->offset = 0; pAR->glVBOid = VBOid; pAR->stride = stride;\n pAR = &pDJ->aTuv; pAR->offset = sizeof(float) * 3; pAR->glVBOid = VBOid; pAR->stride = stride;\n \/\/create and fill vertex attributes array (VAO)\n pDJ->buildVAO();\n pGS->djTotalN = DrawJob::drawJobs.size() - pGS->djStartN;\n\n return 1;\n}\nint TheGame::drawFrame() {\n myPollEvents();\n\n \/\/glClearColor(0.0, 0.0, 0.5, 1.0);\n glClear(GL_COLOR_BUFFER_BIT);\n mat4x4 mProjection, mMVP;\n mat4x4_ortho(mProjection, -(float)screenSize[0] \/ 2, (float)screenSize[0] \/ 2, -(float)screenSize[1] \/ 2, (float)screenSize[1] \/ 2, 200.f, -200.f);\n\n \/\/scan subjects\n int subjsN = gameSubjs.size();\n for (int subjN = 0; subjN < subjsN; subjN++) {\n GameSubj* pGS = gameSubjs.at(subjN);\n \/\/behavior - apply rotation speed\n pGS->moveSubj();\n \/\/prepare subject for rendering\n pGS->buildModelMatrix(pGS);\n \/\/build MVP matrix for given subject\n mat4x4_mul(mMVP, mProjection, pGS->ownModelMatrix);\n \/\/render subject\n for (int i = 0; i < pGS->djTotalN; i++) {\n DrawJob* pDJ = DrawJob::drawJobs.at(pGS->djStartN + i);\n pDJ->execute((float*)mMVP, NULL);\n }\n }\n mySwapBuffers();\n return 1;\n}\nint TheGame::cleanUp() {\n Texture::cleanUp();\n Shader::cleanUp();\n DrawJob::cleanUp();\n return 1;\n}\nint TheGame::onScreenResize(int width, int height) {\n if (screenSize[0] == width && screenSize[1] == height)\n return 0;\n screenSize[0] = width;\n screenSize[1] = height;\n screenRatio = (float)width \/ (float)height;\n glViewport(0, 0, width, height);\n mylog(" screen size %d x %d\\n", width, height);\n return 1;\n}\nint TheGame::run() {\n getReady();\n while (!bExitGame) {\n drawFrame();\n }\n cleanUp();\n return 1;\n}\n\n<\/pre><\/div>\n\n\n
\n\n\n\n
\n\n\n\n
\n\n\n\nAndroid<\/h2>\n\n\n\n
\n\n\n\n
10. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c, \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u043c, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c.<\/p>\n\n\n\n
\n\n\n\n