Esempio n. 1
0
        private void SendGraphicsToView(GraphicsUpdateParams parameters)
        {
            Points        = parameters.Points;
            Lines         = parameters.Lines;
            LinesSelected = parameters.SelectedLines;
            Mesh          = parameters.Mesh;
            MeshSelected  = parameters.SelectedMesh;
            PerVertexMesh = parameters.PerVertexMesh;
            Text          = parameters.Text;

            // Send property changed notifications for everything
            NotifyPropertyChanged(string.Empty);
        }
Esempio n. 2
0
        private void SendGraphicsToView(GraphicsUpdateParams parameters)
        {
            Points = parameters.Points;
            Lines = parameters.Lines;
            LinesSelected = parameters.SelectedLines;
            DynamoMesh = parameters.DynamoMesh;
            Mesh = parameters.Mesh;
            Text = parameters.Text;

            linesView.Attach(watch_view.RenderHost);
            linesSelectedView.Attach(watch_view.RenderHost);
            pointsView.Attach(watch_view.RenderHost);
            dynamoMeshView.Attach(watch_view.RenderHost);
            meshView.Attach(watch_view.RenderHost);
            textView.Attach(watch_view.RenderHost);

            // Send property changed notifications for everything
            NotifyPropertyChanged(string.Empty);

            Points = null;
            Lines = null;
            LinesSelected = null;
            DynamoMesh = null;
            Mesh = null;
            Text = null;
        }
Esempio n. 3
0
        /// <summary>
        /// Use the render packages returned from the visualization manager to update the visuals.
        /// The visualization event arguments will contain a set of render packages and an id representing 
        /// the associated node. Visualizations for the background preview will return an empty id.
        /// </summary>
        /// <param name="e"></param>
        public void RenderDrawables(VisualizationEventArgs e)
        {
            //check the id, if the id is meant for another watch,
            //then ignore it
            if (e.Id != _id)
            {
                return;
            }

            // Don't render if the user's system is incapable.
            if (renderingTier == 0)
            {
                return;
            }

#if DEBUG
            renderTimer.Start();
#endif
            Detach(false);

            var packages = e.Packages.Concat(e.SelectedPackages)
                .Cast<HelixRenderPackage>().Where(rp=>rp.MeshVertexCount % 3 == 0);

            var points = HelixRenderPackage.InitPointGeometry();
            var lines = HelixRenderPackage.InitLineGeometry();
            var linesSel = HelixRenderPackage.InitLineGeometry();
            var dynamoMesh = HelixRenderPackage.InitMeshGeometry();
            var mesh = HelixRenderPackage.InitMeshGeometry();
            var text = HelixRenderPackage.InitText3D();

            var aggParams = new PackageAggregationParams
            {
                Packages = packages,
                Points = points,
                Lines = lines,
                SelectedLines = linesSel,
                DynamoMesh = dynamoMesh,
                Mesh = mesh,
                Text = text
            };

            AggregateRenderPackages(aggParams);

            if (!points.Positions.Any())
                points = null;

            if (!lines.Positions.Any())
                lines = null;

            if (!linesSel.Positions.Any())
                linesSel = null;

            if (!text.TextInfo.Any())
                text = null;

            if (!dynamoMesh.Positions.Any())
                dynamoMesh = null;

            if (!mesh.Positions.Any())
                mesh = null;

#if DEBUG
            renderTimer.Stop();
            Debug.WriteLine(string.Format("RENDER: {0} ellapsed for compiling assets for rendering.", renderTimer.Elapsed));
            renderTimer.Reset();
            renderTimer.Start();
#endif

            var updateGraphicsParams = new GraphicsUpdateParams
            {
                Points = points,
                Lines = lines,
                SelectedLines = linesSel,
                DynamoMesh = dynamoMesh,
                Mesh = mesh,
                Text = text
            };

            SendGraphicsToView(updateGraphicsParams);

            //DrawTestMesh();
        }
Esempio n. 4
0
        /// <summary>
        /// Use the render packages returned from the visualization manager to update the visuals.
        /// The visualization event arguments will contain a set of render packages and an id representing
        /// the associated node. Visualizations for the background preview will return an empty id.
        /// </summary>
        /// <param name="e"></param>
        public void RenderDrawables(VisualizationEventArgs e)
        {
            //check the id, if the id is meant for another watch,
            //then ignore it
            if (e.Id != _id)
            {
                return;
            }

#if DEBUG
            renderTimer.Start();
#endif
            Points        = null;
            Lines         = null;
            LinesSelected = null;
            Mesh          = null;
            PerVertexMesh = null;
            MeshSelected  = null;
            Text          = null;
            MeshCount     = 0;

            var packages = e.Packages.Concat(e.SelectedPackages)
                           .Cast <HelixRenderPackage>().Where(rp => rp.MeshVertexCount % 3 == 0);

            var points        = HelixRenderPackage.InitPointGeometry();
            var lines         = HelixRenderPackage.InitLineGeometry();
            var linesSel      = HelixRenderPackage.InitLineGeometry();
            var mesh          = HelixRenderPackage.InitMeshGeometry();
            var meshSel       = HelixRenderPackage.InitMeshGeometry();
            var perVertexMesh = HelixRenderPackage.InitMeshGeometry();
            var text          = HelixRenderPackage.InitText3D();

            var aggParams = new PackageAggregationParams
            {
                Packages      = packages,
                Points        = points,
                Lines         = lines,
                SelectedLines = linesSel,
                Mesh          = mesh,
                PerVertexMesh = perVertexMesh,
                SelectedMesh  = meshSel,
                Text          = text
            };

            AggregateRenderPackages(aggParams);

            if (!points.Positions.Any())
            {
                points = null;
            }

            if (!lines.Positions.Any())
            {
                lines = null;
            }

            if (!linesSel.Positions.Any())
            {
                linesSel = null;
            }

            if (!text.TextInfo.Any())
            {
                text = null;
            }

            if (!mesh.Positions.Any())
            {
                mesh = null;
            }

            if (!meshSel.Positions.Any())
            {
                meshSel = null;
            }

            if (!perVertexMesh.Positions.Any())
            {
                perVertexMesh = null;
            }

#if DEBUG
            renderTimer.Stop();
            Debug.WriteLine(string.Format("RENDER: {0} ellapsed for compiling assets for rendering.", renderTimer.Elapsed));
            renderTimer.Reset();
            renderTimer.Start();
#endif

            var updateGraphicsParams = new GraphicsUpdateParams
            {
                Points        = points,
                Lines         = lines,
                SelectedLines = linesSel,
                Mesh          = mesh,
                SelectedMesh  = meshSel,
                PerVertexMesh = perVertexMesh,
                Text          = text
            };

            SendGraphicsToView(updateGraphicsParams);

            //DrawTestMesh();
        }