Пример #1
0
 public void Init(int passId, Matrix viewProjMatrix, MyViewport viewport, MyGBuffer gbuffer)
 {
     m_viewProjMatrix = viewProjMatrix;
     m_viewport       = viewport;
     m_gbuffer        = gbuffer;
     Init(passId, "GBuffer", MyFrustumEnum.MainFrustum, MyPassIdResolver.GetGBufferPassIdx(PassId));
 }
        internal static void DrawFullscreenQuad(MyViewport? customViewport = null)
        {
            if (customViewport.HasValue)
            {
                RC.DeviceContext.Rasterizer.SetViewport(customViewport.Value.OffsetX, customViewport.Value.OffsetY, customViewport.Value.Width, customViewport.Value.Height);
            }
            else
            {
                RC.DeviceContext.Rasterizer.SetViewport(0, 0, MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y);
            }

            // set vertex buffer:
            if (!MyStereoRender.Enable || MyStereoRender.RenderRegion == MyStereoRegion.FULLSCREEN)
                RC.SetVB(0, m_VBFullscreen.Buffer, m_VBFullscreen.Stride);
            else if (MyStereoRender.RenderRegion == MyStereoRegion.LEFT)
                RC.SetVB(0, m_VBLeftPart.Buffer, m_VBLeftPart.Stride);
            else if (MyStereoRender.RenderRegion == MyStereoRegion.RIGHT)
                RC.SetVB(0, m_VBRightPart.Buffer, m_VBRightPart.Stride);

            if (MyStereoRender.Enable)
                MyStereoRender.PSBindRawCB_FrameConstants(RC);

            RC.DeviceContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleStrip;
            RC.SetIL(m_IL);
            RC.SetVS(m_VSCopy);
            RC.DeviceContext.Draw(4, 0);
            MyRender11.ProcessDebugOutput();
            RC.DeviceContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleList;
            
            if (MyStereoRender.Enable)
                RC.DeviceContext.PixelShader.SetConstantBuffer(MyCommon.FRAME_SLOT, MyCommon.FrameConstants);
        }
Пример #3
0
        internal static void DrawFullscreenQuad(MyViewport? customViewport = null)
        {
            if (customViewport.HasValue)
                RC.SetViewport(customViewport.Value.OffsetX, customViewport.Value.OffsetY, customViewport.Value.Width, customViewport.Value.Height);
            else
                RC.SetScreenViewport();

            // set vertex buffer:
            if (!MyStereoRender.Enable || MyStereoRender.RenderRegion == MyStereoRegion.FULLSCREEN)
                RC.SetVertexBuffer(0, m_VBFullscreen);
            else if (MyStereoRender.RenderRegion == MyStereoRegion.LEFT)
                RC.SetVertexBuffer(0, m_VBLeftPart);
            else if (MyStereoRender.RenderRegion == MyStereoRegion.RIGHT)
                RC.SetVertexBuffer(0, m_VBRightPart);

            if (MyStereoRender.Enable)
                MyStereoRender.PSBindRawCB_FrameConstants(RC);

            RC.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleStrip);
            RC.SetInputLayout(m_IL);
            RC.VertexShader.Set(m_VSCopy);
            RC.Draw(4, 0);
            RC.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleList);

            if (MyStereoRender.Enable)
                RC.PixelShader.SetConstantBuffer(MyCommon.FRAME_SLOT, MyCommon.FrameConstants);
        }
Пример #4
0
        public void UpdateScreenSize(MyViewport currentScreenViewport)
        {
            Viewport = currentScreenViewport; // MySandboxGame.ScreenViewport; // no dependency on sandbox!

            PreviousPosition = Vector3D.Zero;
            BoundingFrustum  = new BoundingFrustumD(MatrixD.Identity);

            ForwardAspectRatio = (float)Viewport.Width / (float)Viewport.Height;
        }
        protected override void StartRenderComponent(MyRenderDeviceSettings?settings)
        {
            DrawThread = Thread.CurrentThread;

            MyRenderWindow wnd = new MyRenderWindow();

#if XB1
            System.Diagnostics.Debug.Assert(false);
#else
            wnd.Control          = Control.FromHandle(WindowHandle);
            wnd.TopLevelForm     = (Form)wnd.Control.TopLevelControl;
            wnd.TopLevelForm.Tag = wnd;

            m_bufferedInputSource = wnd;

            wnd.TopLevelForm.KeyPress += TopLevelForm_KeyPress;

            m_windowCreatedEvent.Set();
            ((Form)wnd.TopLevelForm).FormClosed += (o, e) => ExitThreadSafe();
#endif

            Action showCursor = () =>
            {
                //if (!wnd.TopLevelForm.IsDisposed)
                //wnd.TopLevelForm.ShowCursor = true;
            };
            Action hideCursor = () =>
            {
                //if (!wnd.TopLevelForm.IsDisposed)
                //wnd.TopLevelForm.ShowCursor = false;
            };
            m_setMouseVisible = (b) =>
            {
                // In case of crash, this may be null, don't want subsequent crash
                var component = GameRenderComponent;
                if (component != null)
                {
                    var renderThread = component.RenderThread;
                    if (renderThread != null)
                    {
                        renderThread.Invoke(b ? showCursor : hideCursor);
                    }
                }
            };

            if (settings == null)
            {
                settings = new MyRenderDeviceSettings(0, MyWindowModeEnum.Window, wnd.Control.ClientSize.Width, wnd.Control.ClientSize.Height, 0, false, MyCompilationSymbols.DX11ForceStereo, false);
            }

            GameRenderComponent.StartSync(m_gameTimer, wnd, settings, MyRenderQualityEnum.NORMAL, MyPerGameSettings.MaxFrameRate);
            GameRenderComponent.RenderThread.SizeChanged += RenderThread_SizeChanged;
            GameRenderComponent.RenderThread.BeforeDraw  += RenderThread_BeforeDraw;

            VRageRender.MyViewport vp = new MyViewport(0, 0, wnd.Control.ClientSize.Width, wnd.Control.ClientSize.Height);
            RenderThread_SizeChanged(wnd.Control.ClientSize.Width, wnd.Control.ClientSize.Height, vp);
        }
Пример #6
0
        public void UpdateScreenSize(MyViewport currentScreenViewport)
        {
            Viewport = currentScreenViewport;

            PreviousPosition = Vector3D.Zero;
            BoundingFrustum  = new BoundingFrustumD(MatrixD.Identity);

            AspectRatio = Viewport.Width / Viewport.Height;
        }
