Fission FSN
Loading...
Searching...
No Matches
fsCAxmolRenderTexture.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: fsCAxmolRenderTexture.h
4*
5* Purpose: axmol v3 derived class for render texture
6*
7*********************************************************************/
8
9#ifndef fsCAxmolRenderTextureV3hdr
10#define fsCAxmolRenderTextureV3hdr
11
12#include <fsCore/fsBaseTypes.h>
13#include <fsCore/fsPoint.h>
14
15#include <optional>
16
17#include <renderer/RenderTexture.h>
18#include <renderer/RenderTexturePass.h>
19
20class fsRect;
21
22class fsCAxmolRenderTexture : public ax::RenderTexture
23{
24public:
25
26 bool saveToFileAsJPG(std::string_view filename);
27
28 void begin();
29 void beginWithClear(float r, float g, float b, float a, float depth = 1.0f, unsigned int stencil = 0);
30 void end();
31
32 void partialEnd();
33 // Resume an existing colour composition with a fresh depth/stencil layer.
35
36 void saveToFileWithResize(const std::string_view filename, const std::string_view mask_filename, SaveFileCallbackType callback = nullptr);
37 void saveRegionToFile(const std::string_view filename, const fsRect& pCaptureRect, const fsPoint& pOutputDimensions, SaveFileCallbackType callback = nullptr);
38
39 static fsCAxmolRenderTexture* create(int w, int h, ax::rhi::PixelFormat format, ax::rhi::PixelFormat depthStencilFormat, bool sharedRenderTarget);
40 static fsCAxmolRenderTexture* create(int w, int h, ax::rhi::PixelFormat format, bool sharedRenderTarget);
41 static fsCAxmolRenderTexture* create(int w, int h, bool sharedRenderTarget);
42
43private:
44
45 ax::RenderTexturePass* passEnsure();
46 void onSaveToFileWithResize(const std::string_view filename, const std::string_view mask_filename);
47 void onSaveRegionToFile(const std::string_view filename, const fsRect& pCaptureRect, const fsPoint& pOutputDimensions);
48 ax::Viewport viewportGet() const;
49
50 ax::RefPtr<ax::RenderTexturePass> mPass;
51 std::optional<ax::Viewport> mSavedDefaultViewport;
52 SaveFileCallbackType mSaveFileCallback = nullptr;
53};
54
55#endif
Definition fsCAxmolRenderTexture.h:32
void saveToFileWithResize(const std::string_view filename, const std::string_view mask_filename, SaveFileCallbackType callback=nullptr)
void beginWithClear(float r, float g, float b, float a, float depth=1.0f, unsigned int stencil=0)
Definition fsCAxmolRenderTexture.cpp:54
void begin()
Definition fsCAxmolRenderTexture.cpp:43
void end()
Definition fsCAxmolRenderTexture.cpp:69
bool saveToFileAsJPG(std::string_view filename)
static fsCAxmolRenderTexture * create(int w, int h, bool sharedRenderTarget)
void saveRegionToFile(const std::string_view filename, const fsRect &pCaptureRect, const fsPoint &pOutputDimensions, SaveFileCallbackType callback=nullptr)
static fsCAxmolRenderTexture * create(int w, int h, ax::backend::PixelFormat format, ax::backend::PixelFormat depthStencilFormat, bool sharedRenderTarget)
Definition fsCAxmolRenderTexture.cpp:390
Definition fsRect.h:16
Definition fsPoint.h:17