-
Notifications
You must be signed in to change notification settings - Fork 428
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
Conversation
使い方 * var parser = new GltfParser(); * parser.ParsePath(filePath); // ParseJson, ParseGlb 等パース系の関数 * context = new ImporterContext(parser); // parse から context を作る * context.Load(); // もしくは LoadAsync で、Unity化する
There was a problem hiding this 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" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ほ?
There was a problem hiding this comment.
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 | ||
{ |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AngleAxis
じゃなくても、要素の並び替えと符号反転でも表現できるので、高速化と値保持の余地はありそう。
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
定義自体は interface でもよさそう?
struct なら readonly struct にしておきたいですね(コピーが発生するので)
v0.68.0
での ScriptedImporter の導入は、glb
の Asset import のみ。v0.69.0
以降でvrm
にも拡大する予定。