コード例 #1
0
ファイル: Camera.cs プロジェクト: splitandthechro/nginz
        /// <summary>
        /// Initializes a new instance of the <see cref="nginz.Camera"/> class.
        /// </summary>
        /// <param name="fieldOfView">Field of view.</param>
        /// <param name="resolution">Resolution.</param>
        /// <param name="near">Near plane.</param>
        /// <param name="far">Far plane.</param>
        /// <param name="radians">Whether radians should be used instead of degrees.</param>
        /// <param name="type">The camera type.</param>
        public Camera(float fieldOfView, Resolution resolution, float near, float far, bool radians = false, ProjectionType type = ProjectionType.Perspective)
        {
            // Calculate the field of view
            FieldOfView = radians
                ? fieldOfView
                : MathHelper.DegreesToRadians (fieldOfView);

            // Set the resolution
            Resolution = resolution;

            // Set the near plane
            Near = near;

            // Set the far plane
            Far = far;

            // Initialize the position
            Position = Vector3.Zero;

            // Initialize the orientation
            Orientation = Quaternion.Identity;

            // Set the camera projection type
            ProjectionType = type;

            // Calculate the projection graphics
            ProjectionMatrix =
                type == ProjectionType.Orthographic
                ? Matrix4.CreateOrthographicOffCenter (0, Resolution.Width, Resolution.Height, 0, Near, Far)
                : Matrix4.CreatePerspectiveFieldOfView (FieldOfView, AspectRatio, Near, Far);
        }
コード例 #2
0
        public ImageSetHelper(ImageSetType dataSetType, BandPass bandPass)
        {
            generic = true;
            name = "Generic";
            sparse = false;
            this.dataSetType = dataSetType;

            this.bandPass = bandPass;
            quadTreeTileMap = "";
            url = "";
            levels = 0;
            baseTileDegrees = 0;
            imageSetID = 0;
            extension = "";
            projection = ProjectionType.Equirectangular;
            bottomsUp = false;
            baseLevel = 0;
            mercator = (projection == ProjectionType.Mercator);
            centerX = 0;
            centerY = 0;
            rotation = 0;
            //todo add scale
            thumbnailUrl = "";

            matrix = Matrix3d.Identity;
            matrix.Multiply(Matrix3d.RotationX((((Rotation)) / 180f * Math.PI)));
            matrix.Multiply(Matrix3d.RotationZ(((CenterY) / 180f * Math.PI)));
            matrix.Multiply(Matrix3d.RotationY((((360 - CenterX) + 180) / 180f * Math.PI)));

            Earth3d.AddImageSetToTable(GetHash(), this);
        }
コード例 #3
0
ファイル: Camera.cs プロジェクト: weimingtom/erica
 /// <summary>
 /// コンストラクター
 /// </summary>
 public Camera()
 {
     this.type = ProjectionType.Undefined;
     this.viewport = new Rectangle (0, 0, 1, 1);
     this.screen = new Rectangle (0, 0, 0, 0);
     this.clear = true;
     this.clearColor = Color.Blue;
 }
コード例 #4
0
 public ProjectionsSubsystem(int projectionWorkerThreadCount, ProjectionType runProjections)
 {
     if (runProjections <= ProjectionType.System)
         _projectionWorkerThreadCount = 1;
     else
         _projectionWorkerThreadCount = projectionWorkerThreadCount;
     _runProjections = runProjections;
 }
コード例 #5
0
ファイル: Map.cs プロジェクト: jonclare/KodeKandy
        protected Map(ProjectionType projectionType, Mapper mapper)
            : base(mapper)
        {
            this.projectionType = projectionType;

            // We can only create a default constructor if the toType is concrete.
            if (!projectionType.ToType.IsInterface)
                ConstructUsing = _ => Activator.CreateInstance(ProjectionType.ToType);
        }
コード例 #6
0
        public ProjectionsSubsystem(int projectionWorkerThreadCount, ProjectionType runProjections, bool developmentMode)
        {
            if (runProjections <= ProjectionType.System)
                _projectionWorkerThreadCount = 1;
            else
                _projectionWorkerThreadCount = projectionWorkerThreadCount;

            _runProjections = runProjections;
            _developmentMode = developmentMode;
        }
コード例 #7
0
 public static IMapProjection CreateMapProjection(ProjectionType projectionType)
 {
     switch (projectionType)
     {
         case ProjectionType.None:
             return new LatLongProjection();
         case ProjectionType.Mercator:
             return new MercatorProjection();
         default:
             throw new ArgumentException("Unknown ProjectionType");
     }
     
 }
コード例 #8
0
 public ProjectionsStandardComponents(
     int projectionWorkerThreadCount,
     ProjectionType runProjections,
     InMemoryBus masterOutputBus,
     QueuedHandler masterInputQueue,
     InMemoryBus masterMainBus)
 {
     _projectionWorkerThreadCount = projectionWorkerThreadCount;
     _runProjections = runProjections;
     _masterOutputBus = masterOutputBus;
     _masterInputQueue = masterInputQueue;
     _masterMainBus = masterMainBus;
 }
コード例 #9
0
        public ProjectionWorkerNode(
            Guid workerId,
            TFChunkDb db,
            QueuedHandler inputQueue,
            ITimeProvider timeProvider,
            ISingletonTimeoutScheduler timeoutScheduler,
            ProjectionType runProjections)
        {
            _runProjections = runProjections;
            Ensure.NotNull(db, "db");

            _coreOutput = new InMemoryBus("Core Output");

            IPublisher publisher = CoreOutput;
            _subscriptionDispatcher = new ReaderSubscriptionDispatcher(publisher);
            _spoolProcessingResponseDispatcher = new SpooledStreamReadingDispatcher(publisher);

            _ioDispatcher = new IODispatcher(publisher, new PublishEnvelope(inputQueue));
            _eventReaderCoreService = new EventReaderCoreService(
                publisher,
                _ioDispatcher,
                10,
                db.Config.WriterCheckpoint,
                runHeadingReader: runProjections >= ProjectionType.System);

            _feedReaderService = new FeedReaderService(_subscriptionDispatcher, timeProvider);
            if (runProjections >= ProjectionType.System)
            {
                _projectionCoreServiceCommandReader = new ProjectionCoreServiceCommandReader(
                    publisher,
                    _ioDispatcher,
                    workerId.ToString("N"));

                var multiStreamWriter = new MultiStreamMessageWriter(_ioDispatcher);
                _slaveProjectionResponseWriter = new SlaveProjectionResponseWriter(multiStreamWriter);

                _projectionCoreService = new ProjectionCoreService(
                    workerId,
                    inputQueue,
                    publisher,
                    _subscriptionDispatcher,
                    timeProvider,
                    _ioDispatcher,
                    _spoolProcessingResponseDispatcher,
                    timeoutScheduler);

                var responseWriter = new ResponseWriter(_ioDispatcher);
                _coreResponseWriter = new ProjectionCoreResponseWriter(responseWriter);
            }
        }
コード例 #10
0
ファイル: PolymorphicMap.cs プロジェクト: jonclare/KodeKandy
        public void AddPolymorph(ProjectionType polymorphProjectionType)
        {
            Require.NotNull(polymorphProjectionType, "polymorphProjectionType");

            Require.IsTrue(ProjectionType.FromType.IsAssignableFrom(polymorphProjectionType.FromType),
                String.Format("Cannot be polymorphic for a Projection whose 'from' type '{0}' is not a subtype of this maps 'from' type '{1}'.",
                    polymorphProjectionType.FromType.Name, ProjectionType.FromType.Name));

            Require.IsTrue(ProjectionType.ToType.IsAssignableFrom(polymorphProjectionType.ToType),
                String.Format("Cannot be polymorphic for a Projection whose 'to' type '{0}' is not a subtype of this maps 'to' type '{1}'.",
                    polymorphProjectionType.ToType.Name, ProjectionType.ToType.Name));

            Require.IsFalse(polymorphs.Any(pt => pt.ProjectionType.FromType == polymorphProjectionType.FromType),
                String.Format(
                    "Illegal polymorph defintion. A definition has already been registered for the 'from' type '{0}' and would be made ambiguous by this one.",
                    polymorphProjectionType.FromType.Name));

            polymorphs.Add(new LateBoundProjection(polymorphProjectionType, Mapper));
        }
コード例 #11
0
        /// <summary>
        /// Creates a new scene axes GUI.
        /// </summary>
        /// <param name="window">Window in which the GUI is located in.</param>
        /// <param name="panel">Panel onto which to place the GUI element.</param>
        /// <param name="width">Width of the GUI element.</param>
        /// <param name="height">Height of the GUI element.</param>
        /// <param name="projType">Projection type to display on the GUI.</param>
        public SceneAxesGUI(SceneWindow window, GUIPanel panel, int width, int height, ProjectionType projType)
        {
            renderTexture = new RenderTexture2D(PixelFormat.R8G8B8A8, width, height);
            renderTexture.Priority = 1;

            SceneObject cameraSO = new SceneObject("SceneAxesCamera", true);
            camera = cameraSO.AddComponent<Camera>();
            camera.Target = renderTexture;
            camera.ViewportRect = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);

            cameraSO.Position = new Vector3(0, 0, 5);
            cameraSO.LookAt(new Vector3(0, 0, 0));

            camera.Priority = 2;
            camera.NearClipPlane = 0.05f;
            camera.FarClipPlane = 1000.0f;
            camera.ClearColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
            camera.ProjectionType = ProjectionType.Orthographic;
            camera.Layers = SceneAxesHandle.LAYER;
            camera.AspectRatio = 1.0f;
            camera.OrthoHeight = 2.0f;
            camera.HDR = false;

            renderTextureGUI = new GUIRenderTexture(renderTexture, true);

            GUILayoutY layout = panel.AddLayoutY();
            GUILayoutX textureLayout = layout.AddLayoutX();
            textureLayout.AddElement(renderTextureGUI);
            textureLayout.AddFlexibleSpace();

            Rect2I bounds = new Rect2I(0, 0, width, height);
            sceneHandles = new SceneHandles(window, camera);
            renderTextureGUI.Bounds = bounds;

            labelGUI = new GUILabel(projType.ToString(), EditorStyles.LabelCentered);
            layout.AddElement(labelGUI);
            layout.AddFlexibleSpace();

            this.panel = panel;
            this.bounds = bounds;
        }
コード例 #12
0
ファイル: PolymorphicMap.cs プロジェクト: jonclare/KodeKandy
 public PolymorphicMap(ProjectionType projectionType, Mapper mapper)
     : base(projectionType, mapper)
 {
     this.projectionType = projectionType;
 }
コード例 #13
0
        public static Imageset Create(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, int tileSize, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame)
        {
            Imageset temp = new Imageset();

            temp.SetInitialParameters(name, url, dataSetType, bandPass, projection, imageSetID, baseLevel, levels, baseTileDegrees, extension, bottomsUp, quadTreeMap, centerX, centerY, rotation, sparse, thumbnailUrl, defaultSet, elevationModel, wf, offsetX, offsetY, credits, creditsUrl, demUrlIn, alturl, meanRadius, referenceFrame);

            return(temp);
        }
コード例 #14
0
ファイル: SceneAxesGUI.cs プロジェクト: xuebai5/BansheeEngine
        /// <summary>
        /// Creates a new scene axes GUI.
        /// </summary>
        /// <param name="window">Window in which the GUI is located in.</param>
        /// <param name="panel">Panel onto which to place the GUI element.</param>
        /// <param name="width">Width of the GUI element.</param>
        /// <param name="height">Height of the GUI element.</param>
        /// <param name="projType">Projection type to display on the GUI.</param>
        public SceneAxesGUI(SceneWindow window, GUIPanel panel, int width, int height, ProjectionType projType)
        {
            renderTexture          = new RenderTexture(PixelFormat.RGBA8, width, height);
            renderTexture.Priority = 1;

            SceneObject cameraSO = new SceneObject("SceneAxesCamera", true);

            camera = cameraSO.AddComponent <Camera>();
            camera.Viewport.Target = renderTexture;
            camera.Viewport.Area   = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);

            cameraSO.Position = new Vector3(0, 0, 5);
            cameraSO.LookAt(new Vector3(0, 0, 0));

            camera.Priority            = 2;
            camera.NearClipPlane       = 0.05f;
            camera.FarClipPlane        = 1000.0f;
            camera.Viewport.ClearColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
            camera.ProjectionType      = ProjectionType.Orthographic;
            camera.Layers      = SceneAxesHandle.LAYER;
            camera.AspectRatio = 1.0f;
            camera.OrthoHeight = 2.0f;
            camera.RenderSettings.EnableHDR    = false;
            camera.RenderSettings.EnableSkybox = false;

            renderTextureGUI = new GUIRenderTexture(renderTexture, true);

            GUILayoutY layout        = panel.AddLayoutY();
            GUILayoutX textureLayout = layout.AddLayoutX();

            textureLayout.AddElement(renderTextureGUI);
            textureLayout.AddFlexibleSpace();

            Rect2I bounds = new Rect2I(0, 0, width, height);

            sceneHandles            = new SceneHandles(window, camera);
            renderTextureGUI.Bounds = bounds;

            labelGUI = new GUILabel(projType.ToString(), EditorStyles.LabelCentered);
            layout.AddElement(labelGUI);
            layout.AddFlexibleSpace();

            this.panel  = panel;
            this.bounds = bounds;
        }
