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 6131\u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439: \u043c\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f “\u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c” \u0441\u0442\u044b\u043a (\u0449\u0435\u043b\u044c) \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u0447\u043a\u043e\u0439 \u0438 \u043a\u0440\u044b\u0448\u043a\u043e\u0439, \u043a\u0430\u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e\u00a0normal map<\/em>\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u043a \u0447\u0430\u0441\u0442\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439<\/strong> \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438. \u041a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n\n\n\n <\/p>\n\n\n\n \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0433\u043b\u0430\u0432\u0435 \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c “marked vertices\/triangles group<\/em>“. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0434\u043d\u0443 (\u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 – “box_right”), \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u043b\u0438\u0446\u043e\u043c \u043a \u043d\u0430\u043c:<\/p>\n\n\n\n <\/p>\n\n\n\n \u0417\u0430\u0442\u0435\u043c – \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u0438\u0437 \u044d\u0442\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0431\u0435\u043b\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a.<\/p>\n\n\n\n \u041c\u044b \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043c\u0435\u0448\u0430 (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438) \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0441 \u043d\u0430\u0448\u0438\u043c \u0431\u0435\u043b\u044b\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c. \u0418 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a,<\/em> \u0438 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a<\/em> – \u044d\u0442\u043e \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u044b<\/strong>. \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u043e\u0432<\/strong>. <\/p>\n\n\n\n <\/p>\n\n\n\n \u041d\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u0437\u0434\u0435\u0441\u044c: \u041f\u043e\u043b\u0438\u0433\u043e\u043d\u044b<\/em> \u0438 \u041f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u043e\u0432<\/em>. \u041f\u043e\u043b\u0438\u0433\u043e\u043d<\/em> – \u044d\u0442\u043e \u0432\u043e\u0431\u0449\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0420\u0435\u0431\u0435\u0440 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430 (Polygon Ribs<\/em>).<\/p>\n\n\n\n \u0422\u0435\u043f\u0435\u0440\u044c – \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n\n\n\n 1. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c VS, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c\u00a0C:\\CPP\\a997modeler\\p_windows\\p_windows.sln<\/em>.<\/p>\n\n\n\n 2. \u041f\u043e\u0434 modeler <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 header file PolygonRib.h<\/strong><\/p>\n\n\n\n Location: C:\\CPP\\engine\\modeler<\/em><\/p>\n\n\n\n \u041a\u043e\u0434:<\/p>\n\n\n <\/p>\n\n\n\n 3. \u041f\u043e\u0434 modeler <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 C++ file PolygonRib.cpp<\/strong><\/p>\n\n\n\n Location: C:\\CPP\\engine\\modeler<\/em><\/p>\n\n\n\n \u041a\u043e\u0434:<\/p>\n\n\n <\/p>\n\n\n\n 4. \u041f\u043e\u0434 modeler <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 header file Polygon.h<\/strong><\/p>\n\n\n\n Location: C:\\CPP\\engine\\modeler<\/em><\/p>\n\n\n\n \u041a\u043e\u0434:<\/p>\n\n\n <\/p>\n\n\n\n 5. \u041f\u043e\u0434 modeler <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 C++ file Polygon.cpp<\/strong><\/p>\n\n\n\n Location: C:\\CPP\\engine\\modeler<\/em><\/p>\n\n\n\n \u041a\u043e\u0434:<\/p>\n\n\n <\/p>\n\n\n\n \u0422\u0435\u043f\u0435\u0440\u044c – model description.<\/p>\n\n\n\n 6. \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440<\/strong> \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c (overwrite) \u0435\u0433\u043e to\/as<\/p>\n\n\n\n C:\\CPP\\a997modeler<\/strong>\\dt\\models\\misc\\marlboro01\\root01.txt<\/strong><\/em><\/p>\n\n\n <\/p>\n\n\n\n \u0427\u0442\u043e\u0431\u044b \u0438\u0445 \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c, \u0432 ModelLoader<\/strong>-\u0435 – \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b.<\/p>\n\n\n\n 7. \u0417\u0430\u043c\u0435\u043d\u0438\u043c ModelLoader.h<\/em> \u043a\u043e\u0434 \u043d\u0430:<\/p>\n\n\n <\/p>\n\n\n\n \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n\n\n\n 8. \u0417\u0430\u043c\u0435\u043d\u0438\u043c ModelLoader.cpp<\/em> \u043a\u043e\u0434 \u043d\u0430:<\/p>\n\n\n <\/p>\n\n\n\n <\/p>\n\n\n\n \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n\n\n\n \u0412\u0441\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 processTag_a2mesh(..)<\/em> (\u0441\u0442\u0440\u043e\u043a\u0430 351).<\/p>\n\n\n\n \u0421\u0442\u0440\u043e\u043a\u0430 355. \u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 “\u043a\u0443\u0434\u0430” \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f “apply”.<\/p>\n\n\n\n \u0421\u0442\u0440\u043e\u043a\u0430 360. \u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 (\u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0439) \u043c\u0435\u0448.<\/p>\n\n\n\n \u0421\u0442\u0440\u043e\u043a\u0430 369. \u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0448 \u043b\u0438\u0446\u043e\u043c \u043a \u043d\u0430\u043c:<\/p>\n\n\n\n <\/p>\n\n\n\n \u0421\u0442\u0440\u043e\u043a\u0430 374. \u0427\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c “\u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c”.<\/p>\n\n\n\n \u0421\u0442\u0440\u043e\u043a\u0438 381-390. \u0421\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043c\u0435\u0448\u0430 \u0438 \u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f (\u0441\u0442\u0440\u043e\u043a\u0430 384). \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c Polygon<\/em>-\u0435 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c intersection<\/em> (\u0441\u0442\u0440\u043e\u043a\u0430 383).<\/p>\n\n\n\n \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0442\u043e \u0441\u0442\u0440\u043e\u0438\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 (\u0441\u0442\u0440\u043e\u043a\u0430 486) \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u044b (vectors) vx2 <\/em>(vertices) \u0438 tr2 <\/em>(triangles) (\u0441\u0442\u0440\u043e\u043a\u0430 388).<\/p>\n\n\n\n \u041a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b, \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u0445 vx2 <\/em>\/ tr2<\/em> \u0443 \u043d\u0430\u0441 – \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442, \u0432\u044b\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0439 \u0438\u0437 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 (\u043c\u0435\u0448\u0430):<\/p>\n\n\n\n <\/p>\n\n\n\n \u0427\u0442\u043e\u0431\u044b \u043e\u043d \u043d\u0435 \u0441\u043b\u0438\u043b\u0441\u044f \u0441 \u0444\u043e\u043d\u043e\u043c \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u0437\u0430\u0434, \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0433\u043e material (\u0441\u0442\u0440\u043e\u043a\u0438 394-401). <\/p>\n\n\n\n <\/p>\n\n\n\n \u041c\u044b \u0443\u0431\u0435\u0440\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n\n\n\n \u0421\u0442\u0440\u043e\u043a\u0430 404. \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u044b\u0440\u0435\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u043d\u0430 \u0435\u0433\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e (\u0438\u043b\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e?) \u043f\u043e\u0437\u0438\u0446\u0438\u044e.<\/p>\n\n\n\n \u0421\u0442\u0440\u043e\u043a\u0430 406. \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0442\u0435\u043a\u0441\u043e\u0432\/\u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b ModelBuilder<\/strong>-\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u0443 \u043d\u0438\u0445 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043a\u0430\u043a \u0438 \u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0448\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430:<\/p>\n\n\n\n <\/p>\n\n\n\n \u0427\u0442\u043e\u0431\u044b \u0438\u0445 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0447\u0443\u0442\u043e\u043a \u043e\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0448\u0430, \u0443 \u043d\u0430\u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 root01.txt<\/em>:<\/p>\n\n\n\n \u042d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u043e\u043a\u0430 38.<\/p>\n\n\n\n ModelLoader <\/em>\u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u0442 sizeD <\/em>\u0432 scale<\/em> (\u043c\u0430\u0441\u0448\u0442\u0430\u0431), \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0438 327-339 \u0432 ModelLoader.cpp<\/em>, \u0444\u0443\u043d\u043a\u0446\u0438\u044f fillProps_gt(..)<\/em>.<\/p>\n\n\n\n 9. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n\n\n\n <\/p>\n\n\n\n \u041f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0446\u0435\u043b\u044c \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u0430.<\/p>\n\n\n\n 10. \u041f\u0435\u0440\u0435-\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c VS. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c\u00a0C:\\CPP\\a997modeler<\/em>\\p_android\\p_android.sln<\/em>.<\/strong><\/p>\n\n\n\n 11. \u041f\u043e\u0434 modeler <\/em>\u0434\u043e\u0431\u0430\u0432\u0438\u043c Existing Item<\/strong> <\/p>\n\n\n\n \u0438\u0437 C:\\CPP\\engine\\modeler<\/em><\/p>\n\n\n\n Add<\/strong><\/p>\n\n\n\n 12. \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 \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a.<\/p>\n\n\n\n Ok.<\/p>\n\n\n\n VS top menu -> Debug -> Stop Debugging<\/em>.<\/p>\n\n\n\n \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 – \u043d\u0430\u043b\u043e\u0436\u0438\u0442\u044c normal map<\/em> \u043d\u0430 \u0432\u044b\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0438\u0432 \u0438\u0445 “\u0440\u043e\u0434\u043d\u044b\u0435” \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0438 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b.<\/p>\n\n\n\n <\/p>\n","protected":false},"excerpt":{"rendered":" \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439: \u043c\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f “\u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c” \u0441\u0442\u044b\u043a (\u0449\u0435\u043b\u044c) \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u0447\u043a\u043e\u0439 \u0438 \u043a\u0440\u044b\u0448\u043a\u043e\u0439, \u043a\u0430\u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e\u00a0normal map\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u043a \u0447\u0430\u0441\u0442\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438. \u041a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a: \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0433\u043b\u0430\u0432\u0435 \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c “marked vertices\/triangles group“. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0434\u043d\u0443 (\u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 – “box_right”), \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u043b\u0438\u0446\u043e\u043c \u043a \u043d\u0430\u043c: \u0417\u0430\u0442\u0435\u043c – […]<\/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-1050","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\/1050","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=1050"}],"version-history":[{"count":17,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/posts\/1050\/revisions"}],"predecessor-version":[{"id":1512,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/posts\/1050\/revisions\/1512"}],"wp:attachment":[{"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/media?parent=1050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/categories?post=1050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/writingagame.ru\/index.php\/wp-json\/wp\/v2\/tags?post=1050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
<\/p>\n\n\n\n
<\/p>\n\n\n\n
<\/p>\n\n\n\nWindows<\/h2>\n\n\n\n
\n\n\n\n\n#pragma once\n#include "Vertex01.h"\n#include <vector>\n\nclass PolygonRib\n{\npublic:\n\tint i0;\n\tint i1;\n\tfloat* p0; \/\/rib p0\n\tfloat* p1; \/\/rib p1\n\t\/\/line equation\n\tfloat a_slope = 0; \/\/a\n\tfloat b_intercept = 0; \/\/b\n\tbool isVertical = false;\n\tfloat x_vertical = 0;\n\tbool isHorizontal = false;\n\t\/\/direction to "inner" side\n\tfloat xDirIn = 0;\n\tfloat yDirIn = 0;\npublic:\n\tPolygonRib(std::vector<Vertex01*>* pVxSrc, int idx0);\n\tstatic bool matchingLines(PolygonRib* pRibFrame, PolygonRib* pRibSrc);\n\tstatic bool parallelLines(PolygonRib* pRibFrame, PolygonRib* pRibSrc);\n};\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#include "PolygonRib.h"\n\nPolygonRib::PolygonRib(std::vector<Vertex01*>* pVxSrc, int idx0) {\n\t\/\/2 points\n\ti0 = idx0;\n\tp0 = pVxSrc->at(idx0)->aPos;\n\tint ribsN = pVxSrc->size();\n\tint idx1 = (idx0 + 1) % ribsN;\n\ti1 = idx1;\n\tp1 = pVxSrc->at(idx1)->aPos;\n\t\/\/3-rd "inner" ref point\n\tfloat* p2;\n\tint idx2 = (idx0 + 2) % ribsN;\n\tp2 = pVxSrc->at(idx2)->aPos;\n\t\/\/find line equation\n\tif (p0[0] == p1[0]) {\n\t\tisVertical = true;\n\t\tx_vertical = p0[0];\n\t\t\/\/"inner" side\n\t\tif (p2[0] < x_vertical)\n\t\t\txDirIn = -1;\n\t\telse\n\t\t\txDirIn = 1;\n\t}\n\telse if (p0[1] == p1[1]) {\n\t\tisHorizontal = true;\n\t\ta_slope = 0;\n\t\tb_intercept = p0[1];\n\t\t\/\/"inner" side\n\t\tif (p2[1] < b_intercept)\n\t\t\tyDirIn = -1;\n\t\telse\n\t\t\tyDirIn = 1;\n\t}\n\telse {\n\t\ta_slope = (p1[1]-p0[1]) \/ (p1[0] - p0[0]);\n\t\tb_intercept = p0[1] - a_slope * p0[0];\n\t\t\/\/"inner" side\n\t\tfloat y = a_slope * p2[0] + b_intercept;\n\t\tif(p2[1] < y)\n\t\t\tyDirIn = -1;\n\t\telse\n\t\t\tyDirIn = 1;\n\t\tfloat x = (p2[1] - b_intercept) \/ a_slope;\n\t\tif (p2[0] < x)\n\t\t\txDirIn = -1;\n\t\telse\n\t\t\txDirIn = 1;\n\t}\n}\nbool PolygonRib::matchingLines(PolygonRib* pRibFrame, PolygonRib* pRibSrc) {\n\tif (!parallelLines(pRibFrame, pRibSrc))\n\t\treturn false;\n\tif (pRibFrame->b_intercept != pRibSrc->b_intercept)\n\t\treturn false;\n\tif (pRibFrame->x_vertical != pRibSrc->x_vertical)\n\t\treturn false;\n\treturn true;\n}\nbool PolygonRib::parallelLines(PolygonRib* pRibFrame, PolygonRib* pRibSrc) {\n\tif (pRibFrame->isVertical != pRibSrc->isVertical)\n\t\treturn false;\n\tif (pRibFrame->a_slope != pRibSrc->a_slope)\n\t\treturn false;\n\treturn true;\n}\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#pragma once\n#include "Vertex01.h"\n#include "Triangle01.h"\n#include "PolygonRib.h"\n#include <vector>\n\nclass Polygon\n{\npublic:\n\tstd::vector<Vertex01*> vertices;\n\tstd::vector<PolygonRib*> ribs;\n\tstd::vector<Triangle01*> triangles;\n\tfloat normal[3] = {0,0,0};\n\tint ribsN = 0;\n\t\/\/bounding box\n\tfloat bbMin[3] = { 0,0,0 };\n\tfloat bbMax[3] = { 0,0,0 };\npublic:\n\tvirtual ~Polygon() { clearAll(this); };\n\tstatic void clearAll(Polygon* pPL);\n\tstatic int addVertex(Polygon* pPL, Vertex01* pV);\n\tstatic int addVertex(Polygon* pPL, float x, float y, float z);\n\tstatic int finalizePolygon(Polygon* pPL);\n\tstatic int setTriangle(Polygon* pPL, Triangle01* pT, std::vector<Vertex01*>* pVxSrc);\n\tstatic int setRectangle(Polygon* pPL, float w, float h);\n\tstatic int xyIntersection(Polygon* pDst, Polygon* pFrame, Polygon* pSrc);\n\tstatic int addLinesIntersection(Polygon* pDst, Polygon* pFrame, int ribNframe, Polygon* pSrc, int ribNsrc);\n\n\tstatic bool dotFits(float* p0, PolygonRib* pPR);\n\tstatic bool dotFits(float* p0, Polygon* pPL);\n\tstatic bool correctSide(float* p0, PolygonRib* pPR);\n\tstatic int addVert(Polygon* pDst, float* p0, Vertex01* pV0, Vertex01* pV1);\n\tstatic int addVert(Polygon * pDst, float* p0, Polygon * pSrc);\n\tstatic int buildTriangles(Polygon* pPL);\n};\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#include "Polygon.h"\n#include "linmath.h"\n#include "utils.h"\n#include "platform.h"\n#include <algorithm>\n\nextern float radians2degrees;\n\nvoid Polygon::clearAll(Polygon* pPL) {\n\tfor (int i = pPL->vertices.size() - 1; i >= 0; i--)\n\t\tdelete pPL->vertices.at(i);\n\tpPL->vertices.clear();\n\n\tfor (int i = pPL->ribs.size() - 1; i >= 0; i--)\n\t\tdelete pPL->ribs.at(i);\n\tpPL->ribs.clear();\n\n\tfor (int i = pPL->triangles.size() - 1; i >= 0; i--)\n\t\tdelete pPL->triangles.at(i);\n\tpPL->triangles.clear();\n}\nint Polygon::addVertex(Polygon* pPL, float x, float y, float z) {\n\tVertex01* pV = new Vertex01();\n\tpV->aPos[0] = x;\n\tpV->aPos[1] = y;\n\tpV->aPos[2] = z;\n\tpPL->vertices.push_back(pV);\n\treturn 1;\n}\nint Polygon::addVertex(Polygon* pPL, Vertex01* pV0) {\n\tVertex01* pV = new Vertex01(*pV0);\n\tpPL->vertices.push_back(pV);\n\/\/mylog("====Adding vertexs %f x %f\\n",pV->aPos[0], pV->aPos[1]);\n\treturn 1;\n}\nint Polygon::setTriangle(Polygon* pPL, Triangle01* pT, std::vector<Vertex01*>* pVxSrc) {\n\tclearAll(pPL);\n\tfor (int i = 0; i < 3; i++) {\n\t\tint vN = pT->idx[i];\n\t\tVertex01* pV = pVxSrc->at(vN);\n\t\taddVertex(pPL, pV);\n\t}\n\tfinalizePolygon(pPL);\n\treturn 1;\n}\nint Polygon::setRectangle(Polygon* pPL, float w, float h) {\n\tclearAll(pPL);\n\tw \/= 2;\n\th \/= 2;\n\t\/\/CCW\n\taddVertex(pPL, -w, h, 0); \/\/NW\n\taddVertex(pPL, -w, -h, 0); \/\/SW\n\taddVertex(pPL, w, -h, 0); \/\/SE\n\taddVertex(pPL, w, h, 0); \/\/NE\n\tfinalizePolygon(pPL);\n\treturn 1;\n}\nint Polygon::finalizePolygon(Polygon* pPL) {\n\tpPL->ribsN = pPL->vertices.size();\n\tfor (int i = 0; i < pPL->ribsN; i++) {\n\t\tPolygonRib* pPR = new PolygonRib(&pPL->vertices,i);\n\t\tpPL->ribs.push_back(pPR);\n\t}\n\t\/\/calculate polygon's normal\n\tfloat v0[3];\n\tfloat v2[3];\n\tfor (int i = 0; i < 3; i++) {\n\t\tv0[i] = pPL->vertices.at(1)->aPos[i] - pPL->vertices.at(0)->aPos[i];\n\t\tv2[i] = pPL->vertices.at(2)->aPos[i] - pPL->vertices.at(0)->aPos[i];\n\t}\n\tvec3_mul_cross(pPL->normal, v0, v2);\n\tvec3_norm(pPL->normal, pPL->normal);\n\t\/\/bounding box\n\tVertex01* pV = pPL->vertices.at(0);\n\tv3copy(pPL->bbMin, pV->aPos);\n\tv3copy(pPL->bbMax, pV->aPos);\n\tfor (int vN = pPL->vertices.size() - 1; vN >= 1; vN--) {\n\t\tpV = pPL->vertices.at(vN);\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tif (pPL->bbMin[i] > pV->aPos[i])\n\t\t\t\tpPL->bbMin[i] = pV->aPos[i];\n\t\t\tif (pPL->bbMax[i] < pV->aPos[i])\n\t\t\t\tpPL->bbMax[i] = pV->aPos[i];\n\t\t}\n\t}\n\treturn 1;\n}\nint Polygon::addLinesIntersection(Polygon* pDst, Polygon* pFrame, int ribNframe, Polygon* pSrc, int ribNsrc) {\n\tPolygonRib* pRibFrame = pFrame->ribs.at(ribNframe);\n\tPolygonRib* pRibSrc = pSrc->ribs.at(ribNsrc);\n\t\/*\nmylog("==addLinesIntersection\\n");\nmylog(" fr %f x %f to %f x %f v=%d h=%d\\n", pRibFrame->p0[0], pRibFrame->p0[1], pRibFrame->p1[0], pRibFrame->p1[1], pRibFrame->isVertical, pRibFrame->isHorizontal);\nmylog(" tr %f x %f to %f x %f v=%d h=%d\\n", pRibSrc->p0[0], pRibSrc->p0[1], pRibSrc->p1[0], pRibSrc->p1[1], pRibSrc->isVertical, pRibSrc->isHorizontal);\n*\/\n\tif (PolygonRib::matchingLines(pRibFrame, pRibSrc)) {\n\t\tVertex01* pV0 = pSrc->vertices.at(pRibSrc->i0);\n\t\tVertex01* pV1 = pSrc->vertices.at(pRibSrc->i1);\n\t\tint dstVertsN0 = pDst->vertices.size();\n\t\tif (dotFits(pRibFrame->p0, pRibSrc))\n\t\t\taddVert(pDst, pRibFrame->p0, pV0,pV1);\n\t\tif (dotFits(pRibFrame->p1, pRibSrc))\n\t\t\taddVert(pDst, pRibFrame->p1, pV0, pV1);\n\t\tif (dotFits(pRibSrc->p0, pRibFrame))\n\t\t\taddVertex(pDst, pV0);\n\t\tif (dotFits(pRibSrc->p1, pRibFrame))\n\t\t\taddVertex(pDst, pV1);\n\/\/mylog(" lines are identical\\n");\n\t\treturn pDst->vertices.size()- dstVertsN0;\n\t}\n\tif (PolygonRib::parallelLines(pRibFrame, pRibSrc)) {\n\/\/mylog(" lines are parallel\\n");\n\t\treturn 0;\n\t}\n\t\/\/find lines intersection, assuming lines are not parallel\n\tfloat x,y;\n\tif (pRibFrame->isVertical) {\n\t\tx = pRibFrame->p0[0];\n\t\ty = pRibSrc->a_slope * x + pRibSrc->b_intercept;\n\t}\n\telse { \/\/pRibFrame not vertical\n\t\tif (pRibSrc->isVertical) {\n\t\t\tx = pRibSrc->p0[0];\n\t\t\ty = pRibFrame->a_slope * x + pRibFrame->b_intercept;\n\t\t}\n\t\telse { \/\/both lines are "normal"\n\t\t\tx = (pRibSrc->b_intercept - pRibFrame->b_intercept) \/ (pRibFrame->a_slope - pRibSrc->a_slope);\n\t\t\ty = pRibFrame->a_slope * x + pRibFrame->b_intercept;\n\t\t}\n\t}\n\t\/\/check if belongs to both PolygonRibs\n\tfloat xy[2];\n\txy[0] = x;\n\txy[1] = y;\n\tif (!dotFits(xy, pRibFrame))\n\t\treturn 0;\n\tif (!dotFits(xy, pRibSrc))\n\t\treturn 0;\n\taddVert(pDst, xy, pSrc->vertices.at(pRibSrc->i0), pSrc->vertices.at(pRibSrc->i1));\n\treturn 1;\n}\nbool Polygon::correctSide(float* p0, PolygonRib* pPR) {\n\tif (pPR->isVertical)\n\t\tif ((p0[0] - pPR->x_vertical) * pPR->xDirIn < 0)\n\t\t\treturn false;\n\tif (pPR->isHorizontal)\n\t\tif ((p0[1] - pPR->b_intercept) * pPR->yDirIn < 0)\n\t\t\treturn false;\n\tfloat y = pPR->a_slope * p0[0] + pPR->b_intercept;\n\tif ((p0[1] - y) * pPR->yDirIn < 0)\n\t\treturn false;\n\treturn true;\n}\nint Polygon::addVert(Polygon* pDst, float* p0, Vertex01* pV0, Vertex01* pV1) {\n\tfloat d[2];\n\tfor (int i = 0; i < 2; i++)\n\t\td[i] = pV0->aPos[i] - p0[i];\n\tfloat dist2v0 = v3lengthXY(d);\n\tif (dist2v0 == 0)\n\t\treturn addVertex(pDst, pV0);\n\tfor (int i = 0; i < 2; i++)\n\t\td[i] = pV1->aPos[i] - p0[i];\n\tfloat dist2v1 = v3lengthXY(d);\n\tif (dist2v1 == 0)\n\t\treturn addVertex(pDst, pV1);\n\t\/\/if here - find mid values\n\tfloat k0 = dist2v1 \/ (dist2v0 + dist2v1);\n\tfloat k1 = dist2v0 \/ (dist2v0 + dist2v1);\n\tVertex01* pVx = new Vertex01(*pV0);\n\tpVx->aPos[0] = p0[0];\n\tpVx->aPos[1] = p0[1];\n\tpVx->aPos[2] = k0 * pV0->aPos[2] + k1 * pV1->aPos[2];\n\tfor (int i = 0; i < 3; i++)\n\t\tpVx->aNormal[i] = k0 * pV0->aNormal[i] + k1 * pV1->aNormal[i];\n\tfor (int i = 0; i < 2; i++)\n\t\tpVx->aTuv[i] = k0 * pV0->aTuv[i] + k1 * pV1->aTuv[i];\n\tfor (int i = 0; i < 2; i++)\n\t\tpVx->aTuv2[i] = k0 * pV0->aTuv2[i] + k1 * pV1->aTuv2[i];\n\taddVertex(pDst, pVx);\n\tdelete pVx;\n\treturn 0;\n}\nint Polygon::xyIntersection(Polygon* pDst, Polygon* pFrame, Polygon* pSrc) {\n\t\/\/check bounding boxes, XY only\n\tfor (int i = 0; i < 2; i++) {\n\t\tif (pFrame->bbMin[i] > pSrc->bbMax[i])\n\t\t\treturn 0;\n\t\tif (pFrame->bbMax[i] < pSrc->bbMin[i])\n\t\t\treturn 0;\n\t}\n\t\/\/compare normals\n\tif (v3dotProduct(pFrame->normal, pSrc->normal) <= 0)\n\t\treturn 0;\n\/*\nmylog(">>>pFrame %fx%f to %fx%f to %fx%f \\n",\n\tpFrame->vertices.at(0)->aPos[0], pFrame->vertices.at(0)->aPos[1],\n\tpFrame->vertices.at(1)->aPos[0], pFrame->vertices.at(1)->aPos[1],\n\tpFrame->vertices.at(2)->aPos[0], pFrame->vertices.at(2)->aPos[1]\n);\nmylog(" pSrc %fx%f to %fx%f to %fx%f \\n",\n\tpSrc->vertices.at(0)->aPos[0], pSrc->vertices.at(0)->aPos[1],\n\tpSrc->vertices.at(1)->aPos[0], pSrc->vertices.at(1)->aPos[1],\n\tpSrc->vertices.at(2)->aPos[0], pSrc->vertices.at(2)->aPos[1]\n);\nmylog("---SrcVerts\\n");\n*\/\n\t\/\/if here - have overlap\n\tint addedSrcVerts = 0;\n\tfor (int vN = 0; vN < pSrc->ribsN; vN++) {\n\t\tVertex01* pV = pSrc->vertices.at(vN);\n\t\tif (dotFits(pV->aPos, pFrame))\n\t\t\taddedSrcVerts += addVertex(pDst, pV);\n\t}\n\tif (addedSrcVerts == pSrc->ribsN)\n\t\treturn addedSrcVerts;\n\n\/\/mylog("---FrameVerts\\n");\n\tint addedFrameVerts = 0;\n\tfor (int vN = 0; vN < pFrame->ribsN; vN++) {\n\t\tVertex01* pV = pFrame->vertices.at(vN);\n\t\tif (dotFits(pV->aPos, pSrc)) {\n\t\t\tint frameVerts = addVert(pDst, pV->aPos, pSrc);\n\t\t\taddedFrameVerts += frameVerts;\n\t\t}\n\t}\n\tif (addedFrameVerts == pFrame->ribsN)\n\t\treturn addedFrameVerts;\n\n\/\/mylog("---CrossVerts\\n");\n\t\/\/check ribs intersections\n\tint addedCrossVerts = 0;\n\tfor (int ribNframe = 0; ribNframe < pFrame->ribsN; ribNframe++) {\n\t\tfor (int ribNsrc = 0; ribNsrc < pSrc->ribsN; ribNsrc++) {\n\t\t\tint crossVerts = addLinesIntersection(pDst, pFrame, ribNframe, pSrc, ribNsrc);\n\t\t\taddedCrossVerts += crossVerts;\n\t\t}\n\t}\n\treturn (addedSrcVerts + addedFrameVerts + addedCrossVerts);\n}\nbool Polygon::dotFits(float* p0, PolygonRib* pPR) {\n\/\/mylog("dotFits Rib %f x %f vs %f x %f to %f x %f\\n", p0[0], p0[1], pPR->p0[0], pPR->p0[1], pPR->p1[0], pPR->p1[1]);\n\t\/\/assuming that p0 is on the line\n\tint dir0;\n\tint dir1;\n\tif (pPR->isVertical) {\n\t\tif (pPR->p0[1] == p0[1])\n\t\t\treturn true;\n\t\telse if (pPR->p0[1] < p0[1])\n\t\t\tdir0 = -1;\n\t\telse\n\t\t\tdir0 = 1;\n\n\t\tif (pPR->p1[1] == p0[1])\n\t\t\treturn true;\n\t\telse if (pPR->p1[1] < p0[1])\n\t\t\tdir1 = -1;\n\t\telse\n\t\t\tdir1 = 1;\n\t}\n\telse{ \/\/"normal" line\n\t\tif (pPR->p0[0] == p0[0])\n\t\t\treturn true;\n\t\telse if (pPR->p0[0] < p0[0])\n\t\t\tdir0 = -1;\n\t\telse\n\t\t\tdir0 = 1;\n\n\t\tif (pPR->p1[0] == p0[0])\n\t\t\treturn true;\n\t\telse if (pPR->p1[0] < p0[0])\n\t\t\tdir1 = -1;\n\t\telse\n\t\t\tdir1 = 1;\n\t}\n\/\/mylog(" fits?=%d\\n", !(dir0 == dir1));\n\tif (dir0 == dir1)\n\t\treturn false;\n\treturn true;\n}\nbool Polygon::dotFits(float* p0, Polygon* pPL) {\n\/\/mylog("dotFits Polygon %f x %f\\n",p0[0],p0[1]);\n\n\tfor (int i = 0; i < pPL->ribsN; i++)\n\t\tif (!correctSide(p0, pPL->ribs.at(i))) {\n\/\/mylog(" don't Fit side %f x %f to %f x %f\\n", pPL->ribs.at(i)->p0[0], pPL->ribs.at(i)->p0[1], pPL->ribs.at(i)->p1[0], pPL->ribs.at(i)->p1[1]);\n\t\t\treturn false;\n\t\t}\n\/\/mylog(" dotFits!\\n");\n\treturn true;\n}\nint Polygon::buildTriangles(Polygon* pPL) {\n\tint vertsN = pPL->vertices.size();\n\t\/\/mid point coords\n\tfloat p0[2] = { 0,0 };\n\tfor (int vN = 0; vN < vertsN; vN++) {\n\t\tfloat* p1 = pPL->vertices.at(vN)->aPos;\n\t\tp0[0] += p1[0];\n\t\tp0[1] += p1[1];\n\t}\n\tp0[0] \/= vertsN;\n\tp0[1] \/= vertsN;\n\tfor (int vN = 0; vN < vertsN; vN++) {\n\t\tfloat* p1 = pPL->vertices.at(vN)->aPos;\n\t\tfloat v1[3] ={0,0,0};\n\t\tv1[0] = p1[0] - p0[0];\n\t\tv1[1] = p1[1] - p0[1];\n\t\tfloat az = -atan2f(v1[0], v1[1]) * radians2degrees;\n\t\t\/\/aTangent is not used at this point, ok to use it to store az\n\t\tpPL->vertices.at(vN)->aTangent[0] = az;\n\t}\n\t\/\/sort vertices\n\tstd::sort(pPL->vertices.begin(), pPL->vertices.end(), \n\t\t[](Vertex01* pV0, Vertex01* pV1) {\n\t\treturn pV0->aTangent[0] > pV1->aTangent[0]; });\n\t\/\/check for redundancy\n\tfor (int vN = pPL->vertices.size() - 1; vN > 0; vN--) {\n\t\tVertex01* pV = pPL->vertices.at(vN);\n\t\tVertex01* pVprev = pPL->vertices.at(vN-1);\n\t\tif (pV->aTangent[0] == pVprev->aTangent[0]) {\n\t\t\tdelete pV;\n\t\t\tpPL->vertices.erase(pPL->vertices.begin() + vN);\n\t\t}\n\t}\n\tpPL->ribsN = pPL->vertices.size();\n\t\/\/build triangles\n\tVertex01* pV = pPL->vertices.at(0);\n\tfor (int vN = 2; vN < pPL->ribsN; vN++) {\n\t\tTriangle01* pTR = new Triangle01();\n\t\tpPL->triangles.push_back(pTR);\n\t\tpTR->idx[0] = 0;\n\t\tpTR->idx[1] = vN;\n\t\tpTR->idx[2] = vN - 1;\n\t\tpTR->subjN = pV->subjN;\n\t\tpTR->materialN = pV->materialN;\n\t\t\/\/mark\n\t\tmyStrcpy_s(pTR->marks, 124, pV->marks);\n\t}\n\treturn 1;\n}\nint Polygon::addVert(Polygon* pDst, float* p0, Polygon* pSrc) {\n\t\/\/check where horizontal line drawn through p0 crosses polygon's ribs\n\tVertex01 vx0;\n\tVertex01 vx1;\n\tint vxN = 0;\n\tfor (int ribN = 0; ribN < pSrc->ribsN; ribN++) {\n\t\tPolygonRib* pPR = pSrc->ribs.at(ribN);\n\t\tif (pPR->isHorizontal)\n\t\t\tcontinue;\n\t\tfloat p1[2];\n\t\tp1[1] = p0[1];\n\t\tif (pPR->isVertical)\n\t\t\tp1[0] = pPR->x_vertical;\n\t\telse\n\t\t\tp1[0] = (p1[1] - pPR->b_intercept) \/ pPR->a_slope;\n\t\tif (!dotFits(p1, pPR))\n\t\t\tcontinue;\n\t\t\/\/if here - 1 intersection found\n\t\tVertex01* pVdst = &vx0;\n\t\tif(vxN > 0)\n\t\t\tpVdst = &vx1;\n\t\tVertex01* pV0src = pSrc->vertices.at(pPR->i0);\n\t\tVertex01* pV1src = pSrc->vertices.at(pPR->i1);\n\t\tmemcpy(pVdst, pV0src, sizeof(Vertex01));\n\t\tfloat d[2];\n\t\tfor (int i = 0; i < 2; i++)\n\t\t\td[i] = pV0src->aPos[i] - p1[i];\n\t\tfloat dist2v0 = v3lengthXY(d);\n\t\tif (dist2v0 == 0)\n\t\t\tmemcpy(pVdst, pV0src, sizeof(Vertex01));\n\t\telse {\n\t\t\tfor (int i = 0; i < 2; i++)\n\t\t\t\td[i] = pV1src->aPos[i] - p1[i];\n\t\t\tfloat dist2v1 = v3lengthXY(d);\n\t\t\tif (dist2v1 == 0)\n\t\t\t\tmemcpy(pVdst, pV1src, sizeof(Vertex01));\n\t\t\telse {\n\t\t\t\t\/\/if here - find mid values\n\t\t\t\tfloat k0 = dist2v1 \/ (dist2v0 + dist2v1);\n\t\t\t\tfloat k1 = dist2v0 \/ (dist2v0 + dist2v1);\n\t\t\t\tpVdst->aPos[0] = p1[0];\n\t\t\t\tpVdst->aPos[1] = p1[1];\n\t\t\t\tpVdst->aPos[2] = k0 * pV0src->aPos[2] + k1 * pV1src->aPos[2];\n\t\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\t\tpVdst->aNormal[i] = k0 * pV0src->aNormal[i] + k1 * pV1src->aNormal[i];\n\t\t\t\tfor (int i = 0; i < 2; i++)\n\t\t\t\t\tpVdst->aTuv[i] = k0 * pV0src->aTuv[i] + k1 * pV1src->aTuv[i];\n\t\t\t\tfor (int i = 0; i < 2; i++)\n\t\t\t\t\tpVdst->aTuv2[i] = k0 * pV0src->aTuv2[i] + k1 * pV1src->aTuv2[i];\n\t\t\t}\n\t\t}\n\t\tvxN++;\n\t\tif (vxN > 1)\n\t\t\tbreak;\n\t}\n\taddVert(pDst, p0, &vx0, &vx1);\n\treturn 1;\n}\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n<texture_as="tx0" src="marlboro03small.png" ckey="#00ff00"\/>\n<mt_type="phong" uTex0_use="tx0" \/>\n<vs="box_tank" whl="53,83,21" ext=1 sectR=1 \/>\n<a="front v" xywh="2,1,323,495" mark="box_front"\/>\n<a="back v" xywh="2,1,323,495" mark="box_back"\/>\n<a="right all" xywh="327,1,128,495" mark="box_right"\/>\n<a="left all" xywh="457,1,128,495" mark="box_left"\/>\n<a="top" xywh="588,1,323,133"\/>\n<a="bottom" xywh="587,136,324,134"\/>\n\/\/golden prints\n<vs="box" whl="55.1,85.1,23.1" \/>\n<texture_as="whitenoise" src="\/dt\/common\/img\/whitenoise\/wn64_blur3.bmp"\/>\n<texture_as="gold" src="\/dt\/common\/img\/materials\/gold02roman.bmp" \/>\n<mt_type="mirror" uAlphaBlending uTex1mask_use="tx0" uTex1alphaChannelN=1 uTex0_use="whitenoise" uTex0translateChannelN=0 uTex3_use="gold" \/>\n\/\/side golden prints\n<a="right" xywh="342,12,101,10" whl="x,1.8,18.1" pxyz="x,39.8, -0.3" \/> \/\/Please do not litter\n<a="right" xywh="339,144,105,89" whl="x,15.35,18.9" pxyz="x,10.3,-0.12" \/> \/\/For special offers...\n<a="left" xywh="475,15,95,48" whl="x,8.4,17" pxyz="x,36, 0.3" \/> \/\/Underage sale...\n\/\/front prints\n<group>\n\t\/\/bottom golden print "20 class a..."\n\t<a="front" xywh="20,498,289,13" whl="47.5,2,x" pxyz="1,-36,x" \/>\n\t\/\/blazon\/emblem\n\t<mt_type="mirror" uAlphaBlending uTex2nm_use="tx0" uTex0_use="whitenoise" uTex0translateChannelN=0 uTex3_use="gold" \/>\n\t<a="front" xywh2nm="589,415,128,94" whl="20.7,16,x" pxyz="0.3,6.1,x" \/> \/\/emblem\n\t\/\/"Marlboro\n\t<mt_type="phong" uAlphaBlending uTex2nm_use="tx0" uColor="#1E211E" \/>\n\t<a="front" xywh2nm="590,275,301,136" whl="49.2,23.3,x" pxyz="0.21,-18,x" \/> \/\/marlboro\n<\/group> \n<clone ay=180 \/>\n\/\/joint (slit) between the pack and the lid\n<group> \n\t<a2mesh wh="50,2" all markedAs="box_right" onThe="right" py=24.6 az=31 \/>\n\t<a2mesh wh="50,2" all markedAs="box_left" onThe="left" py=24.6 az=-31 \/>\n\t<a2mesh wh="53,2" all markedAs="box_front" py=17.8 \/>\n\t<a2mesh wh="6 ,2" all markedAs="box_back" onThe="back" py=31.5 px=23.5 \/>\n\t<a2mesh wh="6 ,2" all markedAs="box_back" onThe="back" py=31.5 px=-23.5 \/>\n<\/group sizeD="0.1,0,0.1"> \n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#pragma once\n#include "XMLparser.h"\n#include "ModelBuilder.h"\n#include "GroupTransform.h"\n\nclass ModelLoader : public XMLparser\n{\npublic:\n\tModelBuilder* pModelBuilder = NULL;\n\tbool ownModelBuilder = false;\n\tstd::vector<GameSubj*>* pSubjsVector = NULL;\npublic:\n\tModelLoader(std::vector<GameSubj*>* pSubjsVector0, int subjN, ModelBuilder* pMB, std::string filePath) : XMLparser(filePath) {\n\t\tpSubjsVector = pSubjsVector0;\n\t\tif (pMB != NULL) {\n\t\t\townModelBuilder = false;\n\t\t\tpModelBuilder = pMB;\n\t\t}\n\t\telse {\n\t\t\townModelBuilder = true;\n\t\t\tpModelBuilder = new ModelBuilder();\n\t\t\tpModelBuilder->lockGroup(pModelBuilder);\n\t\t}\n\t\tpModelBuilder->useSubjN(subjN);\n\t};\n\tvirtual ~ModelLoader() {\n\t\tif (!ownModelBuilder)\n\t\t\treturn;\n\t\tpModelBuilder->buildDrawJobs(*pSubjsVector);\n\t\tdelete pModelBuilder;\n\t};\n\tstatic int processTag_a(ModelLoader* pML); \/\/apply\n\tstatic int setValueFromIntHashMap(int* pInt, std::map<std::string, int> intHashMap, std::string varName, std::string tagStr);\n\tstatic int setTexture(ModelLoader* pML, int* pInt, std::string txName);\n\tstatic int setMaterialTextures(ModelLoader* pML, Material* pMT);\n\tstatic int fillProps_vs(VirtualShape* pVS, std::string tagStr); \/\/virtual shape\n\tstatic int fillProps_mt(Material* pMT, std::string tagStr, ModelLoader* pML); \/\/Material\n\tstatic int fillProps_gt(GroupTransform* pGS, ModelBuilder* pMB, std::string tagStr);\n\tint processTag() { return processTag(this); };\n\tstatic int processTag(ModelLoader* pML);\n\tstatic int loadModel(std::vector<GameSubj*>* pSubjsVector0, std::string sourceFile, std::string subjClass);\n\tstatic int processTag_clone(ModelLoader* pML);\n\tstatic int addMark(char* marks, std::string newMark);\n\tstatic int processTag_do(ModelLoader* pML);\n\tstatic int processTag_a2mesh(ModelLoader* pML);\n};\n\n<\/pre><\/div>\n\n\n
\n\n\n\n\n#include "ModelLoader.h"\n#include "platform.h"\n#include "TheGame.h"\n#include "DrawJob.h"\n#include "Texture.h"\n#include "utils.h"\n#include "Polygon.h"\n\nextern TheGame theGame;\n\nint ModelLoader::loadModel(std::vector<GameSubj*>* pSubjsVector0, std::string sourceFile, std::string subjClass) {\n\t\/\/returns element's (Subj) number or -1\n\tint subjN = pSubjsVector0->size();\n\tGameSubj* pGS = theGame.newGameSubj(subjClass);\n\tpSubjsVector0->push_back(pGS);\n\t\/\/pGS->djStartN = DrawJob::drawJobs.size();\n\tModelLoader* pML = new ModelLoader(pSubjsVector0, subjN, NULL, sourceFile);\n\tprocessSource(pML);\n\tdelete pML;\n\t\/\/pGS->djTotalN = DrawJob::drawJobs.size() - pGS->djStartN;\n\treturn subjN;\n}\nint ModelLoader::setValueFromIntHashMap(int* pInt, std::map<std::string, int> intHashMap, std::string varName, std::string tagStr) {\n\tif (!varExists(varName, tagStr))\n\t\treturn 0;\n\tstd::string str0 = getStringValue(varName, tagStr);\n\tif (intHashMap.find(str0) == intHashMap.end()) {\n\t\tmylog("ERROR in ModelLoader::setValueFromIntMap, %s not found, %s\\n", varName.c_str(), tagStr.c_str());\n\t\treturn -1;\n\t}\n\t*pInt = intHashMap[getStringValue(varName, tagStr)];\n\treturn 1;\n}\nint ModelLoader::setTexture(ModelLoader* pML, int* pInt, std::string txName) {\n\tModelBuilder* pMB = pML->pModelBuilder;\n\tstd::string varName = txName + "_use";\n\tif (setValueFromIntHashMap(pInt, pMB->texturesHashMap, varName, pML->currentTag) == 0) {\n\t\t\/\/the texture is not in hash table\n\t\tvarName = txName + "_src";\n\t\tif (varExists(varName, pML->currentTag)) {\n\t\t\tstd::string txFile = getStringValue(varName, pML->currentTag);\n\t\t\tvarName = txName + "_ckey";\n\t\t\tunsigned int intCkey = 0;\n\t\t\tsetUintColorValue(&intCkey, varName, pML->currentTag);\n\t\t\t*pInt = Texture::loadTexture(buildFullPath(pML, txFile), intCkey);\n\t\t}\n\t}\n\treturn 1;\n}\nint ModelLoader::setMaterialTextures(ModelLoader* pML, Material* pMT) {\n\tsetTexture(pML, &pMT->uTex0, "uTex0");\n\tsetTexture(pML, &pMT->uTex1mask, "uTex1mask");\n\tsetTexture(pML, &pMT->uTex2nm, "uTex2nm");\n\tsetTexture(pML, &pMT->uTex3, "uTex3");\n\treturn 1;\n}\nint ModelLoader::fillProps_mt(Material* pMT, std::string tagStr, ModelLoader* pML) {\n\tsetCharsValue(pMT->shaderType, 20, "mt_type", tagStr);\n\tsetMaterialTextures(pML, pMT);\n\t\/\/color\n\tif (varExists("uColor", tagStr)) {\n\t\tunsigned int uintColor = 0;\n\t\tsetUintColorValue(&uintColor, "uColor", tagStr);\n\t\tpMT->uColor.setUint32(uintColor);\n\t}\n\t\/\/mylog("mt.uTex0=%d, mt.uTex1mask=%d\\n", mt.uTex0, mt.uTex1mask);\n\tif (varExists("primitiveType", tagStr)) {\n\t\tstd::string str0 = getStringValue("primitiveType", tagStr);\n\t\tif (str0.compare("GL_POINTS") == 0) pMT->primitiveType = GL_POINTS;\n\t\telse if (str0.compare("GL_LINES") == 0) pMT->primitiveType = GL_LINES;\n\t\telse if (str0.compare("GL_LINE_STRIP") == 0) pMT->primitiveType = GL_LINE_STRIP;\n\t\telse if (str0.compare("GL_LINE_LOOP") == 0) pMT->primitiveType = GL_LINE_LOOP;\n\t\telse if (str0.compare("GL_TRIANGLE_STRIP") == 0) pMT->primitiveType = GL_TRIANGLE_STRIP;\n\t\telse if (str0.compare("GL_TRIANGLE_FAN") == 0) pMT->primitiveType = GL_TRIANGLE_FAN;\n\t\telse pMT->primitiveType = GL_TRIANGLES;\n\t}\n\tsetIntValue(&pMT->uTex1alphaChannelN, "uTex1alphaChannelN", tagStr);\n\tsetIntValue(&pMT->uTex0translateChannelN, "uTex0translateChannelN", tagStr);\n\tsetIntBoolValue(&pMT->uAlphaBlending, "uAlphaBlending", tagStr);\n\tsetFloatValue(&pMT->uAlphaFactor, "uAlphaFactor", tagStr);\n\tsetFloatValue(&pMT->uAmbient, "uAmbient", tagStr);\n\tsetFloatValue(&pMT->uSpecularIntencity, "uSpecularIntencity", tagStr);\n\tsetFloatValue(&pMT->uSpecularMinDot, "uSpecularMinDot", tagStr);\n\tsetFloatValue(&pMT->uSpecularPowerOf, "uSpecularPowerOf", tagStr);\n\n\tpML->pModelBuilder->useMaterial(pMT);\n\treturn 1;\n}\nint ModelLoader::processTag(ModelLoader* pML) {\n\tModelBuilder* pMB = pML->pModelBuilder;\n\tif (pML->tagName.compare("texture_as") == 0) {\n\t\t\/\/saves texture N in texturesMap under given name\n\t\tstd::string keyName = getStringValue("texture_as", pML->currentTag);\n\t\tif (pMB->texturesHashMap.find(keyName) != pMB->texturesHashMap.end())\n\t\t\treturn pMB->texturesHashMap[keyName];\n\t\telse { \/\/add new\n\t\t\tstd::string txFile = getStringValue("src", pML->currentTag);\n\t\t\tunsigned int intCkey = 0;\n\t\t\tsetUintColorValue(&intCkey, "ckey", pML->currentTag);\n\t\t\tint txN = Texture::loadTexture(buildFullPath(pML, txFile), intCkey);\n\t\t\tpMB->texturesHashMap[keyName] = txN;\n\t\t\t\/\/mylog("%s=%d\\n", keyName.c_str(), pMB->texturesMap[keyName]);\n\t\t\treturn txN;\n\t\t}\n\t}\n\tif (pML->tagName.find("mt_") == 0) {\n\t\t\/\/sets current material\n\t\tModelBuilder* pMB = pML->pModelBuilder;\n\t\tif (!pML->closedTag) {\n\t\t\t\/\/save previous material in stack\n\t\t\tif (pMB->usingMaterialN >= 0)\n\t\t\t\tpMB->materialsStack.push_back(pMB->usingMaterialN);\n\t\t}\n\t\tMaterial mt;\n\t\treturn fillProps_mt(&mt, pML->currentTag, pML);\n\t}\n\tif (pML->tagName.find("\/mt_") == 0) {\n\t\t\/\/restore previous material\n\t\tif (pMB->materialsStack.size() > 0) {\n\t\t\tpMB->usingMaterialN = pMB->materialsStack.back();\n\t\t\tpMB->materialsStack.pop_back();\n\t\t}\n\t\treturn 1;\n\t}\n\tif (pML->tagName.compare("vs") == 0) {\n\t\t\/\/sets virtual shape\n\t\tModelBuilder* pMB = pML->pModelBuilder;\n\t\tif (pML->closedTag) {\n\t\t\tif (pMB->pCurrentVShape != NULL)\n\t\t\t\tdelete pMB->pCurrentVShape;\n\t\t}\n\t\telse { \/\/open tag\n\t\t\t\/\/save previous vshape in stack\n\t\t\tif (pMB->pCurrentVShape != NULL)\n\t\t\t\tpMB->vShapesStack.push_back(pMB->pCurrentVShape);\n\t\t}\n\t\tpMB->pCurrentVShape = new VirtualShape();\n\t\tfillProps_vs(pMB->pCurrentVShape, pML->currentTag);\n\t\treturn 1;\n\t}\n\tif (pML->tagName.compare("\/vs") == 0) {\n\t\t\/\/restore previous virtual shape\n\t\tif (pMB->vShapesStack.size() > 0) {\n\t\t\tif (pMB->pCurrentVShape != NULL)\n\t\t\t\tdelete(pMB->pCurrentVShape);\n\t\t\tpMB->pCurrentVShape = pMB->vShapesStack.back();\n\t\t\tpMB->vShapesStack.pop_back();\n\t\t}\n\t\treturn 1;\n\t}\n\tif (pML->tagName.compare("group") == 0) {\n\t\tstd::string notAllowed[] = { "pxyz","axyz","align","headTo" };\n\t\tint notAllowedLn = sizeof(notAllowed) \/ sizeof(notAllowed[0]);\n\t\tfor (int i = 0; i < notAllowedLn; i++)\n\t\t\tif (varExists(notAllowed[i], pML->currentTag)) {\n\t\t\t\tmylog("ERROR in ModelLoader::processTag: use %s in <\/group>: %s\\n", notAllowed[i].c_str(), pML->currentTag.c_str());\n\t\t\t\treturn -1;\n\t\t\t}\n\t\tpMB->lockGroup(pMB);\n\t\t\/\/mark\n\t\tif (varExists("mark", pML->currentTag))\n\t\t\taddMark(pMB->pCurrentGroup->marks, getStringValue("mark", pML->currentTag));\n\t\treturn 1;\n\t}\n\tif (pML->tagName.compare("\/group") == 0) {\n\t\tGroupTransform gt;\n\t\tfillProps_gt(>, pMB, pML->currentTag);\n\t\tgt.executeGroupTransform(pMB);\n\n\t\tpMB->releaseGroup(pMB);\n\t\treturn 1;\n\t}\n\tif (pML->tagName.compare("a") == 0)\n\t\treturn processTag_a(pML); \/\/apply \n\tif (pML->tagName.compare("clone") == 0)\n\t\treturn processTag_clone(pML);\n\tif (pML->tagName.compare("\/clone") == 0)\n\t\treturn processTag_clone(pML);\n\tif (pML->tagName.compare("do") == 0)\n\t\treturn processTag_do(pML);\n\tif (pML->tagName.compare("a2mesh") == 0)\n\t\treturn processTag_a2mesh(pML);\n\n\t\/\/mylog("%s, %s \/group?=%d\\n",pML->currentTag.c_str(), pML->tagName.c_str(), (pML->tagName.compare("\/group") == 0));\n\tmylog("ERROR in ModelLoader::processTag, unhandled tag %s, file %s\\n", pML->currentTag.c_str(), pML->fullPath.c_str());\n\treturn -1;\n}\nint ModelLoader::fillProps_vs(VirtualShape* pVS, std::string tagStr) {\n\t\/\/sets virtual shape\n\tsetCharsValue(pVS->shapeType, 20, "vs", tagStr);\n\tsetFloatArray(pVS->whl, 3, "whl", tagStr);\n\t\/\/extensions\n\tfloat ext;\n\tif (varExists("ext", tagStr)) {\n\t\tsetFloatValue(&ext, "ext", tagStr);\n\t\tpVS->setExt(ext);\n\t}\n\tif (varExists("extX", tagStr)) {\n\t\tsetFloatValue(&ext, "extX", tagStr);\n\t\tpVS->setExtX(ext);\n\t}\n\tif (varExists("extY", tagStr)) {\n\t\tsetFloatValue(&ext, "extY", tagStr);\n\t\tpVS->setExtY(ext);\n\t}\n\tif (varExists("extZ", tagStr)) {\n\t\tsetFloatValue(&ext, "extZ", tagStr);\n\t\tpVS->setExtZ(ext);\n\t}\n\tsetFloatValue(&pVS->extU, "extU", tagStr);\n\tsetFloatValue(&pVS->extD, "extD", tagStr);\n\tsetFloatValue(&pVS->extL, "extL", tagStr);\n\tsetFloatValue(&pVS->extR, "extR", tagStr);\n\tsetFloatValue(&pVS->extF, "extF", tagStr);\n\tsetFloatValue(&pVS->extB, "extB", tagStr);\n\t\/\/sections\n\tsetIntValue(&pVS->sectionsR, "sectR", tagStr);\n\tsetIntValue(&pVS->sections[0], "sectX", tagStr);\n\tsetIntValue(&pVS->sections[1], "sectY", tagStr);\n\tsetIntValue(&pVS->sections[2], "sectZ", tagStr);\n\n\t\/\/mylog("pVS->shapeType=%s whl=%fx%fx%f\\n", pVS->shapeType, pVS->whl[0], pVS->whl[1], pVS->whl[2]);\n\treturn 1;\n}\nint ModelLoader::processTag_a(ModelLoader* pML) {\n\t\/\/apply\n\tModelBuilder* pMB = pML->pModelBuilder;\n\tstd::string tagStr = pML->currentTag;\n\tpMB->lockGroup(pMB);\n\t\/\/mark\n\tif (varExists("mark", tagStr))\n\t\taddMark(pMB->pCurrentGroup->marks, getStringValue("mark", tagStr));\n\n\tstd::vector<std::string> applyTosVector = splitString(pML->getStringValue("a", tagStr), ",");\n\tMaterial* pMT = pMB->materialsList.at(pMB->usingMaterialN);\n\tint texN = pMT->uTex1mask;\n\tif (texN < 0)\n\t\ttexN = pMT->uTex0;\n\tfloat xywh[4] = { 0,0,1,1 };\n\tsetFloatArray(xywh, 4, "xywh", tagStr);\n\tstd::string flipStr = getStringValue("flip", tagStr);\n\tTexCoords tc;\n\ttc.set(texN, xywh[0], xywh[1], xywh[2], xywh[3], flipStr);\n\n\tsetFloatArray(xywh, 4, "xywh2nm", tagStr);\n\tflipStr = getStringValue("flip2nm", tagStr);\n\tTexCoords tc2nm;\n\ttc2nm.set(pMT->uTex2nm, xywh[0], xywh[1], xywh[2], xywh[3], flipStr);\n\n\t\/\/adjusted VirtualShape\n\tVirtualShape* pVS_a = new VirtualShape(*pMB->pCurrentVShape);\n\tfillProps_vs(pVS_a, tagStr);\n\n\tfor (int aN = 0; aN < (int)applyTosVector.size(); aN++) {\n\t\t\/\/pMB->buildFace(pMB, applyTosVector.at(aN), pMB->pCurrentVShape, &tc, &tc2nm);\n\t\tpMB->buildFace(pMB, applyTosVector.at(aN), pVS_a, &tc, &tc2nm);\n\t}\n\tdelete pVS_a;\n\t\/\/mylog("vertsN=%d\\n",pMB->vertices.size());\n\n\tGroupTransform GT_a;\n\tfillProps_gt(>_a, pMB, tagStr);\n\tGT_a.executeGroupTransform(pMB);\n\n\tpMB->releaseGroup(pMB);\n\treturn 1;\n}\nint ModelLoader::processTag_clone(ModelLoader* pML) {\n\tModelBuilder* pMB = pML->pModelBuilder;\n\tif (pML->tagName.compare("clone") == 0) {\n\t\t\/\/mark what to clone\n\t\tGroupTransform gt;\n\t\tgt.pGroup = pMB->pLastClosedGroup;\n\t\tgt.flagSelection(>, &pMB->vertices, &pMB->triangles);\n\n\t\t\/\/cloning\n\t\tpMB->lockGroup(pMB);\n\t\tgt.cloneFlagged(pMB, &pMB->vertices, &pMB->triangles, &pMB->vertices, &pMB->triangles);\n\t}\n\tGroupTransform gt;\n\tfillProps_gt(>, pMB, pML->currentTag);\n\tgt.executeGroupTransform(pMB);\n\n\tif (pML->tagName.compare("\/clone") == 0 || pML->closedTag) {\n\t\tpMB->releaseGroup(pMB);\n\t}\n\treturn 1;\n}\nint ModelLoader::addMark(char* marks, std::string newMark) {\n\tif (newMark.empty())\n\t\treturn 0;\n\tstd::string allMarks;\n\tallMarks.assign(marks);\n\tallMarks.append("<"+ newMark+">");\n\tmyStrcpy_s(marks,124, allMarks.c_str());\n\treturn 1;\n}\n\nint ModelLoader::fillProps_gt(GroupTransform* pGT, ModelBuilder* pMB, std::string tagStr) {\n\tpGT->pGroup = pMB->pCurrentGroup;\n\t\/\/position\n\tsetFloatArray(pGT->shift, 3, "pxyz", tagStr);\n\tsetFloatValue(&pGT->shift[0], "px", tagStr);\n\tsetFloatValue(&pGT->shift[1], "py", tagStr);\n\tsetFloatValue(&pGT->shift[2], "pz", tagStr);\n\t\/\/angles\n\tsetFloatArray(pGT->spin, 3, "axyz", tagStr);\n\tsetFloatValue(&pGT->spin[0], "ax", tagStr);\n\tsetFloatValue(&pGT->spin[1], "ay", tagStr);\n\tsetFloatValue(&pGT->spin[2], "az", tagStr);\n\t\/\/scale\n\tsetFloatArray(pGT->scale, 3, "scale", tagStr);\n\n\tpGT->onThe = getStringValue("onThe", tagStr);\n\tpGT->allign = getStringValue("allign", tagStr);\n\tpGT->headZto = getStringValue("headZto", tagStr);\n\t\/\/limit to\n\tif(varExists("all",tagStr))\n\t\tpGT->pGroup = NULL;\n\tif (varExists("lastClosedGroup", tagStr))\n\t\tpGT->pGroup = pMB->pLastClosedGroup;\n\tif (varExists("markedAs", tagStr))\n\t\tpGT->limit2mark(pGT, getStringValue("markedAs", tagStr));\n\tsetFloatArray(pGT->pMin, 3, "xyzMin", tagStr);\n\tsetFloatArray(pGT->pMax, 3, "xyzMax", tagStr);\n\n\tif (varExists("sizeD", tagStr)) { \/\/re-size\n\t\tfloat sizeD[3];\n\t\tsetFloatArray(sizeD, 3, "sizeD", tagStr);\n\t\t\/\/bounding box\n\t\tpGT->flagSelection(pGT, &pMB->vertices, NULL);\n\t\tfloat bbMin[3];\n\t\tfloat bbMax[3];\n\t\tpGT->buildBoundingBoxFlagged(bbMin, bbMax, &pMB->vertices);\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tfloat size = bbMax[i] - bbMin[i];\n\t\t\tpGT->scale[i] = (size + sizeD[i]) \/ size;\n\t\t}\n\t}\n\n\treturn 1;\n}\nint ModelLoader::processTag_do(ModelLoader* pML) {\n\tModelBuilder* pMB = pML->pModelBuilder;\n\tGroupTransform gt;\n\tfillProps_gt(>, pMB, pML->currentTag);\n\tgt.flagSelection(>, &pMB->vertices, &pMB->triangles);\n\tgt.transformFlagged(>, &pMB->vertices);\n\treturn 1;\n}\nint ModelLoader::processTag_a2mesh(ModelLoader* pML) {\n\tModelBuilder* pMB = pML->pModelBuilder;\n\tstd::string tagStr = pML->currentTag;\n\tGroupTransform gt;\n\tfillProps_gt(>, pMB, pML->currentTag);\n\tgt.flagSelection(>, &pMB->vertices, &pMB->triangles);\n\t\/\/clone a copy\n\tstd::vector<Vertex01*> vx1;\n\tstd::vector<Triangle01*> tr1;\n\tgt.cloneFlagged(NULL, &vx1, &tr1, &pMB->vertices, &pMB->triangles);\n\t\/\/ build transform and inverted martrices\n\tmat4x4 transformMatrix;\n\tgt.buildTransformMatrix(>, &transformMatrix);\n\tmat4x4 transformMatrixInverted;\n\tmat4x4_invert(transformMatrixInverted, transformMatrix);\n\t\/\/move\/rotate cloned\n\tgt.flagAll(&vx1, &tr1);\n\t\/\/gt.transformFlagged(&pMB->vertices, &transformMatrixInverted);\n\tgt.transformFlaggedMx(&vx1, &transformMatrixInverted);\n\n\/\/gt.cloneFlagged(pMB, &pMB->vertices, &pMB->triangles, &vx1, &tr1);\n\n\tfloat wh[2];\n\tsetFloatArray(wh, 2, "wh", tagStr);\n\tPolygon frame;\n\tframe.setRectangle(&frame, wh[0],wh[1]);\n\t\/\/destination arrays\n\tstd::vector<Vertex01*> vx2;\n\tstd::vector<Triangle01*> tr2;\n\tPolygon triangle;\n\tfor (int i = tr1.size() - 1; i >= 0; i--) {\n\t\ttriangle.setTriangle(&triangle, tr1.at(i), &vx1);\n\t\tPolygon intersection;\n\t\tint pointsN = Polygon::xyIntersection(&intersection, &frame, &triangle);\n\t\tif (pointsN > 2) {\n\t\t\tPolygon::buildTriangles(&intersection);\n\t\t\tGroupTransform::flagAll (&intersection.vertices, &intersection.triangles);\n\t\t\tGroupTransform::cloneFlagged(NULL, &vx2, &tr2, &intersection.vertices, &intersection.triangles);\n\t\t}\n\t}\n\tgt.flagAll(&vx2, &tr2);\n\t\/\/------------\n\t\/\/replace material\n\tMaterial mt;\n\tmt.setShaderType("phong");\n\tmt.uColor.setRGBA(0,255,0,255);\n\tint mtN = pMB->useMaterial(pMB, &mt);\n\tfor (int i = vx2.size() - 1; i >= 0; i--)\n\t\tvx2.at(i)->materialN = mtN;\n\tfor (int i = tr2.size() - 1; i >= 0; i--)\n\t\ttr2.at(i)->materialN = mtN;\n\t\/\/------------\n \t\/\/move\/rotate\n\tgt.transformFlaggedMx(&vx2, &transformMatrix);\n\t\/\/clone back to modelBuilder arrays\n\tgt.cloneFlagged(pMB, &pMB->vertices, &pMB->triangles, &vx2, &tr2);\n\n\t\/\/clear memory\n\tfor (int i = vx1.size() - 1; i >= 0; i--)\n\t\tdelete vx1.at(i);\n\tvx1.clear();\n\tfor (int i = tr1.size() - 1; i >= 0; i--)\n\t\tdelete tr1.at(i);\n\ttr1.clear();\n\tfor (int i = vx2.size() - 1; i >= 0; i--)\n\t\tdelete vx2.at(i);\n\tvx2.clear();\n\tfor (int i = tr2.size() - 1; i >= 0; i--)\n\t\tdelete tr2.at(i);\n\ttr2.clear();\n\n\treturn 1;\n}\n\n<\/pre><\/div>\n\n\n
<\/p>\n\n\n\n
<\/p>\n\n\n\n
<\/p>\n\n\n\n
<\/p>\n\n\n\n<\/group sizeD=\"0.1,0,0.1\"><\/code><\/pre>\n\n\n\n
\n\n\n\n
<\/p>\n\n\n\n
\n\n\n\nAndroid<\/h2>\n\n\n\n
\n\n\n\n
\n\n\n\n
\n\n\n\n
\n\n\n\n