载入中...
搜索中...
未找到
RenderCapture.h
浏览该文件的文档.
1#pragma once
2
3// Capability interface: render-frame capture and scene inspection for
4// devtools / MCP. Provided by the graphics module (which may reach into scene
5// for the entity-id mask and visible-entity JSON).
6
7#include "common/Export.h"
8
9#include <string>
10
11namespace eve {
12
15 int width = 0, height = 0, pixelWidth = 0, pixelHeight = 0;
16 bool had3DThisFrame = false;
17 bool readbackEnabled = false;
18 std::string backend;
19};
20
23public:
24 static constexpr const char* capabilityName = "IRenderCapture";
25
26 virtual ~IRenderCapture() = default;
27
28 virtual RenderStatusInfo status() const = 0;
30 virtual void setReadbackEnabled(bool enabled) = 0;
32 virtual bool savePng(const std::string& path, int* outWidth, int* outHeight,
33 std::string* err) = 0;
35 virtual std::string capturePngDataUrl() = 0;
36
38 virtual bool ensureCamera() = 0;
40 virtual bool setCameraPose(float ex, float ey, float ez, float tx, float ty, float tz,
41 float fovYDeg) = 0;
43 virtual bool setCameraPoseYawPitch(float ex, float ey, float ez, float yawDeg,
44 float pitchDeg, float fovYDeg) = 0;
46 virtual std::string cameraPoseJson() = 0;
47
49 virtual std::string visibleEntitiesJson(float fovYDeg, bool* ok) = 0;
51 virtual std::string visibleEntitiesJsonAt(float ex, float ey, float ez, float tx, float ty,
52 float tz, float fovYDeg, bool* ok) = 0;
54 virtual std::string entityIdMaskJson(int* outWidth, int* outHeight, bool* ok) = 0;
56 virtual bool entityIdMaskPng(const std::string& path, std::string* err) = 0;
58 virtual bool gbufferPng(const std::string& name, const std::string& path,
59 std::string* err) = 0;
60};
61
62} // namespace eve
#define EVENGINE_API
宿主(eve / libmain)导出宏;插件从进程导入同一批符号。
Definition Export.h:16
float height
Definition Grass.cpp:235
int width
const char * name
Definition RockMesh.cpp:21
bool enabled
Frame capture + camera + visible-entity inspection (graphics).
virtual std::string cameraPoseJson()=0
Current camera pose as JSON (eye/target/fov/viewport).
virtual bool setCameraPose(float ex, float ey, float ez, float tx, float ty, float tz, float fovYDeg)=0
Set camera eye/target/fov (fov <= 0 keeps current).
virtual bool ensureCamera()=0
Find the active Camera3D (create one lazily); true when usable.
virtual bool savePng(const std::string &path, int *outWidth, int *outHeight, std::string *err)=0
Capture the last presented frame and write a PNG.
virtual ~IRenderCapture()=default
virtual std::string visibleEntitiesJsonAt(float ex, float ey, float ez, float tx, float ty, float tz, float fovYDeg, bool *ok)=0
Visible-entity 3D snapshot JSON at an explicit camera pose.
virtual bool entityIdMaskPng(const std::string &path, std::string *err)=0
Render the entity-ID mask and write it as a PNG.
virtual std::string visibleEntitiesJson(float fovYDeg, bool *ok)=0
Visible-entity 3D snapshot JSON for the current camera.
virtual std::string entityIdMaskJson(int *outWidth, int *outHeight, bool *ok)=0
Per-pixel entity-ID mask JSON (id -> node map).
virtual bool gbufferPng(const std::string &name, const std::string &path, std::string *err)=0
Save a G-buffer attachment ("depth"|"normal") as PNG.
virtual std::string capturePngDataUrl()=0
Capture the last presented frame as a base64 PNG data URL.
virtual void setReadbackEnabled(bool enabled)=0
Enable/disable full-frame readback for subsequent presents.
virtual bool setCameraPoseYawPitch(float ex, float ey, float ez, float yawDeg, float pitchDeg, float fovYDeg)=0
Set camera eye + yaw/pitch (degrees) + fov.
virtual RenderStatusInfo status() const =0
Definition Build.cpp:11
Render surface / frame state snapshot (value type).