mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-13 14:29:38 -05:00
deploy: 449e072d33
This commit is contained in:
Binary file not shown.
BIN
en/.doctrees/implementation/runtime_resource_management.doctree
Normal file
BIN
en/.doctrees/implementation/runtime_resource_management.doctree
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,53 @@
|
||||
# Runtime のリソース管理について
|
||||
|
||||
Runtime Import で `Texture`, `Material`, `Mesh` などのリソースを Root の `GameObject.OnDestroy`
|
||||
と同時に `UnityEngine.Object.Destroy` したい。
|
||||
|
||||
## RuntimeGltfInstance
|
||||
|
||||
`RuntimeGltfInstance.OnDestroy` で破棄を実行するようにした。
|
||||
|
||||
```
|
||||
ImporterContext
|
||||
[Own]List<Mesh>
|
||||
AnimationClipFactory[Own]List<Animation>
|
||||
TextureFactory[Own]List<Texture>
|
||||
MaterialFactory[Own]List<Material>
|
||||
|
||||
👇 ImporterContext.LoadAsync
|
||||
RuntimeGltfInstance.AttachTo
|
||||
ImporterContext.TransferOwnership
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]List<Mesh>
|
||||
[Own]List<Animation>
|
||||
[Own]List<Texture>
|
||||
[Own]List<Material>
|
||||
```
|
||||
|
||||
> VRM-0.X では `RuntimeGltfInstance` にリソースを委譲している。
|
||||
|
||||
## Vrm10Instance
|
||||
|
||||
```
|
||||
Vrm10Importer
|
||||
[Own]HumanoidAvatar
|
||||
[Own]Vrm10Object
|
||||
[Own]List<Vrm10Expression>
|
||||
|
||||
👇 Vrm10Importer.LoadAsync
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]HumanoidAvatar
|
||||
[Own]VrmObject
|
||||
[Own]List<VrmExpression>
|
||||
```
|
||||
|
||||
### FirstPerson
|
||||
|
||||
```
|
||||
👇 Vrm10Instance.FirstPerson.SetupAsync
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]List<Mesh>.Add(headless)
|
||||
```
|
||||
@@ -37,6 +37,13 @@ vrm0/0_58_blendshape.md
|
||||
vrm0/firstperson.md
|
||||
```
|
||||
|
||||
## 実装メモ
|
||||
|
||||
```{toctree}
|
||||
|
||||
implementation/runtime_resource_management.md
|
||||
```
|
||||
|
||||
### Samples
|
||||
|
||||
- SimpleViewer
|
||||
|
||||
@@ -7,8 +7,7 @@ VR向け FirstPerson 設定の初期化手順です。
|
||||
1. Load する
|
||||
2. Vrm10Instance を取得する
|
||||
3. `controller.Vrm.FirstPerson.SetupAsync` を呼び出す
|
||||
4. `controller.Vrm.FirstPerson.SetupAsync` した結果新規に作成されたモデルを `RuntimeGltfInstance` に渡す
|
||||
5. ShowMeshes
|
||||
4. ShowMeshes
|
||||
|
||||
```csharp
|
||||
async Task<RuntimeGltfInstance> LoadAsync(string path)
|
||||
@@ -26,13 +25,10 @@ async Task<RuntimeGltfInstance> LoadAsync(string path)
|
||||
// 2.
|
||||
var controller = instance.GetComponent<Vrm10Instance>();
|
||||
|
||||
// 3.
|
||||
var created = await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject);
|
||||
// 3. The headless model that created is added to instance
|
||||
await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject);
|
||||
|
||||
// 4.
|
||||
instance.AddRenderers(created);
|
||||
|
||||
// 5.
|
||||
// 4.
|
||||
instance.ShowMeshes();
|
||||
|
||||
return instance;
|
||||
|
||||
165
en/implementation/runtime_resource_management.html
Normal file
165
en/implementation/runtime_resource_management.html
Normal file
@@ -0,0 +1,165 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Runtime のリソース管理について — UniVRM Programming Document documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../_static/nature.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||
<script src="../_static/jquery.js"></script>
|
||||
<script src="../_static/underscore.js"></script>
|
||||
<script src="../_static/doctools.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
<link rel="next" title="RuntimeLoad" href="../vrm1/vrm1_runtime_load.html" />
|
||||
<link rel="prev" title="How to use VRMFirstPerson" href="../vrm0/firstperson.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../vrm1/vrm1_runtime_load.html" title="RuntimeLoad"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../vrm0/firstperson.html" title="How to use VRMFirstPerson"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">UniVRM Programming Document documentation</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Runtime のリソース管理について</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="runtime">
|
||||
<h1>Runtime のリソース管理について<a class="headerlink" href="#runtime" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Runtime Import で <code class="docutils literal notranslate"><span class="pre">Texture</span></code>, <code class="docutils literal notranslate"><span class="pre">Material</span></code>, <code class="docutils literal notranslate"><span class="pre">Mesh</span></code> などのリソースを Root の <code class="docutils literal notranslate"><span class="pre">GameObject.OnDestroy</span></code>
|
||||
と同時に <code class="docutils literal notranslate"><span class="pre">UnityEngine.Object.Destroy</span></code> したい。</p>
|
||||
<section id="runtimegltfinstance">
|
||||
<h2>RuntimeGltfInstance<a class="headerlink" href="#runtimegltfinstance" title="Permalink to this headline">¶</a></h2>
|
||||
<p><code class="docutils literal notranslate"><span class="pre">RuntimeGltfInstance.OnDestroy</span></code> で破棄を実行するようにした。</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ImporterContext
|
||||
[Own]List<Mesh>
|
||||
AnimationClipFactory[Own]List<Animation>
|
||||
TextureFactory[Own]List<Texture>
|
||||
MaterialFactory[Own]List<Material>
|
||||
|
||||
👇 ImporterContext.LoadAsync
|
||||
RuntimeGltfInstance.AttachTo
|
||||
ImporterContext.TransferOwnership
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]List<Mesh>
|
||||
[Own]List<Animation>
|
||||
[Own]List<Texture>
|
||||
[Own]List<Material>
|
||||
</pre></div>
|
||||
</div>
|
||||
<blockquote>
|
||||
<div><p>VRM-0.X では <code class="docutils literal notranslate"><span class="pre">RuntimeGltfInstance</span></code> にリソースを委譲している。</p>
|
||||
</div></blockquote>
|
||||
</section>
|
||||
<section id="vrm10instance">
|
||||
<h2>Vrm10Instance<a class="headerlink" href="#vrm10instance" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Vrm10Importer
|
||||
[Own]HumanoidAvatar
|
||||
[Own]Vrm10Object
|
||||
[Own]List<Vrm10Expression>
|
||||
|
||||
👇 Vrm10Importer.LoadAsync
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]HumanoidAvatar
|
||||
[Own]VrmObject
|
||||
[Own]List<VrmExpression>
|
||||
</pre></div>
|
||||
</div>
|
||||
<section id="firstperson">
|
||||
<h3>FirstPerson<a class="headerlink" href="#firstperson" title="Permalink to this headline">¶</a></h3>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>👇 Vrm10Instance.FirstPerson.SetupAsync
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]List<Mesh>.Add(headless)
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Runtime のリソース管理について</a><ul>
|
||||
<li><a class="reference internal" href="#runtimegltfinstance">RuntimeGltfInstance</a></li>
|
||||
<li><a class="reference internal" href="#vrm10instance">Vrm10Instance</a><ul>
|
||||
<li><a class="reference internal" href="#firstperson">FirstPerson</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../vrm0/firstperson.html"
|
||||
title="previous chapter">How to use VRMFirstPerson</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../vrm1/vrm1_runtime_load.html"
|
||||
title="next chapter">RuntimeLoad</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../_sources/implementation/runtime_resource_management.md.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="searchbox" style="display: none" role="search">
|
||||
<h3 id="searchlabel">Quick search</h3>
|
||||
<div class="searchformwrapper">
|
||||
<form class="search" action="../search.html" method="get">
|
||||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||||
<input type="submit" value="Go" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../vrm1/vrm1_runtime_load.html" title="RuntimeLoad"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../vrm0/firstperson.html" title="How to use VRMFirstPerson"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">UniVRM Programming Document documentation</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Runtime のリソース管理について</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer" role="contentinfo">
|
||||
© Copyright 2021, VRM Consortium.
|
||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.2.0.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -72,6 +72,21 @@
|
||||
<li class="toctree-l1"><a class="reference internal" href="vrm0/firstperson.html">How to use VRMFirstPerson</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section id="id2">
|
||||
<h2>実装メモ<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="implementation/runtime_resource_management.html">Runtime のリソース管理について</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="implementation/runtime_resource_management.html#runtimegltfinstance">RuntimeGltfInstance</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="implementation/runtime_resource_management.html#vrm10instance">Vrm10Instance</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="implementation/runtime_resource_management.html#firstperson">FirstPerson</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<section id="samples">
|
||||
<h3>Samples<a class="headerlink" href="#samples" title="Permalink to this headline">¶</a></h3>
|
||||
<ul class="simple">
|
||||
@@ -101,8 +116,8 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<section id="id2">
|
||||
<h3>Samples<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
|
||||
<section id="id3">
|
||||
<h3>Samples<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3>
|
||||
<ul class="simple">
|
||||
<li><p>VRM10Viewer</p></li>
|
||||
</ul>
|
||||
@@ -130,12 +145,13 @@
|
||||
<li><a class="reference internal" href="#">UniVRM Programming Document</a><ul>
|
||||
<li><a class="reference internal" href="#id1">Overview</a></li>
|
||||
<li><a class="reference internal" href="#gltf">glTF</a></li>
|
||||
<li><a class="reference internal" href="#vrm">VRM</a><ul>
|
||||
<li><a class="reference internal" href="#vrm">VRM</a></li>
|
||||
<li><a class="reference internal" href="#id2">実装メモ</a><ul>
|
||||
<li><a class="reference internal" href="#samples">Samples</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#vrm-1-0">VRM-1.0(β)</a><ul>
|
||||
<li><a class="reference internal" href="#id2">Samples</a></li>
|
||||
<li><a class="reference internal" href="#id3">Samples</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
BIN
en/objects.inv
BIN
en/objects.inv
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -15,7 +15,7 @@
|
||||
<script src="../_static/doctools.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
<link rel="next" title="RuntimeLoad" href="../vrm1/vrm1_runtime_load.html" />
|
||||
<link rel="next" title="Runtime のリソース管理について" href="../implementation/runtime_resource_management.html" />
|
||||
<link rel="prev" title="BlendShapeProxy(0.58)" href="0_58_blendshape.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
@@ -25,7 +25,7 @@
|
||||
<a href="../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../vrm1/vrm1_runtime_load.html" title="RuntimeLoad"
|
||||
<a href="../implementation/runtime_resource_management.html" title="Runtime のリソース管理について"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="0_58_blendshape.html" title="BlendShapeProxy(0.58)"
|
||||
@@ -169,8 +169,8 @@
|
||||
<p class="topless"><a href="0_58_blendshape.html"
|
||||
title="previous chapter">BlendShapeProxy(0.58)</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../vrm1/vrm1_runtime_load.html"
|
||||
title="next chapter">RuntimeLoad</a></p>
|
||||
<p class="topless"><a href="../implementation/runtime_resource_management.html"
|
||||
title="next chapter">Runtime のリソース管理について</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
@@ -199,7 +199,7 @@
|
||||
<a href="../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../vrm1/vrm1_runtime_load.html" title="RuntimeLoad"
|
||||
<a href="../implementation/runtime_resource_management.html" title="Runtime のリソース管理について"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="0_58_blendshape.html" title="BlendShapeProxy(0.58)"
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
<li><p>Load</p></li>
|
||||
<li><p>Get Vrm10Instance</p></li>
|
||||
<li><p>Call <code class="docutils literal notranslate"><span class="pre">controller.Vrm.FirstPerson.SetupAsync</span></code></p></li>
|
||||
<li><p>Add the result of <code class="docutils literal notranslate"><span class="pre">controller.Vrm.FirstPerson.SetupAsync</span></code> to <code class="docutils literal notranslate"><span class="pre">RuntimeGltfInstance</span></code></p></li>
|
||||
<li><p>ShowMeshes</p></li>
|
||||
</ol>
|
||||
<div class="highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="n">Task</span><span class="p"><</span><span class="n">RuntimeGltfInstance</span><span class="p">></span> <span class="n">LoadAsync</span><span class="p">(</span><span class="kt">string</span> <span class="n">path</span><span class="p">)</span>
|
||||
@@ -63,13 +62,10 @@
|
||||
<span class="c1">// 2.</span>
|
||||
<span class="kt">var</span> <span class="n">controller</span> <span class="p">=</span> <span class="n">instance</span><span class="p">.</span><span class="n">GetComponent</span><span class="p"><</span><span class="n">Vrm10Instance</span><span class="p">>();</span>
|
||||
|
||||
<span class="c1">// 3.</span>
|
||||
<span class="kt">var</span> <span class="n">created</span> <span class="p">=</span> <span class="k">await</span> <span class="n">controller</span><span class="p">.</span><span class="n">Vrm</span><span class="p">.</span><span class="n">FirstPerson</span><span class="p">.</span><span class="n">SetupAsync</span><span class="p">(</span><span class="n">controller</span><span class="p">.</span><span class="n">gameObject</span><span class="p">);</span>
|
||||
<span class="c1">// 3. The headless model that created is added to instance</span>
|
||||
<span class="k">await</span> <span class="n">controller</span><span class="p">.</span><span class="n">Vrm</span><span class="p">.</span><span class="n">FirstPerson</span><span class="p">.</span><span class="n">SetupAsync</span><span class="p">(</span><span class="n">controller</span><span class="p">.</span><span class="n">gameObject</span><span class="p">);</span>
|
||||
|
||||
<span class="c1">// 4.</span>
|
||||
<span class="n">instance</span><span class="p">.</span><span class="n">AddRenderers</span><span class="p">(</span><span class="n">created</span><span class="p">);</span>
|
||||
|
||||
<span class="c1">// 5.</span>
|
||||
<span class="c1">// 4. </span>
|
||||
<span class="n">instance</span><span class="p">.</span><span class="n">ShowMeshes</span><span class="p">();</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">instance</span><span class="p">;</span>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
<link rel="next" title="🚧Humanoid" href="vrm1_get_humanoid.html" />
|
||||
<link rel="prev" title="How to use VRMFirstPerson" href="../vrm0/firstperson.html" />
|
||||
<link rel="prev" title="Runtime のリソース管理について" href="../implementation/runtime_resource_management.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
@@ -28,7 +28,7 @@
|
||||
<a href="vrm1_get_humanoid.html" title="🚧Humanoid"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../vrm0/firstperson.html" title="How to use VRMFirstPerson"
|
||||
<a href="../implementation/runtime_resource_management.html" title="Runtime のリソース管理について"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">UniVRM Programming Document documentation</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">RuntimeLoad</a></li>
|
||||
@@ -102,8 +102,8 @@
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../vrm0/firstperson.html"
|
||||
title="previous chapter">How to use VRMFirstPerson</a></p>
|
||||
<p class="topless"><a href="../implementation/runtime_resource_management.html"
|
||||
title="previous chapter">Runtime のリソース管理について</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="vrm1_get_humanoid.html"
|
||||
title="next chapter">🚧Humanoid</a></p>
|
||||
@@ -138,7 +138,7 @@
|
||||
<a href="vrm1_get_humanoid.html" title="🚧Humanoid"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../vrm0/firstperson.html" title="How to use VRMFirstPerson"
|
||||
<a href="../implementation/runtime_resource_management.html" title="Runtime のリソース管理について"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">UniVRM Programming Document documentation</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">RuntimeLoad</a></li>
|
||||
|
||||
Binary file not shown.
BIN
ja/.doctrees/implementation/runtime_resource_management.doctree
Normal file
BIN
ja/.doctrees/implementation/runtime_resource_management.doctree
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,53 @@
|
||||
# Runtime のリソース管理について
|
||||
|
||||
Runtime Import で `Texture`, `Material`, `Mesh` などのリソースを Root の `GameObject.OnDestroy`
|
||||
と同時に `UnityEngine.Object.Destroy` したい。
|
||||
|
||||
## RuntimeGltfInstance
|
||||
|
||||
`RuntimeGltfInstance.OnDestroy` で破棄を実行するようにした。
|
||||
|
||||
```
|
||||
ImporterContext
|
||||
[Own]List<Mesh>
|
||||
AnimationClipFactory[Own]List<Animation>
|
||||
TextureFactory[Own]List<Texture>
|
||||
MaterialFactory[Own]List<Material>
|
||||
|
||||
👇 ImporterContext.LoadAsync
|
||||
RuntimeGltfInstance.AttachTo
|
||||
ImporterContext.TransferOwnership
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]List<Mesh>
|
||||
[Own]List<Animation>
|
||||
[Own]List<Texture>
|
||||
[Own]List<Material>
|
||||
```
|
||||
|
||||
> VRM-0.X では `RuntimeGltfInstance` にリソースを委譲している。
|
||||
|
||||
## Vrm10Instance
|
||||
|
||||
```
|
||||
Vrm10Importer
|
||||
[Own]HumanoidAvatar
|
||||
[Own]Vrm10Object
|
||||
[Own]List<Vrm10Expression>
|
||||
|
||||
👇 Vrm10Importer.LoadAsync
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]HumanoidAvatar
|
||||
[Own]VrmObject
|
||||
[Own]List<VrmExpression>
|
||||
```
|
||||
|
||||
### FirstPerson
|
||||
|
||||
```
|
||||
👇 Vrm10Instance.FirstPerson.SetupAsync
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]List<Mesh>.Add(headless)
|
||||
```
|
||||
@@ -37,6 +37,13 @@ vrm0/0_58_blendshape.md
|
||||
vrm0/firstperson.md
|
||||
```
|
||||
|
||||
## 実装メモ
|
||||
|
||||
```{toctree}
|
||||
|
||||
implementation/runtime_resource_management.md
|
||||
```
|
||||
|
||||
### Samples
|
||||
|
||||
- SimpleViewer
|
||||
|
||||
@@ -7,8 +7,7 @@ VR向け FirstPerson 設定の初期化手順です。
|
||||
1. Load する
|
||||
2. Vrm10Instance を取得する
|
||||
3. `controller.Vrm.FirstPerson.SetupAsync` を呼び出す
|
||||
4. `controller.Vrm.FirstPerson.SetupAsync` した結果新規に作成されたモデルを `RuntimeGltfInstance` に渡す
|
||||
5. ShowMeshes
|
||||
4. ShowMeshes
|
||||
|
||||
```csharp
|
||||
async Task<RuntimeGltfInstance> LoadAsync(string path)
|
||||
@@ -26,13 +25,10 @@ async Task<RuntimeGltfInstance> LoadAsync(string path)
|
||||
// 2.
|
||||
var controller = instance.GetComponent<Vrm10Instance>();
|
||||
|
||||
// 3.
|
||||
var created = await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject);
|
||||
// 3. The headless model that created is added to instance
|
||||
await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject);
|
||||
|
||||
// 4.
|
||||
instance.AddRenderers(created);
|
||||
|
||||
// 5.
|
||||
// 4.
|
||||
instance.ShowMeshes();
|
||||
|
||||
return instance;
|
||||
|
||||
166
ja/implementation/runtime_resource_management.html
Normal file
166
ja/implementation/runtime_resource_management.html
Normal file
@@ -0,0 +1,166 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Runtime のリソース管理について — UniVRM Programming Document ドキュメント</title>
|
||||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../_static/nature.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||
<script src="../_static/jquery.js"></script>
|
||||
<script src="../_static/underscore.js"></script>
|
||||
<script src="../_static/doctools.js"></script>
|
||||
<script src="../_static/translations.js"></script>
|
||||
<link rel="index" title="索引" href="../genindex.html" />
|
||||
<link rel="search" title="検索" href="../search.html" />
|
||||
<link rel="next" title="RuntimeLoad" href="../vrm1/vrm1_runtime_load.html" />
|
||||
<link rel="prev" title="VRMFirstPersonの使い方" href="../vrm0/firstperson.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>ナビゲーション</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="総合索引"
|
||||
accesskey="I">索引</a></li>
|
||||
<li class="right" >
|
||||
<a href="../vrm1/vrm1_runtime_load.html" title="RuntimeLoad"
|
||||
accesskey="N">次へ</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../vrm0/firstperson.html" title="VRMFirstPersonの使い方"
|
||||
accesskey="P">前へ</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">UniVRM Programming Document ドキュメント</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Runtime のリソース管理について</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="runtime">
|
||||
<h1>Runtime のリソース管理について<a class="headerlink" href="#runtime" title="このヘッドラインへのパーマリンク">¶</a></h1>
|
||||
<p>Runtime Import で <code class="docutils literal notranslate"><span class="pre">Texture</span></code>, <code class="docutils literal notranslate"><span class="pre">Material</span></code>, <code class="docutils literal notranslate"><span class="pre">Mesh</span></code> などのリソースを Root の <code class="docutils literal notranslate"><span class="pre">GameObject.OnDestroy</span></code>
|
||||
と同時に <code class="docutils literal notranslate"><span class="pre">UnityEngine.Object.Destroy</span></code> したい。</p>
|
||||
<section id="runtimegltfinstance">
|
||||
<h2>RuntimeGltfInstance<a class="headerlink" href="#runtimegltfinstance" title="このヘッドラインへのパーマリンク">¶</a></h2>
|
||||
<p><code class="docutils literal notranslate"><span class="pre">RuntimeGltfInstance.OnDestroy</span></code> で破棄を実行するようにした。</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>ImporterContext
|
||||
[Own]List<Mesh>
|
||||
AnimationClipFactory[Own]List<Animation>
|
||||
TextureFactory[Own]List<Texture>
|
||||
MaterialFactory[Own]List<Material>
|
||||
|
||||
👇 ImporterContext.LoadAsync
|
||||
RuntimeGltfInstance.AttachTo
|
||||
ImporterContext.TransferOwnership
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]List<Mesh>
|
||||
[Own]List<Animation>
|
||||
[Own]List<Texture>
|
||||
[Own]List<Material>
|
||||
</pre></div>
|
||||
</div>
|
||||
<blockquote>
|
||||
<div><p>VRM-0.X では <code class="docutils literal notranslate"><span class="pre">RuntimeGltfInstance</span></code> にリソースを委譲している。</p>
|
||||
</div></blockquote>
|
||||
</section>
|
||||
<section id="vrm10instance">
|
||||
<h2>Vrm10Instance<a class="headerlink" href="#vrm10instance" title="このヘッドラインへのパーマリンク">¶</a></h2>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Vrm10Importer
|
||||
[Own]HumanoidAvatar
|
||||
[Own]Vrm10Object
|
||||
[Own]List<Vrm10Expression>
|
||||
|
||||
👇 Vrm10Importer.LoadAsync
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]HumanoidAvatar
|
||||
[Own]VrmObject
|
||||
[Own]List<VrmExpression>
|
||||
</pre></div>
|
||||
</div>
|
||||
<section id="firstperson">
|
||||
<h3>FirstPerson<a class="headerlink" href="#firstperson" title="このヘッドラインへのパーマリンク">¶</a></h3>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>👇 Vrm10Instance.FirstPerson.SetupAsync
|
||||
|
||||
RuntimeGltfInstance
|
||||
[Own]List<Mesh>.Add(headless)
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../index.html">目次</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Runtime のリソース管理について</a><ul>
|
||||
<li><a class="reference internal" href="#runtimegltfinstance">RuntimeGltfInstance</a></li>
|
||||
<li><a class="reference internal" href="#vrm10instance">Vrm10Instance</a><ul>
|
||||
<li><a class="reference internal" href="#firstperson">FirstPerson</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>前のトピックへ</h4>
|
||||
<p class="topless"><a href="../vrm0/firstperson.html"
|
||||
title="前の章へ">VRMFirstPersonの使い方</a></p>
|
||||
<h4>次のトピックへ</h4>
|
||||
<p class="topless"><a href="../vrm1/vrm1_runtime_load.html"
|
||||
title="次の章へ">RuntimeLoad</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>このページ</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../_sources/implementation/runtime_resource_management.md.txt"
|
||||
rel="nofollow">ソースコードを表示</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="searchbox" style="display: none" role="search">
|
||||
<h3 id="searchlabel">クイック検索</h3>
|
||||
<div class="searchformwrapper">
|
||||
<form class="search" action="../search.html" method="get">
|
||||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||||
<input type="submit" value="検索" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>ナビゲーション</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../genindex.html" title="総合索引"
|
||||
>索引</a></li>
|
||||
<li class="right" >
|
||||
<a href="../vrm1/vrm1_runtime_load.html" title="RuntimeLoad"
|
||||
>次へ</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../vrm0/firstperson.html" title="VRMFirstPersonの使い方"
|
||||
>前へ</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">UniVRM Programming Document ドキュメント</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Runtime のリソース管理について</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer" role="contentinfo">
|
||||
© Copyright 2021, VRM Consortium.
|
||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.2.0.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -73,6 +73,21 @@
|
||||
<li class="toctree-l1"><a class="reference internal" href="vrm0/firstperson.html">VRMFirstPersonの使い方</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section id="id2">
|
||||
<h2>実装メモ<a class="headerlink" href="#id2" title="このヘッドラインへのパーマリンク">¶</a></h2>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="implementation/runtime_resource_management.html">Runtime のリソース管理について</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="implementation/runtime_resource_management.html#runtimegltfinstance">RuntimeGltfInstance</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="implementation/runtime_resource_management.html#vrm10instance">Vrm10Instance</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="implementation/runtime_resource_management.html#firstperson">FirstPerson</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<section id="samples">
|
||||
<h3>Samples<a class="headerlink" href="#samples" title="このヘッドラインへのパーマリンク">¶</a></h3>
|
||||
<ul class="simple">
|
||||
@@ -102,8 +117,8 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<section id="id2">
|
||||
<h3>Samples<a class="headerlink" href="#id2" title="このヘッドラインへのパーマリンク">¶</a></h3>
|
||||
<section id="id3">
|
||||
<h3>Samples<a class="headerlink" href="#id3" title="このヘッドラインへのパーマリンク">¶</a></h3>
|
||||
<ul class="simple">
|
||||
<li><p>VRM10Viewer</p></li>
|
||||
</ul>
|
||||
@@ -131,12 +146,13 @@
|
||||
<li><a class="reference internal" href="#">UniVRM Programming Document</a><ul>
|
||||
<li><a class="reference internal" href="#id1">概要</a></li>
|
||||
<li><a class="reference internal" href="#gltf">glTF</a></li>
|
||||
<li><a class="reference internal" href="#vrm">VRM</a><ul>
|
||||
<li><a class="reference internal" href="#vrm">VRM</a></li>
|
||||
<li><a class="reference internal" href="#id2">実装メモ</a><ul>
|
||||
<li><a class="reference internal" href="#samples">Samples</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#vrm-1-0">VRM-1.0(β)</a><ul>
|
||||
<li><a class="reference internal" href="#id2">Samples</a></li>
|
||||
<li><a class="reference internal" href="#id3">Samples</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
BIN
ja/objects.inv
BIN
ja/objects.inv
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -16,7 +16,7 @@
|
||||
<script src="../_static/translations.js"></script>
|
||||
<link rel="index" title="索引" href="../genindex.html" />
|
||||
<link rel="search" title="検索" href="../search.html" />
|
||||
<link rel="next" title="RuntimeLoad" href="../vrm1/vrm1_runtime_load.html" />
|
||||
<link rel="next" title="Runtime のリソース管理について" href="../implementation/runtime_resource_management.html" />
|
||||
<link rel="prev" title="BlendShapeProxy(0.58)" href="0_58_blendshape.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
@@ -26,7 +26,7 @@
|
||||
<a href="../genindex.html" title="総合索引"
|
||||
accesskey="I">索引</a></li>
|
||||
<li class="right" >
|
||||
<a href="../vrm1/vrm1_runtime_load.html" title="RuntimeLoad"
|
||||
<a href="../implementation/runtime_resource_management.html" title="Runtime のリソース管理について"
|
||||
accesskey="N">次へ</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="0_58_blendshape.html" title="BlendShapeProxy(0.58)"
|
||||
@@ -170,8 +170,8 @@
|
||||
<p class="topless"><a href="0_58_blendshape.html"
|
||||
title="前の章へ">BlendShapeProxy(0.58)</a></p>
|
||||
<h4>次のトピックへ</h4>
|
||||
<p class="topless"><a href="../vrm1/vrm1_runtime_load.html"
|
||||
title="次の章へ">RuntimeLoad</a></p>
|
||||
<p class="topless"><a href="../implementation/runtime_resource_management.html"
|
||||
title="次の章へ">Runtime のリソース管理について</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>このページ</h3>
|
||||
<ul class="this-page-menu">
|
||||
@@ -200,7 +200,7 @@
|
||||
<a href="../genindex.html" title="総合索引"
|
||||
>索引</a></li>
|
||||
<li class="right" >
|
||||
<a href="../vrm1/vrm1_runtime_load.html" title="RuntimeLoad"
|
||||
<a href="../implementation/runtime_resource_management.html" title="Runtime のリソース管理について"
|
||||
>次へ</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="0_58_blendshape.html" title="BlendShapeProxy(0.58)"
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
<li><p>Load する</p></li>
|
||||
<li><p>Vrm10Instance を取得する</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">controller.Vrm.FirstPerson.SetupAsync</span></code> を呼び出す</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">controller.Vrm.FirstPerson.SetupAsync</span></code> した結果新規に作成されたモデルを <code class="docutils literal notranslate"><span class="pre">RuntimeGltfInstance</span></code> に渡す</p></li>
|
||||
<li><p>ShowMeshes</p></li>
|
||||
</ol>
|
||||
<div class="highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="n">Task</span><span class="p"><</span><span class="n">RuntimeGltfInstance</span><span class="p">></span> <span class="n">LoadAsync</span><span class="p">(</span><span class="kt">string</span> <span class="n">path</span><span class="p">)</span>
|
||||
@@ -64,13 +63,10 @@
|
||||
<span class="c1">// 2.</span>
|
||||
<span class="kt">var</span> <span class="n">controller</span> <span class="p">=</span> <span class="n">instance</span><span class="p">.</span><span class="n">GetComponent</span><span class="p"><</span><span class="n">Vrm10Instance</span><span class="p">>();</span>
|
||||
|
||||
<span class="c1">// 3.</span>
|
||||
<span class="kt">var</span> <span class="n">created</span> <span class="p">=</span> <span class="k">await</span> <span class="n">controller</span><span class="p">.</span><span class="n">Vrm</span><span class="p">.</span><span class="n">FirstPerson</span><span class="p">.</span><span class="n">SetupAsync</span><span class="p">(</span><span class="n">controller</span><span class="p">.</span><span class="n">gameObject</span><span class="p">);</span>
|
||||
<span class="c1">// 3. The headless model that created is added to instance</span>
|
||||
<span class="k">await</span> <span class="n">controller</span><span class="p">.</span><span class="n">Vrm</span><span class="p">.</span><span class="n">FirstPerson</span><span class="p">.</span><span class="n">SetupAsync</span><span class="p">(</span><span class="n">controller</span><span class="p">.</span><span class="n">gameObject</span><span class="p">);</span>
|
||||
|
||||
<span class="c1">// 4.</span>
|
||||
<span class="n">instance</span><span class="p">.</span><span class="n">AddRenderers</span><span class="p">(</span><span class="n">created</span><span class="p">);</span>
|
||||
|
||||
<span class="c1">// 5.</span>
|
||||
<span class="c1">// 4. </span>
|
||||
<span class="n">instance</span><span class="p">.</span><span class="n">ShowMeshes</span><span class="p">();</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">instance</span><span class="p">;</span>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<link rel="index" title="索引" href="../genindex.html" />
|
||||
<link rel="search" title="検索" href="../search.html" />
|
||||
<link rel="next" title="🚧Humanoid" href="vrm1_get_humanoid.html" />
|
||||
<link rel="prev" title="VRMFirstPersonの使い方" href="../vrm0/firstperson.html" />
|
||||
<link rel="prev" title="Runtime のリソース管理について" href="../implementation/runtime_resource_management.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>ナビゲーション</h3>
|
||||
@@ -29,7 +29,7 @@
|
||||
<a href="vrm1_get_humanoid.html" title="🚧Humanoid"
|
||||
accesskey="N">次へ</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../vrm0/firstperson.html" title="VRMFirstPersonの使い方"
|
||||
<a href="../implementation/runtime_resource_management.html" title="Runtime のリソース管理について"
|
||||
accesskey="P">前へ</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">UniVRM Programming Document ドキュメント</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">RuntimeLoad</a></li>
|
||||
@@ -105,8 +105,8 @@
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h4>前のトピックへ</h4>
|
||||
<p class="topless"><a href="../vrm0/firstperson.html"
|
||||
title="前の章へ">VRMFirstPersonの使い方</a></p>
|
||||
<p class="topless"><a href="../implementation/runtime_resource_management.html"
|
||||
title="前の章へ">Runtime のリソース管理について</a></p>
|
||||
<h4>次のトピックへ</h4>
|
||||
<p class="topless"><a href="vrm1_get_humanoid.html"
|
||||
title="次の章へ">🚧Humanoid</a></p>
|
||||
@@ -141,7 +141,7 @@
|
||||
<a href="vrm1_get_humanoid.html" title="🚧Humanoid"
|
||||
>次へ</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../vrm0/firstperson.html" title="VRMFirstPersonの使い方"
|
||||
<a href="../implementation/runtime_resource_management.html" title="Runtime のリソース管理について"
|
||||
>前へ</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">UniVRM Programming Document ドキュメント</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">RuntimeLoad</a></li>
|
||||
|
||||
Reference in New Issue
Block a user