Exemple #1
0
        public static PMXVector2 LoadFromStreamStatic(BinaryReader br)
        {
            PMXVector2 res = new PMXVector2();

            res.LoadFromStream(br);
            return(res);
        }
        public PMXMorphOffsetUV(PMXModel model, PMXMorph morph, UVAddIndexType index = UVAddIndexType.UV) : base(model, morph)
        {
            switch (index)
            {
            case UVAddIndexType.UV:
                this.MorphTargetType = PMXMorph.MORPH_IDENTIFY_UV;
                break;

            case UVAddIndexType.AddUV1:
                this.MorphTargetType = PMXMorph.MORPH_IDENTIFY_UV_EXTENDED1;
                break;

            case UVAddIndexType.AddUV2:
                this.MorphTargetType = PMXMorph.MORPH_IDENTIFY_UV_EXTENDED2;
                break;

            case UVAddIndexType.AddUV3:
                this.MorphTargetType = PMXMorph.MORPH_IDENTIFY_UV_EXTENDED3;
                break;

            case UVAddIndexType.AddUV4:
                this.MorphTargetType = PMXMorph.MORPH_IDENTIFY_UV_EXTENDED4;
                break;

            default:
                this.MorphTargetType = PMXMorph.MORPH_IDENTIFY_UV;
                break;
            }

            this.UVTranslation  = new PMXVector2();
            this.UVTranslation2 = new PMXVector2();
        }
        public override void LoadFromStream(BinaryReader br, MMDImportSettings importSettings)
        {
            int vtxIndex = PMXParser.ReadIndex(br, importSettings.BitSettings.VertexIndexLength);

            this.Vertex         = this.Model.Vertices[vtxIndex];
            this.UVTranslation  = PMXVector2.LoadFromStreamStatic(br);
            this.UVTranslation2 = PMXVector2.LoadFromStreamStatic(br);
        }
Exemple #4
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);
            }
        }