日本語ドキュメントを sphinx 化

This commit is contained in:
ousttrue
2021-09-14 13:32:22 +09:00
parent 14967bf686
commit 2cbcdf0ce2
23 changed files with 208 additions and 153 deletions

View File

@@ -1,3 +0,0 @@
これは、開発者(UniVRMを使ったアプリケーションを作成する人)向けのドキュメントです。
UnityでVRMをエクスポートする方法などについては [manual](https://vrm.dev/docs/univrm/) を参照してください。

View File

@@ -1,51 +0,0 @@
- name: 概要
href: index.md
items:
- name: パッケージ構成
href: package.md
- name: Version
href: history.md
- name: glTF
items:
- name: GlbImport(0.82)
href: gltf/0_82_glb_import.md
- name: glTF拡張の実装(0.63.2)
href: gltf/how_to_impl_extension.md
- name: GltfUpdate(0.36)
href: gltf/0_36_update.md
- name: VRM
items:
- name: 🚧Samples/SimpleViewer
- name: 🚧Samples/RuntimeExporerSample
- name: 🚧Samples/FirstPersonSample
- name: 🚧Samples/AnimationBridgeSample
- name: RuntimeImport(0.82)
href: vrm0/0_82_runtime_import.md
- name: RuntimeImport(0.79)
href: vrm0/0_79_runtime_import.md
- name: RuntimeImport(0.77)
href: vrm0/0_77_runtime_import.md
- name: RuntimeImport(0.68)
href: vrm0/0_68_runtime_import.md
- name: RuntimeImport(0.44)
href: vrm0/0_44_runtime_import.md
- name: BlendShapeProxy(0.58)
href: vrm0/0_58_blendshape.md
- name: FirstPerson
href: vrm0/firstperson.md
- name: VRM-1.0(β)
items:
- name: 🚧Samples/VRM10Viewer
- name: RuntimeImport
href: vrm1/vrm1_runtime_load.md
- name: 🚧Humanoid
href: vrm1/vrm1_get_humanoid.md
- name: 🚧Expression
href: vrm1/vrm1_expression.md
- name: 🚧LookAt
href: vrm1/vrm1_lookat.md
- name: FirstPerson
href: vrm1/vrm1_firstperson.md

View File

@@ -1,5 +0,0 @@
---
title: 🚧LookAt
weight: 40
---

1
docs/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_build

55
docs/conf.py Normal file
View File

@@ -0,0 +1,55 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'UniVRM Programming Document'
copyright = '2021, VRM Consortium'
author = 'VRM Consortium'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['myst_parser']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'ja'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'classic'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

View File

@@ -1,4 +1,4 @@
# v0.36
# GltfUpdate(0.36)
## テクスチャ名の格納位置の修正

View File

@@ -1,3 +1,4 @@
# GlbImport(0.82)
`0.82.1` の API です。
`0.82.0` の場合は更新をお願いします。
@@ -7,55 +8,55 @@
2. `GltfData` から `Unity Hierarchy` を ロード する。`RuntimeGltfInstance` を得る。 ローダーを破棄する。
3. ロードした `RuntimeGltfInstance` 使う。`RuntimeGltfInstance` を破棄する。
# 1. パースする
## 1. パースする
## glb ファイルパスからパースする
### glb ファイルパスからパースする
* `vrm` もこの関数を使います。
```cs
```csharp
GltfData Load(string path)
{
return new GlbFileParser(path).Parse();
}
```
## glb バイト列をパースする
### glb バイト列をパースする
* `vrm` もこの関数を使います。
```cs
```csharp
GltfData Load(byte[] bytes)
{
return new GlbBinaryParser(bytes, "LOAD_NAME").parse();
}
```
## gltf ファイルパスからパースする
### gltf ファイルパスからパースする
```cs
```csharp
GltfData Load(string path)
{
return new GltfFileWithResourceFilesParser(path).Parse();
}
```
## zip アーカイブからパースする
### zip アーカイブからパースする
gltf と関連するファイルを zip アーカイブしたファイルをパースできます(実験)。
```cs
```csharp
GltfData Load(string path)
{
return new ZipArchivedGltfFileParser(path).Parse();
}
```
## ファイルパスの拡張子でパースする
### ファイルパスの拡張子でパースする
サンプルの `SimpleViewer` を参考にしてください。
```cs
```csharp
GltfData Load(string path)
{
// ファイル拡張子で自動判定します
@@ -63,11 +64,11 @@ GltfData Load(string path)
}
```
# 2. ロードする
## 2. ロードする
## sync
### sync
```cs
```csharp
RuntimeGltfInstance Load(GltfData data)
{
// ImporterContext は使用後に Dispose を呼び出してください。
@@ -80,9 +81,9 @@ RuntimeGltfInstance Load(GltfData data)
}
```
## async
### async
```cs
```csharp
async RuntimeGltfInstance Load(GltfData data)
{
// ImporterContext は使用後に Dispose を呼び出してください。
@@ -95,11 +96,11 @@ async RuntimeGltfInstance Load(GltfData data)
}
```
## materialGenerator で URP 用のマテリアルをロードする
### materialGenerator で URP 用のマテリアルをロードする
`materialGenerator` 引き数(省略可能)を指定することで URP マテリアルを生成するようにカスタムできます。
```cs
```csharp
async RuntimeGltfInstance Load(GltfData data)
{
var materialGenerator = new GltfUrpMaterialDescriptorGenerator();
@@ -111,9 +112,9 @@ async RuntimeGltfInstance Load(GltfData data)
}
```
# 3. インスタンスを使用する
## 3. インスタンスを使用する
```cs
```csharp
// SkinnedMeshRenderer に対する指示
instance.EnableUpdateWhenOffscreen();
// 準備ができたら表示する(デフォルトでは非表示)
@@ -121,6 +122,6 @@ instance.ShowMeshes();
```
使用後に以下のように破棄してください。関連する Asset(Texture, Material, Meshなど)も破棄されます。
```cs
```csharp
GameObject.Destroy(instance);
```

View File

@@ -1,3 +1,5 @@
# glTF拡張の実装(0.63.2)
`UniVRM-0.63.2` から `UniGLTF` の構成が変わって、 `extensions` / `extras` の実装方法が変わりました。
## GLTF 拡張とは
@@ -26,7 +28,7 @@
`v0.63.0` 以前は、`GLTF 型``extensions` フィールドに、`GLTFExtensions` 型を定義して、`VRM` フィールドを定義するという方法をとっていました。
```cs
```csharp
class VRM
{
@@ -49,7 +51,7 @@ class GLTF
`v0.63.1` から設計を変更して、すべての `extensions/extras` に同じ型の入れ物を使うように変更しました。
UniGLTF は `import/export` の具体的な内容を知らずに中間データの入れ物として扱います。
```cs
```csharp
// extensions / extras の入れ物として使う型
// 実行時は、 glTFExtensionImport / glTFExtensionExport を使う
public abstract class glTFExtension
@@ -126,7 +128,7 @@ void ImportMaterial(UniGLTF.glTFMaterial material)
### export
```cs
```csharp
void SerializeGoodMaterial(UniJSON.JsonFormatter f, GoodMaterial value)
{
// シリアライズ。手で書くかコード生成する(後述)
@@ -255,7 +257,7 @@ C# の型から生成するものと、JsonSchema から C# の型とともに
* `Assets\UniGLTF\Editor\UniGLTF\Serialization\SerializerGenerator.cs`
```cs
```csharp
using System;
using System.Collections.Generic;
using System.IO;
@@ -331,7 +333,7 @@ namespace UniGLTF {
* `Assets\UniGLTF\Editor\UniGLTF\Serialization\DeserializerGenerator.cs`
```cs
```csharp
using System.IO;
using System.Reflection;
using System.Text;
@@ -401,21 +403,21 @@ public static class GltfDeserializer
TODO: `int?` にするべきだった
```cs
```csharp
[JsonSchema(Minimum = 0)]
int index = -1;
```
のようにすることで、キーの出力を抑制できます。
```cs
```csharp
// 生成コードのキー出力例
if(value.index>=0){
```
何も付けないと
```cs
```csharp
// 出力制御無し
if(true){
```
@@ -425,7 +427,7 @@ int index = -1;
enumの値の名前を文字列で使う、enumの値の数値を使うの2種類がありえます。
enumの場合はデフォルト値が無いので必須です。
```cs
```csharp
[JsonSchema(EnumSerializationType = EnumSerializationType.AsInt)]
public glBufferTarget target;

67
docs/index.md Normal file
View File

@@ -0,0 +1,67 @@
# UniVRM Programming Document
これは、開発者(UniVRMを使ったアプリケーションを作成する人)向けのドキュメントです。
UnityでVRMをエクスポートする方法などについては [manual](https://vrm.dev/docs/univrm/) を参照してください。
## 概要
```{toctree}
:maxdepth: 1
package.md
history.md
```
## glTF
```{toctree}
:maxdepth: 1
gltf/0_82_glb_import.md
gltf/how_to_impl_extension.md
gltf/0_36_update.md
```
## VRM
```{toctree}
:maxdepth: 1
vrm0/0_82_runtime_import.md
vrm0/0_79_runtime_import.md
vrm0/0_77_runtime_import.md
vrm0/0_68_runtime_import.md
vrm0/0_44_runtime_import.md
vrm0/0_58_blendshape.md
vrm0/firstperson.md
```
### Samples
- SimpleViewer
- RuntimeExporerSample
- FirstPersonSample
- AnimationBridgeSample
## VRM-1.0(β)
```{toctree}
:maxdepth: 2
vrm1/vrm1_runtime_load.md
vrm1/vrm1_get_humanoid.md
vrm1/vrm1_expression.md
vrm1/vrm1_lookat.md
vrm1/vrm1_firstperson.md
```
### Samples
- VRM10Viewer
# Indices and tables
* {ref}`genindex`
* {ref}`modindex`
* {ref}`search`

View File

@@ -1,5 +1,7 @@
# パッケージ構成
## パッケージ
| unitypackage | folder | contents |
|--------------------|-----------------------------------|-----------------------|
| VRMShaders_UniGLTF | Assets/VRMShaders, Assets/UniGLTF | VRMShaders と UniGLTF |
@@ -17,7 +19,7 @@
+----------------------+
```
# UPM
## UPM
```json
// manifest.json 抜粋

View File

@@ -1,3 +1,5 @@
# RuntimeImport(0.44)
## `Version 0.44` LoadAsyncの例
```csharp

View File

@@ -1,13 +1,5 @@
---
title: BlendShapeProxyの使い方
date: 2018-04-16T16:30:00+09:00
aliases: [
"/dev/univrm-0.xx/programming/univrm_use_blendshape/",
"/univrm/programming/how_to_use_blendshapeproxy/",
]
weight: 3
tags: ["api"]
---
# BlendShapeProxy(0.58)
## 環境
UniVRM v0.58.0
@@ -103,7 +95,7 @@ BlendShape同士が競合することがわかりました。
例:
```cs
```csharp
var proxy = GetComponent<VRMBlendShapeProxy>();
proxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.A), 1.0f);
@@ -113,7 +105,7 @@ proxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.A), 1.
例:
```cs
```csharp
var proxy = GetComponent<VRMBlendShapeProxy>();
proxy.AccumulateValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink_L), 1.0f); // すぐに適用せずにたくわえる
@@ -129,7 +121,7 @@ BlendShape合成器が必要に応じ呼び出すことを想定しています
例:
```cs
```csharp
var proxy = GetComponent<VRMBlendShapeProxy>();
proxy.SetValues(new Dictionary<BlendShapeKey, float>

View File

@@ -1,6 +1,6 @@
## `Version 0.68`
# RuntimeImport(0.68)
### 過去バージョンからの仕様変更
## 過去バージョンからの仕様変更
`ImporterContext` の仕様を変更しました。
@@ -17,9 +17,9 @@
* VRM の GameObject の破棄タイミングでリソース (Texture, Material, Mesh, etc) を破棄します。
### サンプルコード(同期的ロード)
## サンプルコード(同期的ロード)
```cs
```csharp
using UniGLTF;
using UnityEngine;
using VRM;
@@ -85,9 +85,9 @@ namespace YourNameSpace
}
```
### サンプルコード(非同期ロード)
## サンプルコード(非同期ロード)
```cs
```csharp
using System.IO;
using System.Threading.Tasks;
using UniGLTF;

View File

@@ -1,4 +1,4 @@
## `Version 0.77~`
# RuntimeImport(0.77)
[DisposeOnGameObjectDestroyed](https://github.com/vrm-c/UniVRM/issues/1018)
@@ -17,7 +17,7 @@
Load の呼び出し後の任意のタイミングで ImporterContext.Dispose で Importer を破棄してください。
任意のタイミングで RuntimeGltfInstance を Destory することで紐づくリソース (Texture, Material, Mesh, etc) も破棄されます。
```cs
```csharp
using UniGLTF;
using UnityEngine;

View File

@@ -1,12 +1,12 @@
## `Version 0.79`
# RuntimeImport(0.79)
`GltfParser``GltfData` の分割
```cs
```csharp
var parser = new GltfParser();
parser.ParsePath(path);
```
```cs
```csharp
GltfData data = new GlbFileParser(path).Parse();
```

View File

@@ -1,3 +1,5 @@
# RuntimeImport(0.82)
* `Version 0.82.0``0.82.1` 以降を使ってください。
* `Version 0.82.1~`
@@ -10,9 +12,9 @@
サンプルの `Assets\VRM\Samples\SimpleViewer\ViewerUI.cs` も参照してください。
# 1. `GltfData` を得る
## 1. `GltfData` を得る
```cs
```csharp
GltfData Load(string path)
{
return new GlbFileParser(path).Parse();
@@ -21,15 +23,15 @@ GltfData Load(string path)
[GLB import](../gltf/0_82_glb_import.md) も参照してください。
# 2. `VRMData` を得る
## 2. `VRMData` を得る
```cs
```csharp
VRMData vrm = new VRMData(data);
```
# 3. Load する
## 3. Load する
```cs
```csharp
async RuntimeGltfInstance Load(VRMData vrm)
{
// 使用後に Dispose で VRMImporterContext を破棄してください。
@@ -41,12 +43,12 @@ async RuntimeGltfInstance Load(VRMData vrm)
}
```
## URP 向けに `materialGenerator` を指定する(実験)
### URP 向けに `materialGenerator` を指定する(実験)
`materialGenerator` 引き数(省略可能)を指定することで URP マテリアルを生成するようにカスタムできます。
指定しない場合は `built-in` 向けのデフォルトが使用されます。
```cs
```csharp
async RuntimeGltfInstance Load(VRMData vrm)
{
var materialGenerator = new VRMUrpMaterialDescriptorGenerator(vrm.VrmExtension);
@@ -60,9 +62,9 @@ async RuntimeGltfInstance Load(VRMData vrm)
* まだ URP 向け MToonShader が作成されていないので、`UniUnlit` にフォールバックします。
# 4. Instance
## 4. Instance
```cs
```csharp
// SkinnedMeshRenderer に対する指示
instance.EnableUpdateWhenOffscreen();
// 準備ができたら表示する(デフォルトでは非表示)
@@ -70,7 +72,7 @@ instance.ShowMeshes();
```
使用後に以下のように破棄してください。関連する Asset(Texture, Material, Meshなど)も破棄されます。
```cs
```csharp
// GameObject.Destroy(instance);
// RuntimeGltfInstance ではなくて、その GameObject を Destroy します。