コード例 #15
0
 /// <inheritdoc />
 public IItem AddCurve(Mat curvePoints, bool addToRef = false,
                       ProjectionType projectionType  = ProjectionType.AlongNormalRecalc)
 {
     return(Link.AddCurve(curvePoints, this, addToRef, projectionType));
 }
コード例 #16
0
 public void AddVertex(Vector3 position, Vector3 normal, ProjectionType type)
 {
     AddVertex(new VertexPosNorTex(position, normal, GenerateUV(type, position, normal, new Vector2(1, 1))));
 }
コード例 #17
0
        public static Imageset FromXMLNode(XmlNode node)
        {
            try
            {
                ImageSetType type = ImageSetType.Sky;

                ProjectionType projection = ProjectionType.Tangent;

                if (node.Attributes.GetNamedItem("DataSetType") != null)
                {
                    type = (ImageSetType)Enums.Parse("ImageSetType", node.Attributes.GetNamedItem("DataSetType").Value);
                }

                BandPass bandPass = BandPass.Visible;

                bandPass = (BandPass)Enums.Parse("BandPass", node.Attributes.GetNamedItem("BandPass").Value);

                int wf = 1;
                if (node.Attributes.GetNamedItem("WidthFactor") != null)
                {
                    wf = int.Parse(node.Attributes.GetNamedItem("WidthFactor").Value);
                }

                if (node.Attributes.GetNamedItem("Generic") == null || !bool.Parse(node.Attributes.GetNamedItem("Generic").Value.ToString()))
                {
                    projection = (ProjectionType)Enums.Parse("ProjectionType", node.Attributes.GetNamedItem("Projection").Value);

                    string fileType = node.Attributes.GetNamedItem("FileType").Value.ToString();
                    if (!fileType.StartsWith("."))
                    {
                        fileType = "." + fileType;
                    }


                    string thumbnailUrl = "";

                    XmlNode thumbUrl = Util.SelectSingleNode(node, "ThumbnailUrl");
                    if (thumbUrl != null)
                    {
                        if (string.IsNullOrEmpty(thumbUrl.InnerText))
                        {
                            ChromeNode cn = (ChromeNode)(object)thumbUrl;
                            thumbnailUrl = cn.TextContent;
                        }
                        else
                        {
                            thumbnailUrl = thumbUrl.InnerText;
                        }
                    }

                    bool stockSet       = false;
                    bool elevationModel = false;

                    if (node.Attributes.GetNamedItem("StockSet") != null)
                    {
                        stockSet = bool.Parse(node.Attributes.GetNamedItem("StockSet").Value.ToString());
                    }

                    if (node.Attributes.GetNamedItem("ElevationModel") != null)
                    {
                        elevationModel = bool.Parse(node.Attributes.GetNamedItem("ElevationModel").Value.ToString());
                    }

                    string demUrl = "";
                    if (node.Attributes.GetNamedItem("DemUrl") != null)
                    {
                        demUrl = node.Attributes.GetNamedItem("DemUrl").Value.ToString();
                    }

                    string alturl = "";

                    if (node.Attributes.GetNamedItem("AltUrl") != null)
                    {
                        alturl = node.Attributes.GetNamedItem("AltUrl").Value.ToString();
                    }


                    double offsetX = 0;

                    if (node.Attributes.GetNamedItem("OffsetX") != null)
                    {
                        offsetX = double.Parse(node.Attributes.GetNamedItem("OffsetX").Value.ToString());
                    }

                    double offsetY = 0;

                    if (node.Attributes.GetNamedItem("OffsetY") != null)
                    {
                        offsetY = double.Parse(node.Attributes.GetNamedItem("OffsetY").Value.ToString());
                    }

                    string creditText = "";

                    XmlNode credits = Util.SelectSingleNode(node, "Credits");

                    if (credits != null)
                    {
                        creditText = Util.GetInnerText(credits);
                    }

                    string creditsUrl = "";

                    credits = Util.SelectSingleNode(node, "CreditsUrl");

                    if (credits != null)
                    {
                        creditsUrl = Util.GetInnerText(credits);
                    }

                    double meanRadius = 0;

                    if (node.Attributes.GetNamedItem("MeanRadius") != null)
                    {
                        meanRadius = double.Parse(node.Attributes.GetNamedItem("MeanRadius").Value.ToString());
                    }

                    string referenceFrame = null;
                    if (node.Attributes.GetNamedItem("ReferenceFrame") != null)
                    {
                        referenceFrame = node.Attributes.GetNamedItem("ReferenceFrame").Value;
                    }

                    string name = "";
                    if (node.Attributes.GetNamedItem("Name") != null)
                    {
                        name = node.Attributes.GetNamedItem("Name").Value.ToString();
                    }

                    string url = "";
                    if (node.Attributes.GetNamedItem("Url") != null)
                    {
                        url = node.Attributes.GetNamedItem("Url").Value.ToString();
                    }

                    int baseTileLevel = 0;
                    if (node.Attributes.GetNamedItem("BaseTileLevel") != null)
                    {
                        baseTileLevel = int.Parse(node.Attributes.GetNamedItem("BaseTileLevel").Value.ToString());
                    }

                    int tileLevels = 0;
                    if (node.Attributes.GetNamedItem("TileLevels") != null)
                    {
                        tileLevels = int.Parse(node.Attributes.GetNamedItem("TileLevels").Value.ToString());
                    }

                    double baseDegreesPerTile = 0;

                    if (node.Attributes.GetNamedItem("BaseDegreesPerTile") != null)
                    {
                        baseDegreesPerTile = double.Parse(node.Attributes.GetNamedItem("BaseDegreesPerTile").Value.ToString());
                    }


                    bool bottomsUp = false;


                    if (node.Attributes.GetNamedItem("BottomsUp") != null)
                    {
                        bottomsUp = bool.Parse(node.Attributes.GetNamedItem("BottomsUp").Value.ToString());
                    }

                    string quadTreeMap = "";
                    if (node.Attributes.GetNamedItem("QuadTreeMap") != null)
                    {
                        quadTreeMap = node.Attributes.GetNamedItem("QuadTreeMap").Value.ToString();
                    }

                    double centerX = 0;

                    if (node.Attributes.GetNamedItem("CenterX") != null)
                    {
                        centerX = double.Parse(node.Attributes.GetNamedItem("CenterX").Value.ToString());
                    }

                    double centerY = 0;

                    if (node.Attributes.GetNamedItem("CenterY") != null)
                    {
                        centerY = double.Parse(node.Attributes.GetNamedItem("CenterY").Value.ToString());
                    }

                    double rotation = 0;

                    if (node.Attributes.GetNamedItem("Rotation") != null)
                    {
                        rotation = double.Parse(node.Attributes.GetNamedItem("Rotation").Value.ToString());
                    }

                    bool sparse = false;

                    if (node.Attributes.GetNamedItem("Sparse") != null)
                    {
                        sparse = bool.Parse(node.Attributes.GetNamedItem("Sparse").Value.ToString());
                    }

                    return(Imageset.Create(name, url,
                                           type, bandPass, projection, Math.Abs(Util.GetHashCode(url)),
                                           baseTileLevel, tileLevels,
                                           256, baseDegreesPerTile, fileType,
                                           bottomsUp, quadTreeMap,
                                           centerX, centerY,
                                           rotation, sparse,
                                           thumbnailUrl, stockSet, elevationModel, wf, offsetX, offsetY, creditText, creditsUrl, demUrl, alturl, meanRadius, referenceFrame));
                }
                else
                {
                    return(Imageset.CreateGeneric(type, bandPass));
                }
            }
            catch
            {
                return(null);
            }
        }
コード例 #18
0
 /// <summary>
 /// 获取瓦片的投影信息
 /// </summary>
 /// <param name="projType">投影类型</param>
 /// <param name="extent">坐标范围</param>
 /// <returns></returns>
 public static TileProjection GetTileProjection(ProjectionType projType, CoordinateExtent extent)
 {
     return(getTileProjection(projType, extent, null, null));
 }
コード例 #19
0
 public Projection(string[] nonKeyAttributes, ProjectionType type)
 {
     NonKeyAttributes = nonKeyAttributes ?? Array.Empty <string>();
     ProjectionType   = type;
 }
コード例 #20
0
ファイル: CaptureBase.cs プロジェクト: tcdanielh/tilt-brush
        /// <summary>
        /// Prepare capture settings.
        /// </summary>
        protected bool PrepareCapture()
        {
            if (status != CaptureStatus.READY)
            {
                Debug.LogWarningFormat(LOG_FORMAT, "Previous capture session not finish yet!");
                OnCaptureError(new CaptureErrorEventArgs(CaptureErrorCode.CAPTURE_ALREADY_IN_PROGRESS));
                return(false);
            }

            if (!FFmpegConfig.IsExist())
            {
                Debug.LogErrorFormat(LOG_FORMAT,
                                     "FFmpeg not found, please follow document and add ffmpeg executable before start capture!");
                OnCaptureError(new CaptureErrorEventArgs(CaptureErrorCode.FFMPEG_NOT_FOUND));
                return(false);
            }

            if (captureSource == CaptureSource.RENDERTEXTURE)
            {
                if (inputTexture == null)
                {
                    Debug.LogErrorFormat(LOG_FORMAT, "Input render texture not found, please attach input render texture!");
                    OnCaptureError(new CaptureErrorEventArgs(CaptureErrorCode.INPUT_TEXTURE_NOT_FOUND));
                    return(false);
                }
                if (captureMode != CaptureMode.REGULAR)
                {
                    Debug.LogFormat(LOG_FORMAT, "Capture from render texture only support REGULAR CaptureMode");
                    captureMode    = CaptureMode.REGULAR;
                    projectionType = ProjectionType.NONE;
                }
                if (stereoMode != StereoMode.NONE)
                {
                    Debug.LogFormat(LOG_FORMAT, "Capture from render texture only support NONE StereoMode");
                    stereoMode = StereoMode.NONE;
                }
                frameWidth  = inputTexture.width;
                frameHeight = inputTexture.height;
            }
            else if (captureSource == CaptureSource.SCREEN)
            {
                if (captureMode != CaptureMode.REGULAR)
                {
                    Debug.LogFormat(LOG_FORMAT, "Capture from screen only support REGULAR CaptureMode");
                    captureMode    = CaptureMode.REGULAR;
                    projectionType = ProjectionType.NONE;
                }
                if (stereoMode != StereoMode.NONE)
                {
                    Debug.LogFormat(LOG_FORMAT, "Capture from screen only support NONE StereoMode");
                    stereoMode = StereoMode.NONE;
                }
                if (captureCursor)
                {
                    Cursor.SetCursor(cursorImage, Vector2.zero, CursorMode.ForceSoftware);
                }
                frameWidth  = Screen.width;
                frameHeight = Screen.height;
            }
            else
            {
                ResolutionPresetSettings();
            }
            // Some codec cannot handle odd video size
            frameWidth  = Utils.GetClosestEvenNumber(frameWidth);
            frameHeight = Utils.GetClosestEvenNumber(frameHeight);

            if (captureType == CaptureType.LIVE)
            {
                if (string.IsNullOrEmpty(liveStreamUrl))
                {
                    Debug.LogWarningFormat(LOG_FORMAT, "Please input a valid live streaming url.");
                    OnCaptureError(new CaptureErrorEventArgs(CaptureErrorCode.INVALID_STREAM_URI));
                    return(false);
                }
            }

            if (captureMode == CaptureMode._360)
            {
                if (projectionType == ProjectionType.NONE)
                {
                    Debug.LogFormat(LOG_FORMAT,
                                    "Projection type should be set for 360 capture, set type to equirect for generating texture properly");
                    projectionType = ProjectionType.EQUIRECT;
                }
                if (projectionType == ProjectionType.CUBEMAP)
                {
                    if (stereoMode != StereoMode.NONE)
                    {
                        Debug.LogFormat(LOG_FORMAT,
                                        "Stereo settings not support for cubemap capture, reset to mono video capture.");
                        stereoMode = StereoMode.NONE;
                    }
                }
                CubemapSizeSettings();
            }
            else if (captureMode == CaptureMode.REGULAR)
            {
                // Non 360 capture doesn't have projection type
                projectionType = ProjectionType.NONE;
            }

            if (frameRate < 18)
            {
                frameRate = 18;
                Debug.LogFormat(LOG_FORMAT, "Minimum frame rate is 18, set frame rate to 18.");
            }

            if (frameRate > 120)
            {
                frameRate = 120;
                Debug.LogFormat(LOG_FORMAT, "Maximum frame rate is 120, set frame rate to 120.");
            }

            AntiAliasingSettings();

            if (captureAudio && offlineRender)
            {
                Debug.LogFormat(LOG_FORMAT, "Audio capture not supported in offline render mode, disable audio capture!");
                captureAudio = false;
            }

            // Save camera settings
            SaveCameraSettings();

            if (transparent)
            {
                TransparentCameraSettings();
            }

            ffmpegFullPath     = FFmpegConfig.path;
            saveFolderFullPath = Utils.CreateFolder(saveFolder);
            lastVideoFile      = "";

            return(true);
        }