Пример #7
0
        public void UpdateScreenSize()
        {
            Viewport = MySandboxGame.ScreenViewport;

            PreviousPosition = Vector3D.Zero;
            BoundingFrustum  = new BoundingFrustumD(MatrixD.Identity);

            ForwardAspectRatio = (float)Viewport.Width / (float)Viewport.Height;
        }
Пример #8
0
        internal static void Run(RenderTargetView renderTarget, RenderTargetView intermediateRenderTarget, ShaderResourceView intermediateResourceView, ShaderResourceView initialResourceView,
                                 int maxOffset = 5, MyBlurDensityFunctionType densityFunctionType = MyBlurDensityFunctionType.Gaussian, float WeightParameter = 1.5f,
                                 DepthStencilState depthStencilState = null, int stencilRef = 0x0, bool copyOnStencilFail = false,
                                 float depthDiscardThreshold = 0.0f, MyViewport? viewport = null)
        {
            ProfilerShort.Begin("MyBlur.Run");
            MyGpuProfiler.IC_BeginBlock("MyBlur.Run");
            Debug.Assert(initialResourceView != null);
            Debug.Assert(intermediateResourceView != null);
            Debug.Assert(intermediateRenderTarget != null);
            Debug.Assert(renderTarget != null);

            int shaderKey = InitShaders(densityFunctionType, maxOffset, copyOnStencilFail, depthDiscardThreshold);

            RC.DeviceContext.PixelShader.SetConstantBuffer(5, m_blurConstantBuffer);

            BlurConstants constants = new BlurConstants
            {
                DistributionWeight = WeightParameter,
                StencilRef = stencilRef,
            };
            var mapping = MyMapping.MapDiscard(m_blurConstantBuffer);
            mapping.WriteAndPosition(ref constants);
            mapping.Unmap();

            // Horizontal pass
            MyRender11.DeviceContext.ClearRenderTargetView(intermediateRenderTarget, Color4.White);
            RC.DeviceContext.OutputMerger.SetTargets(intermediateRenderTarget);
            RC.SetDS(depthStencilState, stencilRef);
            RC.DeviceContext.PixelShader.SetShaderResource(0, MyGBuffer.Main.DepthStencil.m_SRV_depth);
            RC.DeviceContext.PixelShader.SetShaderResource(4, MyGBuffer.Main.DepthStencil.m_SRV_stencil);
            RC.DeviceContext.PixelShader.SetShaderResource(5, initialResourceView);
            RC.SetPS(m_blurShaders[shaderKey].Item1);
            MyScreenPass.DrawFullscreenQuad(viewport);
            RC.DeviceContext.PixelShader.SetShaderResource(5, null);

            // Vertical pass
            MyRender11.DeviceContext.ClearRenderTargetView(renderTarget, Color4.White);
            RC.DeviceContext.OutputMerger.SetTargets(renderTarget);
            RC.SetDS(depthStencilState, stencilRef);
            RC.DeviceContext.PixelShader.SetShaderResource(0, MyGBuffer.Main.DepthStencil.m_SRV_depth);
            RC.DeviceContext.PixelShader.SetShaderResource(4, MyGBuffer.Main.DepthStencil.m_SRV_stencil);
            RC.DeviceContext.PixelShader.SetShaderResource(5, intermediateResourceView);
            RC.SetPS(m_blurShaders[shaderKey].Item2);
            MyScreenPass.DrawFullscreenQuad(viewport);

            RC.DeviceContext.PixelShader.SetShaderResource(0, null);
            RC.DeviceContext.PixelShader.SetShaderResource(4, null);
            RC.DeviceContext.PixelShader.SetShaderResource(5, null);

            MyGpuProfiler.IC_EndBlock();
            ProfilerShort.End();
        }
Пример #9
0
        internal static void DrawFullscreenQuad(MyViewport ? customViewport = null)
        {
            if(customViewport.HasValue)
            {
                RC.Context.Rasterizer.SetViewport(customViewport.Value.OffsetX, customViewport.Value.OffsetY, customViewport.Value.Width, customViewport.Value.Height);
            }
            else
            {
                RC.Context.Rasterizer.SetViewport(0, 0, MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y);
            }

            RC.Context.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleList;
            RC.SetIL(null);
            RC.SetVS(m_fullscreenQuadVS);
            RC.Context.Draw(3, 0);
        }
Пример #10
0
        public void Init(int passId, Matrix viewProjMatrix, MyViewport viewport, IDsvBindable dsv, bool isCascade, string debugName)
        {
            m_viewProjMatrix = viewProjMatrix;
            m_viewport       = viewport;
            m_dsv            = dsv;
            m_isCascade      = isCascade;

            if (isCascade)
            {
                Init(passId, debugName, MyFrustumEnum.ShadowCascade, MyPassIdResolver.GetCascadeDepthPassIdx(passId));
            }
            else
            {
                Init(passId, debugName, MyFrustumEnum.ShadowProjection, MyPassIdResolver.GetSingleDepthPassIdx(passId));
            }
        }
Пример #11
0
        protected override void StartRenderComponent(MyRenderDeviceSettings? settings)
        {
            DrawThread = Thread.CurrentThread;

            MyRenderWindow wnd = new MyRenderWindow();
            wnd.Control = Control.FromHandle(WindowHandle);
            wnd.TopLevelForm = (Form)wnd.Control.TopLevelControl;

            m_bufferedInputSource = wnd;
            m_windowCreatedEvent.Set();
            ((Form)wnd.TopLevelForm).FormClosed += (o, e) => ExitThreadSafe();
            Action showCursor = () =>
            {
                //if (!wnd.TopLevelForm.IsDisposed)
                //wnd.TopLevelForm.ShowCursor = true;
            };
            Action hideCursor = () =>
            {
                //if (!wnd.TopLevelForm.IsDisposed)
                //wnd.TopLevelForm.ShowCursor = false;
            };
            m_setMouseVisible = (b) =>
            {
                // In case of crash, this may be null, don't want subsequent crash
                var component = GameRenderComponent;
                if (component != null)
                {
                    var renderThread = component.RenderThread;
                    if (renderThread != null)
                    {
                        renderThread.Invoke(b ? showCursor : hideCursor);
                    }
                }
            };

            if (settings == null)
            {
                settings = new MyRenderDeviceSettings(0, MyWindowModeEnum.Window, wnd.Control.ClientSize.Width, wnd.Control.ClientSize.Height, 0, false);
            }

            GameRenderComponent.StartSync(m_gameTimer, wnd, settings, MyRenderQualityEnum.NORMAL);
            GameRenderComponent.RenderThread.SizeChanged += RenderThread_SizeChanged;
            GameRenderComponent.RenderThread.BeforeDraw += RenderThread_BeforeDraw;

            VRageRender.MyViewport vp = new MyViewport(0, 0, wnd.Control.ClientSize.Width, wnd.Control.ClientSize.Height);
            RenderThread_SizeChanged(wnd.Control.ClientSize.Width, wnd.Control.ClientSize.Height, vp);
        }
