Example #1
0
        public static ModelingHistory ReadBinaryFile(BinaryReader br)
        {
            ModelingHistory hist = new ModelingHistory();

            hist.ReadBinary(br);
            return(hist);
        }
Example #2
0
        public ViewerControl(ModelingHistory history) :
            base(new GraphicsMode(m_GLColorFormat, m_GLDepth, m_GLStencil, m_GLSamples, 48, 2, m_GLStereo), 3, 0, GraphicsContextFlags.Debug)
        {
            hist = history;

            //clusters = hist.Layers.GetClusters();
            clusters = hist.Layers.GetClusteringLayer(currentClusterLayer).clusters;

            this.SuspendLayout();
            this.BackColor = System.Drawing.Color.DimGray;
            this.ResumeLayout(false);

            base.CreateControl();

            this.Cursor = Cursors.Cross;
            VSync       = false;

            //setup viewables
            SetCluster();

            //setup camera
            m_Camera.Width  = Width;
            m_Camera.Height = Height;
            m_Camera.Set(new Vec3f(), Quatf.AxisAngleToQuatf(Vec3f.Z, -45), 10, false);

            //m_RefreshTimer.Elapsed += delegate { RefreshControl(); };
        }
Example #3
0
 public ClusteringLayers(ModelingHistory history, Func <string, int, SolidBrush> CommandToBrush)
 {
     this.history        = history;
     level0              = new ClusteringLevel0(CommandToBrush, history); //levelTop =
     level0.Reevaluated += ClusteringReevaluated;
     nlevels             = 1;
 }
Example #4
0
        private bool filteringfunc(Cluster cluster)
        {
            ModelingHistory hist = ModelingHistory.history;

            IndexedViewableAlpha[] vs = hist.GetViewables(cluster, false, true, true, false);
            bool[] selected           = new bool[hist.SnapshotCount];
            foreach (IndexedViewableAlpha viewable in vs)
            {
                for (int ivert = 0; ivert < viewable.nVerts; ivert++)
                {
                    if (viewable.Selected[ivert])
                    {
                        selected[viewable.VertUIDs[ivert]] = true;
                    }
                }
            }
            for (int ivert = 0; ivert < hist.UniqueVertCount; ivert++)
            {
                if (selected[ivert] && hist.GetVTags(ivert).Contains(tag))
                {
                    return(false);
                }
            }
            return(true);
        }
Example #5
0
        public MyForm(ModelingHistory history)
        {
            // set modeling history
            hist = history;

            // set tlp
            InitializeTableLayoutPanel();

            // add toolstrip to tlp
            InitializeToolStrip();

            //add viewer control to form
            InitializeViewControl();

            // add timeline control to form
            InitializeTimeline();

            // Add changed influence on timeline with control
            //timeline.AddCurrentIndexChangedDelegate(ref viewer.CurrentIndexChanged);
            viewer.CurrentIndexChanged    += timeline.SetCurrentIndex;
            timeline.TimeLineIndexChanged += viewer.SetClusterIndex;

            // add items to the main window (form)
            this.Text = "Mesh Flow Viewer";
            this.Size = new Size(800, 800);

            //this.KeyPreview = true;
            this.Controls.Add(tlp);
        }
Example #6
0
 public ModelingHistory()
 {
     if (ModelingHistory.history != null)
     {
         throw new Exception("Failed sanity check");
     }
     ModelingHistory.history = this;
 }
Example #7
0
        public string[] GetTTags()
        {
            ModelingHistory  hist = ModelingHistory.history;
            HashSet <string> tags = new HashSet <string>();

            foreach (int i0 in snapshots)
            {
                foreach (string tag in hist.GetTTags(i0))
                {
                    tags.Add(tag);
                }
            }
            return(tags.ToArray());
        }
Example #8
0
        private bool filteringfunc(Cluster cluster)
        {
            ModelingHistory hist = ModelingHistory.history;

            for (int i0 = cluster.start; i0 <= cluster.end; i0++)
            {
                bool[] sel = hist.GetSelectedVerts_Snapshot(i0);
                for (int ivert = 0; ivert < sel.Length; ivert++)
                {
                    if (sel[ivert] && hist.IsHighlighted(ivert))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Example #9
0
 public void SetModelingHistory(ModelingHistory history)
 {
     this.hist = history;
 }
Example #10
0
        public CameraProperties[] GetCameras()
        {
            ModelingHistory history = ModelingHistory.history;

            CameraProperties artist   = null;
            CameraProperties bestview = null;

            Vec3f tar   = new Vec3f();
            Quatf rot   = new Quatf();
            float dist  = 0.0f;
            float ortho = 0.0f;

            List <Vec3f> selverts = new List <Vec3f>();
            Vec3f        anorm    = new Vec3f();

            foreach (int isnapshot in snapshots)
            {
                SnapshotScene    scene = history[isnapshot];
                CameraProperties cam   = scene.GetCamera();

                tar   += cam.GetTarget();
                rot   += cam.GetRotation();
                dist  += cam.GetDistance();
                ortho += (cam.GetOrtho() ? 1.0f : 0.0f);

                foreach (SnapshotModel model in scene.GetSelectedModels())
                {
                    Vec3f[] verts  = model.GetVerts();
                    Vec3f[] vnorms = model.GetVertNormals();
                    foreach (int ind in model.selinds)
                    {
                        selverts.Add(verts[ind]); anorm += vnorms[ind];
                    }
                }
            }

            int nsnapshots = snapshots.Count;

            if (nsnapshots == 0)
            {
                rot  = new Quatf(0.5f, -0.5f, -0.5f, -0.5f);
                dist = 10.0f;
                System.Console.WriteLine("Cluster with no snapshots " + start + ":" + end);
            }
            else
            {
                tar   /= (float)nsnapshots;
                rot   /= (float)nsnapshots;
                dist  /= (float)nsnapshots;
                ortho /= (float)nsnapshots;
            }

            artist = new CameraProperties(tar, rot, dist, (ortho >= 0.5f))
            {
                Name = "Artist"
            };

            bestview = artist;

            return(new CameraProperties[] { artist, bestview });
        }