#include <renderwindow.h>
Public Types | |
enum | EPresentationMode : int { Immediate, Mailbox, FIFO_Relaxed, FIFO } |
![]() | |
using | EventPtrList = std::vector< EventPtr > |
using | EventPtrConstIterator = utility::UniquePtrConstVectorWrapper< WindowEventPtrList, Event * > |
Public Member Functions | |
RenderWindow (Core &core) | |
virtual | ~RenderWindow () override |
virtual bool | init (utility::ErrorState &errorState) override |
virtual void | onDestroy () override |
const glm::ivec2 | getSize () const |
int | getWidth () const |
int | getWidthPixels () const |
int | getHeight () const |
int | getHeightPixels () const |
const glm::ivec2 | getBufferSize () const override |
void | show () |
void | hide () |
const std::string & | getTitle () const |
void | setTitle (std::string newTitle) |
bool | isResizable () const |
void | setFullscreen (bool value) |
void | toggleFullscreen () |
void | setWidth (int width) |
void | setHeight (int height) |
void | setSize (const glm::ivec2 &size) |
virtual void | setClearColor (const RGBAColorFloat &color) override |
virtual const RGBAColorFloat & | getClearColor () const override |
void | setPosition (const glm::ivec2 &position) |
const glm::ivec2 | getPosition () const |
SDL_Window * | getNativeWindow () const |
virtual uint | getNumber () const override |
math::Rect | getRect () const |
math::Rect | getRectPixels () const |
virtual void | beginRendering () override |
virtual void | endRendering () override |
virtual VkFormat | getColorFormat () const override |
virtual VkFormat | getDepthFormat () const override |
virtual VkSampleCountFlagBits | getSampleCount () const override |
virtual bool | getSampleShadingEnabled () const override |
virtual ECullWindingOrder | getWindingOrder () const override |
virtual VkRenderPass | getRenderPass () const override |
![]() | |
void | addEvent (WindowEventPtr inEvent) |
void | processEvents () |
EventPtrConstIterator | getEvents () const |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Public Attributes | |
bool | mSampleShading = true |
Property: 'SampleShading' Reduces texture aliasing when enabled, at higher computational cost. More... | |
int | mWidth = 512 |
Property: 'Width' window horizontal resolution. More... | |
int | mHeight = 512 |
Property: 'Height' window vertical resolution. More... | |
bool | mBorderless = false |
Property: 'Borderless' if the window has any borders. More... | |
bool | mResizable = true |
Property: 'Resizable' if the window is resizable. More... | |
bool | mVisible = true |
Property: 'Visible' if the render window is visible on screen. More... | |
EPresentationMode | mMode = EPresentationMode::Immediate |
Property: 'Mode' the image presentation mode to use. More... | |
std::string | mTitle = "" |
Property: 'Title' window title. More... | |
RGBAColorFloat | mClearColor = { 0.0f, 0.0f, 0.0f, 1.0f } |
Property: 'ClearColor' background clear color. More... | |
ERasterizationSamples | mRequestedSamples = ERasterizationSamples::Four |
Property: 'Samples' The number of samples used during Rasterization. For even better results enable 'SampleShading'. More... | |
int | mAddedSwapImages = 1 |
Property: 'AdditionalSwapImages' number of additional swapchain images to create, added to minimum specified by hardware. More... | |
bool | mRestorePosition = true |
Property: 'RestorePosition' if window position is restored from previous session. More... | |
bool | mRestoreSize = true |
Property: 'RestoreSize' if window size is restored from previous session More... | |
![]() | |
Signal< const WindowEvent & > | mWindowEvent |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Vulkan render window that can be declared in JSON.
Multiple presentation (display) modes are available to choose from. The selected presentation mode controls how the rendered images are presented to screen: in sync, out of sync or tied to the refresh rate of the monitor. It is however possible that the selected presentation mode is not supported by the graphics hardware, if that's the case the window will revert to FIFO_KRH, which is the presentation mode every vulkan compatible device must support. A warning is issued if the selected presentation mode is unavailable.
In order to improve performance, consider lowering the sample count and disable sample based shading. If sample based shading is requested but not supported, it is disabled and a warning is issued. If the requested multi-sample count exceeds what is supported by the hardware, the highest available sample count is picked and a warning is issued.
Initialization will fail when the nap::RenderService is configured to run headless. When headless rendering is enabled, the engine is initialized without surface and swapchain support, which are required by a nap::RenderWindow to display images on screen.
|
strong |
The various image presentation modes. Controls the way in which images are presented to screen.
RenderWindow | ( | Core & | core | ) |
This constructor is called when creating the render window using the resource manager Every render window needs to be aware of it's render service
|
overridevirtual |
Destroys all render resources
|
overridevirtual |
Starts a render pass. Only call this when recording is enabled.
Implements IRenderTarget.
|
overridevirtual |
Ends a render pass. Always call this after beginRendering().
Implements IRenderTarget.
|
overridevirtual |
Returns the width and height of this window in pixels.
Implements IRenderTarget.
|
overridevirtual |
|
overridevirtual |
Implements IRenderTarget.
|
overridevirtual |
Implements IRenderTarget.
int getHeight | ( | ) | const |
Returns the height of the window, in screen coordinates. Note that on high DPI monitors this is not the same as the pixel count. To get the height in pixels use the size of the backbuffer using getHeightPixels().
int getHeightPixels | ( | ) | const |
Returns the height of this window in pixels.
SDL_Window* getNativeWindow | ( | ) | const |
|
overridevirtual |
Implements Window.
const glm::ivec2 getPosition | ( | ) | const |
math::Rect getRect | ( | ) | const |
Creates a rectangle based on the current width and height of the render window. Note that the returned dimensions of the rectangle can differ from the actual size in pixels on a high dpi monitor. To obtain a rectangle that contains the actual size of the window in pixels use: getRectPixels
math::Rect getRectPixels | ( | ) | const |
Creates a rectangle based on the current width and height of the render window in pixels.
|
overridevirtual |
Implements IRenderTarget.
|
overridevirtual |
Implements IRenderTarget.
|
overridevirtual |
Implements IRenderTarget.
const glm::ivec2 getSize | ( | ) | const |
Returns the width and height of this window, in screen coordinates. Note that on high DPI monitors this is not the same as the pixel count. To get the width and height in pixels use getBufferSize().
const std::string& getTitle | ( | ) | const |
int getWidth | ( | ) | const |
Returns the width of the window, in screen coordinates. Note that on high DPI monitors this is not the same as the pixel count. To get the width in pixels use the size of the backbuffer using getWidthPixels().
int getWidthPixels | ( | ) | const |
Returns the width of this window in pixels.
|
overridevirtual |
Implements IRenderTarget.
void hide | ( | ) |
Hides the window
|
overridevirtual |
Creates window, connects to resize event.
Reimplemented from Object.
bool isResizable | ( | ) | const |
|
overridevirtual |
Called when the window is detroyed.
Reimplemented from Object.
|
overridevirtual |
void setFullscreen | ( | bool | value | ) |
Turns full screen on / off This is the windowed full screen mode, game is not supported
value | if the window is set to fill the screen or not |
void setHeight | ( | int | height | ) |
Sets the height of the window, in screen coordinates.
height | the new window height, in screen coordinates. |
void setPosition | ( | const glm::ivec2 & | position | ) |
Sets the position of the window on screen
position | the new screen position in pixel coordinates |
void setSize | ( | const glm::ivec2 & | size | ) |
Set the size of the window, in screen coordinates.
size | the new window size, in screen coordinates. |
void setTitle | ( | std::string | newTitle | ) |
Sets the window title
void setWidth | ( | int | width | ) |
Sets the width of the window, in screen coordinates.
width | the new width of the window, in screen coordinates. |
void show | ( | ) |
Shows the window and gives it input focus. This call also makes sure the window is on top of other windows.
void toggleFullscreen | ( | ) |
Toggles full screen on / off
int mAddedSwapImages = 1 |
Property: 'AdditionalSwapImages' number of additional swapchain images to create, added to minimum specified by hardware.
bool mBorderless = false |
Property: 'Borderless' if the window has any borders.
RGBAColorFloat mClearColor = { 0.0f, 0.0f, 0.0f, 1.0f } |
Property: 'ClearColor' background clear color.
int mHeight = 512 |
Property: 'Height' window vertical resolution.
Property: 'Mode' the image presentation mode to use.
ERasterizationSamples mRequestedSamples = ERasterizationSamples::Four |
Property: 'Samples' The number of samples used during Rasterization. For even better results enable 'SampleShading'.
bool mResizable = true |
Property: 'Resizable' if the window is resizable.
bool mRestorePosition = true |
Property: 'RestorePosition' if window position is restored from previous session.
bool mRestoreSize = true |
Property: 'RestoreSize' if window size is restored from previous session
bool mSampleShading = true |
Property: 'SampleShading' Reduces texture aliasing when enabled, at higher computational cost.
std::string mTitle = "" |
Property: 'Title' window title.
bool mVisible = true |
Property: 'Visible' if the render window is visible on screen.
int mWidth = 512 |
Property: 'Width' window horizontal resolution.