Пример #12
0
        internal static void Run(MyBindableResource destination, MyBindableResource source, MyViewport? customViewport = null)
        {
            var context = MyRender11.DeviceContext;
        
            context.OutputMerger.BlendState = null;
            //context.Rasterizer.SetViewport(0, 0, MyRender.ViewportResolution.X, MyRender.ViewportResolution.Y);

            RC.SetIL(null);
            context.PixelShader.Set(m_copyPs);
        
            //context.OutputMerger.SetTargets(null as DepthStencilView, target);
            //context.PixelShader.SetShaderResource(0, resource);
        
            RC.BindDepthRT(null, DepthStencilAccess.ReadWrite, destination);
            RC.BindSRV(0, source);

            MyScreenPass.DrawFullscreenQuad(customViewport ?? new MyViewport(destination.GetSize().X, destination.GetSize().Y));
        }
Пример #13
0
        internal static void Run(IRtvBindable destination, ISrvBindable source, bool alphaBlended = false, MyViewport? customViewport = null)
        {
            if (alphaBlended)
                RC.SetBlendState(MyBlendStateManager.BlendAlphaPremult);
            else
                RC.SetBlendState(null);
            //context.Rasterizer.SetViewport(0, 0, MyRender.ViewportResolution.X, MyRender.ViewportResolution.Y);

            RC.SetInputLayout(null);
            RC.PixelShader.Set(m_copyPs);
        
            //context.OutputMerger.SetTargets(null as DepthStencilView, target);
            //context.PixelShader.SetShaderResource(0, resource);
        
            RC.SetRtv(destination);
            RC.PixelShader.SetSrv(0, source);

            MyScreenPass.DrawFullscreenQuad(customViewport ?? new MyViewport(destination.Size.X, destination.Size.Y));
        }
        void InitRenderPasses(MyCullQuery cullQuery, List <MyRenderPass> renderPasses)
        {
            renderPasses.Clear();
            foreach (var query in cullQuery.RenderingPasses)
            {
                if (query == null)
                {
                    continue;
                }

                Matrix     matrix   = query.ViewProjection;
                MyViewport viewport = query.Viewport;

                if (query is VRageRender.MyGBufferPass)
                {
                    VRageRender.MyGBufferPass oldGBufferPass = (VRageRender.MyGBufferPass)query;
                    MyGBuffer     gbuffer = oldGBufferPass.GBuffer;
                    MyGBufferPass gbufferPass;
                    int           passId = GetPassId(oldGBufferPass);
                    m_gbufferPassesPool.AllocateOrCreate(out gbufferPass);
                    gbufferPass.Init(passId, matrix, viewport, gbuffer);
                    renderPasses.Add(gbufferPass);
                }

                if (query is VRageRender.MyDepthPass)
                {
                    VRageRender.MyDepthPass oldDepthPass = (VRageRender.MyDepthPass)query;
                    IDsvBindable            dsv          = oldDepthPass.Dsv;
                    MyDepthPass             depthPass;
                    bool isCascade = oldDepthPass.IsCascade;
                    int  passId    = GetPassId(oldDepthPass);
                    m_depthPassesPool.AllocateOrCreate(out depthPass);
                    depthPass.Init(passId, matrix, viewport, dsv, isCascade, oldDepthPass.DebugName);
                    renderPasses.Add(depthPass);
                }
            }
        }
Пример #15
0
 static void Resolve(bool blur, IRtvBindable dst, MyViewport viewport)
 {
     RC.SetRtv(dst);
     RC.PixelShader.SetSrv(0, m_quarterResAOTextureArray);
     if (blur)
     {
         RC.PixelShader.Set(m_reinterleaveAOPS_PreBlur);
         RC.PixelShader.SetSrv(1, m_fullResViewDepthTarget);
     }
     else
     {
         RC.PixelShader.Set(m_reinterleaveAOPS);
     }
     RC.PixelShader.SetSamplers(0, MySamplerStateManager.PointHBAOClamp);
     MyScreenPass.DrawFullscreenQuad(viewport);
 }
