#include <snapshot.h>
Public Member Functions | |
| Snapshot (Core &core) | |
| virtual bool | init (utility::ErrorState &errorState) override |
| void | setClearColor (const RGBAColorFloat &color) |
| void | snap (PerspCameraComponentInstance &camera, std::vector< RenderableComponentInstance * > &comps) |
| void | snap (PerspCameraComponentInstance &camera, std::function< void(nap::SnapshotRenderTarget &)> renderCallback) |
| glm::u32vec2 | getSize () |
Public Member Functions inherited from Resource | |
| Resource () | |
Public Member Functions inherited from Object | |
| Object () | |
| virtual | ~Object () |
| virtual void | onDestroy () |
| Object (Object &)=delete | |
| Object & | operator= (const Object &)=delete |
| Object (Object &&)=delete | |
| Object & | operator= (Object &&)=delete |
Public Attributes | |
| uint32 | mWidth = 1920 |
| Property: 'Width' width of the snapshot in texels. More... | |
| uint32 | mHeight = 1080 |
| Property: 'Height' height of the snapshot in texels. More... | |
| uint32 | mDivisor = 1 |
| Property: 'Divisor' subdivides the texture equally over multiple cells. More... | |
| RGBAColorFloat | mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f } |
| Property: 'ClearColor' color selection used for clearing the render target. More... | |
| RenderTexture2D::EFormat | mTextureFormat = RenderTexture2D::EFormat::RGBA8 |
| Property: 'Format' texture format. More... | |
| ERasterizationSamples | mRequestedSamples = ERasterizationSamples::Four |
| Property: 'Samples' The number of samples used during Rasterization. For better results turn on 'SampleShading'. More... | |
| bool | mSampleShading = true |
| Property: 'SampleShading' Reduces texture aliasing when enabled, at higher computational cost. More... | |
| std::string | mOutputDirectory = "snapshots" |
| Property: 'OutputDirectory' Location of the directory where snapshots are saved to, defaults to 'data'. More... | |
| BitmapFileBuffer::EImageFileFormat | mImageFileFormat = BitmapFileBuffer::EImageFileFormat::PNG |
| Property: 'ImageFormat' Image format of the snapshot image file. More... | |
| nap::Signal | onSnapshot |
| nap::Signal< std::string > | onSnapshotSaved |
Public Attributes inherited from Object | |
| std::string | mID |
| Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Protected Attributes | |
| RenderService * | mRenderService = nullptr |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
| static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
The Snapshot module renders objects at any given resolution and format and saves the result to a specified location on disk (as long as its configuration is supported by the hardware and sufficient video memory is available).
| glm::u32vec2 getSize | ( | ) |
Returns the size of the snapshot
|
overridevirtual |
Initialize this object after de-serialization
| errorState | contains the error message when initialization fails |
Reimplemented from Object.
| void setClearColor | ( | const RGBAColorFloat & | color | ) |
Updates the render target clear color.
| color | the new clear color to use. |
| void snap | ( | PerspCameraComponentInstance & | camera, |
| std::function< void(nap::SnapshotRenderTarget &)> | renderCallback | ||
| ) |
Takes a high-res snapshot using a callback and saves the result to a location on disk. This call gives you more freedom in setting up your own render commands compared to the call above, which assumes you're rendering a fixed number of components through the render service.
Make sure begin a headless recording in the render service e.g.
| camera | camera to take snapshot with |
| renderCallback | function that is called when snapshot is taken. |
| void snap | ( | PerspCameraComponentInstance & | camera, |
| std::vector< RenderableComponentInstance * > & | comps | ||
| ) |
Takes a high-res snapshot and saves the result to a location on disk. Make sure to begin a headless recording in the render service e.g.
| camera | Camera to take snapshot with |
| comps | Components to render |
| RGBAColorFloat mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f } |
Property: 'ClearColor' color selection used for clearing the render target.
| uint32 mDivisor = 1 |
Property: 'Divisor' subdivides the texture equally over multiple cells.
| uint32 mHeight = 1080 |
Property: 'Height' height of the snapshot in texels.
| BitmapFileBuffer::EImageFileFormat mImageFileFormat = BitmapFileBuffer::EImageFileFormat::PNG |
Property: 'ImageFormat' Image format of the snapshot image file.
| std::string mOutputDirectory = "snapshots" |
Property: 'OutputDirectory' Location of the directory where snapshots are saved to, defaults to 'data'.
|
protected |
| ERasterizationSamples mRequestedSamples = ERasterizationSamples::Four |
Property: 'Samples' The number of samples used during Rasterization. For better results turn on 'SampleShading'.
| bool mSampleShading = true |
Property: 'SampleShading' Reduces texture aliasing when enabled, at higher computational cost.
| RenderTexture2D::EFormat mTextureFormat = RenderTexture2D::EFormat::RGBA8 |
Property: 'Format' texture format.
| uint32 mWidth = 1920 |
Property: 'Width' width of the snapshot in texels.
| nap::Signal onSnapshot |
| nap::Signal<std::string> onSnapshotSaved |