示例#1
0
        internal LightData(BinaryReader br, Map map, SharedForms.Output outForm)
        {
            mNumSamples = br.ReadInt32();
            int numFaces = br.ReadInt32();

            mLightPoints = new Vector3[numFaces][];
            mInSolid     = new bool[numFaces][];
            mPlanes      = new GFXPlane[numFaces];
            mFInfos      = new FInfo[numFaces];

            outForm.Print("Reading " + numFaces + " faces...\n");
            outForm.UpdateProgress(0, numFaces, 0);

            int numPointsTotal = 0;

            for (int i = 0; i < numFaces; i++)
            {
                int numPoints = br.ReadInt32();

                mLightPoints[i] = new Vector3[numPoints];
                mInSolid[i]     = new bool[numPoints];

                for (int j = 0; j < numPoints; j++)
                {
                    mLightPoints[i][j] = FileUtil.ReadVector3(br);
                    mInSolid[i][j]     = map.IsPointInSolidSpace(mLightPoints[i][j]);
                    numPointsTotal++;
                }

                mPlanes[i] = new GFXPlane();
                mPlanes[i].Read(br);

                bool bFInfo = br.ReadBoolean();
                if (bFInfo)
                {
                    mFInfos[i] = new FInfo();
                    mFInfos[i].ReadVecs(br);
                }
                outForm.UpdateProgress(0, numFaces, i);
            }

            outForm.UpdateProgress(0, numFaces, 0);
            outForm.Print("Read " + numPointsTotal + " total points.\n");
        }
示例#2
0
        static AnimForm SetUpForms(Device gd, MatLib matLib, StuffKeeper sk, CommonPrims ep)
        {
            MeshLib.AnimLib animLib = new MeshLib.AnimLib();
            AnimForm        af      = new AnimForm(gd, matLib, animLib);
            StripElements   se      = new StripElements();
            SkeletonEditor  skel    = new SkeletonEditor();

            SharedForms.MaterialForm matForm = new SharedForms.MaterialForm(matLib, sk);
            SharedForms.CelTweakForm celForm = new SharedForms.CelTweakForm(gd, matLib);
            SharedForms.Output       outForm = new SharedForms.Output();

            //save positions
            matForm.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                      Settings.Default, "MaterialFormPos", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            matForm.DataBindings.Add(new System.Windows.Forms.Binding("Size",
                                                                      Settings.Default, "MaterialFormSize", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            af.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                 Settings.Default, "AnimFormPos", true,
                                                                 System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            skel.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                   Settings.Default, "SkeletonEditorFormPos", true,
                                                                   System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            skel.DataBindings.Add(new System.Windows.Forms.Binding("Size",
                                                                   Settings.Default, "SkeletonEditorFormSize", true,
                                                                   System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            celForm.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                      Settings.Default, "CelTweakFormPos", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            outForm.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                      Settings.Default, "OutputFormPos", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            outForm.DataBindings.Add(new System.Windows.Forms.Binding("Size",
                                                                      Settings.Default, "OutputFormSize", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            SeamEditor seam = null;

            MakeSeamForm(ref seam);

            af.eMeshChanged        += (sender, args) => matForm.SetMesh(sender);
            af.ePrint              += (sender, args) => outForm.Print(sender as string);
            matForm.eNukedMeshPart += (sender, args) => af.NukeMeshPart(sender as List <int>);
            matForm.eStripElements += (sender, args) =>
            { if (se.Visible)
              {
                  return;
              }
              se.Populate(args as ArchEventArgs); };
            matForm.eGenTangents += (sender, args) =>
            { ArchEventArgs aea = args as ArchEventArgs;
              if (aea != null)
              {
                  aea.mArch.GenTangents(gd, aea.mIndexes, matForm.GetTexCoordSet());
              }
            };
            matForm.eFoundSeams += (sender, args) =>
            { if (seam.IsDisposed)
              {
                  MakeSeamForm(ref seam);
              }
              seam.Initialize(gd);
              seam.AddSeams(sender as List <EditorMesh.WeightSeam>);
              seam.SizeColumns();
              seam.Visible = true; };
            se.eDeleteElement += (sender, args) =>
            { List <int> elements = sender as List <int>;
              af.NukeVertexElement(se.GetIndexes(), elements);
              se.Populate(null);      se.Visible = false;
              matForm.RefreshMeshPartList(); };
            se.eEscape += (sender, args) =>
            { se.Populate(null);      se.Visible = false; };
            af.eSkeletonChanged += (sender, args) => skel.Initialize(sender as MeshLib.Skeleton);
            af.eBoundsChanged   += (sender, args) => ep.ReBuildBoundsDrawData(gd, sender);

            skel.eSelectUnUsedBones += (sender, args) => af.GetBoneNamesInUseByDraw(sender as List <string>);
            skel.eBonesChanged      += (sender, args) => af.BonesChanged();

            af.Visible      = true;
            matForm.Visible = true;
            skel.Visible    = true;
            celForm.Visible = true;
            outForm.Visible = true;

            return(af);
        }