Пример #16
0
        static void DrawBlurXPS(MyViewport viewport)
        {
            RC.SetRtv(m_fullResAOZTexture);
            RC.PixelShader.Set(m_blurXPS);
            RC.PixelShader.SetSrv(0, m_fullResAOZTexture2);
            RC.PixelShader.SetSamplers(0, MySamplerStateManager.Point);
            RC.PixelShader.SetSamplers(1, MySamplerStateManager.Linear);

            MyScreenPass.DrawFullscreenQuad(viewport);
        }
        internal static void RenderColoredTextures(List <renderColoredTextureProperties> texturesToRender)
        {
            if (texturesToRender.Count == 0)
            {
                return;
            }

            if (!m_initialized)
            {
                Init();
            }

            const int RENDER_TEXTURE_RESOLUTION = 512;

            RC.DeviceContext.OutputMerger.BlendState = null;
            RC.SetIL(null);

            RC.SetPS(m_ps);
            RC.SetCB(0, MyCommon.FrameConstants);
            RC.SetCB(1, m_cb);

            Dictionary <Vector2I, MyRenderTarget> createdRenderTextureTargets = new Dictionary <Vector2I, MyRenderTarget>();

            foreach (var texture in texturesToRender)
            {
                TexId texId = MyTextures.GetTexture(texture.TextureName, MyTextureEnum.COLOR_METAL, true);
                if (texId == TexId.NULL)
                {
                    continue;
                }

                Vector2  texSize = MyTextures.GetSize(texId);
                Vector2I renderTargetResolution = new Vector2I(RENDER_TEXTURE_RESOLUTION, RENDER_TEXTURE_RESOLUTION);
                if (texSize.Y > 0)
                {
                    if (texSize.Y < RENDER_TEXTURE_RESOLUTION)
                    {
                        renderTargetResolution.X = (int)texSize.X;
                        renderTargetResolution.Y = (int)texSize.Y;
                    }
                    else
                    {
                        renderTargetResolution.X *= (int)(texSize.X / texSize.Y);
                    }
                }

                MyViewport viewport = new MyViewport(renderTargetResolution.X, renderTargetResolution.Y);

                MyRenderTarget renderTexture = null;
                if (!createdRenderTextureTargets.TryGetValue(renderTargetResolution, out renderTexture))
                {
                    renderTexture = new MyRenderTarget(renderTargetResolution.X, renderTargetResolution.Y, SharpDX.DXGI.Format.R8G8B8A8_UNorm_SRgb, 1, 0);
                    createdRenderTextureTargets[renderTargetResolution] = renderTexture;
                }

                RC.BindDepthRT(null, DepthStencilAccess.ReadWrite, renderTexture);

                // Set color
                var     mapping = MyMapping.MapDiscard(m_cb);
                Vector4 color   = new Vector4(texture.ColorMaskHSV, 1);
                mapping.WriteAndPosition(ref color);
                mapping.Unmap();

                // Set texture
                RC.DeviceContext.PixelShader.SetShaderResource(0, MyTextures.GetView(texId));

                // Draw
                MyScreenPass.DrawFullscreenQuad(viewport);

                // Save to file
                MyTextureData.ToFile(renderTexture.GetHWResource(), texture.PathToSave, ImageFileFormat.Png);
            }

            texturesToRender.Clear();

            foreach (var texture in createdRenderTextureTargets)
            {
                texture.Value.Release();
            }
            createdRenderTextureTargets.Clear();

            RC.BindDepthRT(null, DepthStencilAccess.ReadWrite, null);
            RC.BindGBufferForRead(0, MyGBuffer.Main);
        }
Пример #18
0
        static void DrawCoarseAO(MyGBuffer gbuffer, MyViewport viewport)
        {
            var qViewport = GetQuarterViewport(viewport);

            RC.PixelShader.Set(m_coarseAOPS);
            RC.PixelShader.SetSamplers(0, Params.DepthClampToEdge ? MySamplerStateManager.PointHBAOClamp : MySamplerStateManager.PointHBAOBorder);
            RC.PixelShader.SetSamplers(1, MySamplerStateManager.PointHBAOClamp);
            RC.PixelShader.SetSrv(1, gbuffer.GBuffer1);

            for (int sliceIndex = 0; sliceIndex < NUM_SLICES; ++sliceIndex)
            {
                RC.PixelShader.SetSrv(0, m_quarterResViewDepthTextureArray.SubresourceSrv(sliceIndex));

                RC.PixelShader.SetConstantBuffer(1, m_perPassCBs[sliceIndex]);
                RC.GeometryShader.SetConstantBuffer(1, m_perPassCBs[sliceIndex]);

                RC.SetRtv(m_quarterResAOTextureArray.SubresourceRtv(sliceIndex));
                MyScreenPass.DrawFullscreenQuad(qViewport);
            }

            RC.GeometryShader.Set(null);
        }
Пример #19
0
        public void UpdateScreenSize()
        {
            Viewport = MySandboxGame.ScreenViewport;

            PreviousPosition = Vector3D.Zero;
            BoundingFrustum = new BoundingFrustumD(MatrixD.Identity);

            ForwardAspectRatio = (float)Viewport.Width / (float)Viewport.Height;
        }
Пример #20
0
        // -------------------------------------------------------------------------------------

        public MyCamera(float fieldOfView, MyViewport currentScreenViewport)
        {
            FieldOfView = fieldOfView;
            Zoom        = new MyCameraZoomProperties(this);
            UpdateScreenSize(currentScreenViewport);
        }
Пример #21
0
 protected void RenderThread_SizeChanged(int width, int height, MyViewport viewport)
 {
     this.Invoke(() => UpdateScreenSize(width, height, viewport));
 }
