/// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal モデル情報(Stream st, ヘッダ header)
 {
     this.モデル名   = ParserHelper.get_TextBuf(st, header.エンコード方式);
     this.モデル名_英 = ParserHelper.get_TextBuf(st, header.エンコード方式);
     this.コメント   = ParserHelper.get_TextBuf(st, header.エンコード方式);
     this.コメント_英 = ParserHelper.get_TextBuf(st, header.エンコード方式);
 }
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal override void 読み込む(Stream fs, ヘッダ header)
        {
            this.関連剛体Aのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
            this.関連剛体Bのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
            this.位置           = ParserHelper.get_Float3(fs);
            this.回転rad        = ParserHelper.get_Float3(fs);

            Vector3 moveLimitationMin = ParserHelper.get_Float3(fs);
            Vector3 moveLimitationMax = ParserHelper.get_Float3(fs);

            this.Damping   = moveLimitationMin.X;
            this.FixThresh = moveLimitationMax.X;

            this.MoterEnabled = Math.Abs(moveLimitationMin.Z - 1) < 0.3f;     // floatなので誤差防止のため(こんなに大きくいらないけど。)

            if (this.MoterEnabled)
            {
                this.MaxMotorImpluse = moveLimitationMax.Z;
            }

            Vector3 rotationLimitationMin = ParserHelper.get_Float3(fs);

            this.SwingSpan1 = rotationLimitationMin.Z;
            this.SwingSpan2 = rotationLimitationMin.Y;
            this.TwistSpan  = rotationLimitationMin.X;
            ParserHelper.get_Float3(fs);     // スキップ

            Vector3 springMoveCoefficient = ParserHelper.get_Float3(fs);

            this.Softness         = springMoveCoefficient.X;
            this.BiasFactor       = springMoveCoefficient.Y;
            this.RelaxationFactor = springMoveCoefficient.Z;
            ParserHelper.get_Float3(fs);     // スキップ
        }
Beispiel #3
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal override void 読み込む(Stream fs, ヘッダ header)
        {
            this.関連剛体Aのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
            this.関連剛体Bのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
            this.位置           = ParserHelper.get_Float3(fs);
            this.回転           = ParserHelper.get_Float3(fs);

            Vector3 moveLimitationMin         = ParserHelper.get_Float3(fs);
            Vector3 moveLimitationMax         = ParserHelper.get_Float3(fs);
            Vector3 rotationLimitationMin     = ParserHelper.get_Float3(fs);
            Vector3 rotationLimitationMax     = ParserHelper.get_Float3(fs);
            Vector3 springMoveCoefficient     = ParserHelper.get_Float3(fs);
            Vector3 springRotationCoefficient = ParserHelper.get_Float3(fs);

            this.LowerLinLimit = moveLimitationMin.X;
            this.UpperLinLimit = moveLimitationMax.X;
            this.LowerAngLimit = rotationLimitationMin.X;
            this.UpperAngLimit = rotationLimitationMax.X;

            this.IsPoweredLinMoter = Math.Abs(springMoveCoefficient.X - 1) < 0.3f;          // floatなので誤差防止のため(こんなに大きくいらないけど。)

            if (this.IsPoweredLinMoter)
            {
                this.TargetLinMotorVelocity = springMoveCoefficient.Y;
                this.MaxLinMotorForce       = springMoveCoefficient.Z;
            }

            this.IsPoweredAngMotor = Math.Abs(springRotationCoefficient.X - 1) < 0.3f;      // 同上

            if (this.IsPoweredAngMotor)
            {
                this.TargetAngMotorVelocity = springRotationCoefficient.Y;
                this.MaxAngMotorForce       = springRotationCoefficient.Z;
            }
        }
Beispiel #4
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal 頂点リスト(Stream st, ヘッダ header)
        {
            int 頂点数 = ParserHelper.get_Int(st);

            Debug.WriteLine($"頂点数: {頂点数}");

            this.Capacity = 頂点数;

            for (int i = 0; i < 頂点数; i++)
            {
                this.Add(new 頂点(st, header));
            }
#if DEBUG
            int[] 出現数 = new int[5];
            for (int i = 0; i < 頂点数; i++)
            {
                var ウェイト変換方式 = (byte)this[i].ウェイト変形方式;
                出現数[ウェイト変換方式]++;
            }
            Debug.WriteLine($"   " +
                            $"BDEF1:{出現数[(int) ボーンウェイト種別.BDEF1]}, " +
                            $"BDEF2:{出現数[ (int) ボーンウェイト種別.BDEF2 ]}, " +
                            $"BDEF4:{出現数[ (int) ボーンウェイト種別.BDEF4 ]}, " +
                            $"SDEF:{出現数[ (int) ボーンウェイト種別.SDEF ]}, " +
                            $"QDEF:{出現数[ (int) ボーンウェイト種別.QDEF ]}");
#endif
        }
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal ジョイント(Stream fs, ヘッダ header)
 {
     this.ジョイント名   = ParserHelper.get_TextBuf(fs, header.エンコード方式);
     this.ジョイント名_英 = ParserHelper.get_TextBuf(fs, header.エンコード方式);
     this.種別       = (ジョイント種別)ParserHelper.get_Byte(fs);
     this.パラメータ    = ジョイントパラメータ.読み込む(fs, header, this.種別);
 }
Beispiel #6
0
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal ボーンモーフオフセット(Stream st, ヘッダ header)
 {
     this.モーフ種類     = モーフ種別.ボーン;
     this.ボーンインデックス = ParserHelper.get_Index(st, header.ボーンインデックスサイズ);
     this.移動量       = ParserHelper.get_Float3(st);
     this.回転量       = ParserHelper.get_Float4(st);
 }
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal インパルスモーフオフセット(Stream st, ヘッダ header)
 {
     this.モーフ種類    = モーフ種別.インパルス;
     this.剛体インデックス = ParserHelper.get_Index(st, header.剛体インデックスサイズ);
     this.ローカルフラグ  = ParserHelper.get_Byte(st);
     this.移動速度     = ParserHelper.get_Float3(st);
     this.回転トルク    = ParserHelper.get_Float3(st);
 }
Beispiel #8
0
            }                                                   // 角度制限あり の場合


            /// <summary>
            ///     指定されたストリームから読み込む。
            /// </summary>
            internal IKリンク(Stream st, ヘッダ header)
            {
                this.リンクボーンのボーンインデックス = ParserHelper.get_Index(st, header.ボーンインデックスサイズ);
                this.角度制限あり           = ParserHelper.get_Byte(st) == 1 ? true : false;

                if (this.角度制限あり)
                {
                    this.角度制限の下限rad = ParserHelper.get_Float3(st);
                    this.角度制限の上限rad = ParserHelper.get_Float3(st);
                }
            }
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal モーフリスト(Stream st, ヘッダ header)
        {
            int モーフ数 = ParserHelper.get_Int(st);

            Debug.WriteLine($"モーフ数: {モーフ数}");

            this.Capacity = モーフ数;

            for (int i = 0; i < モーフ数; i++)
            {
                this.Add(new モーフ(st, header));
            }
        }
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal ボーンリスト(Stream st, ヘッダ header)
        {
            int ボーン数 = ParserHelper.get_Int(st);

            Debug.WriteLine($"ボーン数: {ボーン数}");

            this.Capacity = ボーン数;

            for (int i = 0; i < ボーン数; i++)
            {
                this.Add(new ボーン(st, header));
            }
        }
Beispiel #11
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal 表示枠(Stream fs, ヘッダ header)
        {
            this.枠名     = ParserHelper.get_TextBuf(fs, header.エンコード方式);
            this.枠名_英   = ParserHelper.get_TextBuf(fs, header.エンコード方式);
            this.特殊枠フラグ = ParserHelper.get_Byte(fs) == 1;
            int 枠内要素数 = ParserHelper.get_Int(fs);

            this.枠内要素リスト = new List <枠内要素>(枠内要素数);
            for (int i = 0; i < 枠内要素数; i++)
            {
                this.枠内要素リスト.Add(new 枠内要素(fs, header));
            }
        }
Beispiel #12
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal テクスチャリスト(Stream st, ヘッダ header)
        {
            int テクスチャ数 = ParserHelper.get_Int(st);

            Debug.WriteLine($"テクスチャ数: {テクスチャ数}");

            this.Capacity = テクスチャ数;

            for (int i = 0; i < テクスチャ数; i++)
            {
                this.Add(ParserHelper.get_TextBuf(st, header.エンコード方式));
            }
        }
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal 表示枠リスト(Stream st, ヘッダ header)
        {
            int 表示枠数 = ParserHelper.get_Int(st);

            Debug.WriteLine($"表示枠数: {表示枠数}");

            this.Capacity = 表示枠数;

            for (int i = 0; i < 表示枠数; i++)
            {
                this.Add(new 表示枠(st, header));
            }
        }
Beispiel #14
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal 枠内要素(Stream fs, ヘッダ header)
        {
            this.要素対象 = (ParserHelper.get_Byte(fs) == 1);

            if (this.要素対象)
            {
                this.要素対象インデックス = ParserHelper.get_Index(fs, header.モーフインデックスサイズ);
            }
            else
            {
                this.要素対象インデックス = ParserHelper.get_Index(fs, header.ボーンインデックスサイズ);
            }
        }
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal override void 読み込む(Stream fs, ヘッダ header)
 {
     this.関連剛体Aのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
     this.関連剛体Bのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
     this.位置           = ParserHelper.get_Float3(fs);
     this.回転rad        = ParserHelper.get_Float3(fs);
     ParserHelper.get_Float3(fs);     // 使わないフィールドをスキップ
     ParserHelper.get_Float3(fs);
     ParserHelper.get_Float3(fs);
     ParserHelper.get_Float3(fs);
     ParserHelper.get_Float3(fs);
     ParserHelper.get_Float3(fs);
 }
Beispiel #16
0
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal override void 読み込む(Stream fs, ヘッダ header)
 {
     this.関連剛体Aのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
     this.関連剛体Bのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
     this.位置           = ParserHelper.get_Float3(fs);
     this.回転rad        = ParserHelper.get_Float3(fs);
     this.移動制限の下限      = ParserHelper.get_Float3(fs);
     this.移動制限の上限      = ParserHelper.get_Float3(fs);
     this.回転制限の下限rad   = ParserHelper.get_Float3(fs);
     this.回転制限の上限rad   = ParserHelper.get_Float3(fs);
     ParserHelper.get_Float3(fs);     //6DOF は、 回転・平行移動バネ定数が無効なので読み取ってシーク
     ParserHelper.get_Float3(fs);
 }
Beispiel #17
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal ジョイントリスト(Stream st, ヘッダ header)
        {
            int ジョイント数 = ParserHelper.get_Int(st);

            Debug.WriteLine($"ジョイント数: {ジョイント数}");

            this.Capacity = ジョイント数;

            for (int i = 0; i < ジョイント数; i++)
            {
                this.Add(new ジョイント(st, header));
            }
        }
Beispiel #18
0
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal override void 読み込む(Stream fs, ヘッダ header)
 {
     this.関連剛体Aのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
     this.関連剛体Bのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
     this.位置           = ParserHelper.get_Float3(fs);
     this.回転rad        = ParserHelper.get_Float3(fs);
     this.移動制限の下限      = ParserHelper.get_Float3(fs);
     this.移動制限の上限      = ParserHelper.get_Float3(fs);
     this.回転制限の下限rad   = ParserHelper.get_Float3(fs);
     this.回転制限の上限rad   = ParserHelper.get_Float3(fs);
     this.バネ移動定数       = ParserHelper.get_Float3(fs);
     this.バネ回転定数       = ParserHelper.get_Float3(fs);
 }
Beispiel #19
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal 剛体リスト(Stream st, ヘッダ header)
        {
            int 剛体数 = ParserHelper.get_Int(st);

            Debug.WriteLine($"剛体数: {剛体数}");

            this.Capacity = 剛体数;

            for (int i = 0; i < 剛体数; i++)
            {
                this.Add(new 剛体(st, header));
            }
        }
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal 材質モーフオフセット(Stream st, ヘッダ header)
 {
     this.モーフ種類       = モーフ種別.材質;
     this.材質インデックス    = ParserHelper.get_Index(st, header.材質インデックスサイズ);
     this.オフセット演算形式   = ParserHelper.get_Byte(st);
     this.拡散色         = ParserHelper.get_Float4(st);
     this.反射色         = ParserHelper.get_Float3(st);
     this.反射強度        = ParserHelper.get_Float(st);
     this.環境色         = ParserHelper.get_Float3(st);
     this.エッジ色        = ParserHelper.get_Float4(st);
     this.エッジサイズ      = ParserHelper.get_Float(st);
     this.テクスチャ係数     = ParserHelper.get_Float4(st);
     this.スフィアテクスチャ係数 = ParserHelper.get_Float4(st);
     this.Toonテクスチャ係数 = ParserHelper.get_Float4(st);
 }
Beispiel #21
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal 面リスト(Stream st, ヘッダ header)
        {
            int 面数 = ParserHelper.get_Int(st);

            Debug.WriteLine($"面数: {面数 / 3}");

            this.Capacity = 面数 / 3;

            for (int i = 0; i < 面数 / 3; i++)
            {
                this.Add(
                    new 面(
                        ParserHelper.get_VertexIndex(st, header.頂点インデックスサイズ),
                        ParserHelper.get_VertexIndex(st, header.頂点インデックスサイズ),
                        ParserHelper.get_VertexIndex(st, header.頂点インデックスサイズ)));
            }
        }
Beispiel #22
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal 材質リスト(Stream st, ヘッダ header)
        {
            int 材質数 = ParserHelper.get_Int(st);

            Debug.WriteLine($"材質数: {材質数}");

            this.Capacity = 材質数;

            int 開始index = 0;

            for (int i = 0; i < 材質数; i++)
            {
                var mat = new 材質(st, header, 開始index);
                this.Add(mat);
                開始index += mat.頂点数;
            }
        }
Beispiel #23
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal 材質(Stream fs, ヘッダ header, int index)
        {
            this.開始インデックス           = index;
            this.材質名                = ParserHelper.get_TextBuf(fs, header.エンコード方式);
            this.材質名_英              = ParserHelper.get_TextBuf(fs, header.エンコード方式);
            this.拡散色                = ParserHelper.get_Float4(fs);
            this.反射色                = ParserHelper.get_Float3(fs);
            this.反射強度               = ParserHelper.get_Float(fs);
            this.環境色                = ParserHelper.get_Float3(fs);
            this.描画フラグ              = (描画フラグ)ParserHelper.get_Byte(fs);
            this.エッジ色               = ParserHelper.get_Float4(fs);
            this.エッジサイズ             = ParserHelper.get_Float(fs);
            this.通常テクスチャの参照インデックス   = ParserHelper.get_Index(fs, header.テクスチャインデックスサイズ);
            this.スフィアテクスチャの参照インデックス = ParserHelper.get_Index(fs, header.テクスチャインデックスサイズ);

            switch (ParserHelper.get_Byte(fs))
            {
            case 0:
                this.スフィアモード = スフィアモード.無効;
                break;

            case 1:
                this.スフィアモード = スフィアモード.乗算;
                break;

            case 2:
                this.スフィアモード = スフィアモード.加算;
                break;

            case 3:
                this.スフィアモード = スフィアモード.サブテクスチャ;
                break;

            default:
                throw new InvalidDataException("スフィアモード値が異常です。");
            }

            this.共有Toonフラグ            = ParserHelper.get_Byte(fs);
            this.共有Toonのテクスチャ参照インデックス = this.共有Toonフラグ == 0 ? ParserHelper.get_Index(fs, header.テクスチャインデックスサイズ) : ParserHelper.get_Byte(fs);
            this.メモ  = ParserHelper.get_TextBuf(fs, header.エンコード方式);
            this.頂点数 = ParserHelper.get_Int(fs);
            if (this.頂点数 % 3 != 0)
            {
                throw new InvalidDataException();   // 3 の倍数じゃなければエラー。
            }
        }
Beispiel #24
0
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal 剛体(Stream fs, ヘッダ header)
 {
     this.剛体名         = ParserHelper.get_TextBuf(fs, header.エンコード方式);
     this.剛体名_英       = ParserHelper.get_TextBuf(fs, header.エンコード方式);
     this.関連ボーンインデックス = ParserHelper.get_Index(fs, header.ボーンインデックスサイズ);
     this.グループ        = ParserHelper.get_Byte(fs);
     this.非衝突グループフラグ  = ParserHelper.get_UShort(fs);
     this.形状          = (剛体形状)ParserHelper.get_Byte(fs);
     this.サイズ         = ParserHelper.get_Float3(fs);
     this.位置          = ParserHelper.get_Float3(fs);
     this.回転rad       = ParserHelper.get_Float3(fs);
     this.質量          = ParserHelper.get_Float(fs);
     this.移動減衰        = ParserHelper.get_Float(fs);
     this.回転減衰        = ParserHelper.get_Float(fs);
     this.反発力         = ParserHelper.get_Float(fs);
     this.摩擦力         = ParserHelper.get_Float(fs);
     this.物理演算        = (剛体の物理演算)ParserHelper.get_Byte(fs);
 }
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal static ジョイントパラメータ 読み込む(Stream fs, ヘッダ header, ジョイント種別 type)
        {
            switch (type)
            {
            // PMX 2.0
            case ジョイント種別.ばね付き6DOF:
                var sp6 = new ばね付き6DOFジョイントパラメータ();
                sp6.読み込む(fs, header);
                return(sp6);

            // PMX 2.1
            case ジョイント種別.基本6DOF:
            case ジョイント種別.P2P:
            case ジョイント種別.円錐回転:
            case ジョイント種別.スライダー:
            case ジョイント種別.ヒンジ:
                throw new NotSupportedException("PMX2.1 以降には未対応です。");           // todo: PMX2.1 拡張のジョイントの実装

            default:
                throw new NotSupportedException();
            }
        }
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal override void 読み込む(Stream fs, ヘッダ header)
        {
            this.関連剛体Aのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
            this.関連剛体Bのインデックス = ParserHelper.get_Index(fs, header.剛体インデックスサイズ);
            this.位置           = ParserHelper.get_Float3(fs);
            this.回転rad        = ParserHelper.get_Float3(fs);

            Vector3 moveLimitationMin         = ParserHelper.get_Float3(fs);
            Vector3 moveLimitationMax         = ParserHelper.get_Float3(fs);
            Vector3 rotationLimitationMin     = ParserHelper.get_Float3(fs);
            Vector3 rotationLimitationMax     = ParserHelper.get_Float3(fs);
            Vector3 springMoveCoefficient     = ParserHelper.get_Float3(fs);
            Vector3 springRotationCoefficient = ParserHelper.get_Float3(fs);

            this.Low              = rotationLimitationMin.X;
            this.High             = rotationLimitationMax.X;
            this.SoftNess         = springMoveCoefficient.X;
            this.BiasFactor       = springMoveCoefficient.Y;
            this.RelaxationFactor = springMoveCoefficient.Z;
            this.MotorEnabled     = Math.Abs(springRotationCoefficient.X - 1) < 0.3f; // floatなので誤差防止のため(こんなに大きくいらないけど。)
            this.TargetVelocity   = springRotationCoefficient.Y;
            this.MaxMotorImpulse  = springRotationCoefficient.Z;
        }
Beispiel #27
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal 頂点(Stream st, ヘッダ header)
        {
            this.位置   = ParserHelper.get_Float3(st);
            this.法線   = ParserHelper.get_Float3(st);
            this.UV   = ParserHelper.get_Float2(st);
            this.追加UV = new Vector4[header.追加UV数];

            for (int i = 0; i < header.追加UV数; i++)
            {
                this.追加UV[i] = ParserHelper.get_Float4(st);
            }

            switch ((ボーンウェイト種別)ParserHelper.get_Byte(st))
            {
            case ボーンウェイト種別.BDEF1:
                this.ウェイト変形方式 = ボーンウェイト種別.BDEF1;
                this.ボーンウェイト  = new BDEF1()
                {
                    boneReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                };
                break;

            case ボーンウェイト種別.BDEF2:
                this.ウェイト変形方式 = ボーンウェイト種別.BDEF2;
                this.ボーンウェイト  = new BDEF2()
                {
                    Bone1ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone2ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone1Weight         = ParserHelper.get_Float(st),
                };
                break;

            case ボーンウェイト種別.BDEF4:
                this.ウェイト変形方式 = ボーンウェイト種別.BDEF4;
                this.ボーンウェイト  = new BDEF4()
                {
                    Bone1ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone2ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone3ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone4ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Weights             = ParserHelper.get_Float4(st),
                };
                break;

            case ボーンウェイト種別.SDEF:
                this.ウェイト変形方式 = ボーンウェイト種別.SDEF;
                this.ボーンウェイト  = new SDEF()
                {
                    Bone1ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone2ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone1Weight         = ParserHelper.get_Float(st),
                    SDEF_C  = ParserHelper.get_Float3(st),
                    SDEF_R0 = ParserHelper.get_Float3(st),
                    SDEF_R1 = ParserHelper.get_Float3(st),
                };
                break;

            case ボーンウェイト種別.QDEF:
                if (header.PMXバージョン < 2.1f)
                {
                    throw new InvalidDataException("QDEFはPMX2.1以降でのみサポートされます。");
                }
                this.ウェイト変形方式 = ボーンウェイト種別.QDEF;
                this.ボーンウェイト  = new QDEF()
                {
                    Bone1ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone2ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone3ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Bone4ReferenceIndex = ParserHelper.get_Index(st, header.ボーンインデックスサイズ),
                    Weights             = ParserHelper.get_Float4(st),
                };
                break;

            default:
                throw new InvalidDataException();
            }

            this.エッジ倍率 = ParserHelper.get_Float(st);
        }
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal UVモーフオフセット(Stream st, ヘッダ header, モーフ種別 type)
 {
     this.モーフ種類    = type;
     this.頂点インデックス = ParserHelper.get_VertexIndex(st, header.頂点インデックスサイズ);
     this.UVオフセット量 = ParserHelper.get_Float4(st);
 }
Beispiel #29
0
        /// <summary>
        ///     指定されたストリームから読み込む。
        /// </summary>
        internal モーフ(Stream st, ヘッダ header)
        {
            this.モーフ名   = ParserHelper.get_TextBuf(st, header.エンコード方式);
            this.モーフ名_英 = ParserHelper.get_TextBuf(st, header.エンコード方式);
            this.操作パネル  = ParserHelper.get_Byte(st);
            byte Morphtype = ParserHelper.get_Byte(st);

            this.モーフオフセット数   = ParserHelper.get_Int(st);
            this.モーフオフセットリスト = new モーフオフセット[this.モーフオフセット数];

            for (int i = 0; i < this.モーフオフセット数; i++)
            {
                switch (Morphtype)
                {
                case 0:
                    //Group Morph
                    this.モーフ種類          = モーフ種別.グループ;
                    this.モーフオフセットリスト[i] = new グループモーフオフセット(st, header);
                    break;

                case 1:
                    //Vertex Morph
                    this.モーフ種類          = モーフ種別.頂点;
                    this.モーフオフセットリスト[i] = new 頂点モーフオフセット(st, header);
                    break;

                case 2:
                    this.モーフ種類          = モーフ種別.ボーン;
                    this.モーフオフセットリスト[i] = new ボーンモーフオフセット(st, header);
                    break;

                //3~7はすべてUVMorph
                case 3:
                    this.モーフ種類          = モーフ種別.UV;
                    this.モーフオフセットリスト[i] = new UVモーフオフセット(st, header, モーフ種別.UV);
                    break;

                case 4:
                    this.モーフ種類          = モーフ種別.追加UV1;
                    this.モーフオフセットリスト[i] = new UVモーフオフセット(st, header, モーフ種別.追加UV1);
                    break;

                case 5:
                    this.モーフ種類          = モーフ種別.追加UV2;
                    this.モーフオフセットリスト[i] = new UVモーフオフセット(st, header, モーフ種別.追加UV2);
                    break;

                case 6:
                    this.モーフ種類          = モーフ種別.追加UV3;
                    this.モーフオフセットリスト[i] = new UVモーフオフセット(st, header, モーフ種別.追加UV3);
                    break;

                case 7:
                    this.モーフ種類          = モーフ種別.追加UV4;
                    this.モーフオフセットリスト[i] = new UVモーフオフセット(st, header, モーフ種別.追加UV4);
                    break;

                case 8:
                    //Material Morph
                    this.モーフ種類          = モーフ種別.材質;
                    this.モーフオフセットリスト[i] = new 材質モーフオフセット(st, header);
                    break;

                case 9:
                    if (header.PMXバージョン < 2.1)
                    {
                        throw new InvalidDataException("FlipモーフはPMX2.1以降でサポートされています。");
                    }
                    this.モーフ種類          = モーフ種別.フリップ;
                    this.モーフオフセットリスト[i] = new フリップモーフオフセット(st, header);
                    break;

                case 10:
                    if (header.PMXバージョン < 2.1)
                    {
                        throw new InvalidDataException("ImpulseモーフはPMX2.1以降でサポートされています。");
                    }
                    this.モーフ種類          = モーフ種別.インパルス;
                    this.モーフオフセットリスト[i] = new インパルスモーフオフセット(st, header);
                    break;
                }
            }
        }
 /// <summary>
 ///     指定されたストリームから読み込む。
 /// </summary>
 internal グループモーフオフセット(Stream st, ヘッダ header)
 {
     this.モーフ種類     = モーフ種別.グループ;
     this.モーフインデックス = ParserHelper.get_Index(st, header.モーフインデックスサイズ);
     this.影響度       = ParserHelper.get_Float(st);
 }