RAMSES Documentation  27.0.130
Information for RAMSES users and developers
IRendererEventHandler.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // Copyright (C) 2015 BMW Car IT GmbH
3 // -------------------------------------------------------------------------
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 // -------------------------------------------------------------------------
8 
9 #ifndef RAMSES_IRENDEREREVENTHANDLER_H
10 #define RAMSES_IRENDEREREVENTHANDLER_H
11 
12 #include "Types.h"
14 #include <chrono>
15 
16 namespace ramses
17 {
24  {
25  public:
33  virtual void offscreenBufferCreated(displayId_t displayId, displayBufferId_t offscreenBufferId, ERendererEventResult result) = 0;
34 
42  virtual void offscreenBufferDestroyed(displayId_t displayId, displayBufferId_t offscreenBufferId, ERendererEventResult result) = 0;
43 
58  virtual void framebufferPixelsRead(const uint8_t* pixelData, const uint32_t pixelDataSize, displayId_t displayId, displayBufferId_t displayBuffer, ERendererEventResult result) = 0;
59 
67  virtual void warpingMeshDataUpdated(displayId_t displayId, ERendererEventResult result) = 0;
68 
75  virtual void displayCreated(displayId_t displayId, ERendererEventResult result) = 0;
76 
83  virtual void displayDestroyed(displayId_t displayId, ERendererEventResult result) = 0;
84 
92  virtual void keyEvent(displayId_t displayId, EKeyEvent eventType, uint32_t keyModifiers, EKeyCode keyCode) = 0;
93 
94 
102  virtual void mouseEvent(displayId_t displayId, EMouseEvent eventType, int32_t mousePosX, int32_t mousePosY) = 0;
103 
114  virtual void windowResized(displayId_t displayId, uint32_t width, uint32_t height) = 0;
115 
124  virtual void windowMoved(displayId_t displayId, int32_t windowPosX, int32_t windowPosY) = 0;
125 
130  virtual void windowClosed(displayId_t displayId) = 0;
131 
140  virtual void renderThreadLoopTimings(std::chrono::microseconds maximumLoopTime, std::chrono::microseconds averageLooptime) = 0;
141 
142 #ifdef RAMSES_ENABLE_RENDER_LOOP_TIMINGS_PER_DISPLAY
154  virtual void renderThreadLoopTimingsPerDisplay(displayId_t displayId, std::chrono::microseconds maximumLoopTime, std::chrono::microseconds averageLooptime)
155  {
156  (void)displayId;
157  (void)maximumLoopTime;
158  (void)averageLooptime;
159  }
160 #endif
161 
162 #ifdef RAMSES_ENABLE_EXTERNAL_BUFFER_EVENTS
171  virtual void externalBufferCreated(displayId_t displayId, externalBufferId_t externalBufferId, uint32_t textureGlId, ERendererEventResult result) = 0;
172 
180  virtual void externalBufferDestroyed(displayId_t displayId, externalBufferId_t externalBufferId, ERendererEventResult result) = 0;
181 #endif
182 
186  virtual ~IRendererEventHandler() = default;
187  };
188 
194  {
195  public:
199  virtual void offscreenBufferCreated(displayId_t displayId, displayBufferId_t offscreenBufferId, ERendererEventResult result) override
200  {
201  (void)displayId;
202  (void)offscreenBufferId;
203  (void)result;
204  }
205 
209  virtual void offscreenBufferDestroyed(displayId_t displayId, displayBufferId_t offscreenBufferId, ERendererEventResult result) override
210  {
211  (void)displayId;
212  (void)offscreenBufferId;
213  (void)result;
214  }
215 
219  virtual void framebufferPixelsRead(const uint8_t* pixelData, const uint32_t pixelDataSize, displayId_t displayId, displayBufferId_t displayBuffer, ERendererEventResult result) override
220  {
221  (void)pixelData;
222  (void)pixelDataSize;
223  (void)displayId;
224  (void)displayBuffer;
225  (void)result;
226  }
227 
231  virtual void warpingMeshDataUpdated(displayId_t displayId, ERendererEventResult result) override
232  {
233  (void)displayId;
234  (void)result;
235  }
236 
240  virtual void displayCreated(displayId_t displayId, ERendererEventResult result) override
241  {
242  (void)displayId;
243  (void)result;
244  }
245 
249  virtual void displayDestroyed(displayId_t displayId, ERendererEventResult result) override
250  {
251  (void)displayId;
252  (void)result;
253  }
254 
258  virtual void keyEvent(displayId_t displayId, EKeyEvent eventType, uint32_t keyModifiers, EKeyCode keyCode) override
259  {
260  (void)displayId;
261  (void)eventType;
262  (void)keyModifiers;
263  (void)keyCode;
264  }
265 
269  virtual void mouseEvent(displayId_t displayId, EMouseEvent eventType, int32_t mousePosX, int32_t mousePosY) override
270  {
271  (void)displayId;
272  (void)eventType;
273  (void)mousePosX;
274  (void)mousePosY;
275  }
276 
280  virtual void windowResized(displayId_t displayId, uint32_t width, uint32_t height) override
281  {
282  (void)displayId;
283  (void)width;
284  (void)height;
285  }
286 
290  virtual void windowMoved(displayId_t displayId, int32_t windowPosX, int32_t windowPosY) override
291  {
292  (void)displayId;
293  (void)windowPosX;
294  (void)windowPosY;
295  }
296 
300  virtual void windowClosed(displayId_t displayId) override
301  {
302  (void)displayId;
303  }
304 
308  virtual void renderThreadLoopTimings(std::chrono::microseconds maximumLoopTime, std::chrono::microseconds averageLooptime) override
309  {
310  (void)maximumLoopTime;
311  (void)averageLooptime;
312  }
313 
314 #ifdef RAMSES_ENABLE_EXTERNAL_BUFFER_EVENTS
318  virtual void externalBufferCreated(displayId_t displayId, externalBufferId_t externalBufferId, uint32_t textureGlId, ERendererEventResult result) override
319  {
320  (void)displayId;
321  (void)externalBufferId;
322  (void)textureGlId;
323  (void)result;
324  }
325 
329  virtual void externalBufferDestroyed(displayId_t displayId, externalBufferId_t externalBufferId, ERendererEventResult result) override
330  {
331  (void)displayId;
332  (void)externalBufferId;
333  (void)result;
334  }
335 #endif
336 
337  };
338 }
339 
340 #endif
#define RAMSES_API
Definition: APIExport.h:35
Provides an interface for handling the result of renderer events. Implementation of this interface mu...
Definition: IRendererEventHandler.h:24
virtual ~IRendererEventHandler()=default
Empty destructor.
virtual void mouseEvent(displayId_t displayId, EMouseEvent eventType, int32_t mousePosX, int32_t mousePosY)=0
This method will be called when a mouse event action has occured while a display's window was focused...
virtual void windowMoved(displayId_t displayId, int32_t windowPosX, int32_t windowPosY)=0
This method will be called when a display's window has been moved, if the renderer uses WGL/Windows o...
virtual void warpingMeshDataUpdated(displayId_t displayId, ERendererEventResult result)=0
This method will be called when update of warping mesh data was finished. This is the result of Ramse...
virtual void offscreenBufferCreated(displayId_t displayId, displayBufferId_t offscreenBufferId, ERendererEventResult result)=0
This method will be called after an offscreen buffer is created (or failed to be created) as a result...
virtual void displayCreated(displayId_t displayId, ERendererEventResult result)=0
This method will be called after a display was created (or failed to create) as a result of RamsesRen...
virtual void windowResized(displayId_t displayId, uint32_t width, uint32_t height)=0
This method will be called when a display's window has been resized.
virtual void keyEvent(displayId_t displayId, EKeyEvent eventType, uint32_t keyModifiers, EKeyCode keyCode)=0
This method will be called when a key has been pressed while a display's window was focused.
virtual void renderThreadLoopTimings(std::chrono::microseconds maximumLoopTime, std::chrono::microseconds averageLooptime)=0
This method will be called in period given to renderer config (ramses::RendererConfig::setRenderThrea...
virtual void displayDestroyed(displayId_t displayId, ERendererEventResult result)=0
This method will be called after a display was destroyed (or failed to destroy) as a result of Ramses...
virtual void offscreenBufferDestroyed(displayId_t displayId, displayBufferId_t offscreenBufferId, ERendererEventResult result)=0
This method will be called after an offscreen buffer is destroyed (or failed to be destroyed) as a re...
virtual void windowClosed(displayId_t displayId)=0
This method will be called when a display's window has been closed.
virtual void framebufferPixelsRead(const uint8_t *pixelData, const uint32_t pixelDataSize, displayId_t displayId, displayBufferId_t displayBuffer, ERendererEventResult result)=0
This method will be called when a read back of pixels from display buffer was finished....
Convenience empty implementation of IRendererEventHandler that can be used to derive from when only s...
Definition: IRendererEventHandler.h:194
virtual void displayCreated(displayId_t displayId, ERendererEventResult result) override
This method will be called after a display was created (or failed to create) as a result of RamsesRen...
Definition: IRendererEventHandler.h:240
virtual void framebufferPixelsRead(const uint8_t *pixelData, const uint32_t pixelDataSize, displayId_t displayId, displayBufferId_t displayBuffer, ERendererEventResult result) override
This method will be called when a read back of pixels from display buffer was finished....
Definition: IRendererEventHandler.h:219
virtual void keyEvent(displayId_t displayId, EKeyEvent eventType, uint32_t keyModifiers, EKeyCode keyCode) override
This method will be called when a key has been pressed while a display's window was focused.
Definition: IRendererEventHandler.h:258
virtual void windowMoved(displayId_t displayId, int32_t windowPosX, int32_t windowPosY) override
This method will be called when a display's window has been moved, if the renderer uses WGL/Windows o...
Definition: IRendererEventHandler.h:290
virtual void renderThreadLoopTimings(std::chrono::microseconds maximumLoopTime, std::chrono::microseconds averageLooptime) override
This method will be called in period given to renderer config (ramses::RendererConfig::setRenderThrea...
Definition: IRendererEventHandler.h:308
virtual void warpingMeshDataUpdated(displayId_t displayId, ERendererEventResult result) override
This method will be called when update of warping mesh data was finished. This is the result of Ramse...
Definition: IRendererEventHandler.h:231
virtual void offscreenBufferCreated(displayId_t displayId, displayBufferId_t offscreenBufferId, ERendererEventResult result) override
This method will be called after an offscreen buffer is created (or failed to be created) as a result...
Definition: IRendererEventHandler.h:199
virtual void mouseEvent(displayId_t displayId, EMouseEvent eventType, int32_t mousePosX, int32_t mousePosY) override
This method will be called when a mouse event action has occured while a display's window was focused...
Definition: IRendererEventHandler.h:269
virtual void windowResized(displayId_t displayId, uint32_t width, uint32_t height) override
This method will be called when a display's window has been resized.
Definition: IRendererEventHandler.h:280
virtual void offscreenBufferDestroyed(displayId_t displayId, displayBufferId_t offscreenBufferId, ERendererEventResult result) override
This method will be called after an offscreen buffer is destroyed (or failed to be destroyed) as a re...
Definition: IRendererEventHandler.h:209
virtual void windowClosed(displayId_t displayId) override
This method will be called when a display's window has been closed.
Definition: IRendererEventHandler.h:300
virtual void displayDestroyed(displayId_t displayId, ERendererEventResult result) override
This method will be called after a display was destroyed (or failed to destroy) as a result of Ramses...
Definition: IRendererEventHandler.h:249
The RAMSES namespace contains all client side objects and functions used to implement RAMSES applicat...
Definition: AnimatedProperty.h:15
EKeyCode
Specifies key codes for keyboard input.
Definition: Types.h:141
StronglyTypedValue< uint32_t, std::numeric_limits< uint32_t >::max(), struct ExternalBufferIdTag > externalBufferId_t
External buffer identifier referring to external buffer.
Definition: RamsesFrameworkTypes.h:66
EMouseEvent
Specifies events for mouse input.
Definition: Types.h:105
EKeyEvent
Specifies keypress events for keyboard input.
Definition: Types.h:129
StronglyTypedValue< uint32_t, std::numeric_limits< uint32_t >::max(), struct DisplayIdTag > displayId_t
Display identifier used to refer to display in renderer API and dispatched callbacks.
Definition: RamsesFrameworkTypes.h:57
ERendererEventResult
Specifies the result of the operation referred to by renderer event.
Definition: Types.h:94