コード例 #21
0
 /// <summary>
 /// 获取瓦片的投影信息
 /// </summary>
 /// <param name="projType">投影类型</param>
 /// <returns></returns>
 public static TileProjection GetTileProjection(ProjectionType projType)
 {
     return(getTileProjection(projType, null, null, null));
 }
コード例 #22
0
ファイル: Imageset.cs プロジェクト: itguy327/wwt-web-client
        public static Imageset FromXMLNode(XmlNode node)
        {
            try
            {
                ImageSetType type = ImageSetType.Sky;



                ProjectionType projection = ProjectionType.Tangent;

                if (node.Attributes.GetNamedItem("DataSetType") != null)
                {
                    switch (node.Attributes.GetNamedItem("DataSetType").Value.ToLowerCase())
                    {
                    case "earth":
                        type = ImageSetType.Earth;
                        break;

                    case "planet":
                        type = ImageSetType.Planet;
                        break;

                    case "sky":
                        type = ImageSetType.Sky;
                        break;

                    case "panorama":
                        type = ImageSetType.Panorama;
                        break;

                    case "solarsystem":
                        type = ImageSetType.SolarSystem;
                        break;
                    }
                }

                BandPass bandPass = BandPass.Visible;



                switch (node.Attributes.GetNamedItem("BandPass").Value)
                {
                case "Gamma":
                    bandPass = BandPass.Gamma;
                    break;

                case "XRay":
                    bandPass = BandPass.XRay;
                    break;

                case "Ultraviolet":
                    bandPass = BandPass.Ultraviolet;
                    break;

                case "Visible":
                    bandPass = BandPass.Visible;
                    break;

                case "HydrogenAlpha":
                    bandPass = BandPass.HydrogenAlpha;
                    break;

                case "IR":
                    bandPass = BandPass.IR;
                    break;

                case "Microwave":
                    bandPass = BandPass.Microwave;
                    break;

                case "Radio":
                    bandPass = BandPass.Radio;
                    break;

                case "VisibleNight":
                    bandPass = BandPass.VisibleNight;
                    break;

                default:
                    break;
                }


                int wf = 1;
                if (node.Attributes.GetNamedItem("WidthFactor") != null)
                {
                    wf = int.Parse(node.Attributes.GetNamedItem("WidthFactor").Value);
                }

                if (node.Attributes.GetNamedItem("Generic") == null || !bool.Parse(node.Attributes.GetNamedItem("Generic").Value.ToString()))
                {
                    switch (node.Attributes.GetNamedItem("Projection").Value.ToString().ToLowerCase())
                    {
                    case "tan":
                    case "tangent":
                        projection = ProjectionType.Tangent;
                        break;

                    case "mercator":
                        projection = ProjectionType.Mercator;
                        break;

                    case "equirectangular":
                        projection = ProjectionType.Equirectangular;
                        break;

                    case "toast":
                        projection = ProjectionType.Toast;
                        break;

                    case "spherical":
                        projection = ProjectionType.Spherical;
                        break;

                    case "plotted":
                        projection = ProjectionType.Plotted;
                        break;

                    case "skyimage":
                        projection = ProjectionType.SkyImage;
                        break;
                    }

                    string fileType = node.Attributes.GetNamedItem("FileType").Value.ToString();
                    if (!fileType.StartsWith("."))
                    {
                        fileType = "." + fileType;
                    }


                    string thumbnailUrl = "";

                    XmlNode thumbUrl = Util.SelectSingleNode(node, "ThumbnailUrl");
                    if (thumbUrl != null)
                    {
                        if (string.IsNullOrEmpty(thumbUrl.InnerText))
                        {
                            ChromeNode cn = (ChromeNode)(object)thumbUrl;
                            thumbnailUrl = cn.TextContent;
                        }
                        else
                        {
                            thumbnailUrl = thumbUrl.InnerText;
                        }
                    }

                    bool stockSet       = false;
                    bool elevationModel = false;

                    if (node.Attributes.GetNamedItem("StockSet") != null)
                    {
                        stockSet = bool.Parse(node.Attributes.GetNamedItem("StockSet").Value.ToString());
                    }

                    if (node.Attributes.GetNamedItem("ElevationModel") != null)
                    {
                        elevationModel = bool.Parse(node.Attributes.GetNamedItem("ElevationModel").Value.ToString());
                    }

                    string demUrl = "";
                    if (node.Attributes.GetNamedItem("DemUrl") != null)
                    {
                        demUrl = node.Attributes.GetNamedItem("DemUrl").Value.ToString();
                    }

                    string alturl = "";

                    if (node.Attributes.GetNamedItem("AltUrl") != null)
                    {
                        alturl = node.Attributes.GetNamedItem("AltUrl").Value.ToString();
                    }


                    double offsetX = 0;

                    if (node.Attributes.GetNamedItem("OffsetX") != null)
                    {
                        offsetX = double.Parse(node.Attributes.GetNamedItem("OffsetX").Value.ToString());
                    }

                    double offsetY = 0;

                    if (node.Attributes.GetNamedItem("OffsetY") != null)
                    {
                        offsetY = double.Parse(node.Attributes.GetNamedItem("OffsetY").Value.ToString());
                    }

                    string creditText = "";

                    XmlNode credits = Util.SelectSingleNode(node, "Credits");

                    if (credits != null)
                    {
                        creditText = Util.GetInnerText(credits);
                    }

                    string creditsUrl = "";

                    credits = Util.SelectSingleNode(node, "CreditsUrl");

                    if (credits != null)
                    {
                        creditsUrl = Util.GetInnerText(credits);
                    }

                    double meanRadius = 0;

                    if (node.Attributes.GetNamedItem("MeanRadius") != null)
                    {
                        meanRadius = double.Parse(node.Attributes.GetNamedItem("MeanRadius").Value.ToString());
                    }

                    string referenceFrame = null;
                    if (node.Attributes.GetNamedItem("ReferenceFrame") != null)
                    {
                        referenceFrame = node.Attributes.GetNamedItem("ReferenceFrame").Value;
                    }

                    string name = "";
                    if (node.Attributes.GetNamedItem("Name") != null)
                    {
                        name = node.Attributes.GetNamedItem("Name").Value.ToString();
                    }

                    string url = "";
                    if (node.Attributes.GetNamedItem("Url") != null)
                    {
                        url = node.Attributes.GetNamedItem("Url").Value.ToString();
                    }

                    int baseTileLevel = 0;
                    if (node.Attributes.GetNamedItem("BaseTileLevel") != null)
                    {
                        baseTileLevel = int.Parse(node.Attributes.GetNamedItem("BaseTileLevel").Value.ToString());
                    }

                    int tileLevels = 0;
                    if (node.Attributes.GetNamedItem("TileLevels") != null)
                    {
                        tileLevels = int.Parse(node.Attributes.GetNamedItem("TileLevels").Value.ToString());
                    }

                    double baseDegreesPerTile = 0;

                    if (node.Attributes.GetNamedItem("BaseDegreesPerTile") != null)
                    {
                        baseDegreesPerTile = double.Parse(node.Attributes.GetNamedItem("BaseDegreesPerTile").Value.ToString());
                    }


                    bool bottomsUp = false;


                    if (node.Attributes.GetNamedItem("BottomsUp") != null)
                    {
                        bottomsUp = bool.Parse(node.Attributes.GetNamedItem("BottomsUp").Value.ToString());
                    }

                    string quadTreeMap = "";
                    if (node.Attributes.GetNamedItem("QuadTreeMap") != null)
                    {
                        quadTreeMap = node.Attributes.GetNamedItem("QuadTreeMap").Value.ToString();
                    }

                    double centerX = 0;

                    if (node.Attributes.GetNamedItem("CenterX") != null)
                    {
                        centerX = double.Parse(node.Attributes.GetNamedItem("CenterX").Value.ToString());
                    }

                    double centerY = 0;

                    if (node.Attributes.GetNamedItem("CenterY") != null)
                    {
                        centerY = double.Parse(node.Attributes.GetNamedItem("CenterY").Value.ToString());
                    }

                    double rotation = 0;

                    if (node.Attributes.GetNamedItem("Rotation") != null)
                    {
                        rotation = double.Parse(node.Attributes.GetNamedItem("Rotation").Value.ToString());
                    }

                    bool sparse = false;

                    if (node.Attributes.GetNamedItem("Sparse") != null)
                    {
                        sparse = bool.Parse(node.Attributes.GetNamedItem("Sparse").Value.ToString());
                    }

                    return(Imageset.Create(name, url,
                                           type, bandPass, projection, Math.Abs(Util.GetHashCode(url)),
                                           baseTileLevel, tileLevels,
                                           256, baseDegreesPerTile, fileType,
                                           bottomsUp, quadTreeMap,
                                           centerX, centerY,
                                           rotation, sparse,
                                           thumbnailUrl, stockSet, elevationModel, wf, offsetX, offsetY, creditText, creditsUrl, demUrl, alturl, meanRadius, referenceFrame));
                }
                else
                {
                    return(Imageset.CreateGeneric(type, bandPass));
                }
            }
            catch
            {
                return(null);
            }
        }
コード例 #23
0
        public ImageSetHelper(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, int tileSize, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame)
        {
            this.ReferenceFrame = referenceFrame;
            this.MeanRadius     = meanRadius;
            this.altUrl         = alturl;
            this.demUrl         = demUrlIn;
            this.creditsText    = credits;
            this.creditsUrl     = creditsUrl;
            this.offsetY        = offsetY;
            this.offsetX        = offsetX;
            this.widthFactor    = wf;
            this.elevationModel = elevationModel;
            this.defaultSet     = defaultSet;
            this.name           = name;
            this.sparse         = sparse;
            this.dataSetType    = dataSetType;

            this.bandPass        = bandPass;
            this.quadTreeTileMap = quadTreeMap;
            this.url             = url;
            this.levels          = levels;
            this.baseTileDegrees = baseTileDegrees;
            this.imageSetID      = imageSetID;
            this.extension       = extension;
            this.projection      = projection;
            this.bottomsUp       = bottomsUp;
            this.baseLevel       = baseLevel;
            this.mercator        = (projection == ProjectionType.Mercator);
            this.centerX         = centerX;
            this.centerY         = centerY;
            this.rotation        = rotation;
            this.thumbnailUrl    = thumbnailUrl;



            ComputeMatrix();
            //if (Earth3d.multiMonClient)
            {
                Earth3d.AddImageSetToTable(this.GetHash(), this);
            }
        }
コード例 #24
0
        public static ImageSetHelper FromXMLNode(XmlNode node)
        {
            try
            {
                ImageSetType type = ImageSetType.Sky;



                ProjectionType projection = ProjectionType.Tangent;
                if (node.Attributes["DataSetType"] != null)
                {
                    type = (ImageSetType)Enum.Parse(typeof(ImageSetType), node.Attributes["DataSetType"].Value.ToString(), true);
                }

                BandPass bandPass = BandPass.Visible;

                if (node.Attributes["BandPass"] != null)
                {
                    bandPass = (BandPass)Enum.Parse(typeof(BandPass), node.Attributes["BandPass"].Value.ToString());
                }
                int wf = 1;
                if (node.Attributes["WidthFactor"] != null)
                {
                    wf = Convert.ToInt32(node.Attributes["WidthFactor"].Value);
                }

                if (node.Attributes["Generic"] == null || !Convert.ToBoolean(node.Attributes["Generic"].Value.ToString()))
                {
                    switch (node.Attributes["Projection"].Value.ToString().ToLower())
                    {
                    case "tan":
                    case "tangent":
                        projection = ProjectionType.Tangent;
                        break;

                    case "mercator":
                        projection = ProjectionType.Mercator;
                        break;

                    case "equirectangular":
                        projection = ProjectionType.Equirectangular;
                        break;

                    case "toast":
                        projection = ProjectionType.Toast;
                        break;

                    case "spherical":
                        projection = ProjectionType.Spherical;
                        break;

                    case "plotted":
                        projection = ProjectionType.Plotted;
                        break;

                    case "skyimage":
                        projection = ProjectionType.SkyImage;
                        break;
                    }

                    string fileType = node.Attributes["FileType"].Value.ToString();
                    if (!fileType.StartsWith("."))
                    {
                        fileType = "." + fileType;
                    }

                    string thumbnailUrl;

                    XmlNode thumbUrl = node["ThumbnailUrl"];
                    thumbnailUrl = thumbUrl.InnerText;

                    bool stockSet       = false;
                    bool elevationModel = false;

                    if (node.Attributes["StockSet"] != null)
                    {
                        stockSet = Convert.ToBoolean(node.Attributes["StockSet"].Value.ToString());
                    }

                    if (node.Attributes["ElevationModel"] != null)
                    {
                        elevationModel = Convert.ToBoolean(node.Attributes["ElevationModel"].Value.ToString());
                    }

                    string demUrl = "";
                    if (node.Attributes["DemUrl"] != null)
                    {
                        demUrl = node.Attributes["DemUrl"].Value.ToString();
                    }

                    string alturl = "";

                    if (node.Attributes["AltUrl"] != null)
                    {
                        alturl = node.Attributes["AltUrl"].Value.ToString();
                    }


                    double offsetX = 0;

                    if (node.Attributes["OffsetX"] != null)
                    {
                        offsetX = Convert.ToDouble(node.Attributes["OffsetX"].Value.ToString());
                    }

                    double offsetY = 0;

                    if (node.Attributes["OffsetY"] != null)
                    {
                        offsetY = Convert.ToDouble(node.Attributes["OffsetY"].Value.ToString());
                    }

                    string creditText = "";

                    XmlNode credits = node["Credits"];

                    if (credits != null)
                    {
                        creditText = credits.InnerText;
                    }

                    string creditsUrl = "";

                    credits = node["CreditsUrl"];

                    if (credits != null)
                    {
                        creditsUrl = credits.InnerText;
                    }

                    double meanRadius = 0;

                    if (node.Attributes["MeanRadius"] != null)
                    {
                        meanRadius = Convert.ToDouble(node.Attributes["MeanRadius"].Value.ToString());
                    }
                    string referenceFrame = null;
                    if (node.Attributes["ReferenceFrame"] != null)
                    {
                        referenceFrame = node.Attributes["ReferenceFrame"].Value;
                    }


                    return(new ImageSetHelper(node.Attributes["Name"].Value.ToString(), node.Attributes["Url"].Value.ToString(), type, bandPass, projection, Math.Abs(node.Attributes["Url"].Value.GetHashCode32()), Convert.ToInt32(node.Attributes["BaseTileLevel"].Value), Convert.ToInt32(node.Attributes["TileLevels"].Value), 256, Convert.ToDouble(node.Attributes["BaseDegreesPerTile"].Value), fileType, Convert.ToBoolean(node.Attributes["BottomsUp"].Value.ToString()), node.Attributes["QuadTreeMap"].Value.ToString(), Convert.ToDouble(node.Attributes["CenterX"].Value), Convert.ToDouble(node.Attributes["CenterY"].Value), Convert.ToDouble(node.Attributes["Rotation"].Value), Convert.ToBoolean(node.Attributes["Sparse"].Value.ToString()), thumbnailUrl, stockSet, elevationModel, wf, offsetX, offsetY, creditText, creditsUrl, demUrl, alturl, meanRadius, referenceFrame));
                }
                else
                {
                    return(new ImageSetHelper(type, bandPass));
                }
            }
            catch
            {
                return(null);
            }
        }