Пример #22
0
        static GlobalConstantBuffer InitConstantBuffer(MyViewport viewport)
        {
            GlobalConstantBuffer m_Data = new GlobalConstantBuffer();
            Matrix m = MyRender11.Environment.Matrices.Projection;

            // ProjectionMatrixInfo
            // In matrices generated with D3DXMatrixPerspectiveFovRH
            // A = zf/(zn-zf)
            // B = zn*zf/(zn-zf)
            // C = -1
            float A = m.M33;
            float B = m.M43;

            // Rely on INFs to be generated in case of any divisions by zero
            float zNear = B / A;
            float zFar = B / (A + 1);
            // Some matrices may use negative m00 or m11 terms to flip X/Y axises
            float tanHalfFovX = 1 / Math.Abs(m.M11);
            float tanHalfFovY = 1 / Math.Abs(m.M22);

            // SetDepthLinearizationConstants
            const float EPSILON = 1e-6f;
            float inverseZNear = Math.Max(1 / zNear, EPSILON);
            float inverseZFar = Math.Max(1 / zFar, EPSILON);
            m_Data.LinearizeDepthA = inverseZFar - inverseZNear;
            m_Data.LinearizeDepthB = inverseZNear;

            // SetViewportConstants
            m_Data.InverseDepthRangeA = 1f;
            m_Data.InverseDepthRangeB = 0f;

            m_Data.InputViewportTopLeft.X = viewport.OffsetX;
            m_Data.InputViewportTopLeft.Y = viewport.OffsetY;

            // SetProjectionConstants
            m_Data.UVToViewA.X = 2 * tanHalfFovX;
            m_Data.UVToViewA.Y = -2 * tanHalfFovY;
            m_Data.UVToViewB.X = -1 * tanHalfFovX;
            m_Data.UVToViewB.Y = 1 * tanHalfFovY;

            // SetResolutionConstants
            m_Data.InvFullResolution.X = 1.0f / viewport.Width;
            m_Data.InvFullResolution.Y = 1.0f / viewport.Height;
            m_Data.InvQuarterResolution.X = 1.0f / DivUp((int)viewport.Width, 4);
            m_Data.InvQuarterResolution.Y = 1.0f / DivUp((int)viewport.Height, 4);

            // SetNormalData
            m_Data.NormalMatrix = MyRender11.Environment.Matrices.ViewAt0;
            m_Data.NormalDecodeScale = 2;
            m_Data.NormalDecodeBias = -1;

            // SetAORadiusConstants
            float radiusInMeters = Math.Max(Params.Radius, EPSILON);
            float r = radiusInMeters * METERS_TO_VIEW_SPACE_UNITS;
            m_Data.R2 = r * r;
            m_Data.NegInvR2 = -1 / m_Data.R2;

            m_Data.RadiusToScreen = r * 0.5f / tanHalfFovY * viewport.Height;

            float backgroundViewDepth = Math.Max(Params.BackgroundViewDepth, EPSILON);
            if (Params.AdaptToFOV)
            {
                // use larger background view depth for low FOV values (less then 30 degrees)
                float factor = Math.Min(1.0f, MyRender11.Environment.Matrices.FovH / MathHelper.ToRadians(30));
                backgroundViewDepth = MathHelper.Lerp(6000, backgroundViewDepth, factor);
            }
            m_Data.BackgroundAORadiusPixels = m_Data.RadiusToScreen / backgroundViewDepth;

            float foregroundViewDepth = Math.Max(Params.ForegroundViewDepth, EPSILON);
            m_Data.ForegroundAORadiusPixels = m_Data.RadiusToScreen / foregroundViewDepth;

            // SetBlurConstants
            float BaseSharpness = Math.Max(Params.BlurSharpness, 0);
            BaseSharpness /= METERS_TO_VIEW_SPACE_UNITS;

            if (Params.BlurSharpnessFunctionEnable)
            {
                m_Data.BlurViewDepth0 = Math.Max(Params.BlurSharpnessFunctionForegroundViewDepth, 0);
                m_Data.BlurViewDepth1 = Math.Max(Params.BlurSharpnessFunctionBackgroundViewDepth, m_Data.BlurViewDepth0 + EPSILON);
                m_Data.BlurSharpness0 = BaseSharpness * Math.Max(Params.BlurSharpnessFunctionForegroundScale, 0);
                m_Data.BlurSharpness1 = BaseSharpness;
            }
            else
            {
                m_Data.BlurSharpness0 = BaseSharpness;
                m_Data.BlurSharpness1 = BaseSharpness;
                m_Data.BlurViewDepth0 = 0;
                m_Data.BlurViewDepth1 = 1;
            }

            // SetDepthThresholdConstants
            if (Params.DepthThresholdEnable)
            {
                m_Data.ViewDepthThresholdNegInv = -1 / Math.Max(Params.DepthThreshold, EPSILON);
                m_Data.ViewDepthThresholdSharpness = Math.Max(Params.DepthThresholdSharpness, 0);
            }
            else
            {
                m_Data.ViewDepthThresholdNegInv = 0;
                m_Data.ViewDepthThresholdSharpness = 1;
            }

            // SetAOParameters
            m_Data.PowExponent = Math.Min(Math.Max(Params.PowerExponent, 1), 8);
            m_Data.NDotVBias = Math.Min(Math.Max(Params.Bias, 0.0f), 0.5f);

            float aoAmountScaleFactor = 1 / (1 - m_Data.NDotVBias);
            m_Data.SmallScaleAOAmount = Math.Min(Math.Max(Params.SmallScaleAO, 0), 4) * aoAmountScaleFactor * 2;
            m_Data.LargeScaleAOAmount = Math.Min(Math.Max(Params.LargeScaleAO, 0), 4) * aoAmountScaleFactor;

            return m_Data;
        }
Пример #23
0
        public void UpdateScreenSize(MyViewport currentScreenViewport)
        {
            Viewport = currentScreenViewport; 

            PreviousPosition = Vector3D.Zero;
            BoundingFrustum = new BoundingFrustumD(MatrixD.Identity);

            AspectRatio = Viewport.Width / Viewport.Height;
        }
Пример #24
0
        internal static void RenderColoredTextures(List <renderColoredTextureProperties> texturesToRender)
        {
            if (texturesToRender.Count == 0)
            {
                return;
            }

            if (!m_initialized)
            {
                Init();
            }

            const int RENDER_TEXTURE_RESOLUTION = 512;

            RC.SetBlendState(null);
            RC.SetInputLayout(null);

            RC.PixelShader.Set(m_ps);
            RC.AllShaderStages.SetConstantBuffer(MyCommon.FRAME_SLOT, MyCommon.FrameConstants);
            RC.AllShaderStages.SetConstantBuffer(1, m_cb);

            MyBorrowedRwTextureManager rwTexManager   = MyManagers.RwTexturesPool;
            MyFileTextureManager       fileTexManager = MyManagers.FileTextures;

            foreach (var texture in texturesToRender)
            {
                ISrvBindable tex = fileTexManager.GetTexture(texture.TextureName, MyFileTextureEnum.COLOR_METAL, true);
                if (tex == null)
                {
                    continue;
                }

                Vector2  texSize = tex.Size;
                Vector2I renderTargetResolution = new Vector2I(RENDER_TEXTURE_RESOLUTION, RENDER_TEXTURE_RESOLUTION);
                if (texSize.Y > 0)
                {
                    if (texSize.Y < RENDER_TEXTURE_RESOLUTION)
                    {
                        renderTargetResolution.X = (int)texSize.X;
                        renderTargetResolution.Y = (int)texSize.Y;
                    }
                    else
                    {
                        renderTargetResolution.X *= (int)(texSize.X / texSize.Y);
                    }
                }

                MyViewport viewport = new MyViewport(renderTargetResolution.X, renderTargetResolution.Y);

                IBorrowedRtvTexture renderTexture = rwTexManager.BorrowRtv("MySaveExportedTextures.RenderColoredTextures",
                                                                           renderTargetResolution.X, renderTargetResolution.Y, SharpDX.DXGI.Format.R8G8B8A8_UNorm_SRgb, 1, 0);

                RC.SetRtv(renderTexture);

                // Set color
                var     mapping = MyMapping.MapDiscard(m_cb);
                Vector4 color   = new Vector4(texture.ColorMaskHSV, 1);
                mapping.WriteAndPosition(ref color);
                mapping.Unmap();

                // Set texture
                RC.PixelShader.SetSrv(0, tex);

                // Draw
                MyScreenPass.DrawFullscreenQuad(viewport);

                // Save to file
                MyTextureData.ToFile(renderTexture, texture.PathToSave, ImageFileFormat.Png);

                renderTexture.Release();
            }

            texturesToRender.Clear();

            RC.SetRtv(null);
            RC.PixelShader.SetSrvs(0, MyGBuffer.Main);
        }