View File

@@ -1,13 +1,6 @@
---
title: "VRMFirstPersonの使い方"
linkTitle: "一人称モードの使い方"
date: 2018-05-29T10:00:00+09:00
aliases: ["/dev/univrm-0.xx/programming/univrm_use_firstperson/"]
weight: 5
tags: ["api"]
---
# VRMFirstPersonの使い方
# VRMFirstPersonの設定
## VRMFirstPersonの設定
[VRMFirstPerson]({{< relref "univrm_firstperson.md" >}})ではRendererに対して設定があります。
|FirstPersonFlag |レイヤー |備考 |
@@ -19,7 +12,7 @@ tags: ["api"]
実行時に**VRMFirstPerson.Setup**を呼び出すことで、上記のレイヤー設定を行うことができます。明示的に外部から呼び出してください。
# アプリケーションに追加の描画レイヤーを指定する
## アプリケーションに追加の描画レイヤーを指定する
定数で以下のレイヤーを定義しています。
@@ -37,7 +30,7 @@ public class VRMFirstPerson : MonoBehaviour
|-----|
|9番と番にLayerを設定|
# 実行時にSetupを呼び出して、カメラにLayerMaskを設定する
## 実行時にSetupを呼び出して、カメラにLayerMaskを設定する
* VRMFirstPerson.Setupの呼び出し
* 一人称カメラとその他のカメラに対してLayerMask