コード例 #25
0
        public static ImageSetHelper FromXMLNode(XmlNode node)
        {
            try
            {
                var type = ImageSetType.Sky;

                var projection = ProjectionType.Tangent;
                if (node.Attributes["DataSetType"] != null)
                {
                    type = (ImageSetType)Enum.Parse(typeof(ImageSetType), node.Attributes["DataSetType"].Value, true);
                }

                var bandPass = BandPass.Visible;

                if (node.Attributes["BandPass"] != null)
                {
                    bandPass = (BandPass) Enum.Parse(typeof(BandPass),node.Attributes["BandPass"].Value);
                }
                var wf = 1;
                if (node.Attributes["WidthFactor"] != null)
                {
                    wf = Convert.ToInt32(node.Attributes["WidthFactor"].Value);
                }

                if (node.Attributes["Generic"] == null || !Convert.ToBoolean(node.Attributes["Generic"].Value))
                {

                    switch (node.Attributes["Projection"].Value.ToLower())
                    {
                        case "tan":
                        case "tangent":
                            projection = ProjectionType.Tangent;
                            break;
                        case "mercator":
                            projection = ProjectionType.Mercator;
                            break;
                        case "equirectangular":
                            projection = ProjectionType.Equirectangular;
                            break;
                        case "toast":
                            projection = ProjectionType.Toast;
                            break;
                        case "spherical":
                            projection = ProjectionType.Spherical;
                            break;
                        case "plotted":
                            projection = ProjectionType.Plotted;
                            break;
                        case "skyimage":
                            projection = ProjectionType.SkyImage;
                            break;
                    }

                    var fileType = node.Attributes["FileType"].Value;
                    if (!fileType.StartsWith("."))
                    {
                        fileType = "." + fileType;
                    }

                    string thumbnailUrl;

                    XmlNode thumbUrl = node["ThumbnailUrl"];
                    thumbnailUrl = thumbUrl.InnerText;

                    var stockSet = false;
                    var elevationModel = false;

                    if (node.Attributes["StockSet"] != null)
                    {
                        stockSet = Convert.ToBoolean(node.Attributes["StockSet"].Value);
                    }

                    if (node.Attributes["ElevationModel"] != null)
                    {
                        elevationModel = Convert.ToBoolean(node.Attributes["ElevationModel"].Value);
                    }

                    var demUrl = "";
                    if (node.Attributes["DemUrl"] != null)
                    {
                        demUrl = node.Attributes["DemUrl"].Value;
                    }

                    var alturl = "";

                    if (node.Attributes["AltUrl"] != null)
                    {
                        alturl = node.Attributes["AltUrl"].Value;
                    }

                    double offsetX = 0;

                    if (node.Attributes["OffsetX"] != null)
                    {
                        offsetX = Convert.ToDouble(node.Attributes["OffsetX"].Value);
                    }

                    double offsetY = 0;

                    if (node.Attributes["OffsetY"] != null)
                    {
                        offsetY = Convert.ToDouble(node.Attributes["OffsetY"].Value);
                    }

                    var creditText = "";

                    XmlNode credits = node["Credits"];

                    if (credits != null)
                    {
                        creditText = credits.InnerText;
                    }

                    var creditsUrl = "";

                    credits = node["CreditsUrl"];

                    if (credits != null)
                    {
                        creditsUrl = credits.InnerText;
                    }

                    double meanRadius = 0;

                    if (node.Attributes["MeanRadius"] != null)
                    {
                        meanRadius = Convert.ToDouble(node.Attributes["MeanRadius"].Value);
                    }
                    string referenceFrame = null;
                    if (node.Attributes["ReferenceFrame"] != null)
                    {
                        referenceFrame = node.Attributes["ReferenceFrame"].Value;
                    }

                    return new ImageSetHelper(node.Attributes["Name"].Value, node.Attributes["Url"].Value, type, bandPass, projection, Math.Abs(node.Attributes["Url"].Value.GetHashCode32()), Convert.ToInt32(node.Attributes["BaseTileLevel"].Value), Convert.ToInt32(node.Attributes["TileLevels"].Value), 256, Convert.ToDouble(node.Attributes["BaseDegreesPerTile"].Value), fileType, Convert.ToBoolean(node.Attributes["BottomsUp"].Value), node.Attributes["QuadTreeMap"].Value, Convert.ToDouble(node.Attributes["CenterX"].Value), Convert.ToDouble(node.Attributes["CenterY"].Value), Convert.ToDouble(node.Attributes["Rotation"].Value), Convert.ToBoolean(node.Attributes["Sparse"].Value), thumbnailUrl, stockSet, elevationModel, wf, offsetX, offsetY, creditText, creditsUrl, demUrl, alturl, meanRadius, referenceFrame);
                }
                return new ImageSetHelper(type, bandPass);
            }
            catch
            {
                return null;
            }
        }
コード例 #26
0
 /// <summary>
 /// 获取瓦片的投影信息
 /// </summary>
 /// <param name="projType">投影类型</param>
 /// <param name="minZoomLevel">最小缩放等级</param>
 /// <param name="maxZoomLevel">最大缩放等级</param>
 /// <returns></returns>
 public static TileProjection GetTileProjection(ProjectionType projType, int minZoomLevel, int maxZoomLevel)
 {
     return(getTileProjection(projType, null, minZoomLevel, maxZoomLevel));
 }
コード例 #27
0
        public ImageSetHelper(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, int tileSize, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame)
        {
            ReferenceFrame = referenceFrame;
            MeanRadius = meanRadius;
            altUrl = alturl;
            demUrl = demUrlIn;
            creditsText = credits;
            this.creditsUrl = creditsUrl;
            this.offsetY = offsetY;
            this.offsetX = offsetX;
            widthFactor = wf;
            this.elevationModel = elevationModel;
            this.defaultSet = defaultSet;
            this.name = name;
            this.sparse = sparse;
            this.dataSetType = dataSetType;

            this.bandPass = bandPass;
            quadTreeTileMap = quadTreeMap;
            this.url = url;
            this.levels = levels;
            this.baseTileDegrees = baseTileDegrees;
            this.imageSetID = imageSetID;
            this.extension = extension;
            this.projection = projection;
            this.bottomsUp = bottomsUp;
            this.baseLevel = baseLevel;
            mercator = (projection == ProjectionType.Mercator);
            this.centerX = centerX;
            this.centerY = centerY;
            this.rotation = rotation;
            this.thumbnailUrl = thumbnailUrl;

            ComputeMatrix();
            //if (Earth3d.multiMonClient)
            {
                Earth3d.AddImageSetToTable(GetHash(), this);
            }
        }
コード例 #28
0
 /// <summary>
 /// 获取瓦片的投影信息
 /// </summary>
 /// <param name="projType">投影类型</param>
 /// <param name="extent">坐标范围</param>
 /// <param name="minZoomLevel">最小缩放等级</param>
 /// <param name="maxZoomLevel">最大缩放等级</param>
 /// <returns></returns>
 public static TileProjection GetTileProjection(ProjectionType projType, CoordinateExtent extent, int minZoomLevel, int maxZoomLevel)
 {
     return(getTileProjection(projType, extent, minZoomLevel, maxZoomLevel));
 }
コード例 #29
0
    private float SmoothStepInterpolation(float percentage, ProjectionType projectionType)
    {
        int index = GetLastPointIndex(percentage);
        CameraPathFOV pointP = (CameraPathFOV)GetPoint(index);
        CameraPathFOV pointQ = (CameraPathFOV)GetPoint(index + 1);

        float startPercentage = pointP.percent;
        float endPercentage = pointQ.percent;

        if (startPercentage > endPercentage)
            endPercentage += 1;

        float curveLength = endPercentage - startPercentage;
        float curvePercentage = percentage - startPercentage;
        float ct = curvePercentage / curveLength;

        float valueA = (projectionType == ProjectionType.FOV) ? pointP.FOV : pointP.Size;
        float valueB = (projectionType == ProjectionType.FOV) ? pointQ.FOV : pointQ.Size;
        return Mathf.Lerp(valueA, valueB, CPMath.SmoothStep(ct));
    }
コード例 #30
0
        private static TileProjection getTileProjection(ProjectionType projType, CoordinateExtent extent, int?minZoomLevel, int?maxZoomLevel)
        {
            // 默认投影信息
            Projection projection = new Projection(projType);
            // 瓦片投影
            TileProjection tileProjection = new TileProjection();

            tileProjection.ProjType = projType;
            if (extent == null)
            {
                extent = projection.GetDefaultCoordinateExtent();
            }
            else
            {
                extent = projection.CorrectCoordianteExtent(extent);
            }
            tileProjection.CoordExtent = extent;
            if (minZoomLevel == null || !projection.CheckZoomLevel(minZoomLevel.Value))
            {
                tileProjection.MinZoomLevel = projection.MIN_ZOOM_LEVEL;
            }
            else
            {
                tileProjection.MinZoomLevel = minZoomLevel.Value;
            }
            if (maxZoomLevel == null || !projection.CheckZoomLevel(maxZoomLevel.Value))
            {
                tileProjection.MaxZoomLevel = projection.MAX_ZOOM_LEVEL;
            }
            else
            {
                tileProjection.MaxZoomLevel = maxZoomLevel.Value;
            }
            // TileExtent: key,level;value,TileExtent
            tileProjection.TileExtentCollection = new Dictionary <int, TileExtent>();
            // 遍历所有Level
            for (int i = tileProjection.MinZoomLevel; i <= tileProjection.MaxZoomLevel; i++)
            {
                TileExtent tileExtent = new TileExtent();
                tileExtent.ProjType  = projType;
                tileExtent.ZoomLevel = i;
                // 计算当前范围
                double originX = projection.MIN_X;
                double originY = projection.MAX_Y;

                tileExtent.MinRowIndex = Convert.ToInt32(
                    Math.Floor(
                        (originY - extent.MaxY) / (projection.TILE_SIZE * projection.GetZoomResolution(i))
                        ));
                tileExtent.MinColumnIndex = Convert.ToInt32(
                    Math.Floor(
                        (originX - extent.MinX) / (projection.TILE_SIZE * projection.GetZoomResolution(i))
                        ));
                tileExtent.MaxRowIndex = Convert.ToInt32(
                    Math.Ceiling(
                        (originY - extent.MinY) / (projection.TILE_SIZE * projection.GetZoomResolution(i))
                        ));
                tileExtent.MaxColumnIndex = Convert.ToInt32(
                    Math.Ceiling(
                        (originX - extent.MaxX) / (projection.TILE_SIZE * projection.GetZoomResolution(i))
                        ));

                tileExtent.RowNumber    = tileExtent.MaxRowIndex - tileExtent.MinRowIndex + 1;
                tileExtent.ColumnNumber = tileExtent.MaxColumnIndex - tileExtent.MinColumnIndex + 1;

                // 添加到集合
                tileProjection.TileExtentCollection.Add(i, tileExtent);
            }

            return(tileProjection);
        }
コード例 #31
0
ファイル: ProjectionOptions.cs プロジェクト: andyvans/sanchez
 public ProjectionOptions(ProjectionType projection, InterpolationType interpolation, int imageSize)
 {
     Projection    = projection;
     Interpolation = interpolation;
     ImageSize     = imageSize;
 }
