{"id":94784,"date":"2026-08-15T09:48:54","date_gmt":"2026-08-15T01:48:54","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/94784.html"},"modified":"2026-08-15T09:48:54","modified_gmt":"2026-08-15T01:48:54","slug":"vulkanscenegraph%e5%ad%a6%e4%b9%a0%e6%95%99%e7%a8%8b%ef%bc%88%e5%8d%81%e4%b8%89%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/94784.html","title":{"rendered":"VulkanSceneGraph\u5b66\u4e60\u6559\u7a0b\uff08\u5341\u4e09\uff09"},"content":{"rendered":"<h2 id=\"-13- - -3d-\">\u7b2c 13 \u7ae0\u3000\u52a0\u8f7d 3D \u6a21\u578b<\/h2>\n<p>\u6458\u8981&#xff1a;\u672c\u7ae0\u7cfb\u7edf\u4ecb\u7ecd\u4e86\u5728 VulkanSceneGraph (VSG) \u4e2d\u52a0\u8f7d\u5916\u90e8 3D \u6a21\u578b\u7684\u6838\u5fc3\u6d41\u7a0b\u3002\u91cd\u70b9\u9610\u8ff0\u4e86\u5982\u4f55\u4f7f\u7528\u7edf\u4e00\u7684 vsg::read() \u51fd\u6570\u52a0\u8f7d glTF\/OBJ \u7b49\u683c\u5f0f\u7684\u6a21\u578b&#xff0c;\u5f3a\u8c03\u4e86 vsgXchange \u7ec4\u4ef6\u5e93\u5728\u63d0\u4f9b\u683c\u5f0f\u652f\u6301\u4e2d\u7684\u5173\u952e\u4f5c\u7528&#xff0c;\u5e76\u8be6\u7ec6\u8bf4\u660e\u4e86 CMake \u7684\u94fe\u63a5\u914d\u7f6e\u65b9\u6cd5\u3002\u6b64\u5916&#xff0c;\u672c\u7ae0\u8fd8\u89e3\u91ca\u4e86\u52a0\u8f7d\u540e\u5f97\u5230\u7684 Node \u5b50\u6811\u7ed3\u6784\u3001\u5982\u4f55\u901a\u8fc7 vsg::Options \u63a7\u5236\u52a0\u8f7d\u884c\u4e3a&#xff08;\u5982\u5750\u6807\u8f74\u8f6c\u6362\u548c\u8d44\u6e90\u8def\u5f84&#xff09;&#xff0c;\u5e76\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5b8c\u6574\u7684\u6a21\u578b\u67e5\u770b\u5668\u793a\u4f8b\u3002\u6700\u540e&#xff0c;\u603b\u7ed3\u4e86\u5e38\u89c1\u95ee\u9898\u7684\u6392\u67e5\u601d\u8def&#xff0c;\u4e3a\u540e\u7eed\u7684\u6a21\u578b\u53d8\u6362\u3001\u52a8\u753b\u548c\u7eb9\u7406\u5b66\u4e60\u5960\u5b9a\u4e86\u57fa\u7840\u3002<\/p>\n<p>\u672c\u7ae0\u5b9a\u4f4d&#xff1a;\u5b9e\u9645\u9879\u76ee\u5f88\u5c11\u624b\u6413\u51e0\u4f55\u4f53\u2014\u2014vsgXchange \u7ec4\u4ef6\u5e93\u8ba9 vsg::read() \u76f4\u63a5\u5403 glTF \/ OBJ \/ \u56fe\u50cf \/ \u5b57\u4f53\u3002\u672c\u7ae0\u8bb2\u6e05\u300c\u4e00\u884c\u8bfb\u53d6\u3001\u6302\u5165\u573a\u666f\u56fe\u300d\u3002<\/p>\n<hr \/>\n<h3 id=\"131-\">13.1 \u672c\u7ae0\u76ee\u6807<\/h3>\n<ul>\n<li>\u7528 vsg::read() \u52a0\u8f7d glTF \/ OBJ \u6a21\u578b&#xff1b;<\/li>\n<li>\u4e86\u89e3 vsgXchange \u5728\u80cc\u540e\u63d0\u4f9b\u7684\u683c\u5f0f\u652f\u6301&#xff1b;<\/li>\n<li>\u6b63\u786e\u94fe\u63a5 vsgXchange \u5e76\u914d\u7f6e CMake&#xff1b;<\/li>\n<li>\u77e5\u9053\u52a0\u8f7d\u8fdb\u6765\u7684 Node \u5df2\u7ecf\u81ea\u5e26\u51e0\u4f55\u4f53\u3001\u72b6\u6001\u4e0e\u63cf\u8ff0\u7b26\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3 id=\"132-\">13.2 \u524d\u7f6e\u51c6\u5907<\/h3>\n<ul>\n<li>\u7b2c 3 \u7ae0\u5df2\u88c5\u597d VSG \u5e76\u5b89\u88c5\u4e86 vsgXchange&#xff1b;<\/li>\n<li>\u7b2c 6 \u7ae0\u7406\u89e3\u573a\u666f\u56fe\u8282\u70b9\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3 id=\"133- vsgread\">13.3 \u7edf\u4e00\u5165\u53e3&#xff1a;vsg::read()<\/h3>\n<p>VSG \u7684 IO \u7cfb\u7edf\u6709\u4e00\u4e2a\u7edf\u4e00\u8bfb\u53d6\u51fd\u6570&#xff08;\u4f4d\u4e8e vsg\/io\/read.h&#xff09;&#xff1a;<\/p>\n<p>ref_ptr&lt;Object&gt; read(const Path&amp; filename, ref_ptr&lt;const Options&gt; options &#061; {});<\/p>\n<p>\u5b83\u6839\u636e\u6587\u4ef6\u6269\u5c55\u540d\u6311\u9009\u5df2\u6ce8\u518c\u7684 ReaderWriter\u3002vsgXchange \u5728\u94fe\u63a5\u540e\u81ea\u52a8\u6ce8\u518c\u5bf9 glTF\/OBJ\/KTX2\/PNG\/\u5b57\u4f53\u7b49\u7684\u652f\u6301\u3002<\/p>\n<p>\/\/ \u8bfb\u53d6 glTF&#xff08;vsgXchange \u63d0\u4f9b\u652f\u6301&#xff09;<br \/>\nauto object &#061; vsg::read(&#034;models\/duck.gltf&#034;);<br \/>\nif (!object)<br \/>\n{<br \/>\n    std::cerr &lt;&lt; &#034;\u52a0\u8f7d\u5931\u8d25&#xff1a;\u8bf7\u786e\u8ba4\u6587\u4ef6\u5b58\u5728\u4e14\u5df2\u94fe\u63a5 vsgXchange&#034; &lt;&lt; std::endl;<br \/>\n    return 1;<br \/>\n}<br \/>\nauto model &#061; vsg::ref_ptr&lt;vsg::Node&gt;(object);   \/\/ \u8f6c\u6362\u4e3a Node \u5e76\u6302\u5165\u573a\u666f\u56fe<br \/>\nroot-&gt;addChild(model);<\/p>\n<p>\u26a0\ufe0f \u5fc5\u987b\u94fe\u63a5 vsgXchange&#xff1a;\u6838\u5fc3\u5e93 vsg \u53ea\u8ba4\u81ea\u5bb6\u7684 .vsgt\/.vsgb \u7b49\u683c\u5f0f&#xff1b;glTF\/OBJ\/PNG \u5168\u9760 vsgXchange\u3002\u6ca1\u88c5\u5b83&#xff0c;vsg::read(&#034;x.gltf&#034;) \u4f1a\u8fd4\u56de null\u3002<\/p>\n<hr \/>\n<h3 id=\"134-cmake -vsgxchange\">13.4 CMake&#xff1a;\u94fe\u63a5 vsgXchange<\/h3>\n<p>find_package(vsg REQUIRED)<br \/>\nfind_package(vsgXchange REQUIRED)        # \u989d\u5916\u5f15\u5165\u6a21\u578b\/\u56fe\u50cf\u652f\u6301<\/p>\n<p>target_link_libraries(my_app PRIVATE vsg::vsg vsgXchange::vsgXchange)<\/p>\n<p>vsgXchange \u4f1a\u6309\u9700\u62c9\u5165 tinygltf\u3001libpng\u3001ktx \u7b49\u5e95\u5c42\u4f9d\u8d56&#xff08;\u591a\u6570\u901a\u8fc7 FetchContent \u81ea\u52a8\u5904\u7406&#xff09;\u3002<\/p>\n<hr \/>\n<h3 id=\"135-\">13.5 \u52a0\u8f7d\u8fdb\u6765\u7684\u8282\u70b9\u957f\u4ec0\u4e48\u6837<\/h3>\n<p>vsgXchange \u7684 glTF \u8bfb\u53d6\u5668\u4f1a\u628a\u6587\u4ef6\u89e3\u6790\u6210\u4e00\u68f5\u5b8c\u6574\u7684 Node \u5b50\u6811&#xff1a;<\/p>\n<ul>\n<li>\u7f51\u683c \u2192 vsg::Geometry&#xff08;\u9876\u70b9\/\u7d22\u5f15\/\u7ed8\u5236\u547d\u4ee4&#xff0c;\u89c1\u7b2c 7 \u7ae0&#xff09;&#xff1b;<\/li>\n<li>\u6750\u8d28\/\u7eb9\u7406 \u2192 \u81ea\u52a8\u751f\u6210 DescriptorImage &#043; Sampler&#xff0c;\u6302\u5230 StateGroup&#xff08;\u89c1\u7b2c 10 \u7ae0&#xff09;&#xff1b;<\/li>\n<li>\u53d8\u6362\u5c42\u7ea7 \u2192 vsg::MatrixTransform&#xff1b;<\/li>\n<li>\u52a8\u753b \u2192 vsg::Animation &#043; TransformSampler&#xff08;\u89c1\u7b2c 14 \u7ae0&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u4f60\u62ff\u5230\u7684\u5df2\u7ecf\u662f\u300c\u53ef\u6e32\u67d3\u300d\u7684\u573a\u666f\u56fe&#xff0c;\u901a\u5e38\u53ea\u9700\u5957\u4e00\u5c42 MatrixTransform \u8c03\u6574\u4f4d\u7f6e\/\u7f29\u653e\u5373\u53ef\u3002<\/p>\n<hr \/>\n<h3 id=\"136- vsgoptions\">13.6 \u52a0\u8f7d\u9009\u9879&#xff1a;vsg::Options<\/h3>\n<p>\u9700\u8981\u5750\u6807\u7cfb\u8f6c\u6362&#xff08;glTF \u662f Y-up&#xff0c;VSG \u5e38 Z-up&#xff09;\u3001\u7f29\u653e\u3001\u6216\u6307\u5b9a\u5b57\u4f53\/\u56fe\u50cf\u641c\u7d22\u8def\u5f84\u65f6&#xff0c;\u4f20 Options&#xff1a;<\/p>\n<p>auto options &#061; vsg::Options::create();<br \/>\noptions-&gt;paths &#061; vsg::Paths{&#034;models\/&#034;, &#034;textures\/&#034;};   \/\/ \u8d44\u6e90\u641c\u7d22\u8def\u5f84<br \/>\noptions-&gt;fileCache &#061; vsg::getFileCache();              \/\/ \u5171\u4eab\u5df2\u52a0\u8f7d\u5bf9\u8c61<br \/>\nauto model &#061; vsg::read(&#034;duck.gltf&#034;, options);<\/p>\n<p>glTF \u4e0e VSG \u7684\u5750\u6807\u8f74\u5dee\u5f02\u901a\u5e38\u7531 vsgXchange \u5728\u8bfb\u53d6\u65f6\u6309 options \u5904\u7406&#xff1b;\u9047\u5230\u6a21\u578b\u300c\u8eba\u5e73\u300d&#xff0c;\u591a\u534a\u662f up-axis \u6ca1\u8bbe\u5bf9&#xff0c;\u68c0\u67e5 Options \u7684\u8f74\u5411\/\u7f29\u653e\u8bbe\u7f6e\u3002<\/p>\n<hr \/>\n<h3 id=\"137-\">13.7 \u5b8c\u6574\u793a\u4f8b&#xff1a;\u52a0\u8f7d\u5e76\u67e5\u770b\u4e00\u4e2a\u6a21\u578b<\/h3>\n<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u3001\u53ef\u76f4\u63a5\u7f16\u8bd1\u8fd0\u884c\u7684 VSG \u7a0b\u5e8f\u793a\u4f8b&#xff0c;\u6f14\u793a\u5982\u4f55\u52a0\u8f7d glTF \u6a21\u578b\u5e76\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u67e5\u770b\u5668\u3002<\/p>\n<p>#include &lt;vsg\/all.h&gt;<br \/>\n#include &lt;iostream&gt;<\/p>\n<p>int main(int argc, char** argv)<br \/>\n{<br \/>\n    \/\/ 1. \u89e3\u6790\u547d\u4ee4\u884c\u53c2\u6570&#xff08;\u6a21\u578b\u6587\u4ef6\u8def\u5f84&#xff09;<br \/>\n    vsg::CommandLine arguments(&amp;argc, argv);<br \/>\n    auto modelFile &#061; arguments.value(std::string(&#034;models\/duck.gltf&#034;), &#034;&#8211;model&#034;);<br \/>\n    auto width &#061; arguments.value(1024, &#034;&#8211;width&#034;);<br \/>\n    auto height &#061; arguments.value(768, &#034;&#8211;height&#034;);<\/p>\n<p>    \/\/ 2. \u521b\u5efa\u7a97\u53e3\u548c\u67e5\u770b\u5668<br \/>\n    auto traits &#061; vsg::WindowTraits::create();<br \/>\n    traits-&gt;width &#061; width;<br \/>\n    traits-&gt;height &#061; height;<br \/>\n    traits-&gt;title &#061; &#034;VSG Model Viewer&#034;;<br \/>\n    auto window &#061; vsg::Window::create(traits);<br \/>\n    if (!window)<br \/>\n    {<br \/>\n        std::cerr &lt;&lt; &#034;\u65e0\u6cd5\u521b\u5efa\u7a97\u53e3&#034; &lt;&lt; std::endl;<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    auto viewer &#061; vsg::Viewer::create();<br \/>\n    viewer-&gt;addWindow(window);<\/p>\n<p>    \/\/ 3. \u52a0\u8f7d\u6a21\u578b&#xff08;\u9700\u8981\u5df2\u94fe\u63a5 vsgXchange&#xff09;<br \/>\n    auto options &#061; vsg::Options::create();<br \/>\n    options-&gt;paths &#061; vsg::getEnvPaths(&#034;VSG_FILE_PATH&#034;); \/\/ \u4ece\u73af\u5883\u53d8\u91cf\u83b7\u53d6\u641c\u7d22\u8def\u5f84<br \/>\n    options-&gt;paths.push_back(&#034;models\/&#034;);                \/\/ \u6dfb\u52a0\u672c\u5730\u6a21\u578b\u76ee\u5f55<br \/>\n    options-&gt;paths.push_back(&#034;textures\/&#034;);              \/\/ \u6dfb\u52a0\u7eb9\u7406\u76ee\u5f55<\/p>\n<p>    auto model &#061; vsg::read&lt;vsg::Node&gt;(modelFile, options);<br \/>\n    if (!model)<br \/>\n    {<br \/>\n        std::cerr &lt;&lt; &#034;\u6a21\u578b\u52a0\u8f7d\u5931\u8d25: &#034; &lt;&lt; modelFile &lt;&lt; std::endl;<br \/>\n        std::cerr &lt;&lt; &#034;\u8bf7\u786e\u8ba4&#xff1a;&#034; &lt;&lt; std::endl;<br \/>\n        std::cerr &lt;&lt; &#034;  1. \u6587\u4ef6\u8def\u5f84\u6b63\u786e&#034; &lt;&lt; std::endl;<br \/>\n        std::cerr &lt;&lt; &#034;  2. \u5df2\u5b89\u88c5\u5e76\u94fe\u63a5 vsgXchange&#034; &lt;&lt; std::endl;<br \/>\n        std::cerr &lt;&lt; &#034;  3. \u4f9d\u8d56\u7684\u7eb9\u7406\u6587\u4ef6\u5728\u641c\u7d22\u8def\u5f84\u4e2d&#034; &lt;&lt; std::endl;<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    \/\/ 4. \u521b\u5efa\u573a\u666f\u56fe\u6839\u8282\u70b9<br \/>\n    auto root &#061; vsg::Group::create();<\/p>\n<p>    \/\/ 5. \u6dfb\u52a0\u53d8\u6362\u8282\u70b9\u8c03\u6574\u6a21\u578b\u4f4d\u7f6e\u548c\u5927\u5c0f<br \/>\n    auto transform &#061; vsg::MatrixTransform::create();<br \/>\n    \/\/ \u5c06\u6a21\u578b\u5c45\u4e2d\u5e76\u9002\u5f53\u7f29\u653e<br \/>\n    transform-&gt;matrix &#061; vsg::translate(0.0, 0.0, 0.0) * vsg::scale(0.5, 0.5, 0.5);<br \/>\n    transform-&gt;addChild(model);<br \/>\n    root-&gt;addChild(transform);<\/p>\n<p>    \/\/ 6. \u8bbe\u7f6e\u76f8\u673a<br \/>\n    auto camera &#061; vsg::Camera::create();<\/p>\n<p>    \/\/ \u900f\u89c6\u6295\u5f71<br \/>\n    double aspect &#061; static_cast&lt;double&gt;(width) \/ static_cast&lt;double&gt;(height);<br \/>\n    camera-&gt;projectionMatrix &#061; vsg::Perspective::create(60.0, aspect, 0.1, 100.0);<\/p>\n<p>    \/\/ \u89c2\u5bdf\u77e9\u9635&#xff1a;\u76f8\u673a\u5728 (0, 2, 5)&#xff0c;\u770b\u5411\u539f\u70b9&#xff0c;\u4e0a\u65b9\u5411\u4e3a Y \u8f74<br \/>\n    camera-&gt;viewMatrix &#061; vsg::LookAt::create(<br \/>\n        vsg::dvec3(0.0, 2.0, 5.0),   \/\/ \u76f8\u673a\u4f4d\u7f6e<br \/>\n        vsg::dvec3(0.0, 0.0, 0.0),   \/\/ \u89c2\u5bdf\u76ee\u6807<br \/>\n        vsg::dvec3(0.0, 1.0, 0.0)    \/\/ \u4e0a\u65b9\u5411<br \/>\n    );<\/p>\n<p>    \/\/ \u89c6\u53e3\u4e0e\u7a97\u53e3\u5927\u5c0f\u4e00\u81f4<br \/>\n    camera-&gt;viewportState &#061; vsg::ViewportState::create(window-&gt;extent2D());<\/p>\n<p>    \/\/ 7. \u521b\u5efa\u6e32\u67d3\u56fe\u548c\u547d\u4ee4\u56fe<br \/>\n    auto renderGraph &#061; vsg::createRenderGraphForView(window, camera, root);<br \/>\n    auto commandGraph &#061; vsg::createCommandGraphForView(window, camera, root);<\/p>\n<p>    \/\/ 8. \u914d\u7f6e\u67e5\u770b\u5668<br \/>\n    viewer-&gt;assignRecordAndSubmitTaskAndPresentation({commandGraph});<\/p>\n<p>    \/\/ 9. \u7f16\u8bd1\u573a\u666f\u56fe<br \/>\n    auto compileResult &#061; viewer-&gt;compile();<br \/>\n    if (!compileResult)<br \/>\n    {<br \/>\n        std::cerr &lt;&lt; &#034;\u573a\u666f\u56fe\u7f16\u8bd1\u5931\u8d25&#034; &lt;&lt; std::endl;<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    \/\/ 10. \u6dfb\u52a0\u8f68\u9053\u76f8\u673a\u63a7\u5236\u5668&#xff08;\u65b9\u4fbf\u4ea4\u4e92\u67e5\u770b&#xff09;<br \/>\n    auto trackball &#061; vsg::Trackball::create(camera, window);<br \/>\n    viewer-&gt;addEventHandler(trackball);<\/p>\n<p>    \/\/ 11. \u4e3b\u6e32\u67d3\u5faa\u73af<br \/>\n    std::cout &lt;&lt; &#034;\u6210\u529f\u52a0\u8f7d\u6a21\u578b: &#034; &lt;&lt; modelFile &lt;&lt; std::endl;<br \/>\n    std::cout &lt;&lt; &#034;\u6309 ESC \u952e\u9000\u51fa\u7a0b\u5e8f&#034; &lt;&lt; std::endl;<\/p>\n<p>    while (viewer-&gt;advanceToNextFrame())<br \/>\n    {<br \/>\n        \/\/ \u5904\u7406\u7a97\u53e3\u4e8b\u4ef6&#xff08;\u9f20\u6807\u3001\u952e\u76d8\u7b49&#xff09;<br \/>\n        viewer-&gt;handleEvents();<\/p>\n<p>        \/\/ \u66f4\u65b0\u573a\u666f&#xff08;\u52a8\u753b\u3001\u76f8\u673a\u7b49&#xff09;<br \/>\n        viewer-&gt;update();<\/p>\n<p>        \/\/ \u8bb0\u5f55\u547d\u4ee4\u7f13\u51b2\u533a\u5e76\u63d0\u4ea4<br \/>\n        viewer-&gt;recordAndSubmit();<\/p>\n<p>        \/\/ \u5448\u73b0\u5230\u5c4f\u5e55<br \/>\n        viewer-&gt;present();<br \/>\n    }<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<h4>CMakeLists.txt \u914d\u7f6e<\/h4>\n<p>\u786e\u4fdd\u4f60\u7684 CMakeLists.txt \u6b63\u786e\u94fe\u63a5\u4e86 vsgXchange&#xff1a;<\/p>\n<p>cmake_minimum_required(VERSION 3.12)<br \/>\nproject(model_viewer)<\/p>\n<p>find_package(vsg REQUIRED)<br \/>\nfind_package(vsgXchange REQUIRED)  # \u5173\u952e&#xff1a;\u5f15\u5165\u6a21\u578b\/\u56fe\u50cf\u652f\u6301<\/p>\n<p>add_executable(model_viewer main.cpp)<br \/>\ntarget_link_libraries(model_viewer PRIVATE<br \/>\n    vsg::vsg<br \/>\n    vsgXchange::vsgXchange  # \u5173\u952e&#xff1a;\u94fe\u63a5 vsgXchange<br \/>\n)<\/p>\n<h4>\u8fd0\u884c\u8bf4\u660e<\/h4>\n<li>\u51c6\u5907\u6a21\u578b\u6587\u4ef6&#xff1a;\u5c06 glTF \u6a21\u578b&#xff08;\u5982 duck.gltf&#xff09;\u653e\u5728 models\/ \u76ee\u5f55\u4e0b<\/li>\n<li>\u7f16\u8bd1&#xff1a;\n<p>mkdir build &amp;&amp; cd build<br \/>\ncmake .. -DCMAKE_PREFIX_PATH&#061;\/path\/to\/vsg\/install<br \/>\nmake\n<\/li>\n<li>\u8fd0\u884c&#xff1a;\n<p>.\/model_viewer &#8211;model models\/duck.gltf &#8211;width 1280 &#8211;height 720\n<\/li>\n<li>\u4ea4\u4e92&#xff1a;\n<ul>\n<li>\u9f20\u6807\u5de6\u952e\u62d6\u52a8&#xff1a;\u65cb\u8f6c\u6a21\u578b<\/li>\n<li>\u9f20\u6807\u53f3\u952e\u62d6\u52a8&#xff1a;\u5e73\u79fb\u6a21\u578b<\/li>\n<li>\u9f20\u6807\u6eda\u8f6e&#xff1a;\u7f29\u653e<\/li>\n<li>ESC \u952e&#xff1a;\u9000\u51fa\u7a0b\u5e8f<\/li>\n<\/ul>\n<\/li>\n<p>\u63d0\u793a&#xff1a;\u5982\u679c\u6a21\u578b\u663e\u793a\u5f02\u5e38&#xff08;\u5982\u98a0\u5012\u3001\u5927\u5c0f\u4e0d\u5408\u9002&#xff09;&#xff0c;\u53ef\u4ee5\u8c03\u6574 transform-&gt;matrix \u4e2d\u7684\u53d8\u6362\u53c2\u6570&#xff0c;\u6216\u5728 Options \u4e2d\u8bbe\u7f6e upAxis \u548c scale\u3002<\/p>\n<hr \/>\n<h3 id=\"138-\">13.8 \u5e38\u89c1\u95ee\u9898<\/h3>\n<table>\n<tr>\u73b0\u8c61\u539f\u56e0\u89e3\u51b3\u65b9\u6848<\/tr>\n<tbody>\n<tr>\n<td>vsg::read \u8fd4\u56de null<\/td>\n<td>\u672a\u94fe\u63a5 vsgXchange \u6216\u6587\u4ef6\/\u8def\u5f84\u9519\u8bef<\/td>\n<td>\u786e\u8ba4 target_link_libraries(&#8230; vsgXchange::vsgXchange)&#xff1b;\u68c0\u67e5\u8def\u5f84<\/td>\n<\/tr>\n<tr>\n<td>\u6a21\u578b\u98a0\u5012\/\u8eba\u5e73<\/td>\n<td>up-axis \/ \u7f29\u653e\u8bbe\u7f6e\u4e0d\u6b63\u786e<\/td>\n<td>\u5728 Options \u4e2d\u8bbe\u7f6e\u8f74\u5411\u4e0e\u7f29\u653e&#xff0c;\u6216\u4f7f\u7528\u5916\u5c42 MatrixTransform \u65cb\u8f6c<\/td>\n<\/tr>\n<tr>\n<td>\u7eb9\u7406\u4e22\u5931<\/td>\n<td>\u7eb9\u7406\u6587\u4ef6\u4e0d\u5728\u641c\u7d22\u8def\u5f84\u4e2d<\/td>\n<td>\u4f7f\u7528 Options::paths \u6307\u5b9a\u8d44\u6e90\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>\u7f16\u8bd1\u62a5\u627e\u4e0d\u5230 glTF \u7b26\u53f7<\/td>\n<td>\u53ea\u5b89\u88c5\u4e86\u6838\u5fc3\u5e93<\/td>\n<td>\u5b89\u88c5\u5e76\u94fe\u63a5 vsgXchange<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3 id=\"139-\">13.9 \u6027\u80fd\u4f18\u5316\u4e0e\u9ad8\u7ea7\u7528\u6cd5<\/h3>\n<p>\u5728\u638c\u63e1\u4e86\u57fa\u7840\u52a0\u8f7d\u6d41\u7a0b\u540e&#xff0c;\u4e86\u89e3\u4e00\u4e9b\u9ad8\u7ea7\u7528\u6cd5\u548c\u6027\u80fd\u4f18\u5316\u6280\u5de7\u80fd\u8ba9\u4f60\u5728\u590d\u6742\u9879\u76ee\u4e2d\u66f4\u9ad8\u6548\u5730\u4f7f\u7528 VSG \u7684\u6a21\u578b\u52a0\u8f7d\u529f\u80fd\u3002<\/p>\n<h4>1. \u8d44\u6e90\u590d\u7528&#xff1a;\u907f\u514d\u91cd\u590d\u52a0\u8f7d<\/h4>\n<p>\u5f53\u591a\u4e2a\u573a\u666f\u9700\u8981\u52a0\u8f7d\u540c\u4e00\u6a21\u578b\u6216\u7eb9\u7406\u65f6&#xff0c;\u91cd\u590d\u4ece\u78c1\u76d8\u8bfb\u53d6\u4f1a\u6d6a\u8d39 I\/O \u548c\u5185\u5b58\u3002VSG \u63d0\u4f9b\u4e86\u4e24\u79cd\u8d44\u6e90\u590d\u7528\u673a\u5236&#xff1a;<\/p>\n<h5>\u4f7f\u7528 vsg::SharedObjects \u5168\u5c40\u5171\u4eab<\/h5>\n<p>\/\/ \u521b\u5efa\u5168\u5c40\u5171\u4eab\u5bf9\u8c61\u7ba1\u7406\u5668<br \/>\nauto sharedObjects &#061; vsg::SharedObjects::create();<\/p>\n<p>\/\/ \u7b2c\u4e00\u6b21\u52a0\u8f7d\u65f6\u6ce8\u518c\u5230\u5171\u4eab\u7ba1\u7406\u5668<br \/>\nauto options &#061; vsg::Options::create();<br \/>\noptions-&gt;sharedObjects &#061; sharedObjects;<br \/>\nauto model1 &#061; vsg::read(&#034;models\/duck.gltf&#034;, options);<\/p>\n<p>\/\/ \u540e\u7eed\u52a0\u8f7d\u76f8\u540c\u6587\u4ef6\u65f6&#xff0c;\u76f4\u63a5\u4ece\u5171\u4eab\u7ba1\u7406\u5668\u83b7\u53d6<br \/>\nauto model2 &#061; vsg::read(&#034;models\/duck.gltf&#034;, options);  \/\/ \u590d\u7528\u5df2\u52a0\u8f7d\u7684\u8d44\u6e90<\/p>\n<h5>\u4f7f\u7528 Options::fileCache \u6587\u4ef6\u7ea7\u7f13\u5b58<\/h5>\n<p>\/\/ \u521b\u5efa\u5e26\u6587\u4ef6\u7f13\u5b58\u7684 Options<br \/>\nauto options &#061; vsg::Options::create();<br \/>\noptions-&gt;fileCache &#061; vsg::getFileCache();  \/\/ \u83b7\u53d6\u5168\u5c40\u6587\u4ef6\u7f13\u5b58<\/p>\n<p>\/\/ \u591a\u6b21\u8bfb\u53d6\u540c\u4e00\u6587\u4ef6&#xff0c;\u53ea\u6709\u7b2c\u4e00\u6b21\u4f1a\u771f\u6b63\u4ece\u78c1\u76d8\u52a0\u8f7d<br \/>\nauto texture1 &#061; vsg::read(&#034;textures\/diffuse.png&#034;, options);<br \/>\nauto texture2 &#061; vsg::read(&#034;textures\/diffuse.png&#034;, options);  \/\/ \u4ece\u7f13\u5b58\u83b7\u53d6<\/p>\n<p>\u9002\u7528\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li>SharedObjects&#xff1a;\u9002\u7528\u4e8e\u8fd0\u884c\u65f6\u9700\u8981\u591a\u6b21\u521b\u5efa\u76f8\u540c\u6a21\u578b\u7684\u573a\u666f&#xff08;\u5982\u6e38\u620f\u4e2d\u7684 NPC\u3001\u9053\u5177&#xff09;<\/li>\n<li>fileCache&#xff1a;\u9002\u7528\u4e8e\u7eb9\u7406\u3001\u5b57\u4f53\u7b49\u9759\u6001\u8d44\u6e90\u7684\u91cd\u590d\u52a0\u8f7d<\/li>\n<\/ul>\n<h4>2. \u7c7b\u578b\u5b89\u5168\u8bfb\u53d6&#xff1a;vsg::read_cast&lt;T&gt;()<\/h4>\n<p>\u6807\u51c6 vsg::read() \u8fd4\u56de ref_ptr&lt;Object&gt;&#xff0c;\u9700\u8981\u624b\u52a8\u7c7b\u578b\u8f6c\u6362\u3002\u4f7f\u7528 read_cast \u53ef\u4ee5\u5728\u8bfb\u53d6\u65f6\u76f4\u63a5\u8fdb\u884c\u7c7b\u578b\u68c0\u67e5&#xff1a;<\/p>\n<p>\/\/ \u4f20\u7edf\u65b9\u5f0f&#xff1a;\u9700\u8981\u624b\u52a8\u8f6c\u6362\u548c\u68c0\u67e5<br \/>\nauto object &#061; vsg::read(&#034;models\/duck.gltf&#034;);<br \/>\nif (object)<br \/>\n{<br \/>\n    auto node &#061; vsg::ref_ptr&lt;vsg::Node&gt;(object);  \/\/ \u624b\u52a8\u8f6c\u6362<br \/>\n    if (node) root-&gt;addChild(node);<br \/>\n}<\/p>\n<p>\/\/ \u7c7b\u578b\u5b89\u5168\u65b9\u5f0f&#xff1a;\u76f4\u63a5\u83b7\u53d6\u6307\u5b9a\u7c7b\u578b<br \/>\nauto node &#061; vsg::read_cast&lt;vsg::Node&gt;(&#034;models\/duck.gltf&#034;);<br \/>\nif (node) root-&gt;addChild(node);  \/\/ node \u5df2\u7ecf\u662f\u6b63\u786e\u7684\u7c7b\u578b<\/p>\n<p>\/\/ \u4e5f\u53ef\u4ee5\u7528\u4e8e\u8bfb\u53d6\u7279\u5b9a\u7c7b\u578b\u7684\u8d44\u6e90<br \/>\nauto image &#061; vsg::read_cast&lt;vsg::Data&gt;(&#034;textures\/diffuse.png&#034;);<br \/>\nauto font &#061; vsg::read_cast&lt;vsg::Font&gt;(&#034;fonts\/arial.ttf&#034;);<\/p>\n<p>\u4f18\u52bf&#xff1a;<\/p>\n<ul>\n<li>\u7f16\u8bd1\u65f6\u7c7b\u578b\u5b89\u5168&#xff0c;\u907f\u514d\u8fd0\u884c\u65f6\u7c7b\u578b\u9519\u8bef<\/li>\n<li>\u4ee3\u7801\u66f4\u7b80\u6d01&#xff0c;\u51cf\u5c11\u624b\u52a8\u7c7b\u578b\u8f6c\u6362<\/li>\n<li>\u6e05\u6670\u7684\u610f\u56fe\u8868\u8fbe&#xff0c;\u63d0\u9ad8\u4ee3\u7801\u53ef\u8bfb\u6027<\/li>\n<\/ul>\n<h4>3. \u5f02\u6b65\u52a0\u8f7d&#xff1a;\u63d0\u5347\u542f\u52a8\u548c\u5207\u6362\u6027\u80fd<\/h4>\n<p>\u5bf9\u4e8e\u5927\u578b\u6a21\u578b\u6216\u7f51\u7edc\u8d44\u6e90&#xff0c;\u540c\u6b65\u52a0\u8f7d\u4f1a\u963b\u585e\u4e3b\u7ebf\u7a0b\u3002VSG \u63d0\u4f9b\u4e86\u5f02\u6b65\u52a0\u8f7d\u673a\u5236&#xff1a;<\/p>\n<p>#include &lt;vsg\/threading\/OperationThreads.h&gt;<br \/>\n#include &lt;vsg\/io\/read.h&gt;<\/p>\n<p>\/\/ 1. \u521b\u5efa\u64cd\u4f5c\u7ebf\u7a0b\u6c60&#xff08;\u5efa\u8bae\u5728\u7a0b\u5e8f\u521d\u59cb\u5316\u65f6\u521b\u5efa&#xff09;<br \/>\nauto operationThreads &#061; vsg::OperationThreads::create(2);  \/\/ 2\u4e2a\u5de5\u4f5c\u7ebf\u7a0b<\/p>\n<p>\/\/ 2. \u521b\u5efa\u652f\u6301\u5f02\u6b65\u7684 Options<br \/>\nauto options &#061; vsg::Options::create();<br \/>\noptions-&gt;operationThreads &#061; operationThreads;<\/p>\n<p>\/\/ 3. \u5f02\u6b65\u8bfb\u53d6\u6a21\u578b<br \/>\nauto future &#061; vsg::readAsync&lt;vsg::Node&gt;(&#034;models\/large_scene.gltf&#034;, options);<\/p>\n<p>\/\/ \u4e3b\u7ebf\u7a0b\u53ef\u4ee5\u7ee7\u7eed\u505a\u5176\u4ed6\u4e8b\u60c5&#8230;<br \/>\nsetupCamera();<br \/>\nsetupLighting();<\/p>\n<p>\/\/ 4. \u9700\u8981\u6a21\u578b\u65f6\u68c0\u67e5\u662f\u5426\u52a0\u8f7d\u5b8c\u6210<br \/>\nif (future.valid() &amp;&amp; future.wait_for(std::chrono::seconds(0)) &#061;&#061; std::future_status::ready)<br \/>\n{<br \/>\n    auto model &#061; future.get();<br \/>\n    if (model) root-&gt;addChild(model);<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n    \/\/ \u53ef\u4ee5\u663e\u793a\u52a0\u8f7d\u8fdb\u5ea6\u6761\u6216\u5360\u4f4d\u6a21\u578b<br \/>\n    showLoadingIndicator();<\/p>\n<p>    \/\/ \u963b\u585e\u7b49\u5f85&#xff08;\u5982\u679c\u5fc5\u987b\u7acb\u5373\u4f7f\u7528&#xff09;<br \/>\n    \/\/ auto model &#061; future.get();<br \/>\n}<\/p>\n<p>\u9002\u7528\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li>\u5927\u578b\u573a\u666f\u52a0\u8f7d&#xff1a;\u6e38\u620f\u5173\u5361\u5207\u6362\u3001CAD \u6a21\u578b\u67e5\u770b\u5668<\/li>\n<li>\u7f51\u7edc\u8d44\u6e90&#xff1a;\u4ece\u7f51\u7edc\u52a0\u8f7d\u6a21\u578b\u6216\u7eb9\u7406<\/li>\n<li>\u540e\u53f0\u9884\u52a0\u8f7d&#xff1a;\u9884\u52a0\u8f7d\u4e0b\u4e00\u573a\u666f\u7684\u8d44\u6e90<\/li>\n<li>\u54cd\u5e94\u5f0f UI&#xff1a;\u907f\u514d\u52a0\u8f7d\u5361\u4f4f\u7528\u6237\u754c\u9762<\/li>\n<\/ul>\n<p>\u6ce8\u610f\u4e8b\u9879&#xff1a;<\/p>\n<ul>\n<li>\u5f02\u6b65\u52a0\u8f7d\u7684\u8d44\u6e90\u5728\u6dfb\u52a0\u5230\u573a\u666f\u56fe\u524d\u4e0d\u80fd\u8bbf\u95ee<\/li>\n<li>\u9700\u8981\u5408\u7406\u7ba1\u7406\u7ebf\u7a0b\u6c60\u5927\u5c0f&#xff0c;\u907f\u514d\u521b\u5efa\u8fc7\u591a\u7ebf\u7a0b<\/li>\n<li>\u5f02\u6b65\u52a0\u8f7d\u5931\u8d25\u65f6&#xff0c;future.get() \u53ef\u80fd\u629b\u51fa\u5f02\u5e38&#xff0c;\u9700\u8981\u9002\u5f53\u5904\u7406<\/li>\n<\/ul>\n<h4>4. \u7ec4\u5408\u4f7f\u7528\u793a\u4f8b<\/h4>\n<p>\u5728\u5b9e\u9645\u9879\u76ee\u4e2d&#xff0c;\u901a\u5e38\u4f1a\u7ec4\u5408\u4f7f\u7528\u8fd9\u4e9b\u6280\u672f&#xff1a;<\/p>\n<p>class ResourceManager {<br \/>\npublic:<br \/>\n    ResourceManager() {<br \/>\n        \/\/ \u521b\u5efa\u5171\u4eab\u5bf9\u8c61\u548c\u7ebf\u7a0b\u6c60<br \/>\n        sharedObjects &#061; vsg::SharedObjects::create();<br \/>\n        operationThreads &#061; vsg::OperationThreads::create(4);<\/p>\n<p>        options &#061; vsg::Options::create();<br \/>\n        options-&gt;sharedObjects &#061; sharedObjects;<br \/>\n        options-&gt;operationThreads &#061; operationThreads;<br \/>\n        options-&gt;fileCache &#061; vsg::getFileCache();<br \/>\n    }<\/p>\n<p>    vsg::ref_ptr&lt;vsg::Node&gt; loadModelAsync(const std::string&amp; path) {<br \/>\n        \/\/ \u68c0\u67e5\u662f\u5426\u5df2\u7f13\u5b58<br \/>\n        if (auto cached &#061; sharedObjects-&gt;get&lt;vsg::Node&gt;(path))<br \/>\n            return cached;<\/p>\n<p>        \/\/ \u5f02\u6b65\u52a0\u8f7d<br \/>\n        auto future &#061; vsg::readAsync&lt;vsg::Node&gt;(path, options);<br \/>\n        pendingFutures[path] &#061; std::move(future);<br \/>\n        return nullptr;<br \/>\n    }<\/p>\n<p>    bool tryGetModel(const std::string&amp; path, vsg::ref_ptr&lt;vsg::Node&gt;&amp; outModel) {<br \/>\n        if (auto it &#061; pendingFutures.find(path); it !&#061; pendingFutures.end()) {<br \/>\n            if (it-&gt;second.wait_for(std::chrono::seconds(0)) &#061;&#061; std::future_status::ready) {<br \/>\n                outModel &#061; it-&gt;second.get();<br \/>\n                pendingFutures.erase(it);<br \/>\n                return true;<br \/>\n            }<br \/>\n        }<br \/>\n        return false;<br \/>\n    }<\/p>\n<p>private:<br \/>\n    vsg::ref_ptr&lt;vsg::SharedObjects&gt; sharedObjects;<br \/>\n    vsg::ref_ptr&lt;vsg::OperationThreads&gt; operationThreads;<br \/>\n    vsg::ref_ptr&lt;vsg::Options&gt; options;<br \/>\n    std::unordered_map&lt;std::string, std::future&lt;vsg::ref_ptr&lt;vsg::Node&gt;&gt;&gt; pendingFutures;<br \/>\n};<\/p>\n<p>\u6027\u80fd\u5efa\u8bae&#xff1a;<\/p>\n<ul>\n<li>\u5c0f\u6587\u4ef6&#xff08;&lt; 10MB&#xff09;\u4f7f\u7528\u540c\u6b65\u52a0\u8f7d &#043; \u7f13\u5b58\u5373\u53ef<\/li>\n<li>\u4e2d\u7b49\u6587\u4ef6&#xff08;10-100MB&#xff09;\u8003\u8651\u4f7f\u7528\u5f02\u6b65\u52a0\u8f7d<\/li>\n<li>\u8d85\u5927\u6587\u4ef6&#xff08;&gt; 100MB&#xff09;\u9700\u8981\u5206\u5757\u52a0\u8f7d\u6216\u4f7f\u7528\u6d41\u5f0f\u52a0\u8f7d&#xff08;\u5982\u679c\u683c\u5f0f\u652f\u6301&#xff09;<\/li>\n<li>\u79fb\u52a8\u8bbe\u5907\u4e0a\u9002\u5f53\u51cf\u5c11\u7ebf\u7a0b\u6c60\u5927\u5c0f&#xff08;1-2\u4e2a\u7ebf\u7a0b&#xff09;<\/li>\n<\/ul>\n<hr \/>\n<h3 id=\"139-\">13.9 \u5c0f\u7ed3<\/h3>\n<ul>\n<li>vsg::read(path) \u662f\u7edf\u4e00\u5165\u53e3&#xff0c;\u6309\u6269\u5c55\u540d\u9009 ReaderWriter&#xff1b;<\/li>\n<li>glTF\/OBJ\/\u56fe\u50cf\/\u5b57\u4f53\u652f\u6301\u6765\u81ea\u7ec4\u4ef6\u5e93 vsgXchange&#xff0c;\u52a1\u5fc5 find_package &#043; \u94fe\u63a5&#xff1b;<\/li>\n<li>\u52a0\u8f7d\u7ed3\u679c\u5df2\u662f\u5b8c\u6574\u53ef\u6e32\u67d3\u7684 Node \u5b50\u6811&#xff0c;\u76f4\u63a5\u6302\u573a\u666f\u56fe\u5373\u53ef&#xff1b;<\/li>\n<li>\u7528 vsg::Options \u63a7\u5236\u8def\u5f84\u3001\u8f74\u5411\u4e0e\u7f13\u5b58\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3 id=\"1310-\">13.10 \u5ef6\u4f38\u9605\u8bfb\u4e0e\u4e0b\u4e00\u7ae0\u9884\u544a<\/h3>\n<ul>\n<li>\u7b2c 14 \u7ae0\u300a\u53d8\u6362\u4e0e\u52a8\u753b\u300b&#xff1a;\u8ba9\u52a0\u8f7d\u7684\u6a21\u578b\u52a8\u8d77\u6765&#xff08;Animation &#043; TransformSampler&#xff09;&#xff1b;<\/li>\n<li>\u7b2c 15 \u7ae0\u300a\u7eb9\u7406\u4e0e\u6750\u8d28\u300b&#xff1a;\u7406\u89e3 glTF \u91cc\u7684\u7eb9\u7406\/\u6750\u8d28\u662f\u600e\u4e48\u53d8\u6210 DescriptorImage \u7684&#xff1b;<\/li>\n<li>\u7b2c 24 \u7ae0\u300a\u7b80\u6613 3D \u6a21\u578b\u67e5\u770b\u5668\u300b&#xff1a;\u628a\u672c\u7ae0\u8bfb\u6a21\u578b &#043; \u8f68\u9053\u76f8\u673a &#043; \u5149\u7167\u6574\u5408\u6210\u4e00\u4e2a\u5b8c\u6574\u7a0b\u5e8f\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c 13 \u7ae0\u3000\u52a0\u8f7d 3D \u6a21\u578b\u6458\u8981&#xff1a;\u672c\u7ae0\u7cfb\u7edf\u4ecb\u7ecd\u4e86\u5728 VulkanSceneGraph (VSG) \u4e2d\u52a0\u8f7d\u5916\u90e8 3D \u6a21\u578b\u7684\u6838\u5fc3\u6d41\u7a0b\u3002\u91cd\u70b9\u9610\u8ff0\u4e86\u5982\u4f55\u4f7f\u7528\u7edf\u4e00\u7684 vsg::read() \u51fd\u6570\u52a0\u8f7d glTF\/OBJ \u7b49\u683c\u5f0f\u7684\u6a21\u578b&#xff0c;\u5f3a\u8c03\u4e86 vsgXchange \u7ec4\u4ef6\u5e93\u5728\u63d0\u4f9b\u683c\u5f0f\u652f\u6301\u4e2d\u7684\u5173\u952e\u4f5c\u7528&#xff0c;\u5e76\u8be6\u7ec6\u8bf4\u660e\u4e86 CMake \u7684\u94fe\u63a5\u914d\u7f6e\u65b9\u6cd5\u3002\u6b64\u5916&#xff0c;\u672c\u7ae0\u8fd8\u89e3\u91ca\u4e86\u52a0\u8f7d\u540e\u5f97\u5230\u7684 Node \u5b50\u6811\u7ed3\u6784\u3001\u5982\u4f55\u901a\u8fc7 vsg::Options \u63a7\u5236<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,371],"topic":[],"class_list":["post-94784","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-371"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>VulkanSceneGraph\u5b66\u4e60\u6559\u7a0b\uff08\u5341\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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:\/\/www.wsisp.com\/helps\/94784.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VulkanSceneGraph\u5b66\u4e60\u6559\u7a0b\uff08\u5341\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u7b2c 13 \u7ae0\u3000\u52a0\u8f7d 3D \u6a21\u578b\u6458\u8981&#xff1a;\u672c\u7ae0\u7cfb\u7edf\u4ecb\u7ecd\u4e86\u5728 VulkanSceneGraph (VSG) \u4e2d\u52a0\u8f7d\u5916\u90e8 3D \u6a21\u578b\u7684\u6838\u5fc3\u6d41\u7a0b\u3002\u91cd\u70b9\u9610\u8ff0\u4e86\u5982\u4f55\u4f7f\u7528\u7edf\u4e00\u7684 vsg::read() \u51fd\u6570\u52a0\u8f7d glTF\/OBJ \u7b49\u683c\u5f0f\u7684\u6a21\u578b&#xff0c;\u5f3a\u8c03\u4e86 vsgXchange \u7ec4\u4ef6\u5e93\u5728\u63d0\u4f9b\u683c\u5f0f\u652f\u6301\u4e2d\u7684\u5173\u952e\u4f5c\u7528&#xff0c;\u5e76\u8be6\u7ec6\u8bf4\u660e\u4e86 CMake \u7684\u94fe\u63a5\u914d\u7f6e\u65b9\u6cd5\u3002\u6b64\u5916&#xff0c;\u672c\u7ae0\u8fd8\u89e3\u91ca\u4e86\u52a0\u8f7d\u540e\u5f97\u5230\u7684 Node \u5b50\u6811\u7ed3\u6784\u3001\u5982\u4f55\u901a\u8fc7 vsg::Options \u63a7\u5236\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/94784.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-15T01:48:54+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/94784.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/94784.html\",\"name\":\"VulkanSceneGraph\u5b66\u4e60\u6559\u7a0b\uff08\u5341\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-15T01:48:54+00:00\",\"dateModified\":\"2026-08-15T01:48:54+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/94784.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/94784.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/94784.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"VulkanSceneGraph\u5b66\u4e60\u6559\u7a0b\uff08\u5341\u4e09\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"VulkanSceneGraph\u5b66\u4e60\u6559\u7a0b\uff08\u5341\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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:\/\/www.wsisp.com\/helps\/94784.html","og_locale":"zh_CN","og_type":"article","og_title":"VulkanSceneGraph\u5b66\u4e60\u6559\u7a0b\uff08\u5341\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u7b2c 13 \u7ae0\u3000\u52a0\u8f7d 3D \u6a21\u578b\u6458\u8981&#xff1a;\u672c\u7ae0\u7cfb\u7edf\u4ecb\u7ecd\u4e86\u5728 VulkanSceneGraph (VSG) \u4e2d\u52a0\u8f7d\u5916\u90e8 3D \u6a21\u578b\u7684\u6838\u5fc3\u6d41\u7a0b\u3002\u91cd\u70b9\u9610\u8ff0\u4e86\u5982\u4f55\u4f7f\u7528\u7edf\u4e00\u7684 vsg::read() \u51fd\u6570\u52a0\u8f7d glTF\/OBJ \u7b49\u683c\u5f0f\u7684\u6a21\u578b&#xff0c;\u5f3a\u8c03\u4e86 vsgXchange \u7ec4\u4ef6\u5e93\u5728\u63d0\u4f9b\u683c\u5f0f\u652f\u6301\u4e2d\u7684\u5173\u952e\u4f5c\u7528&#xff0c;\u5e76\u8be6\u7ec6\u8bf4\u660e\u4e86 CMake \u7684\u94fe\u63a5\u914d\u7f6e\u65b9\u6cd5\u3002\u6b64\u5916&#xff0c;\u672c\u7ae0\u8fd8\u89e3\u91ca\u4e86\u52a0\u8f7d\u540e\u5f97\u5230\u7684 Node \u5b50\u6811\u7ed3\u6784\u3001\u5982\u4f55\u901a\u8fc7 vsg::Options \u63a7\u5236","og_url":"https:\/\/www.wsisp.com\/helps\/94784.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-15T01:48:54+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/94784.html","url":"https:\/\/www.wsisp.com\/helps\/94784.html","name":"VulkanSceneGraph\u5b66\u4e60\u6559\u7a0b\uff08\u5341\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-15T01:48:54+00:00","dateModified":"2026-08-15T01:48:54+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/94784.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/94784.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/94784.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"VulkanSceneGraph\u5b66\u4e60\u6559\u7a0b\uff08\u5341\u4e09\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/94784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=94784"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/94784\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=94784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=94784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=94784"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=94784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}