Ejemplo n.º 1
0
 public Rect(Int2 _From, Int2 _To)
 {
     From = _From;
     To = _To;
 }
Ejemplo n.º 2
0
 public RenderTarget(Int2 _Size)
 {
     rendertarget = new RenderTarget2D(Graphics.device, _Size.X, _Size.Y, 0, SurfaceFormat.Color);
 }
Ejemplo n.º 3
0
 public TextureGPU(Int2 _Size)
 {
     size = _Size;
     texture = new Texture2D(Graphics.device, size.X, size.Y, Graphics.ImageMipLevelDepth, TextureUsage.None, SurfaceFormat.Rgba32);
 }
Ejemplo n.º 4
0
 internal TextureGPU(Texture2D _Source)
 {
     texture = _Source;
     size = new Int2(texture.Width, texture.Height);
 }
Ejemplo n.º 5
0
 public TextureGPU(string _FileName)
 {
     texture = Texture2D.FromFile(Graphics.device, _FileName);
     size = new Int2(texture.Width, texture.Height);
 }
Ejemplo n.º 6
0
 public RenderTarget(Int2 _Size, SurfaceFormat _Format)
 {
     rendertarget = new RenderTarget2D(Graphics.device, _Size.X, _Size.Y, 0, (Microsoft.Xna.Framework.Graphics.SurfaceFormat)_Format);
 }
Ejemplo n.º 7
0
        public static void Present(IntPtr _WindowHandle, Float2 _SourceRectFrom, Float2 _SourceRectTo, Int2 _TargetRectFrom, Int2 _TargetRectTo)
        {
            float w = device.PresentationParameters.BackBufferWidth;
            float h = device.PresentationParameters.BackBufferHeight;
            _SourceRectTo.X *= w;
            _SourceRectTo.Y *= h;
            _SourceRectFrom.X *= w;
            _SourceRectFrom.Y *= h;

            _SourceRectTo -= _SourceRectFrom;
            _TargetRectTo -= _TargetRectFrom;
            device.Present(
                new Rectangle((int)_SourceRectFrom.X, (int)_SourceRectFrom.Y, (int)_SourceRectTo.X, (int)_SourceRectTo.Y),
                new Rectangle(_TargetRectFrom.X, _TargetRectFrom.Y, _TargetRectTo.X, _TargetRectTo.Y),

                _WindowHandle);
        }
Ejemplo n.º 8
0
        public static void Initialize(IntPtr _WindowHandle, Int2 _Resolution)
        {
            foreach (GraphicsAdapter adapter in GraphicsAdapter.Adapters)
            {
                Log.Write("Graphics", "Adapter found :", adapter.Description);
            }

            var parameter = new PresentationParameters();
            parameter.BackBufferWidth = _Resolution.X;
            parameter.BackBufferHeight = _Resolution.Y;
            parameter.DeviceWindowHandle = _WindowHandle;

            device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, DeviceType.Hardware, _WindowHandle, parameter);

            //load default stuff
            defaultshader = ShaderCompiler.Compile(System.IO.File.ReadAllText("Default.fx"));
        }
Ejemplo n.º 9
0
 public static void SetScissorRect(Int2 _From, Int2 _To)
 {
     device.ScissorRectangle = new Rectangle(_From.X, _From.Y, _To.X, _To.Y);
 }