コード例 #32
0
 public ProjectionInfo(ProjectionType type, Func<IViewProvider, IBus, object> create)
 {
     this.type = type;
     this.Create = create;
 }
コード例 #33
0
        public static Imageset Create(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, int tileSize, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame)
        {
            Imageset temp = new Imageset();

            temp.ReferenceFrame  = referenceFrame;
            temp.MeanRadius      = meanRadius;
            temp.altUrl          = alturl;
            temp.demUrl          = demUrlIn;
            temp.creditsText     = credits;
            temp.creditsUrl      = creditsUrl;
            temp.offsetY         = offsetY;
            temp.offsetX         = offsetX;
            temp.widthFactor     = wf;
            temp.elevationModel  = elevationModel;
            temp.defaultSet      = defaultSet;
            temp.name            = name;
            temp.sparse          = sparse;
            temp.dataSetType     = dataSetType;
            temp.bandPass        = bandPass;
            temp.quadTreeTileMap = quadTreeMap;
            temp.url             = url;
            temp.levels          = levels;
            temp.baseTileDegrees = baseTileDegrees;
            temp.imageSetID      = imageSetID;
            temp.extension       = extension;
            temp.projection      = projection;
            temp.bottomsUp       = bottomsUp;
            temp.baseLevel       = baseLevel;
            temp.mercator        = (projection == ProjectionType.Mercator);
            temp.centerX         = centerX;
            temp.centerY         = centerY;
            temp.rotation        = rotation;
            temp.thumbnailUrl    = thumbnailUrl;
            temp.ComputeMatrix();

            return(temp);
        }
コード例 #34
0
 /// <summary>
 /// Enables or disables different GUI elements depending on the projection type.
 /// </summary>
 /// <param name="type">Projection type to show GUI elements for.</param>
 private void ToggleTypeSpecificFields(ProjectionType type)
 {
     if (type == ProjectionType.Orthographic)
     {
         fieldOfView.Active = false;
         orthoHeight.Active = true;
     }
     else
     {
         fieldOfView.Active = true;
         orthoHeight.Active = false;
     }
 }
コード例 #35
0
 /// <inheritdoc />
 public Mat ProjectPoints(Mat points, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
 {
     return(Link.ProjectPoints(points, this, projectionType));
 }
コード例 #36
0
ファイル: Imageset.cs プロジェクト: spamarti/wwt-web-client
        public static Imageset FromXMLNode(XmlNode node)
        {
            try
            {
                ImageSetType type = ImageSetType.Sky;

                ProjectionType projection = ProjectionType.Tangent;

                if (node.Attributes.GetNamedItem("DataSetType") != null)
                {
                    switch (node.Attributes.GetNamedItem("DataSetType").Value.ToLowerCase())
                    {
                        case "earth":
                            type = ImageSetType.Earth;
                            break;
                        case "planet":
                            type = ImageSetType.Planet;
                            break;
                        case "sky":
                            type = ImageSetType.Sky;
                            break;
                        case "panorama":
                            type = ImageSetType.Panorama;
                            break;
                        case "solarsystem":
                            type = ImageSetType.SolarSystem;
                            break;
                    }
                }

                BandPass bandPass = BandPass.Visible;

                switch (node.Attributes.GetNamedItem("BandPass").Value)
                {
                    case "Gamma":
                        bandPass = BandPass.Gamma;
                        break;
                    case "XRay":
                        bandPass = BandPass.XRay;
                        break;
                    case "Ultraviolet":
                        bandPass = BandPass.Ultraviolet;
                        break;
                    case "Visible":
                        bandPass = BandPass.Visible;
                        break;
                    case "HydrogenAlpha":
                        bandPass = BandPass.HydrogenAlpha;
                        break;
                    case "IR":
                        bandPass = BandPass.IR;
                        break;
                    case "Microwave":
                        bandPass = BandPass.Microwave;
                        break;
                    case "Radio":
                        bandPass = BandPass.Radio;
                        break;
                    case "VisibleNight":
                        bandPass = BandPass.VisibleNight;
                        break;
                    default:
                        break;
                }

                int wf = 1;
                if (node.Attributes.GetNamedItem("WidthFactor") != null)
                {
                    wf = int.Parse(node.Attributes.GetNamedItem("WidthFactor").Value);
                }

                if (node.Attributes.GetNamedItem("Generic") == null || !bool.Parse(node.Attributes.GetNamedItem("Generic").Value.ToString()))
                {

                    switch (node.Attributes.GetNamedItem("Projection").Value.ToString().ToLowerCase())
                    {
                        case "tan":
                        case "tangent":
                            projection = ProjectionType.Tangent;
                            break;
                        case "mercator":
                            projection = ProjectionType.Mercator;
                            break;
                        case "equirectangular":
                            projection = ProjectionType.Equirectangular;
                            break;
                        case "toast":
                            projection = ProjectionType.Toast;
                            break;
                        case "spherical":
                            projection = ProjectionType.Spherical;
                            break;
                        case "plotted":
                            projection = ProjectionType.Plotted;
                            break;
                        case "skyimage":
                            projection = ProjectionType.SkyImage;
                            break;
                    }

                    string fileType = node.Attributes.GetNamedItem("FileType").Value.ToString();
                    if (!fileType.StartsWith("."))
                    {
                        fileType = "." + fileType;
                    }

                    string thumbnailUrl = "";

                    XmlNode thumbUrl = Util.SelectSingleNode(node, "ThumbnailUrl");
                    if (thumbUrl != null)
                    {
                        if (string.IsNullOrEmpty(thumbUrl.InnerText))
                        {
                            ChromeNode cn = (ChromeNode)(object)thumbUrl;
                            thumbnailUrl = cn.TextContent;
                        }
                        else
                        {
                            thumbnailUrl = thumbUrl.InnerText;
                        }
                    }

                    bool stockSet = false;
                    bool elevationModel = false;

                    if (node.Attributes.GetNamedItem("StockSet") != null)
                    {
                        stockSet = bool.Parse(node.Attributes.GetNamedItem("StockSet").Value.ToString());
                    }

                    if (node.Attributes.GetNamedItem("ElevationModel") != null)
                    {
                        elevationModel = bool.Parse(node.Attributes.GetNamedItem("ElevationModel").Value.ToString());
                    }

                    string demUrl = "";
                    if (node.Attributes.GetNamedItem("DemUrl") != null)
                    {
                        demUrl = node.Attributes.GetNamedItem("DemUrl").Value.ToString();
                    }

                    string alturl = "";

                    if (node.Attributes.GetNamedItem("AltUrl") != null)
                    {
                        alturl = node.Attributes.GetNamedItem("AltUrl").Value.ToString();
                    }

                    double offsetX = 0;

                    if (node.Attributes.GetNamedItem("OffsetX") != null)
                    {
                        offsetX = double.Parse(node.Attributes.GetNamedItem("OffsetX").Value.ToString());
                    }

                    double offsetY = 0;

                    if (node.Attributes.GetNamedItem("OffsetY") != null)
                    {
                        offsetY = double.Parse(node.Attributes.GetNamedItem("OffsetY").Value.ToString());
                    }

                    string creditText = "";

                    XmlNode credits = Util.SelectSingleNode(node, "Credits");

                    if (credits != null)
                    {
                        creditText = Util.GetInnerText(credits);
                    }

                    string creditsUrl = "";

                    credits = Util.SelectSingleNode(node, "CreditsUrl");

                    if (credits != null)
                    {
                        creditsUrl = Util.GetInnerText(credits);
                    }

                    double meanRadius = 0;

                    if (node.Attributes.GetNamedItem("MeanRadius") != null)
                    {
                        meanRadius = double.Parse(node.Attributes.GetNamedItem("MeanRadius").Value.ToString());
                    }

                    string referenceFrame = null;
                    if (node.Attributes.GetNamedItem("ReferenceFrame") != null)
                    {
                        referenceFrame = node.Attributes.GetNamedItem("ReferenceFrame").Value;
                    }

                    string name = "";
                    if (node.Attributes.GetNamedItem("Name") != null)
                    {
                        name = node.Attributes.GetNamedItem("Name").Value.ToString();
                    }

                    string url = "";
                    if (node.Attributes.GetNamedItem("Url") != null)
                    {
                        url = node.Attributes.GetNamedItem("Url").Value.ToString();
                    }

                    int baseTileLevel = 0;
                    if (node.Attributes.GetNamedItem("BaseTileLevel") != null)
                    {
                        baseTileLevel = int.Parse(node.Attributes.GetNamedItem("BaseTileLevel").Value.ToString());
                    }

                    int tileLevels = 0;
                    if (node.Attributes.GetNamedItem("TileLevels") != null)
                    {
                        tileLevels = int.Parse(node.Attributes.GetNamedItem("TileLevels").Value.ToString());
                    }

                    double baseDegreesPerTile = 0;

                    if (node.Attributes.GetNamedItem("BaseDegreesPerTile") != null)
                    {
                        baseDegreesPerTile = double.Parse(node.Attributes.GetNamedItem("BaseDegreesPerTile").Value.ToString());
                    }

                    bool bottomsUp = false;

                    if (node.Attributes.GetNamedItem("BottomsUp") != null)
                    {
                        bottomsUp = bool.Parse(node.Attributes.GetNamedItem("BottomsUp").Value.ToString());
                    }

                    string quadTreeMap = "";
                    if (node.Attributes.GetNamedItem("QuadTreeMap") != null)
                    {
                        quadTreeMap = node.Attributes.GetNamedItem("QuadTreeMap").Value.ToString();
                    }

                    double centerX = 0;

                    if (node.Attributes.GetNamedItem("CenterX") != null)
                    {
                        centerX = double.Parse(node.Attributes.GetNamedItem("CenterX").Value.ToString());
                    }

                    double centerY = 0;

                    if (node.Attributes.GetNamedItem("CenterY") != null)
                    {
                        centerY = double.Parse(node.Attributes.GetNamedItem("CenterY").Value.ToString());
                    }

                    double rotation = 0;

                    if (node.Attributes.GetNamedItem("Rotation") != null)
                    {
                        rotation = double.Parse(node.Attributes.GetNamedItem("Rotation").Value.ToString());
                    }

                    bool sparse = false;

                    if (node.Attributes.GetNamedItem("Sparse") != null)
                    {
                        sparse = bool.Parse(node.Attributes.GetNamedItem("Sparse").Value.ToString());
                    }

                    return Imageset.Create(name, url,
                        type, bandPass, projection, Math.Abs(Util.GetHashCode(url)),
                        baseTileLevel, tileLevels,
                        256, baseDegreesPerTile, fileType,
                        bottomsUp, quadTreeMap,
                        centerX, centerY,
                        rotation, sparse,
                        thumbnailUrl, stockSet, elevationModel, wf, offsetX, offsetY, creditText, creditsUrl, demUrl, alturl, meanRadius, referenceFrame);
                }
                else
                {
                    return Imageset.CreateGeneric(type, bandPass);
                }

            }
            catch
            {
                return null;
            }
        }
コード例 #37
0
ファイル: ClassMap.cs プロジェクト: jonclare/KodeKandy
 public ClassMap(ProjectionType projectionType, Mapper mapper)
     : base(projectionType, mapper)
 {
     Require.IsTrue(projectionType.ToType.IsClass);
 }
コード例 #38
0
        private static void SubscribeMainBus(
            ISubscriber mainBus,
            ProjectionManager projectionManager,
            ProjectionType runProjections,
            ProjectionManagerResponseReader projectionManagerResponseReader,
            IODispatcher ioDispatcher,
            ProjectionManagerCommandWriter projectionManagerCommandWriter)
        {
            mainBus.Subscribe<SystemMessage.StateChangeMessage>(projectionManager);
            mainBus.Subscribe<SystemMessage.SystemCoreReady>(projectionManager);
            if (runProjections >= ProjectionType.System)
            {
                mainBus.Subscribe<ProjectionManagementMessage.Command.Post>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.UpdateQuery>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.GetQuery>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.Delete>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.GetStatistics>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.GetState>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.GetResult>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.Disable>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.Enable>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.Abort>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.SetRunAs>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.Reset>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Command.StartSlaveProjections>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.RegisterSystemProjection>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.RegisterSystemProjection>(projectionManager);
                mainBus.Subscribe<CoreProjectionStatusMessage.Started>(projectionManager);
                mainBus.Subscribe<CoreProjectionStatusMessage.Stopped>(projectionManager);
                mainBus.Subscribe<CoreProjectionStatusMessage.Faulted>(projectionManager);
                mainBus.Subscribe<CoreProjectionStatusMessage.Prepared>(projectionManager);
                mainBus.Subscribe<CoreProjectionStatusMessage.StateReport>(projectionManager);
                mainBus.Subscribe<CoreProjectionStatusMessage.ResultReport>(projectionManager);
                mainBus.Subscribe<CoreProjectionStatusMessage.StatisticsReport>(projectionManager);
                mainBus.Subscribe<CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(projectionManager);
                mainBus.Subscribe<CoreProjectionStatusMessage.ProjectionWorkerStarted>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.ReaderReady>(projectionManager);
                mainBus.Subscribe<ProjectionManagementMessage.Starting>(projectionManagerResponseReader);
            }
            mainBus.Subscribe<ClientMessage.WriteEventsCompleted>(projectionManager);
            mainBus.Subscribe<ClientMessage.DeleteStreamCompleted>(projectionManager);
            mainBus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(projectionManager);

            mainBus.Subscribe(ioDispatcher.Awaker);
            mainBus.Subscribe(ioDispatcher.BackwardReader);
            mainBus.Subscribe(ioDispatcher.ForwardReader);
            mainBus.Subscribe(ioDispatcher.StreamDeleter);
            mainBus.Subscribe(ioDispatcher.Writer);
            mainBus.Subscribe(ioDispatcher);

            mainBus.Subscribe<ProjectionManagementMessage.Starting>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.CreatePrepared>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepare>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepareSlave>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.LoadStopped>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.Start>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.Stop>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.Kill>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.Dispose>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.GetState>(projectionManagerCommandWriter);
            mainBus.Subscribe<CoreProjectionManagementMessage.GetResult>(projectionManagerCommandWriter);
            mainBus.Subscribe<ProjectionManagementMessage.SlaveProjectionsStarted>(projectionManagerCommandWriter);
        }
コード例 #39
0
    private void RenderToPanoramaView(ProjectionType projectionType, Camera.MonoOrStereoscopicEye eye, float scaleX, float scaleY, float offsetX, float offsetY)
    {
        if (UseUnityInternalCubemapRenderer)
        {
            switch (GammaConvertType)
            {
            case GammaConvertType.Linear_to_sRGB:
            {
                SetEnableLinearToSRGB(true);
                SetEnableLinearToBT709(false);
            }
            break;

            case GammaConvertType.Linear_to_BT709:
            {
                SetEnableLinearToSRGB(false);
                SetEnableLinearToBT709(true);
            }
            break;

            default:
            {
                SetEnableLinearToSRGB(false);
                SetEnableLinearToBT709(false);
            }
            break;
            }

            _camera.RenderToCubemap(_cubemap, 63, eye);

            SetPositionScaleOffset(scaleX, scaleY, offsetX, offsetY);
            var q = Quaternion.identity;
            var t = _camera.transform;
            while (t != null)
            {
                q = q * t.localRotation;
                t = t.parent;
            }
            _material.SetMatrix("_Matrix", Matrix4x4.Rotate(q));
            Graphics.Blit(_cubemap, RenderTarget, _material);
        }
        else
        {
            float ipdOffset = 0.0f;
            switch (eye)
            {
            case Camera.MonoOrStereoscopicEye.Left:
            {
                ipdOffset = -StereoSeparation / 2.0f;
            }
            break;

            case Camera.MonoOrStereoscopicEye.Right:
            {
                ipdOffset = StereoSeparation / 2.0f;
            }
            break;
            }
            _cubemapRenderer.RenderCubemap(
                _camera,
                projectionType == ProjectionType.Equirectangular_360 ? 63 : 63 - (1 << (int)CubemapFace.NegativeZ),
                ipdOffset,
                GammaConvertType,
                CorrectCameraPositionInStereoRendering);

            SetPositionScaleOffset(scaleX, scaleY, offsetX, offsetY);
            _material.SetMatrix("_Matrix", Matrix4x4.identity);
            SetEnableLinearToSRGB(false);
            SetEnableLinearToBT709(false);
            Graphics.Blit(_cubemapRenderer.Cubemap, RenderTarget, _material);
        }
    }
コード例 #40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProjectionDescriptor" /> class.
 /// </summary>
 /// <param name="projectionType">Type of the projection.</param>
 /// <param name="type">The type.</param>
 public ProjectionDescriptor(ProjectionType projectionType, Type type)
 {
     ProjectionType = projectionType;
     Type           = type;
 }
コード例 #41
0
            public void DrawProjection()
            {
                ProjectionType projectionType = orthographic.boolValue ? ProjectionType.Orthographic : ProjectionType.Perspective;

                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = orthographic.hasMultipleDifferentValues;
                projectionType           = (ProjectionType)EditorGUILayout.EnumPopup(Styles.projection, projectionType);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    orthographic.boolValue = (projectionType == ProjectionType.Orthographic);
                }

                if (!orthographic.hasMultipleDifferentValues)
                {
                    if (projectionType == ProjectionType.Orthographic)
                    {
                        EditorGUILayout.PropertyField(orthographicSize, Styles.size);
                    }
                    else
                    {
                        bool isPhysicalCamera = projectionMatrixMode.intValue == (int)Camera.ProjectionMatrixMode.PhysicalPropertiesBased;

                        GUIContent content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.fieldOfView, fieldOfView);
                        EditorGUI.BeginDisabled(projectionMatrixMode.hasMultipleDifferentValues || isPhysicalCamera && (focalLength.hasMultipleDifferentValues || sensorSize.hasMultipleDifferentValues));
                        EditorGUI.BeginChangeCheck();
                        float fovNewValue = EditorGUILayout.Slider(content, fieldOfView.floatValue, 1f, 179f);
                        bool  fovChanged  = EditorGUI.EndChangeCheck();
                        EditorGUI.EndDisabled();
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.EndProperty();

                        content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.physicalCamera, projectionMatrixMode);
                        EditorGUI.showMixedValue = projectionMatrixMode.hasMultipleDifferentValues;

                        EditorGUI.BeginChangeCheck();
                        isPhysicalCamera = EditorGUILayout.Toggle(content, isPhysicalCamera);
                        if (EditorGUI.EndChangeCheck())
                        {
                            projectionMatrixMode.intValue = isPhysicalCamera ? (int)Camera.ProjectionMatrixMode.PhysicalPropertiesBased : (int)Camera.ProjectionMatrixMode.Implicit;
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.EndProperty();

                        EditorGUI.showMixedValue = false;
                        if (isPhysicalCamera && !projectionMatrixMode.hasMultipleDifferentValues)
                        {
                            using (new EditorGUI.IndentLevelScope())
                            {
                                EditorGUI.showMixedValue = sensorSize.hasMultipleDifferentValues;
                                EditorGUI.BeginChangeCheck();
                                int filmGateIndex = Array.IndexOf(k_ApertureFormats, new Vector2((float)Math.Round(sensorSize.vector2Value.x, 3), (float)Math.Round(sensorSize.vector2Value.y, 3)));
                                if (filmGateIndex == -1)
                                {
                                    filmGateIndex = EditorGUILayout.Popup(Styles.cameraType, k_ApertureFormatNames.Length - 1, k_ApertureFormatNames);
                                }
                                else
                                {
                                    filmGateIndex = EditorGUILayout.Popup(Styles.cameraType, filmGateIndex, k_ApertureFormatNames);
                                }
                                EditorGUI.showMixedValue = false;
                                if (EditorGUI.EndChangeCheck() && filmGateIndex < k_ApertureFormats.Length)
                                {
                                    sensorSize.vector2Value = k_ApertureFormats[filmGateIndex];
                                }

                                EditorGUI.BeginChangeCheck();
                                EditorGUI.showMixedValue = focalLength.hasMultipleDifferentValues;

                                float focalLengthVal = fovChanged ? sensorSize.vector2Value.y * .5f / Mathf.Tan(Mathf.Deg2Rad * fovNewValue * .5f) : focalLength.floatValue;
                                focalLengthVal           = EditorGUILayout.FloatField(Styles.focalLength, focalLengthVal);
                                EditorGUI.showMixedValue = false;
                                if (EditorGUI.EndChangeCheck() || fovChanged)
                                {
                                    focalLength.floatValue = focalLengthVal;
                                }

                                EditorGUILayout.PropertyField(sensorSize, Styles.sensorSize);

                                EditorGUILayout.PropertyField(lensShift, Styles.lensShift);
                            }
                        }
                        else if (fovChanged)
                        {
                            fieldOfView.floatValue = fovNewValue;
                        }
                        EditorGUILayout.Space();
                    }
                }
            }
