diff --git a/includes/xna/content/readers/graphics.hpp b/includes/xna/content/readers/graphics.hpp index 2254ca0..188d28c 100644 --- a/includes/xna/content/readers/graphics.hpp +++ b/includes/xna/content/readers/graphics.hpp @@ -8,6 +8,7 @@ #include "../../graphics/texture.hpp" #include "../manager.hpp" #include "../reader.hpp" +#include "../../graphics/shared.hpp" namespace xna { class Texture2DReader : public ContentTypeReaderT { diff --git a/includes/xna/enumerations.hpp b/includes/xna/enumerations.hpp index 139d511..7d7d481 100644 --- a/includes/xna/enumerations.hpp +++ b/includes/xna/enumerations.hpp @@ -60,14 +60,7 @@ namespace xna { None, CullClockwiseFace, CullCounterClockwiseFace, - }; - - enum class DepthFormat { - None, - Depth16, - Depth24, - Depth24Stencil8 - }; + }; enum class DepthWriteMask { Zero, @@ -128,19 +121,7 @@ namespace xna { Two, Three, Four, - }; - - //Defines flags that describe the relationship between the adapter refresh rate and the rate at which Present operations are completed. - enum class PresentInterval { - //Equivalent to setting One. - Default, - //The driver waits for the vertical retrace period (the runtime will beam trace to prevent tearing). Present operations are not affected more frequently than the screen refresh rate; the runtime completes one Present operation per adapter refresh period, at most. This option is always available for both windowed and full-screen swap chains. - One, - //The driver waits for the vertical retrace period. Present operations are not affected more frequently than every second screen refresh. - Two, - //The runtime updates the window client area immediately, and might do so more than once during the adapter refresh period. Present operations might be affected immediately. This option is always available for both windowed and full-screen swap chains. - Immediate - }; + }; enum class PrimitiveType { @@ -170,38 +151,7 @@ namespace xna { Texture, BackToFront, FrontToBack, - }; - - enum class SurfaceFormat { - Color = 0, - Bgr565 = 1, - Bgra5551 = 2, - Bgra4444 = 3, - Dxt1 = 4, - Dxt3 = 5, - Dxt5 = 6, - NormalizedByte2 = 7, - NormalizedByte4 = 8, - Rgba1010102 = 9, - Rg32 = 10, - Rgba64 = 11, - Alpha8 = 12, - Single = 13, - Vector2 = 14, - Vector4 = 15, - HalfSingle = 16, - HalfVector2 = 17, - HalfVector4 = 18, - HdrBlendable = 19, - Unknown, - }; - - enum class SwapEffect { - Discard, - Sequential, - FlipSequential, - FlipDiscard - }; + }; enum class TextureAddressMode { Wrap, diff --git a/includes/xna/game/gdevicemanager.hpp b/includes/xna/game/gdevicemanager.hpp index 4f2b78e..db0dec8 100644 --- a/includes/xna/game/gdevicemanager.hpp +++ b/includes/xna/game/gdevicemanager.hpp @@ -3,6 +3,7 @@ #include "../csharp/eventhandler.hpp" #include "../default.hpp" +#include "../graphics/shared.hpp" #include "gdeviceinfo.hpp" namespace xna { diff --git a/includes/xna/graphics/displaymode.hpp b/includes/xna/graphics/displaymode.hpp index a5422d9..81ffebc 100644 --- a/includes/xna/graphics/displaymode.hpp +++ b/includes/xna/graphics/displaymode.hpp @@ -3,6 +3,7 @@ #include "../default.hpp" #include "../common/numerics.hpp" +#include "shared.hpp" namespace xna { //Flags indicating the method the raster uses to create an image on a surface diff --git a/includes/xna/graphics/presentparams.hpp b/includes/xna/graphics/presentparams.hpp index 982d9d3..2e287c6 100644 --- a/includes/xna/graphics/presentparams.hpp +++ b/includes/xna/graphics/presentparams.hpp @@ -1,28 +1,55 @@ #ifndef XNA_GRAPHICS_PRESENTPARAMS_HPP #define XNA_GRAPHICS_PRESENTPARAMS_HPP -#include "../default.hpp" +#include "shared.hpp" +#include namespace xna { + //Defines flags that describe the relationship between the adapter refresh rate and the rate at which Present operations are completed. + enum class PresentInterval { + //Equivalent to setting One. + Default, + //The driver waits for the vertical retrace period (the runtime will beam trace to prevent tearing). + //Present operations are not affected more frequently than the screen refresh rate; + //the runtime completes one Present operation per adapter refresh period, at most. + //This option is always available for both windowed and full-screen swap chains. + One, + //The driver waits for the vertical retrace period. + //Present operations are not affected more frequently than every second screen refresh. + Two, + //The runtime updates the window client area immediately, and might do so more than once during the adapter refresh period. + //Present operations might be affected immediately. + //This option is always available for both windowed and full-screen swap chains. + Immediate + }; + + enum class SwapEffect { + Discard, + Sequential, + FlipSequential, + FlipDiscard + }; + //Contains presentation parameters. struct PresentationParameters { //Gets or sets a value indicating the width of the new swap chain's back buffer. - Int BackBufferWidth{ 0 }; + int32_t BackBufferWidth{ 0 }; //Gets or sets a value indicating the height of the new swap chain's back buffer. - Int BackBufferHeight{ 0 }; + int32_t BackBufferHeight{ 0 }; //Gets or sets the format of the back buffer. - SurfaceFormat BackBufferFormat{ SurfaceFormat::Color }; - SwapEffect PresentationSwapEffect{ SwapEffect::FlipDiscard }; + SurfaceFormat BackBufferFormat{ SurfaceFormat::Color }; //Gets or sets the handle to the device window. intptr_t DeviceWindowHandle{ 0 }; //Gets or sets a value indicating whether the application is in full screen mode. bool IsFullscreen{ false }; //Gets or sets a value indicating the number of sample locations during multisampling. - Int MultiSampleCount{ 0 }; + int32_t MultiSampleCount{ 0 }; //Gets or sets the maximum rate at which the swap chain's back buffers can be presented to the front buffer. PresentInterval PresentationInterval{ PresentInterval::Default }; //Gets or sets the depth stencil data format. DepthFormat DepthStencilFormat{ DepthFormat::None }; + + SwapEffect PresentationSwapEffect{ SwapEffect::FlipDiscard }; }; } diff --git a/includes/xna/graphics/shared.hpp b/includes/xna/graphics/shared.hpp index 075e76f..b77691f 100644 --- a/includes/xna/graphics/shared.hpp +++ b/includes/xna/graphics/shared.hpp @@ -2,18 +2,92 @@ #define XNA_GRAPHICS_SHARED_HPP namespace xna { + //Defines comparison functions that can be chosen for alpha, stencil, or depth-buffer tests. enum class ComparisonFunction { + //Always fail the test. Never, + //Accept the new pixel if its value is less than the value of the current pixel. Less, + //Accept the new pixel if its value is equal to the value of the current pixel. Equal, + //Accept the new pixel if its value is less than or equal to the value of the current pixel. LessEquals, + //Accept the new pixel if its value is greater than the value of the current pixel. Greater, + //Accept the new pixel if its value does not equal the value of the current pixel. NotEqual, + //Accept the new pixel if its value is greater than or equal to the value of the current pixel. GreaterEqual, + //Always pass the test. Always }; + //Defines comparison functions that can be chosen for alpha, stencil, or depth-buffer tests. using CompareFunction = ComparisonFunction; + + //Defines various types of surface formats. + enum class SurfaceFormat { + //(Unsigned format) 32-bit ARGB pixel format with alpha, using 8 bits per channel. + Color = 0, + //(Unsigned format) 16-bit BGR pixel format with 5 bits for blue, 6 bits for green, and 5 bits for red. + Bgr565 = 1, + //(Unsigned format) 16-bit BGRA pixel format where 5 bits are reserved for each color and 1 bit is reserved for alpha. + Bgra5551 = 2, + //(Unsigned format) 16-bit BGRA pixel format with 4 bits for each channel. + Bgra4444 = 3, + //DXT1 compression texture format. + //The runtime will not allow an application to create a surface using a DXTn format unless the surface dimensions are multiples of 4. + //This applies to offscreen-plain surfaces, render targets, 2D textures, cube textures, and volume textures. + Dxt1 = 4, + //DXT3 compression texture format. + //The runtime will not allow an application to create a surface using a DXTn format unless the surface dimensions are multiples of 4. + //This applies to offscreen-plain surfaces, render targets, 2D textures, cube textures, and volume textures. + Dxt3 = 5, + //DXT5 compression texture format. + //The runtime will not allow an application to create a surface using a DXTn format unless the surface dimensions are multiples of 4. + //This applies to offscreen-plain surfaces, render targets, 2D textures, cube textures, and volume textures. + Dxt5 = 6, + //Signed format) 16-bit bump-map format using 8 bits each for u and v data. + NormalizedByte2 = 7, + //Signed format) 32-bit bump-map format using 8 bits for each channel. + NormalizedByte4 = 8, + //(Unsigned format) 32-bit RGBA pixel format using 10 bits for each color and 2 bits for alpha. + Rgba1010102 = 9, + //Unsigned format) 32-bit pixel format using 16 bits each for red and green. + Rg32 = 10, + //(Unsigned format) 64-bit RGBA pixel format using 16 bits for each component. + Rgba64 = 11, + //(Unsigned format) 8-bit alpha only. + Alpha8 = 12, + //(IEEE format) 32-bit float format using 32 bits for the red channel. + Single = 13, + //(IEEE format) 64-bit float format using 32 bits for the red channel and 32 bits for the green channel. + Vector2 = 14, + //(IEEE format) 128-bit float format using 32 bits for each channel (alpha, blue, green, red). + Vector4 = 15, + //(Floating-point format) 16-bit float format using 16 bits for the red channel. + HalfSingle = 16, + //(Floating-point format) 32-bit float format using 16 bits for the red channel and 16 bits for the green channel. + HalfVector2 = 17, + //(Floating-point format) 64-bit float format using 16 bits for each channel (alpha, blue, green, red). + HalfVector4 = 18, + //(Floating-point format) for high dynamic range data. + HdrBlendable = 19, + //Not implemented. + Unknown, + }; + + //Defines the format of data in a depth-stencil buffer. + enum class DepthFormat { + //Do not create a depth buffer. + None, + //A buffer that contains 16-bits of depth data. + Depth16, + //A buffer that contains 24-bits of depth data. + Depth24, + //A 32 bit buffer that contains 24 bits of depth data and 8 bits of stencil data. + Depth24Stencil8 + }; } #endif \ No newline at end of file diff --git a/includes/xna/graphics/texture.hpp b/includes/xna/graphics/texture.hpp index a26059e..7a7dd53 100644 --- a/includes/xna/graphics/texture.hpp +++ b/includes/xna/graphics/texture.hpp @@ -3,6 +3,7 @@ #include "../default.hpp" #include "gresource.hpp" +#include "shared.hpp" namespace xna { //Represents a texture resource.