{"id":964,"date":"2022-05-03T17:59:52","date_gmt":"2022-05-03T09:59:52","guid":{"rendered":"https:\/\/dcupqiu.club\/?p=964"},"modified":"2022-05-03T18:02:34","modified_gmt":"2022-05-03T10:02:34","slug":"pilot%e5%b0%8f%e5%bc%95%e6%93%8e%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b01-editor%e7%9b%b8%e5%85%b3","status":"publish","type":"post","link":"https:\/\/dcupqiu.club\/?p=964","title":{"rendered":"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Editor\u4e3b\u4f53\u67b6\u6784<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">namespace Pilot\n{\n    class EditorUI;\n    class PilotEngine;\n\n    class PilotEditor : public PublicSingleton&lt;PilotEditor>\n    {\n        friend class EditorUI;\n        friend class PublicSingleton&lt;PilotEditor>;\n\n    public:\n        virtual ~PilotEditor();\n\n        void initialize(PilotEngine* engine_runtime);\n        void clear();\n\n        void run();\n\n    protected:\n        PilotEditor();\n\n        void   onWindowChanged(float pos_x, float pos_y, float width, float height) const;\n        size_t onUpdateCursorOnAxis(int axis_mode, const Vector2&amp; cursor_uv, const Vector2&amp; window_size) const;\n        size_t getGuidOfPickedMesh(const Vector2&amp; picked_uv) const;\n\n        std::shared_ptr&lt;EditorUI> m_editor_ui;\n        PilotEngine*              m_engine_runtime {nullptr};\n    };\n} \/\/ namespace Pilot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Editor\u5b9e\u4f8b\u5305\u62ec\u4e86run()\u5faa\u73af\u63a5\u53e3\u4ee5\u53ca onWindowChanged \uff0cgetGuidOfPickedMesh\u548c onUpdatedCursorOnAxis\u4e09\u4e2a\u56de\u8c03\u51fd\u6570\uff0c\u5206\u522b\u5904\u7406\u7a97\u53e3\u5927\u5c0f\u66f4\u6539\uff0c\u5750\u6807\u8f74\u66f4\u6539\uff0c\u4ee5\u53ca\u7a97\u53e3\u4e2d\u9009\u4e2d\u64cd\u4f5c\u3002<br>\u5176\u4e2dEditorUI\u5b9e\u73b0\u4f7f\u7528listener\u6a21\u578b\uff0cEditorUI \u7ee7\u627f\u81earender\u4e2dSurfaceUI\u5b9e\u73b0\u3002<br>\u521d\u59cb\u5316\u8fc7\u7a0b\u4e2d\u5c06\u81ea\u8eab\u4f20\u9012  engine_runtime\u4e2d\u7684Render\u8fdb\u884c\u7ed1\u5b9a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">    void PilotEditor::initialize(PilotEngine* engine_runtime)\n    {\n        assert(engine_runtime);\n\n        m_engine_runtime = engine_runtime;\n        m_editor_ui      = std::make_shared&lt;EditorUI>(this);\n\n        std::shared_ptr&lt;PilotRenderer> render = m_engine_runtime->getRender();\n        assert(render);\n\n        render->setSurfaceUI(m_editor_ui);\n    }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Editor\u7684Run\u65b9\u6cd5\u8c03\u7528engine_runtime\u4e2d\u7684main_loop run()<br>\u5176\u4f59\u4e09\u4e2a\u56de\u8c03\u662f\u5bf9engine_runtime\u4e2drender\u7684\u65b9\u6cd5\u7684\u5305\u88c5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">    void PilotEditor::onWindowChanged(float pos_x, float pos_y, float width, float height) const\n    {\n        std::shared_ptr&lt;PilotRenderer> render = m_engine_runtime->getRender();\n        assert(render);\n\n        render->updateWindow(pos_x, pos_y, width, height);\n    }\n\n    size_t PilotEditor::onUpdateCursorOnAxis(int axis_mode, const Vector2&amp; cursor_uv, const Vector2&amp; window_size) const\n    {\n        std::shared_ptr&lt;PilotRenderer> render = m_engine_runtime->getRender();\n        assert(render);\n\n        return render->updateCursorOnAxis(axis_mode, cursor_uv, window_size);\n    }\n\n    size_t PilotEditor::getGuidOfPickedMesh(const Vector2&amp; picked_uv) const\n    {\n        std::shared_ptr&lt;PilotRenderer> render = m_engine_runtime->getRender();\n        assert(render);\n\n        return render->getGuidOfPickedMesh(picked_uv);\n    }<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Editor_UI\u89e3\u6790<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">EditorUI\u7ee7\u627f\u81eaRender\u4e2d\u62bd\u8c61\u7c7bSurfaceUI\uff0c SurfaceUI\u5b9a\u4e49\u4e86\u6210\u5458\u5bf9\u8c61 shared_ptr&lt;SurfaceIO> m_io\uff0c\u521d\u59cb\u5316\u51fd\u6570initialize(std::shared_ptr&lt;SurfaceIO> pio)\uff0c\u72b6\u6001\u53d8\u91cf\u6307\u9488UIState* m_tmp_uistate\uff0c\u4ee5\u53caUI\u7528\u4e8e\u6e32\u67d3\u7684\u63a5\u53e3void onTick(UIState* uistate)\uff0cvoid registerInput()\uff0c\u4ee5\u53ca\u83b7\u53d6\u7a97\u53e3\u7f29\u653e\u6bd4\u4f8b\u51fd\u6570float getContentScale\u3002<br><strong>SurfaceIO\u7c7b<\/strong>\u662f\u5bf9\u7a97\u53e3\u4e2d\u5177\u4f53\u54cd\u5e94\u4e8b\u4ef6\u7684\u5c01\u88c5\uff0c\u57fa\u4e8eGLFW\u7684api\uff0c\u5b9a\u4e49\u4e86\u7528\u4e8e\u54cd\u5e94GLFW\u7a97\u53e3io\u7684static\u56de\u8c03\u51fd\u6570\uff0c\u6307\u5411\u5177\u4f53\u7684\u56de\u8c03\u5b9e\u73b0\u3002\u4f7f\u7528STL\u5bb9\u5668vector&lt;onXxFunc>\u5b58\u50a8\u51fd\u6570\u6307\u9488\uff0c\u6279\u91cf\u5904\u7406\u5bf9\u5e94\u56de\u8c03\u7684\u54cd\u5e94\u3002<br><strong>EditorUI<\/strong>\u7684\u6784\u9020\u51fd\u6570\u5bf9\u8d44\u6e90creator\u8fdb\u884c\u4e86unordered_map\u7684\u7ed1\u5b9a\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3b\u8981\u662fimgui\u90e8\u5206\u7684\u8c03\u7528\uff0c\u90e8\u5206\u901a\u8fc7\u6307\u9488\u8c03\u7528\u4e86vulkan\u90a3\u8fb9window\u7684\u56de\u8c03\uff0c\u5b9e\u73b0\u4e86\u5bf9\u8c61\u9009\u62e9\uff0caxis\u663e\u793a\u4e4b\u7c7b\u7684\uff0c\u8fd9\u90e8\u5206\u5f85\u7eed\uff0c\u76f4\u63a5\u770beigen\u90e8\u5206\u53bb\u3002<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Editor\u4e3b\u4f53\u67b6\u6784 Editor\u5b9e\u4f8b\u5305\u62ec\u4e86run&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,11],"tags":[],"class_list":["post-964","post","type-post","status-publish","format-standard","hentry","category-c-plus-plus","category-programer-language"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.5.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173 - \u79cb\u5586\u306eSite<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dcupqiu.club\/?p=964\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173 - \u79cb\u5586\u306eSite\" \/>\n<meta property=\"og:description\" content=\"Editor\u4e3b\u4f53\u67b6\u6784 Editor\u5b9e\u4f8b\u5305\u62ec\u4e86run...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dcupqiu.club\/?p=964\" \/>\n<meta property=\"og:site_name\" content=\"\u79cb\u5586\u306eSite\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-03T09:59:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-05-03T10:02:34+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79cb\u5586\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dcupqiu.club\/#website\",\"url\":\"https:\/\/dcupqiu.club\/\",\"name\":\"\u79cb\u5586\u306eSite\",\"description\":\"WwwwwW\",\"publisher\":{\"@id\":\"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dcupqiu.club\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dcupqiu.club\/?p=964#webpage\",\"url\":\"https:\/\/dcupqiu.club\/?p=964\",\"name\":\"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173 - \u79cb\u5586\u306eSite\",\"isPartOf\":{\"@id\":\"https:\/\/dcupqiu.club\/#website\"},\"datePublished\":\"2022-05-03T09:59:52+00:00\",\"dateModified\":\"2022-05-03T10:02:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dcupqiu.club\/?p=964#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dcupqiu.club\/?p=964\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dcupqiu.club\/?p=964#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/dcupqiu.club\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/dcupqiu.club\/?p=964#article\",\"isPartOf\":{\"@id\":\"https:\/\/dcupqiu.club\/?p=964#webpage\"},\"author\":{\"@id\":\"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20\"},\"headline\":\"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173\",\"datePublished\":\"2022-05-03T09:59:52+00:00\",\"dateModified\":\"2022-05-03T10:02:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dcupqiu.club\/?p=964#webpage\"},\"wordCount\":77,\"publisher\":{\"@id\":\"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20\"},\"articleSection\":[\"C++\",\"\u7a0b\u5e8f\u8bed\u8a00\u5b66\u4e60\"],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20\",\"name\":\"\u79cb\u5586\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/dcupqiu.club\/#personlogo\",\"inLanguage\":\"zh-Hans\",\"url\":\"https:\/\/dcupqiu.club\/wp-content\/uploads\/\/2022\/04\/ww.png\",\"contentUrl\":\"https:\/\/dcupqiu.club\/wp-content\/uploads\/\/2022\/04\/ww.png\",\"width\":920,\"height\":700,\"caption\":\"\u79cb\u5586\"},\"logo\":{\"@id\":\"https:\/\/dcupqiu.club\/#personlogo\"},\"sameAs\":[\"http:\/\/dcupqiu.club\"],\"url\":\"https:\/\/dcupqiu.club\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173 - \u79cb\u5586\u306eSite","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dcupqiu.club\/?p=964","og_locale":"zh_CN","og_type":"article","og_title":"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173 - \u79cb\u5586\u306eSite","og_description":"Editor\u4e3b\u4f53\u67b6\u6784 Editor\u5b9e\u4f8b\u5305\u62ec\u4e86run...","og_url":"https:\/\/dcupqiu.club\/?p=964","og_site_name":"\u79cb\u5586\u306eSite","article_published_time":"2022-05-03T09:59:52+00:00","article_modified_time":"2022-05-03T10:02:34+00:00","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79cb\u5586","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/dcupqiu.club\/#website","url":"https:\/\/dcupqiu.club\/","name":"\u79cb\u5586\u306eSite","description":"WwwwwW","publisher":{"@id":"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dcupqiu.club\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"https:\/\/dcupqiu.club\/?p=964#webpage","url":"https:\/\/dcupqiu.club\/?p=964","name":"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173 - \u79cb\u5586\u306eSite","isPartOf":{"@id":"https:\/\/dcupqiu.club\/#website"},"datePublished":"2022-05-03T09:59:52+00:00","dateModified":"2022-05-03T10:02:34+00:00","breadcrumb":{"@id":"https:\/\/dcupqiu.club\/?p=964#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dcupqiu.club\/?p=964"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dcupqiu.club\/?p=964#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/dcupqiu.club\/"},{"@type":"ListItem","position":2,"name":"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173"}]},{"@type":"Article","@id":"https:\/\/dcupqiu.club\/?p=964#article","isPartOf":{"@id":"https:\/\/dcupqiu.club\/?p=964#webpage"},"author":{"@id":"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20"},"headline":"Pilot\u5c0f\u5f15\u64ce\u5b66\u4e60\u7b14\u8bb0(1)\u2014\u2014Editor\u76f8\u5173","datePublished":"2022-05-03T09:59:52+00:00","dateModified":"2022-05-03T10:02:34+00:00","mainEntityOfPage":{"@id":"https:\/\/dcupqiu.club\/?p=964#webpage"},"wordCount":77,"publisher":{"@id":"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20"},"articleSection":["C++","\u7a0b\u5e8f\u8bed\u8a00\u5b66\u4e60"],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20","name":"\u79cb\u5586","image":{"@type":"ImageObject","@id":"https:\/\/dcupqiu.club\/#personlogo","inLanguage":"zh-Hans","url":"https:\/\/dcupqiu.club\/wp-content\/uploads\/\/2022\/04\/ww.png","contentUrl":"https:\/\/dcupqiu.club\/wp-content\/uploads\/\/2022\/04\/ww.png","width":920,"height":700,"caption":"\u79cb\u5586"},"logo":{"@id":"https:\/\/dcupqiu.club\/#personlogo"},"sameAs":["http:\/\/dcupqiu.club"],"url":"https:\/\/dcupqiu.club\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/posts\/964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=964"}],"version-history":[{"count":30,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/posts\/964\/revisions"}],"predecessor-version":[{"id":994,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/posts\/964\/revisions\/994"}],"wp:attachment":[{"href":"https:\/\/dcupqiu.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}