コード例 #1
0
ファイル: HelixView3D.cs プロジェクト: msruzy/hydronumerics
        public void ZoomToFit(double animationTime = 0)
        {
            var bounds = Visual3DHelper.FindBounds(Children);

            if (bounds.IsEmpty)
            {
                return;
            }

            ZoomToFit(bounds, animationTime);
        }
コード例 #2
0
        /// <summary>
        /// Exports the specified viewport.
        /// Exports model, camera and lights.
        /// </summary>
        /// <param name="viewport">The viewport.</param>
        public void Export(Viewport3D viewport)
        {
            ExportHeader();
            ExportViewport(viewport);

            // Export objects
            Visual3DHelper.Traverse <GeometryModel3D>(viewport.Children, ExportModel);

            // Export camera
            ExportCamera(viewport.Camera);

            // Export lights
            Visual3DHelper.Traverse <Light>(viewport.Children, ExportLight);
        }
コード例 #3
0
        private void Expand()
        {
            if (!ExpandOrigin.HasValue)
            {
                if (Content != null)
                {
                    actualExpandOrigin = Content.Bounds.Location;
                }
            }
            else
            {
                actualExpandOrigin = ExpandOrigin.Value;
            }

            Visual3DHelper.TraverseModel <GeometryModel3D>(Content, Expand);
        }
コード例 #4
0
        // Viewport3D
        //   ModelVisual3D : Visual3D
        //     GeometryModel3D
        //     DirectionalLight
        //     AmbientLight
        //     PointLight
        //     SpotLight
        //     Model3DGroup
        //       Model3DCollection
        //       GeometryModel3D
        //       Model3DGroup
        //   ModelUIElement3D : UIElement3D : Visual3D

        protected override void ExportViewport(Viewport3D v)
        {
            var ambient = Visual3DHelper.Find <AmbientLight>(v);

            // default global settings
            WriteStartObject("Default Global Settings", "Default Global Settings", "", "Global Settings");
            if (ambient != null)
            {
                WriteParameter("Ambient Light", ambient.Color);
            }

            WriteParameter("Background Color", BackgroundColor);
            WriteParameter("Compute Volume Transfer", false);
            WriteParameter("Transfer Recursion Depth", 1);
            WriteParameter("Background Type", "Sky Color");
            WriteParameter("Sky Intensity", 1.0);
            WriteParameter("Sky Frame", "Transform", "1 0 0 0 0 1 0 0 0 0 1 0 ");
            WriteParameter("Sun Direction", "0 0 1");
            WriteParameter("Sky Turbidity", 2.0);
            WriteParameter("Sky Luminance Gamma", 1.2);
            WriteParameter("Sky Chromaticity Gamma", 1.8);
            WriteParameter("Linear Lightflow", true);
            WriteParameter("Index of Refraction", 1.0);
            WriteParameter("Scatter Density", 0.1);
            WriteParameter("./Location/Latitude", 0.0);
            WriteParameter("./Location/Longitude", 0.0);
            WriteParameter("./Location/Timezone", 0);
            WriteParameter("./Location/Date", "0/0/2007");
            WriteParameter("./Location/Time", "12:0:0");
            WriteParameter("./Background Image/Filename", "[No Bitmap]");
            WriteParameter("./Background Image/Projection", "UV");
            WriteParameter("./Background Image/Offset X", 0.0);
            WriteParameter("./Background Image/Offset Y", 0.0);
            WriteParameter("./Background Image/Scale X", 1.0);
            WriteParameter("./Background Image/Scale Y", 1.0);
            WriteParameter("./Background Image/Rotation", 0.0);
            WriteParameter("./Background Image/Smooth", true);
            WriteParameter("./Background Image/Inverted", false);
            WriteParameter("./Background Image/Alpha Channel", false);
            WriteEndObject();

            // Visual3DHelper.Traverse<Light>(v.Children, ExportLight);
            // Visual3DHelper.Traverse<GeometryModel3D>(v.Children, ExportGeometryModel3D);
        }
コード例 #5
0
        public static double GetDistanceSquared(Point3D position, Visual3D visual)
        {
            var bounds = Visual3DHelper.FindBounds(visual, Transform3D.Identity);

            return(Point3D.Subtract(bounds.Location, position).LengthSquared);
        }
コード例 #6
0
 public void Export(Model3D model)
 {
     ExportHeader();
     Visual3DHelper.TraverseModel <GeometryModel3D>(model, ExportModel);
 }
コード例 #7
0
 public void Export(Visual3D visual)
 {
     ExportHeader();
     Visual3DHelper.Traverse <GeometryModel3D>(visual, ExportModel);
 }