Пример #25
0
        // -------------------------------------------------------------------------------------

        public MyCamera(float fieldOfView, MyViewport currentScreenViewport)
        {
            FieldOfView = fieldOfView; 
            Zoom = new MyCameraZoomProperties(this);
            UpdateScreenSize(currentScreenViewport);
        }
Пример #26
0
        internal virtual void Cleanup()
        {
            m_RC = null;
            if(Locals != null)
                Locals.Clear();
            Stats.Clear();
            m_joined = false;

            m_currentProfilingBlock_renderableType = -1;
            m_currentProfilingBlock_renderableMaterial = string.Empty;

            m_isImmediate = false;
            ViewProjection = default(Matrix);
            Viewport = default(MyViewport);
            DebugName = string.Empty;
            ProcessingMask = 0;
        }
        internal void Render()
        {
            var foliageComponents = MyFoliageComponents.ActiveComponents;
            if (foliageComponents.Count <= 0)
                return;

            ViewProjection = MyRender11.Environment.ViewProjectionAt0;
            Viewport = new MyViewport(MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y);

            PerFrame();
            Begin();

            var viewFrustum = new BoundingFrustumD(MyRender11.Environment.ViewProjectionD);

            foreach (var foliageComponent in foliageComponents)
            {
                var renderableComponent = foliageComponent.Owner.GetRenderable();
                bool removeDitheringInProgress = renderableComponent.m_objectDithering > 0 && renderableComponent.m_objectDithering < 2;
                if (!removeDitheringInProgress && foliageComponent.Owner.CalculateCameraDistance() < MyRender11.RenderSettings.FoliageDetails.GrassDrawDistance())
                {
                    if (viewFrustum.Contains(foliageComponent.Owner.Aabb) != ContainmentType.Disjoint)
                        foliageComponent.Render(this);
                }
            }

            End();
        }
Пример #28
0
        static void DrawBlurYPS(IRtvBindable dst, MyViewport viewport)
        {
            RC.SetRtv(dst);
            RC.PixelShader.Set(m_blurYPS);
            RC.PixelShader.SetSrv(0, m_fullResAOZTexture);

            MyScreenPass.DrawFullscreenQuad(viewport);
        }
Пример #29
0
        internal void AddForwardPass(int index, ref Matrix offsetedViewProjection, ref MatrixD viewProjection, MyViewport viewport, IDsvBindable dsv, IRtvBindable rtv)
        {
            int frustumMask = AddFrustum(ref viewProjection);

            MyForwardPass pass = MyObjectPoolManager.Allocate<MyForwardPass>();
            pass.DebugName = "EnvironmentProbe";
            pass.ProcessingMask = frustumMask;
            pass.ViewProjection = offsetedViewProjection;
            pass.Viewport = viewport;
            pass.FrustumIndex = index;
            pass.Dsv = dsv;
            pass.Rtv = rtv;

            pass.PerFrame();

            RenderingPasses[Size - 1] = pass;
        }
Пример #30
0
 private static void DebugDraw(ISrvBindable src, IRtvBindable dst, MyViewport viewport)
 {
     RC.PixelShader.Set(m_copyPS);
     RC.SetRtv(dst);
     RC.PixelShader.SetSrv(0, src);
     MyScreenPass.DrawFullscreenQuad(viewport);
 }
Пример #31
0
        // viewport, render target
        internal static void Draw(RenderTargetView rtv, MyViewport viewport)
        {
            if (StackTop().m_internalBatch.Texture != null && StackTop().m_internalBatch.Count > 0)
                StackTop().m_internalBatch.Commit();
            StackTop().m_internalBatch = new MySpritesBatch();

            RC.Context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleStrip;

            RC.SetIL(m_inputLayout);
            //RC.SetupScreenViewport();
            RC.Context.Rasterizer.SetViewport(viewport.OffsetX, viewport.OffsetY, viewport.Width, viewport.Height);

            RC.SetVS(m_vs);
            RC.SetCB(MyCommon.FRAME_SLOT, MyCommon.FrameConstants);
            RC.SetCB(MyCommon.PROJECTION_SLOT, MyCommon.GetObjectCB(64));
            RC.SetPS(m_ps);
            RC.Context.PixelShader.SetSamplers(0, MyRender11.StandardSamplers);

            //RC.BindDepthRT(null, DepthStencilAccess.DepthReadOnly, MyRender11.Backbuffer);
            // to reset state
            RC.BindDepthRT(null, DepthStencilAccess.DepthReadOnly, null);
            RC.Context.OutputMerger.SetRenderTargets(rtv);
            
            RC.SetBS(MyRender11.BlendGui);

            CheckBufferSize(StackTop().m_instances.Count);
            RC.SetVB(0, m_VB.Buffer, m_VB.Stride);

            var mapping = MyMapping.MapDiscard(m_VB.Buffer);
            for (int i = 0; i < StackTop().m_instances.Count; i++)
            {
                mapping.stream.Write(StackTop().m_instances[i]);
            }
            mapping.Unmap();

            mapping = MyMapping.MapDiscard(MyCommon.GetObjectCB(64));
            mapping.stream.Write(new Vector2(viewport.Width, viewport.Height));
            mapping.Unmap();

            foreach (var batch in StackTop().m_batches)
            {
                if(batch.ScissorRectangle.HasValue)
                {
                    RC.SetRS(MyRender11.m_scissorTestRasterizerState);

                    var scissor = batch.ScissorRectangle.Value;
                    RC.Context.Rasterizer.SetScissorRectangle((int)scissor.X, (int)scissor.Y, (int)(scissor.X + scissor.Width), (int)(scissor.Y + scissor.Height));
                }
                else
                {
                    RC.SetRS(MyRender11.m_nocullRasterizerState);
                }

                RC.BindRawSRV(0, batch.Texture);
                RC.Context.DrawInstanced(4, batch.Count, 0, batch.Start);
            }

            RC.SetBS(null);
            RC.SetRS(null);

            StackTop().m_instances.Clear();
            StackTop().m_batches.Clear();
        }
