예제 #1
0
 private void returnThumbToPool(LiveThumbnailHostInfo info)
 {
     info.CurrentSceneView.SceneView.CameraCreated -= info.WindowCreatedCallback;
     info.WindowCreatedCallback = null;
     activeImages.Remove(info.CurrentSceneView);
     info.CurrentSceneView.finished();
     info.CurrentSceneView = null;
 }
예제 #2
0
        /// <summary>
        /// Update the camera and position of a live thumb based off the host.
        /// Set the properties on the host before calling this function.
        /// </summary>
        /// <param name="host"></param>
        public void updateCameraAndLayers(LiveThumbnailHost host)
        {
            LiveThumbnailHostInfo info = host._HostInfo;

            if (info.CurrentSceneView != null)
            {
                info.CurrentSceneView.SceneView.immediatlySetPosition(new CameraPosition()
                {
                    Translation = host.Translation,
                    LookAt      = host.LookAt
                });
                host.Layers.instantlyApplyTo(info.CurrentSceneView.SceneView.CurrentTransparencyState);
                info.CurrentSceneView.SceneView.RenderOneFrame = true;
            }
        }
예제 #3
0
        /// <summary>
        /// Set the visiblity of a thumb host, if it is set to visible a live thumb will be created
        /// and if set to false the thumb will be destroyed.
        /// </summary>
        /// <param name="host"></param>
        /// <param name="visible"></param>
        public void setVisibility(LiveThumbnailHost host, bool visible)
        {
            LiveThumbnailHostInfo info = host._HostInfo;

            if (visible != info.Visible)
            {
                info.Visible = visible;
                if (info.Visible)
                {
                    createLiveThumb(info);
                }
                else
                {
                    returnThumbToPool(info);
                }
            }
        }
예제 #4
0
        private void createLiveThumb(LiveThumbnailHostInfo info)
        {
            var sceneView = texturePool.getSceneView(info.Host.Translation, info.Host.LookAt, info.Host.Layers);

            sceneView.SceneView.AlwaysRender   = false;
            sceneView.SceneView.RenderOneFrame = true;

            info.Host.setTextureInfo(sceneView.SceneView.TextureName, new IntCoord(0, 0, (int)sceneView.SceneView.Width, (int)sceneView.SceneView.Height));

            activeImages.Add(sceneView);
            info.CurrentSceneView = sceneView;

            info.WindowCreatedCallback = (window) =>
            {
                info.Host.Layers.instantlyApplyTo(window.CurrentTransparencyState);
            };

            sceneView.SceneView.CameraCreated += info.WindowCreatedCallback;
        }