コード例 #42
0
        private static void SubscribeMainBus(
            ISubscriber mainBus,
            ProjectionManager projectionManager,
            ProjectionType runProjections,
            ProjectionManagerResponseReader projectionManagerResponseReader,
            IODispatcher ioDispatcher,
            ProjectionManagerCommandWriter projectionManagerCommandWriter)
        {
            if (runProjections >= ProjectionType.System)
            {
                mainBus.Subscribe <ProjectionManagementMessage.Command.Post>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.PostBatch>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.UpdateQuery>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.GetQuery>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.Delete>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.GetStatistics>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.GetState>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.GetResult>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.Disable>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.Enable>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.Abort>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.SetRunAs>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.Reset>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.StartSlaveProjections>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.GetConfig>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Command.UpdateConfig>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.RegisterSystemProjection>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Internal.CleanupExpired>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Internal.Deleted>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.RegisterSystemProjection>(projectionManager);
                mainBus.Subscribe <CoreProjectionStatusMessage.Started>(projectionManager);
                mainBus.Subscribe <CoreProjectionStatusMessage.Stopped>(projectionManager);
                mainBus.Subscribe <CoreProjectionStatusMessage.Faulted>(projectionManager);
                mainBus.Subscribe <CoreProjectionStatusMessage.Prepared>(projectionManager);
                mainBus.Subscribe <CoreProjectionStatusMessage.StateReport>(projectionManager);
                mainBus.Subscribe <CoreProjectionStatusMessage.ResultReport>(projectionManager);
                mainBus.Subscribe <CoreProjectionStatusMessage.StatisticsReport>(projectionManager);
                mainBus.Subscribe <CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(projectionManager);
                mainBus.Subscribe <CoreProjectionStatusMessage.ProjectionWorkerStarted>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.ReaderReady>(projectionManager);
                mainBus.Subscribe <ProjectionSubsystemMessage.StartComponents>(projectionManager);
                mainBus.Subscribe <ProjectionSubsystemMessage.StopComponents>(projectionManager);
                mainBus.Subscribe <ProjectionManagementMessage.Starting>(projectionManagerResponseReader);
            }

            mainBus.Subscribe <ClientMessage.WriteEventsCompleted>(projectionManager);
            mainBus.Subscribe <ClientMessage.DeleteStreamCompleted>(projectionManager);
            mainBus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(projectionManager);
            mainBus.Subscribe <ClientMessage.ReadStreamEventsForwardCompleted>(projectionManager);

            mainBus.Subscribe(ioDispatcher.Awaker);
            mainBus.Subscribe(ioDispatcher.BackwardReader);
            mainBus.Subscribe(ioDispatcher.ForwardReader);
            mainBus.Subscribe(ioDispatcher.StreamDeleter);
            mainBus.Subscribe(ioDispatcher.Writer);
            mainBus.Subscribe(ioDispatcher);

            mainBus.Subscribe <ProjectionManagementMessage.Starting>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.CreatePrepared>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.CreateAndPrepare>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.CreateAndPrepareSlave>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.LoadStopped>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.Start>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.Stop>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.Kill>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.Dispose>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.GetState>(projectionManagerCommandWriter);
            mainBus.Subscribe <CoreProjectionManagementMessage.GetResult>(projectionManagerCommandWriter);
            mainBus.Subscribe <ProjectionManagementMessage.SlaveProjectionsStarted>(projectionManagerCommandWriter);
        }