Пример #32
0
        internal static void Run(IRtvTexture dst, MyGBuffer gbuffer, MyViewport? viewport = null)
        {
            CompilePS();
            
            if (!viewport.HasValue)
            {
                viewport = new MyViewport(0, 0, MyRender11.m_resolution.X, MyRender11.m_resolution.Y);
            }
            var data = InitConstantBuffer(viewport.Value);

            var mapping = MyMapping.MapDiscard(m_dataCB);
            mapping.WriteAndPosition(ref data);
            mapping.Unmap();
            RC.PixelShader.SetConstantBuffer(0, m_dataCB);

            RC.PixelShader.SetSamplers(0, MySamplerStateManager.PointHBAOClamp);
            RC.SetBlendState(null);
            RC.SetDepthStencilState(MyDepthStencilStateManager.IgnoreDepthStencil);
            DrawLinearDepthPS(gbuffer.ResolvedDepthStencil.SrvDepth, m_fullResViewDepthTarget, viewport.Value);

            DrawDeinterleavedDepth(viewport.Value);

            DrawCoarseAO(gbuffer, viewport.Value);

            if (Params.BlurEnable)
            {
                Resolve(true, m_fullResAOZTexture2, viewport.Value);

                DrawBlurXPS(viewport.Value);
                DrawBlurYPS(dst, viewport.Value);
            }
            else Resolve(false, dst, viewport.Value);

            RC.SetRtv(null);
        }
Пример #33
0
        /// <param name="clearColor">Color used to clear render targets. Defaults to black</param>
        internal static void Run(IRtvBindable renderTarget, IRtvTexture intermediate, ISrvBindable initialResourceView,
            int maxOffset = 5, MyBlurDensityFunctionType densityFunctionType = MyBlurDensityFunctionType.Gaussian, float WeightParameter = 1.5f,
            IDepthStencilState depthStencilState = null, int stencilRef = 0x0, Color4 clearColor = default(Color4),
            float depthDiscardThreshold = 0.0f, MyViewport? viewport = null)
        {
            ProfilerShort.Begin("MyBlur.Run");
            MyGpuProfiler.IC_BeginBlock("MyBlur.Run");
            Debug.Assert(initialResourceView != null);
            Debug.Assert(intermediate != null);
            Debug.Assert(renderTarget != null);

            int shaderKey = InitShaders(densityFunctionType, maxOffset, depthDiscardThreshold);

            RC.PixelShader.SetConstantBuffer(5, m_blurConstantBuffer);

            BlurConstants constants = new BlurConstants
            {
                DistributionWeight = WeightParameter,
                StencilRef = stencilRef,
            };
            var mapping = MyMapping.MapDiscard(m_blurConstantBuffer);
            mapping.WriteAndPosition(ref constants);
            mapping.Unmap();

            // Horizontal pass
            // NOTE: DepthStencilState is not used here because the resulted target
            // would not be usable to perform vertical pass. DepthStencil is stil
            // bindinded as SRV since it is sampled in the shader 
            RC.ClearRtv(intermediate, clearColor);
            RC.SetRtv(intermediate);
            RC.PixelShader.SetSrv(0, MyGBuffer.Main.DepthStencil.SrvDepth);
            RC.PixelShader.SetSrv(4, MyGBuffer.Main.DepthStencil.SrvStencil);
            RC.SetDepthStencilState(MyDepthStencilStateManager.IgnoreDepthStencil);
            RC.PixelShader.SetSrv(5, initialResourceView);
            RC.PixelShader.Set(m_blurShaders[shaderKey].Item1);
            MyScreenPass.DrawFullscreenQuad(viewport);
            RC.PixelShader.SetSrv(5, null);

            // Vertical pass
            RC.ClearRtv(renderTarget, clearColor);
            if (depthStencilState == null)
            {
                RC.SetRtv(renderTarget);
            }
            else
            {
                RC.SetDepthStencilState(depthStencilState, stencilRef);
                RC.SetRtv(MyGBuffer.Main.DepthStencil, MyDepthStencilAccess.ReadOnly, renderTarget);
            }

            RC.PixelShader.SetSrv(5, intermediate);
            RC.PixelShader.Set(m_blurShaders[shaderKey].Item2);
            MyScreenPass.DrawFullscreenQuad(viewport);

            RC.PixelShader.SetSrv(0, null);
            RC.PixelShader.SetSrv(4, null);
            RC.PixelShader.SetSrv(5, null);
            RC.SetRtv(null);

            MyGpuProfiler.IC_EndBlock();
            ProfilerShort.End();
        }
Пример #34
0
        public static void UpdateScreenSize(int width, int height, MyViewport viewport)
        {
            ProfilerShort.Begin("MySandboxGame::UpdateScreenSize");

            ScreenSize = new Vector2I(width, height);
            ScreenSizeHalf = new Vector2I(ScreenSize.X / 2, ScreenSize.Y / 2);
            ScreenViewport = viewport;

            MyGuiManager.UpdateScreenSize(MySandboxGame.ScreenSize, MySandboxGame.ScreenSizeHalf, MyVideoSettingsManager.IsTripleHead());
            MyScreenManager.RecreateControls();

            if (MySector.MainCamera != null)
            {
                MySector.MainCamera.UpdateScreenSize();
            }
            ProfilerShort.End();
        }