View File

@@ -1,7 +1,4 @@
---
title: 🚧Expression
weight: 30
---
# 🚧Expression
表情周りの操作方法。
@@ -9,7 +6,7 @@ weight: 30
VRM-0.X の例
```cs
```csharp
void SetExpression(GameObject root)
{
var controller = root.GetComponent<BlendShapeProxy>();
@@ -18,7 +15,7 @@ void SetExpression(GameObject root)
VRM-1.0 の例
```cs
```csharp
void SetExpression(GameObject root)
{
var controller = root.GetComponent<VRM10Controller>();

View File

@@ -1,4 +1,6 @@
# Runtime に FirstPerson 機能を有効にする
# FirstPerson
## Runtime に FirstPerson 機能を有効にする
VR向け FirstPerson 設定の初期化手順です。
@@ -8,7 +10,7 @@ VR向け FirstPerson 設定の初期化手順です。
4. `controller.Vrm.FirstPerson.SetupAsync` した結果新規に作成されたモデルを `RuntimeGltfInstance` に渡す
5. ShowMeshes
```cs
```csharp
async Task<RuntimeGltfInstance> LoadAsync(string path)
{
var data = new GlbFileParser(path).Parse();
@@ -38,7 +40,7 @@ async Task<RuntimeGltfInstance> LoadAsync(string path)
}
```
# VRMの推奨する VR 向けのカメラ構成
## VRMの推奨する VR 向けのカメラ構成
ヘッドマウントディスプレイを表すカメラ と その他のカメラという2種類のカメラを想定ます。
それぞれに対して、
@@ -57,10 +59,10 @@ VRMは、`VRMFirstPersonOnly` と `VRMThirdPersonOnly` という名前のレイ
設定してください。
サンプルでは、それぞれに `9``10` を割り当ています。
# 初期化時に layer を明示する
## 初期化時に layer を明示する
追加の引数で指定できます。
```cs
```csharp
var created = await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject, firstPersonOnlyLayer: 9, thirdPersonOnlyLayer: 10);
```

View File

@@ -1,7 +1,4 @@
---
title: 🚧Humanoid
weight: 20
---
# 🚧Humanoid
## Humanoid Bone の取得方法

1
docs/vrm1/vrm1_lookat.md Normal file
View File

@@ -0,0 +1 @@
# 🚧LookAt

View File

@@ -6,7 +6,7 @@
サンプルの `Assets\VRM10\Samples\VRM10Viewer\VRM10ViewerUI.cs` も参照してください。
```cs
```csharp
static IMaterialDescriptorGenerator GetVrmMaterialDescriptorGenerator(bool useUrp)
{
if (useUrp)