|
Cogs.Core
|
Public Member Functions | |
| ViewContext (Context *ctx, WindowData *windowData) | |
| Constructs a new ViewContext instance. | |
| bool | initialize (const Cogs::Core::EntityPtr &renderCamera) |
| Initialises the standard components in this ViewContext instance. | |
| void | update () |
| Updates the components in this view. Called once per frame from the owning Context's update call. | |
| void | preRender () |
| Called by the owning Context during its preRender call. | |
| void | setCamera (const Cogs::Core::EntityPtr &renderCamera) |
| Sets or updates the camera of this ViewContext instance. | |
| void | setSize (int newWidth, int newHeight) |
| Resizes this view. | |
| void | setDPI (int newDPI, float scaleFactor) |
| constexpr Context * | getContext () const |
| constexpr ISwapChain * | getSwapChain () const |
| glm::vec2 | getSize () const |
| Cogs::Core::EntityPtr | getCamera () const |
| Gets view camera. The camera must be valid when rendering a frame in the view. | |
| CameraComponent * | getCameraComponent () const |
| Utility to get the CameraComponent from. | |
| void | addResizeCallback (ResizeCallback *callback) |
| void | removeResizeCallback (ResizeCallback *callback) |
Public Member Functions inherited from Cogs::PlatformContext | |
| void | setWindowData (WindowData *data) |
| WindowData * | refWindowData () |
| Keyboard & | refKeyboard () |
| Mouse & | refMouse () |
| Gestures & | refGestures () |
| const Keyboard & | getKeyboard () const |
| const Mouse & | getMouse () const |
| const Gestures & | getGestures () const |
Public Attributes | |
| std::unique_ptr< class DPIService > | dpiService |
| DPI service instance. | |
| std::unique_ptr< Platform::GamepadHandler > | gamepadHandler |
| Gamepad input handler. | |
| std::unique_ptr< class InputManager > | inputManager |
Private Attributes | |
| std::vector< ResizeCallback * > | resizeCallbacks |
| List of callbacks to be called when this view is resized. | |
| Cogs::Core::WeakEntityPtr | camera |
| The entity that's rendering this view. (Needs a CameraComponent at the bare minimum, and a TransformComponent for some things.) | |
| Context * | context = nullptr |
| Context that owns this view. | |
| ISwapChain * | swapChain = nullptr |
| The swap chain that will be used for display. | |
| TextureHandle | texture |
| Cogs.Core texture that represents the swapchain's buffers. | |
Definition at line 23 of file ViewContext.h.
| Cogs::Core::ViewContext::ViewContext | ( | Context * | ctx, |
| WindowData * | windowData | ||
| ) |
Constructs a new ViewContext instance.
This constructor overload will be called by Context::createView when creating a new window/view.
Definition at line 26 of file ViewContext.cpp.
|
override |
Definition at line 34 of file ViewContext.cpp.
| void Cogs::Core::ViewContext::addResizeCallback | ( | ResizeCallback * | callback | ) |
Definition at line 188 of file ViewContext.cpp.
| Cogs::Core::EntityPtr Cogs::Core::ViewContext::getCamera | ( | ) | const |
Gets view camera. The camera must be valid when rendering a frame in the view.
Definition at line 178 of file ViewContext.cpp.
| Cogs::Core::CameraComponent * Cogs::Core::ViewContext::getCameraComponent | ( | ) | const |
Utility to get the CameraComponent from.
Definition at line 183 of file ViewContext.cpp.
References Cogs::ComponentModel::Component::getComponent().
|
inlineconstexpr |
Definition at line 57 of file ViewContext.h.
| glm::vec2 Cogs::Core::ViewContext::getSize | ( | ) | const |
Definition at line 165 of file ViewContext.cpp.
|
inlineconstexpr |
Definition at line 58 of file ViewContext.h.
| bool Cogs::Core::ViewContext::initialize | ( | const Cogs::Core::EntityPtr & | renderCamera | ) |
Initialises the standard components in this ViewContext instance.
For tertiary views, this needs to be called just after the construction. For a Context's default view this will be called during the initialisation of that context, after the device and main window have been created.
| renderCamera | - Optional camera. Camera required, but can be set later using setCamera |
Definition at line 62 of file ViewContext.cpp.
References Cogs::TextureFlags::ExternalTexture, Cogs::TextureFlags::RenderTarget, and Cogs::TextureFlags::Texture.
| void Cogs::Core::ViewContext::preRender | ( | ) |
Called by the owning Context during its preRender call.
Definition at line 107 of file ViewContext.cpp.
| void Cogs::Core::ViewContext::removeResizeCallback | ( | ResizeCallback * | callback | ) |
Definition at line 196 of file ViewContext.cpp.
| void Cogs::Core::ViewContext::setCamera | ( | const Cogs::Core::EntityPtr & | renderCamera | ) |
Sets or updates the camera of this ViewContext instance.
Clearing the Scene or deleting the Camera entity requires replacing the ViewContext camere.
| renderCamera | - New Camera - must be valid. |
Definition at line 114 of file ViewContext.cpp.
References Cogs::ComponentModel::Component::getComponent(), Cogs::Core::CameraComponent::renderTexture, and Cogs::ComponentModel::Component::setChanged().
Referenced by Cogs::Core::Scene::setup().
| void Cogs::Core::ViewContext::setDPI | ( | int | newDPI, |
| float | scaleFactor | ||
| ) |
Definition at line 159 of file ViewContext.cpp.
| void Cogs::Core::ViewContext::setSize | ( | int | newWidth, |
| int | newHeight | ||
| ) |
Resizes this view.
Definition at line 128 of file ViewContext.cpp.
References Cogs::ComponentModel::Component::setChanged(), and Cogs::Core::CameraComponent::viewportSize.
| void Cogs::Core::ViewContext::update | ( | ) |
Updates the components in this view. Called once per frame from the owning Context's update call.
Definition at line 101 of file ViewContext.cpp.
|
private |
The entity that's rendering this view. (Needs a CameraComponent at the bare minimum, and a TransformComponent for some things.)
Definition at line 85 of file ViewContext.h.
|
private |
Context that owns this view.
Definition at line 88 of file ViewContext.h.
| std::unique_ptr<class DPIService> Cogs::Core::ViewContext::dpiService |
DPI service instance.
Definition at line 71 of file ViewContext.h.
Referenced by Cogs::Core::MarkerPointSetPicker::pickCamera(), and Cogs::Core::PotreeSystem::update().
| std::unique_ptr<Platform::GamepadHandler> Cogs::Core::ViewContext::gamepadHandler |
Gamepad input handler.
Definition at line 74 of file ViewContext.h.
| std::unique_ptr<class InputManager> Cogs::Core::ViewContext::inputManager |
Generic input handler Inputs is directed to the view the user interacts in.
Definition at line 78 of file ViewContext.h.
|
private |
List of callbacks to be called when this view is resized.
Definition at line 82 of file ViewContext.h.
|
private |
The swap chain that will be used for display.
Definition at line 91 of file ViewContext.h.
|
private |
Cogs.Core texture that represents the swapchain's buffers.
Definition at line 94 of file ViewContext.h.