Пример #35
0
 private static void DrawSprites(IRtvBindable texture, MyViewport viewPort)
 {
     GetRenderProfiler().StartProfilingBlock("MySpritesRenderer.Draw");
     MyStatsUpdater.Timestamps.Update(ref MyStatsUpdater.Timestamps.PreDrawSprites_Draw);
     MyGpuProfiler.IC_BeginBlock("SpriteRenderer");
     MySpritesRenderer.Draw(texture, viewPort);
     MyGpuProfiler.IC_EndBlock();
     MyStatsUpdater.Timestamps.Update(ref MyStatsUpdater.Timestamps.PostDrawSprites_Draw);
     GetRenderProfiler().EndProfilingBlock();
 }
        internal static void RenderColoredTextures(List<renderColoredTextureProperties> texturesToRender)
        {
            if (texturesToRender.Count == 0)
                return;

            if (!m_initialized)
                Init();

            const int RENDER_TEXTURE_RESOLUTION = 512;

            RC.SetBlendState(null);
            RC.SetInputLayout(null);

            RC.PixelShader.Set(m_ps);
            RC.AllShaderStages.SetConstantBuffer(MyCommon.FRAME_SLOT, MyCommon.FrameConstants);
            RC.AllShaderStages.SetConstantBuffer(1, m_cb);

            MyBorrowedRwTextureManager rwTexManager = MyManagers.RwTexturesPool;
            MyFileTextureManager fileTexManager = MyManagers.FileTextures;
            foreach (var texture in texturesToRender)
            {
                ISrvBindable tex = fileTexManager.GetTexture(texture.TextureName, MyFileTextureEnum.COLOR_METAL, true);
                if (tex == null)
                    continue;

                Vector2 texSize = tex.Size;
                Vector2I renderTargetResolution = new Vector2I(RENDER_TEXTURE_RESOLUTION, RENDER_TEXTURE_RESOLUTION);
                if (texSize.Y > 0)
                {
                    if (texSize.Y < RENDER_TEXTURE_RESOLUTION)
                    {
                        renderTargetResolution.X = (int)texSize.X;
                        renderTargetResolution.Y = (int)texSize.Y;
                    }
                    else
                    {
                        renderTargetResolution.X *= (int)(texSize.X / texSize.Y);
                    }
                }

                MyViewport viewport = new MyViewport(renderTargetResolution.X, renderTargetResolution.Y);

                IBorrowedRtvTexture renderTexture = rwTexManager.BorrowRtv("MySaveExportedTextures.RenderColoredTextures",
                        renderTargetResolution.X, renderTargetResolution.Y, SharpDX.DXGI.Format.R8G8B8A8_UNorm_SRgb, 1, 0);

                RC.SetRtv(renderTexture);

                // Set color
                var mapping = MyMapping.MapDiscard(m_cb);
                Vector4 color = new Vector4(texture.ColorMaskHSV, 1);
                mapping.WriteAndPosition(ref color);
                mapping.Unmap();

                // Set texture
                RC.PixelShader.SetSrv(0, tex);

                // Draw
                MyScreenPass.DrawFullscreenQuad(viewport);

                // Save to file
                MyTextureData.ToFile(renderTexture, texture.PathToSave, ImageFileFormat.Png);
                
                renderTexture.Release();
            }

            texturesToRender.Clear();

            RC.SetRtv(null);
            RC.PixelShader.SetSrvs(0, MyGBuffer.Main);
        }
Пример #37
0
 static void DrawLinearDepthPS(ISrvBindable resolvedDepth, IRtvBindable rtv, MyViewport viewport)
 {
     RC.PixelShader.Set(m_linearizeDepthPS);
     //RC.SetRtv(m_fullResViewDepthTarget);
     RC.SetRtv(rtv);
     RC.PixelShader.SetSrv(0, resolvedDepth);
     MyScreenPass.DrawFullscreenQuad(viewport);
     RC.SetRtv(null);
 }
Пример #38
0
 static MyViewport GetQuarterViewport(MyViewport viewport)
 {
     MyViewport qViewport;
     qViewport.OffsetX = 0;
     qViewport.OffsetY = 0;
     qViewport.Width = DivUp((int)viewport.Width, 4);
     qViewport.Height = DivUp((int)viewport.Height, 4);
     return qViewport;
 }
Пример #39
0
        static void DrawDeinterleavedDepth(MyViewport viewport)
        {
            var qViewport = GetQuarterViewport(viewport);
            RC.PixelShader.Set(m_deinterleaveDepthPS);
            RC.PixelShader.SetSrv(0, m_fullResViewDepthTarget);

            var rtvs = new IRtvBindable[MAX_NUM_MRTS];
            for (int sliceIndex = 0; sliceIndex < NUM_SLICES; sliceIndex += MAX_NUM_MRTS)
            {
                for (int i = 0; i < MAX_NUM_MRTS; i++)
                    rtvs[i] = m_quarterResViewDepthTextureArray.SubresourceRtv(sliceIndex + i);
                RC.SetRtvs(rtvs);
                RC.PixelShader.SetConstantBuffer(1, m_perPassCBs[sliceIndex]);

                MyScreenPass.DrawFullscreenQuad(qViewport);
            }
        }
Пример #40
0
        protected virtual IMyRenderWindow InitializeRenderThread()
        {
            Debug.Assert(MyPerGameSettings.GameIcon != null, "Set the game icon file in executable project.");

            DrawThread = Thread.CurrentThread;
#if XB1
            var form = new XB1Interface.XB1GameWindow();
#else
            var form = new MySandboxForm();
            WindowHandle = form.Handle;
#endif
            m_bufferedInputSource = form;
            m_windowCreatedEvent.Set();
#if !XB1
            form.Text = MyPerGameSettings.GameName;
            try
            {
                form.Icon = new System.Drawing.Icon(Path.Combine(MyFileSystem.ExePath, MyPerGameSettings.GameIcon));
            }
            catch (System.IO.FileNotFoundException)
            {
                form.Icon = null;
            }
#endif // !XB1
            form.FormClosed += (o, e) => ExitThreadSafe();
#if !XB1
            Action showCursor = () =>
                {
                    if (!form.IsDisposed)
                        form.ShowCursor = true;
                };
            Action hideCursor = () =>
                {
                    if (!form.IsDisposed)
                        form.ShowCursor = false;
                };
            m_setMouseVisible = (b) =>
                {
                    // In case of crash, this may be null, don't want subsequent crash
                    var component = GameRenderComponent;
                    if (component != null)
                    {
                        var renderThread = component.RenderThread;
                        if (renderThread != null)
                        {
                            renderThread.Invoke(b ? showCursor : hideCursor);
                        }
                    }
                };

            if (MySandboxGame.Config.SyncRendering)
            {
                VRageRender.MyViewport vp = new MyViewport(0, 0, (float)MySandboxGame.Config.ScreenWidth, (float)MySandboxGame.Config.ScreenHeight);
                RenderThread_SizeChanged((int)vp.Width, (int)vp.Height, vp);
            }
#endif // !XB1
            return form;
        }
Пример #41
0
 public MyCamera(float fieldOfView, MyViewport currentScreenViewport)
 {
     FieldOfView = fieldOfView; // MySandboxGame.Config.FieldOfView; // no dependency on sandbox!
     Zoom        = new MyCameraZoomProperties(this);
     UpdateScreenSize(currentScreenViewport);
 }