コード例 #43
0
        private void SetUpProjectionsIfNeeded()
        {
            if (_projectionsMode == ProjectionsMode.None)
            {
                _projectionType = ProjectionType.None;
                return;
            }

            switch (_projectionsMode)
            {
                case ProjectionsMode.System:
                    _projectionType = ProjectionType.System;
                    break;
                case ProjectionsMode.All:
                    _projectionType = ProjectionType.All;
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
            _subsystems.Add(new ProjectionsSubsystem(_projectionsThreads, _projectionType, _developmentMode));
        }
コード例 #44
0
 public InfoController(IOptions options, ProjectionType projectionType)
 {
     _options        = options;
     _projectionType = projectionType;
 }
コード例 #45
0
 /// <summary>
 /// 特殊的构造函数。
 /// </summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 private Projection(SerializationInfo info, StreamingContext context)
 {
     this.Name = info.GetString("Name");
     this.Type = (ProjectionType)info.GetValue("Type", typeof(ProjectionType));
 }
コード例 #46
0
 /// <summary>
 /// Sets the type of projection to use (orthographic or perspective).
 /// </summary>
 /// <param name="type">One of the ProjectionType enum values.</param>
 public void setProjectionType(ProjectionType type)
 {
     Camera_setProjectionType(ogreObject, type);
 }
コード例 #47
0
        public override bool OnInitialize()
        {
            base.OnInitialize();

            _flags1 = (SCN0CameraFlags)(ushort)Data->_flags1;
            _flags2 = Data->_flags2;
            _type = (SCN0CameraType)((ushort)_flags2 & 1);
            _projType = (ProjectionType)(int)Data->_projType;

            for (int x = 0; x < 15; x++)
                SetKeys(x, new KeyframeArray(FrameCount + 1));

            bint* values = (bint*)&Data->_position;

            if (Name != "<null>")
                for (int i = 0; i < 15; i++)
                {
                    //if (((int)_flags1 & (int)Ordered[i]) == 0)
                    //    SCN0Node.strings[(int)((&values[i] - Parent.Parent.WorkingUncompressed.Address + values[i]))] = "Camera" + Index + " Keys " + Ordered[i].ToString();

                    DecodeFrames(GetKeys(i), &values[i], (int)_flags1, (int)Ordered[i]);
                }

            _posX._linear = true;
            _posY._linear = true;
            _posZ._linear = true;

            _aimX._linear = true;
            _aimY._linear = true;
            _aimZ._linear = true;

            (_userEntries = new UserDataCollection()).Read(Data->UserData);

            return false;
        }
コード例 #48
0
 private static extern void Camera_setProjectionType(IntPtr camera, ProjectionType type);
コード例 #49
0
        public SolveProjector(ProjectorEntry pe, double radius, ProjectionType type, ScreenTypes tranformType, SolveParameters solveParameters)
        {
            this.projectionType  = type;
            this.screenType      = tranformType;
            this.solveParameters = solveParameters;

            switch (type)
            {
            case ProjectionType.View:
            {
                Fov.Value           = pe.ViewProjection.FOV;
                Aspect.Value        = pe.ViewProjection.Aspect;
                OffsetX.Value       = pe.ViewProjection.XOffset;
                OffsetY.Value       = pe.ViewProjection.YOffset;
                RadialCenterX.Value = pe.ViewProjection.RadialCenterX;
                RadialCenterY.Value = pe.ViewProjection.RadialCenterY;
                RadialAmountX.Value = pe.ViewProjection.RadialAmountX;
                RadialAmountY.Value = pe.ViewProjection.RadialAmountY;

                Pitch.Value   = pe.ViewTransform.Pitch;
                Heading.Value = pe.ViewTransform.Heading;
                Roll.Value    = pe.ViewTransform.Roll;
                X.Value       = -pe.ViewTransform.X;
                Y.Value       = pe.ViewTransform.Y;
                Z.Value       = pe.ViewTransform.Z;
            }
            break;

            case ProjectionType.FishEye:
            case ProjectionType.Projector:
            {
                Fov.Value           = pe.ProjectorProjection.FOV;
                Aspect.Value        = pe.ProjectorProjection.Aspect;
                OffsetX.Value       = pe.ProjectorProjection.XOffset;
                OffsetY.Value       = pe.ProjectorProjection.YOffset;
                RadialCenterX.Value = pe.ProjectorProjection.RadialCenterX;
                RadialCenterY.Value = pe.ProjectorProjection.RadialCenterY;
                RadialAmountX.Value = pe.ProjectorProjection.RadialAmountX;
                RadialAmountY.Value = pe.ProjectorProjection.RadialAmountY;

                Pitch.Value   = pe.ProjectorTransform.Pitch;
                Heading.Value = pe.ProjectorTransform.Heading;
                Roll.Value    = pe.ProjectorTransform.Roll;
                X.Value       = -pe.ProjectorTransform.X;
                Y.Value       = pe.ProjectorTransform.Y;
                Z.Value       = pe.ProjectorTransform.Z;
            }
            break;

            case ProjectionType.Solved:
            {
                Fov.Value           = pe.SolvedProjection.FOV;
                Aspect.Value        = pe.SolvedProjection.Aspect;
                OffsetX.Value       = pe.SolvedProjection.XOffset;
                OffsetY.Value       = pe.SolvedProjection.YOffset;
                RadialCenterX.Value = pe.ProjectorProjection.RadialCenterX;
                RadialCenterY.Value = pe.ProjectorProjection.RadialCenterY;
                RadialAmountX.Value = pe.ProjectorProjection.RadialAmountX;
                RadialAmountY.Value = pe.ProjectorProjection.RadialAmountY;

                Pitch.Value   = pe.SolvedTransform.Pitch;
                Heading.Value = pe.SolvedTransform.Heading;
                Roll.Value    = pe.SolvedTransform.Roll;
                X.Value       = -pe.SolvedTransform.X;
                Y.Value       = pe.SolvedTransform.Y;
                Z.Value       = pe.SolvedTransform.Z;
            }
            break;

            default:
                break;
            }



            width        = pe.Width;
            height       = pe.Height;
            sphereRadius = radius;
        }
コード例 #50
0
 private void PrintMinMax(ProjectionType projection)
 {
     print(projection.ToString() +
           MinMaxDictionary[projection].x[0] + " / " + MinMaxDictionary[projection].x[1] + " - " +
           MinMaxDictionary[projection].y[0] + " / " + MinMaxDictionary[projection].y[1]);
 }
コード例 #51
0
        public static ImageSetHelper Create(string name, string url, ImageSetType dataSetType, BandPass bandPass, ProjectionType projection, int imageSetID, int baseLevel, int levels, int tileSize, double baseTileDegrees, string extension, bool bottomsUp, string quadTreeMap, double centerX, double centerY, double rotation, bool sparse, string thumbnailUrl, bool defaultSet, bool elevationModel, int wf, double offsetX, double offsetY, string credits, string creditsUrl, string demUrlIn, string alturl, double meanRadius, string referenceFrame)
        {
            ImageSetHelper temp = new ImageSetHelper();

            temp.ReferenceFrame = referenceFrame;
            temp.MeanRadius = meanRadius;
            temp.altUrl = alturl;
            temp.demUrl = demUrlIn;
            temp.creditsText = credits;
            temp.creditsUrl = creditsUrl;
            temp.offsetY = offsetY;
            temp.offsetX = offsetX;
            temp.widthFactor = wf;
            temp.elevationModel = elevationModel;
            temp.defaultSet = defaultSet;
            temp.name = name;
            temp.sparse = sparse;
            temp.dataSetType = dataSetType;
            temp.bandPass = bandPass;
            temp.quadTreeTileMap = quadTreeMap;
            temp.url = url;
            temp.levels = levels;
            temp.baseTileDegrees = baseTileDegrees;
            temp.imageSetID = imageSetID;
            temp.extension = extension;
            temp.projection = projection;
            temp.bottomsUp = bottomsUp;
            temp.baseLevel = baseLevel;
            temp.mercator = (projection == ProjectionType.Mercator);
            temp.centerX = centerX;
            temp.centerY = centerY;
            temp.rotation = rotation;
            temp.thumbnailUrl = thumbnailUrl;
            temp.ComputeMatrix();

            return temp;
        }
コード例 #52
0
        public SolveProjector(ProjectorEntry pe, double radius, ProjectionType type, ScreenTypes tranformType, SolveParameters solveParameters)
        {
            projectionType = type;
            screenType = tranformType;
            this.solveParameters = solveParameters;

            switch (type)
            {
                case ProjectionType.View:
                    {

                        Fov.Value = pe.ViewProjection.FOV;
                        Aspect.Value = pe.ViewProjection.Aspect;
                        OffsetX.Value = pe.ViewProjection.XOffset;
                        OffsetY.Value = pe.ViewProjection.YOffset;
                        RadialCenterX.Value = pe.ViewProjection.RadialCenterX;
                        RadialCenterY.Value = pe.ViewProjection.RadialCenterY;
                        RadialAmountX.Value = pe.ViewProjection.RadialAmountX;
                        RadialAmountY.Value = pe.ViewProjection.RadialAmountY;

                        Pitch.Value = pe.ViewTransform.Pitch;
                        Heading.Value = pe.ViewTransform.Heading;
                        Roll.Value = pe.ViewTransform.Roll;
                        X.Value = -pe.ViewTransform.X;
                        Y.Value = pe.ViewTransform.Y;
                        Z.Value = pe.ViewTransform.Z;
                    }
                    break;
                case ProjectionType.FishEye:
                case ProjectionType.Projector:
                    {
                        Fov.Value = pe.ProjectorProjection.FOV;
                        Aspect.Value = pe.ProjectorProjection.Aspect;
                        OffsetX.Value = pe.ProjectorProjection.XOffset;
                        OffsetY.Value = pe.ProjectorProjection.YOffset;
                        RadialCenterX.Value = pe.ProjectorProjection.RadialCenterX;
                        RadialCenterY.Value = pe.ProjectorProjection.RadialCenterY;
                        RadialAmountX.Value = pe.ProjectorProjection.RadialAmountX;
                        RadialAmountY.Value = pe.ProjectorProjection.RadialAmountY;

                        Pitch.Value = pe.ProjectorTransform.Pitch;
                        Heading.Value = pe.ProjectorTransform.Heading;
                        Roll.Value = pe.ProjectorTransform.Roll;
                        X.Value = -pe.ProjectorTransform.X;
                        Y.Value = pe.ProjectorTransform.Y;
                        Z.Value = pe.ProjectorTransform.Z;
                    }
                    break;
                case ProjectionType.Solved:
                    {
                        Fov.Value = pe.SolvedProjection.FOV;
                        Aspect.Value = pe.SolvedProjection.Aspect;
                        OffsetX.Value = pe.SolvedProjection.XOffset;
                        OffsetY.Value = pe.SolvedProjection.YOffset;
                        RadialCenterX.Value = pe.ProjectorProjection.RadialCenterX;
                        RadialCenterY.Value = pe.ProjectorProjection.RadialCenterY;
                        RadialAmountX.Value = pe.ProjectorProjection.RadialAmountX;
                        RadialAmountY.Value = pe.ProjectorProjection.RadialAmountY;

                        Pitch.Value = pe.SolvedTransform.Pitch;
                        Heading.Value = pe.SolvedTransform.Heading;
                        Roll.Value = pe.SolvedTransform.Roll;
                        X.Value = -pe.SolvedTransform.X;
                        Y.Value = pe.SolvedTransform.Y;
                        Z.Value = pe.SolvedTransform.Z;
                    }
                    break;
            }

            width = pe.Width;
            height = pe.Height;
            sphereRadius = radius;
        }
コード例 #53
0
    public float GetValue(float percentage, ProjectionType type)
    {
        if (realNumberOfPoints < 2)
        {
            if(type == ProjectionType.FOV)
            {
                if(realNumberOfPoints == 1)
                    return (this[0]).FOV;
                return defaultFOV;
            }
            else
            {
                if (realNumberOfPoints == 1)
                    return (this[0]).Size;
                return defaultSize;
            }
        }

        percentage = Mathf.Clamp(percentage, 0.0f, 1.0f);

        switch (interpolation)
        {
            case Interpolation.SmoothStep:
                return SmoothStepInterpolation(percentage, type);

            case Interpolation.Linear:
                return LinearInterpolation(percentage, type);

            default:
                return LinearInterpolation(percentage, type);
        }
    }
コード例 #54
0
ファイル: ScreenShot.cs プロジェクト: tcdanielh/tilt-brush
        /// <summary>
        /// Initialize the attributes of the capture session and start capture.
        /// </summary>
        public bool StartCapture()
        {
            if (_captureStarted)
            {
                Debug.LogWarningFormat(LOG_FORMAT, "Previous screenshot session not finish yet!");
                OnCaptureError(new CaptureErrorEventArgs(CaptureErrorCode.SCREENSHOT_ALREADY_IN_PROGRESS));
                return(false);
            }

            saveFolderFullPath = Utils.CreateFolder(saveFolder);

            if (captureMode == CaptureMode._360)
            {
                if (projectionType == ProjectionType.NONE)
                {
                    Debug.LogFormat(LOG_FORMAT,
                                    "Projection type should be set for 360 capture, set type to equirect for generating texture properly");
                    projectionType = ProjectionType.EQUIRECT;
                }
                if (projectionType == ProjectionType.CUBEMAP)
                {
                    if (stereoMode != StereoMode.NONE)
                    {
                        Debug.LogFormat(LOG_FORMAT,
                                        "Stereo settings not support for cubemap capture, reset to mono video capture.");
                        stereoMode = StereoMode.NONE;
                    }
                }
                CubemapSizeSettings();
            }
            else if (captureMode == CaptureMode.REGULAR)
            {
                // Non 360 capture doesn't have projection type
                projectionType = ProjectionType.NONE;
            }

            AntiAliasingSettings();

            // init ffmpeg encoding settings
            FFmpegEncoderSettings();

#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
            if (gpuEncoding)
            {
                if (FreeTrial.Check())
                {
                    Debug.LogFormat(LOG_FORMAT, "GPU encoding is not supported in free trial version, fall back to software encoding.");
                    gpuEncoding = false;
                }

                // init GPU encoding settings
                GPUEncoderSettings();

                if (!gpuEncoder.instantiated || !gpuEncoder.IsSupported())
                {
                    Debug.LogFormat(LOG_FORMAT, "GPU encoding is not supported in current device or settings, fall back to software encoding.");
                    gpuEncoding = false;
                }
            }
#else
            if (gpuEncoding)
            {
                Debug.LogFormat(LOG_FORMAT, "GPU encoding is only available on windows system, fall back to software encoding.");
                gpuEncoding = false;
            }
#endif

            if (gpuEncoding)
            {
                // init hardware encoding settings
                GPUEncoderSettings();

                if (!gpuEncoder.StartScreenShot())
                {
                    OnCaptureError(new CaptureErrorEventArgs(CaptureErrorCode.SCREENSHOT_START_FAILED));
                    return(false);
                }
            }
            else
            {
                if (!ffmpegEncoder.StartScreenShot())
                {
                    OnCaptureError(new CaptureErrorEventArgs(CaptureErrorCode.SCREENSHOT_START_FAILED));
                    return(false);
                }
            }

            _captureStarted = true;

            // Start garbage collect thread.
            //if (!garbageThreadRunning)
            //{
            //  garbageThreadRunning = true;

            //  if (garbageCollectionThread != null &&
            //    garbageCollectionThread.IsAlive)
            //  {
            //    garbageCollectionThread.Abort();
            //    garbageCollectionThread = null;
            //  }

            //  garbageCollectionThread = new Thread(GarbageCollectionProcess);
            //  garbageCollectionThread.Priority = System.Threading.ThreadPriority.Lowest;
            //  garbageCollectionThread.IsBackground = true;
            //  garbageCollectionThread.Start();
            //}

            Debug.LogFormat(LOG_FORMAT, "Screen shot session started.");
            return(true);
        }
コード例 #55
0
 public static Vector2 GenerateUV(ProjectionType type, Vector3 position, Vector3 normal, Vector2 scale)
 {
     if (type == ProjectionType.Spherical)
     {
         return MathHelper.Multiply(
             new Vector2(
                 0.5f - ((float)Math.Atan2(position.Z, position.X)) / ((float)Math.PI * 2),
                 0.5f - 2 * ((float)Math.Asin(position.Y)) / ((float)Math.PI * 2)), scale * 6);
     }
     else if (type == ProjectionType.Box)
     {
         //return MathHelper.Multiply(new Vector2((position.X * normal.Z) + (position.Y * normal.X) + (position.Z * normal.Y), (position.X * normal.Y) + (position.Y * normal.Z) + (position.Z * normal.X)), (textureScale * 0.1f));
         return MathHelper.Multiply(
             new Vector2(
                 (position.X * normal.Z) + (position.Y * normal.X) + (position.Z * normal.Y),
                 (position.X * normal.Y) + (position.Y * normal.Z) + (position.Z * normal.X)),
                 (scale * 0.1f)
                 );
     }
     else if (type == ProjectionType.Conical)
     {
         float phi = (float)Math.Atan2(normal.Z, normal.X);
         return MathHelper.Multiply(new Vector2(
             position.Y,
             phi
             ), scale);
     }
     return Vector2.Zero;
 }
コード例 #56
0
            public void DrawProjection()
            {
                ProjectionType projectionType = orthographic.boolValue ? ProjectionType.Orthographic : ProjectionType.Perspective;

                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = orthographic.hasMultipleDifferentValues;
                projectionType           = (ProjectionType)EditorGUILayout.EnumPopup(Styles.projection, projectionType);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    orthographic.boolValue = (projectionType == ProjectionType.Orthographic);
                }

                if (!orthographic.hasMultipleDifferentValues)
                {
                    if (projectionType == ProjectionType.Orthographic)
                    {
                        EditorGUILayout.PropertyField(orthographicSize, Styles.size);
                    }
                    else
                    {
                        float fovCurrentValue;
                        bool  multipleDifferentFovValues = false;
                        bool  isPhysicalCamera           = projectionMatrixMode.intValue == (int)Camera.ProjectionMatrixMode.PhysicalPropertiesBased;

                        var rect       = EditorGUILayout.GetControlRect();
                        var guiContent = EditorGUI.BeginProperty(rect, Styles.FOVAxisMode, fovAxisMode);
                        EditorGUI.showMixedValue = fovAxisMode.hasMultipleDifferentValues;

                        EditorGUI.BeginChangeCheck();
                        var fovAxisNewVal = (int)(Camera.FieldOfViewAxis)EditorGUI.EnumPopup(rect, guiContent, (Camera.FieldOfViewAxis)fovAxisMode.intValue);
                        if (EditorGUI.EndChangeCheck())
                        {
                            fovAxisMode.intValue = fovAxisNewVal;
                        }
                        EditorGUI.EndProperty();

                        bool fovAxisVertical = fovAxisMode.intValue == 0;

                        if (!fovAxisVertical && !fovAxisMode.hasMultipleDifferentValues)
                        {
                            var   targets     = m_SerializedObject.targetObjects;
                            var   camera0     = targets[0] as Camera;
                            float aspectRatio = isPhysicalCamera ? sensorSize.vector2Value.x / sensorSize.vector2Value.y : camera0.aspect;
                            // camera.aspect is not serialized so we have to check all targets.
                            fovCurrentValue = Camera.VerticalToHorizontalFieldOfView(camera0.fieldOfView, aspectRatio);
                            if (m_SerializedObject.targetObjectsCount > 1)
                            {
                                foreach (Camera camera in targets)
                                {
                                    if (camera.fieldOfView != fovCurrentValue)
                                    {
                                        multipleDifferentFovValues = true;
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            fovCurrentValue            = verticalFOV.floatValue;
                            multipleDifferentFovValues = fovAxisMode.hasMultipleDifferentValues;
                        }

                        EditorGUI.showMixedValue = multipleDifferentFovValues;
                        var content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.fieldOfView, verticalFOV);
                        EditorGUI.BeginDisabled(projectionMatrixMode.hasMultipleDifferentValues || isPhysicalCamera && (sensorSize.hasMultipleDifferentValues || fovAxisMode.hasMultipleDifferentValues));
                        EditorGUI.BeginChangeCheck();
                        var fovNewValue = EditorGUILayout.Slider(content, fovCurrentValue, 0.00001f, 179f);
                        var fovChanged  = EditorGUI.EndChangeCheck();
                        EditorGUI.EndDisabled();
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.EndProperty();
                        EditorGUI.showMixedValue = false;

                        content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.physicalCamera, projectionMatrixMode);
                        EditorGUI.showMixedValue = projectionMatrixMode.hasMultipleDifferentValues;

                        EditorGUI.BeginChangeCheck();
                        isPhysicalCamera = EditorGUILayout.Toggle(content, isPhysicalCamera);
                        if (EditorGUI.EndChangeCheck())
                        {
                            projectionMatrixMode.intValue = isPhysicalCamera ? (int)Camera.ProjectionMatrixMode.PhysicalPropertiesBased : (int)Camera.ProjectionMatrixMode.Implicit;
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.EndProperty();

                        EditorGUI.showMixedValue = false;
                        if (isPhysicalCamera && !projectionMatrixMode.hasMultipleDifferentValues)
                        {
                            using (new EditorGUI.IndentLevelScope())
                            {
                                using (var horizontal = new EditorGUILayout.HorizontalScope())
                                    using (new EditorGUI.PropertyScope(horizontal.rect, Styles.focalLength, focalLength))
                                        using (var checkScope = new EditorGUI.ChangeCheckScope())
                                        {
                                            EditorGUI.showMixedValue = focalLength.hasMultipleDifferentValues;
                                            float sensorLength   = fovAxisVertical ? sensorSize.vector2Value.y : sensorSize.vector2Value.x;
                                            float focalLengthVal = fovChanged ? Camera.FieldOfViewToFocalLength(fovNewValue, sensorLength) : focalLength.floatValue;
                                            focalLengthVal = EditorGUILayout.FloatField(Styles.focalLength, focalLengthVal);
                                            if (checkScope.changed || fovChanged)
                                            {
                                                focalLength.floatValue = focalLengthVal;
                                            }
                                        }

                                EditorGUI.showMixedValue = sensorSize.hasMultipleDifferentValues;
                                EditorGUI.BeginChangeCheck();
                                int filmGateIndex = Array.IndexOf(k_ApertureFormatValues, new Vector2((float)Math.Round(sensorSize.vector2Value.x, 3), (float)Math.Round(sensorSize.vector2Value.y, 3)));
                                if (filmGateIndex == -1)
                                {
                                    filmGateIndex = EditorGUILayout.Popup(Styles.cameraType, k_ApertureFormatNames.Length - 1, k_ApertureFormatNames);
                                }
                                else
                                {
                                    filmGateIndex = EditorGUILayout.Popup(Styles.cameraType, filmGateIndex, k_ApertureFormatNames);
                                }
                                EditorGUI.showMixedValue = false;
                                if (EditorGUI.EndChangeCheck() && filmGateIndex < k_ApertureFormatValues.Length)
                                {
                                    sensorSize.vector2Value = k_ApertureFormatValues[filmGateIndex];
                                }

                                EditorGUILayout.PropertyField(sensorSize, Styles.sensorSize);

                                EditorGUILayout.PropertyField(lensShift, Styles.lensShift);

                                using (var horizontal = new EditorGUILayout.HorizontalScope())
                                    using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, Styles.gateFit, gateFit))
                                        using (var checkScope = new EditorGUI.ChangeCheckScope())
                                        {
                                            int gateValue = (int)(Camera.GateFitMode)EditorGUILayout.EnumPopup(propertyScope.content, (Camera.GateFitMode)gateFit.intValue);
                                            if (checkScope.changed)
                                            {
                                                gateFit.intValue = gateValue;
                                            }
                                        }
                            }
                        }
                        else if (fovChanged)
                        {
                            verticalFOV.floatValue = fovAxisVertical ? fovNewValue : Camera.HorizontalToVerticalFieldOfView(fovNewValue, (m_SerializedObject.targetObjects[0] as Camera).aspect);
                        }
                        EditorGUILayout.Space();
                    }
                }
            }
コード例 #57
0
 public void AddVertex(Vector3 position, ProjectionType type)
 {
     Vector3 normal = new Vector3(1,1,1);
     if ((Vertices.Count + 1) % 3 == 0)
     {
         normal = Vector3.Cross(position, (Vertices[Vertices.Count - 1] as VertexPosNorTex).Position);
         (Vertices[Vertices.Count - 1] as VertexPosNorTex).Normal = normal;
         (Vertices[Vertices.Count - 2] as VertexPosNorTex).Normal = normal;
     }
     AddVertex(new VertexPosNorTex(position, normal, GenerateUV(type, position, normal, new Vector2(1, 1))));
 }
コード例 #58
0
 private static extern void Internal_SetProjectionType(IntPtr instance, ProjectionType value);
コード例 #59
0
 /// <summary>
 /// initializes maps for cv::remap() for wide-angle
 /// </summary>
 /// <param name="cameraMatrix"></param>
 /// <param name="distCoeffs"></param>
 /// <param name="imageSize"></param>
 /// <param name="destImageWidth"></param>
 /// <param name="m1Type"></param>
 /// <param name="map1"></param>
 /// <param name="map2"></param>
 /// <param name="projType"></param>
 /// <param name="alpha"></param>
 /// <returns></returns>
 public static float InitWideAngleProjMap(InputArray cameraMatrix, InputArray distCoeffs,
     Size imageSize, int destImageWidth, MatType m1Type, OutputArray map1, OutputArray map2,
     ProjectionType projType, double alpha = 0)
 {
     if (cameraMatrix == null)
         throw new ArgumentNullException("cameraMatrix");
     if (distCoeffs == null)
         throw new ArgumentNullException("distCoeffs");
     if (map1 == null)
         throw new ArgumentNullException("map1");
     if (map2 == null)
         throw new ArgumentNullException("map2");
     cameraMatrix.ThrowIfDisposed();
     distCoeffs.ThrowIfDisposed();
     map1.ThrowIfNotReady();
     map2.ThrowIfNotReady();
     float ret = NativeMethods.imgproc_initWideAngleProjMap(cameraMatrix.CvPtr, distCoeffs.CvPtr, imageSize,
         destImageWidth, m1Type, map1.CvPtr, map2.CvPtr, (int)projType, alpha);
     map1.Fix();
     map2.Fix();
     return ret;
 }
コード例 #60
0
        public ProjectionManager(
            IPublisher inputQueue,
            IPublisher publisher,
            IDictionary <Guid, IPublisher> queueMap,
            ITimeProvider timeProvider,
            ProjectionType runProjections,
            bool initializeSystemProjections = true)
        {
            if (inputQueue == null)
            {
                throw new ArgumentNullException("inputQueue");
            }
            if (publisher == null)
            {
                throw new ArgumentNullException("publisher");
            }
            if (queueMap == null)
            {
                throw new ArgumentNullException("queueMap");
            }
            if (queueMap.Count == 0)
            {
                throw new ArgumentException("At least one queue is required", "queueMap");
            }

            _inputQueue = inputQueue;
            _publisher  = publisher;
            _queues     = queueMap.Select(v => Tuple.Create(v.Key, v.Value)).ToArray();
            _workers    = _queues.Select(v => v.Item1).ToArray();

            _timeProvider   = timeProvider;
            _runProjections = runProjections;
            _initializeSystemProjections = initializeSystemProjections;

            _writeDispatcher =
                new RequestResponseDispatcher <ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    new PublishEnvelope(_inputQueue));
            _readDispatcher =
                new RequestResponseDispatcher
                <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    new PublishEnvelope(_inputQueue));
            _streamDispatcher =
                new RequestResponseDispatcher <ClientMessage.DeleteStream, ClientMessage.DeleteStreamCompleted>(
                    publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    new PublishEnvelope(_inputQueue));

            _projections        = new Dictionary <string, ManagedProjection>();
            _projectionsMap     = new Dictionary <Guid, string>();
            _publishEnvelope    = new PublishEnvelope(_inputQueue, crossThread: true);
            _getStateDispatcher =
                new RequestResponseDispatcher
                <CoreProjectionManagementMessage.GetState, CoreProjectionStatusMessage.StateReport>(
                    _publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    new PublishEnvelope(_inputQueue));
            _getResultDispatcher =
                new RequestResponseDispatcher
                <CoreProjectionManagementMessage.GetResult, CoreProjectionStatusMessage.ResultReport>(
                    _publisher,
                    v => v.CorrelationId,
                    v => v.CorrelationId,
                    new PublishEnvelope(_inputQueue));
        }