Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gltf の読み書きで反転軸を指定できるようにする #755

Merged
merged 26 commits into from
Feb 25, 2021

Conversation

ousttrue
Copy link
Contributor

@ousttrue ousttrue commented Feb 25, 2021

v0.68.0 での ScriptedImporter の導入は、 glb の Asset import のみ。
v0.69.0 以降で vrm にも拡大する予定。

var context = new ImporterContext(parser, externalObjectMap);
context.InvertAxis = m_reverseAxis; // これ

impoption

extract

@ousttrue ousttrue requested a review from Santarh February 25, 2021 09:01
Copy link
Contributor

@Santarh Santarh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いいんじゃないでしょうか

@@ -1,7 +1,8 @@
{
"name": "UniGLTF.Editor",
"references": [
"UniGLTF"
"UniGLTF",
"MeshUtility.Editor"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR の趣旨からは外れて asmdef 運用話になるのでどちらでも良いのですが…
ライブラリ利用ユーザがアクセスしないと想定されるような asmdef は Auto Referenced のチェックボックスを切ることで、ユーザからの不要な参照は避けられるかもしれません。

@@ -1,4 +1,5 @@
using System.IO;
#if false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ほ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScriptedImporterを導入で、Assets 外のファイルを選択して Prefab として保存するメニューはもう無くてもよさそうなので、消す前に寝かせる処置。

Debug.Log("OnImportAsset to " + ctx.assetPath);

try
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

きれい!

float angle;
Vector3 axis;
q.ToAngleAxis(out angle, out axis);
return Quaternion.AngleAxis(-angle, ReverseX(axis));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AngleAxis じゃなくても、要素の並び替えと符号反転でも表現できるので、高速化と値保持の余地はありそう。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

X-Axis の反転と回転角の反転になるので
おそらく new Quaternion(x, -y, -z, w); かなぁ

X,
}

public struct AxisInverter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

定義自体は interface でもよさそう?
struct なら readonly struct にしておきたいですね(コピーが発生するので)

@ousttrue ousttrue merged commit 6cf4682 into vrm-c:master Feb 25, 2021
@ousttrue ousttrue deleted the feature/glb_coordinate branch April 2, 2021 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants