Ejemplo n.º 1
0
        public override void LoadFromStream(BinaryReader br, MMDImportSettings importSettings)
        {
            this.Position = PMXVector3.LoadFromStreamStatic(br);
            this.Normals  = PMXVector3.LoadFromStreamStatic(br);
            this.UV       = PMXVector2.LoadFromStreamStatic(br);


            if (importSettings.Format == MMDImportSettings.ModelFormat.PMX)
            { //PMX format
                for (int i = 0; i < importSettings.ExtendedUV; i++)
                {
                    this.AddedUVs.Add(PMXQuaternion.LoadFromStreamStatic(br));
                }

                byte deformType = br.ReadByte();

                switch (deformType)
                {
                case PMXBaseDeform.DEFORM_IDENTIFY_BDEF1:
                    this.Deform = new PMXVertexDeformBDEF1(this.Model, this);
                    break;

                case PMXBaseDeform.DEFORM_IDENTIFY_BDEF2:
                    this.Deform = new PMXVertexDeformBDEF2(this.Model, this);
                    break;

                case PMXBaseDeform.DEFORM_IDENTIFY_BDEF4:
                    this.Deform = new PMXVertexDeformBDEF4(this.Model, this);
                    break;

                case PMXBaseDeform.DEFORM_IDENTIFY_SDEF:
                    this.Deform = new PMXVertexDeformSDEF(this.Model, this);
                    break;

                case PMXBaseDeform.DEFORM_IDENTIFY_QDEF:
                default:
                    this.Deform = new PMXVertexDeformQDEF(this.Model, this);
                    break;
                }
                this.Deform.LoadFromStream(br, importSettings);

                this.OutlineMagnification = br.ReadSingle();
            }
            else
            { //PMD format
                this.Deform = PMXVertexDeformBDEF2.DeformFromPMDFile(this.Model, this, br);

                this.OutlineMagnification = ((br.ReadByte() == 0) ? 1.0f : 0.0f);
            }
        }
Ejemplo n.º 2
0
        private Dictionary <int, int> _exportHashNumbers; //Export only

        public PMXVertex(PMXModel model) : base(model)
        {
            this.AddedUVs = new List <PMXQuaternion>();

            this.Position = new PMXVector3();
            this.Normals  = new PMXVector3();
            this.UV       = new PMXVector2();

            PMXVertexDeformBDEF1 df = new PMXVertexDeformBDEF1(this.Model, this);

            this.Deform = df;

            if (this.Model.Bones.Count > 0)
            {
                df.Bone1 = this.Model.Bones[0];
            }

            this._exportHashNumbers = new Dictionary <int, int>();
        }