载入中...
搜索中...
未找到
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#include "common/Result.h"
9
10#include <cstdint>
11#include <string>
12
13namespace eve {
14
17 int width = 0, height = 0, pixelWidth = 0, pixelHeight = 0;
18 bool had3DThisFrame = false;
19 bool readbackEnabled = false;
20 std::string backend;
21};
22
25 std::uint32_t entityId = 0;
26 std::uint32_t generation = 0;
27 float x = 0.f, y = 0.f, z = 0.f;
28 float tintR = 1.f, tintG = 1.f, tintB = 1.f, tintA = 1.f;
29 float metallic = 0.f, roughness = 0.45f, parallaxScale = 0.f;
30 bool visible = true, receiveLight = true, castShadow = true, receiveShadow = true;
31 bool hasPackedMaterial = false, hasTexture = false, hasShader = false;
32};
33
39
42public:
43 static constexpr const char* capabilityName = "IRenderCapture";
44
46 virtual ~IRenderCapture() = default;
47
49 virtual RenderStatusInfo status() const = 0;
51 virtual void setReadbackEnabled(bool enabled) = 0;
57 [[nodiscard]] virtual Result<CaptureImageInfo> savePng(const std::string& path) = 0;
59 virtual std::string capturePngDataUrl() = 0;
60
62 virtual bool ensureCamera() = 0;
64 virtual bool setCameraPose(float ex, float ey, float ez, float tx, float ty, float tz,
65 float fovYDeg) = 0;
67 virtual bool setCameraPoseYawPitch(float ex, float ey, float ez, float yawDeg,
68 float pitchDeg, float fovYDeg) = 0;
70 virtual std::string cameraPoseJson() = 0;
71
79 std::uint32_t entityId, std::uint32_t generation) = 0;
80
82 virtual std::string visibleEntitiesJson(float fovYDeg, bool* ok) = 0;
84 virtual std::string visibleEntitiesJsonAt(float ex, float ey, float ez, float tx, float ty,
85 float tz, float fovYDeg, bool* ok) = 0;
87 virtual std::string entityIdMaskJson(int* outWidth, int* outHeight, bool* ok) = 0;
92 [[nodiscard]] virtual Result<void> entityIdMaskPng(const std::string& path) = 0;
98 [[nodiscard]] virtual Result<void> gbufferPng(const std::string& name, const std::string& path) = 0;
99};
100
101} // namespace eve
double z
double y
double x
Generation generation
Definition ECS.cpp:40
std::string name
Definition ECS.cpp:154
#define EVENGINE_API_FOUNDATION_INLINE
仅供"只有内联成员"的类型使用的组宏:拥有者 dllexport,消费方不导入。
Definition Export.h:170
std::uint32_t height
std::uint32_t width
float roughness
float metallic
std::string path
Definition PlayHost.cpp:111
bool receiveShadow
Move-only, checked operation results for the common layer.
bool visible
Frame capture + camera + visible-entity inspection (graphics).
virtual Result< CaptureImageInfo > savePng(const std::string &path)=0
Capture the last presented frame and write a PNG.
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 Result< void > entityIdMaskPng(const std::string &path)=0
Render the entity-ID mask and write it as a PNG.
virtual bool ensureCamera()=0
Find the active Camera3D (create one lazily); true when usable.
virtual ~IRenderCapture()=default
I render capture.
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 std::string visibleEntitiesJson(float fovYDeg, bool *ok)=0
Visible-entity 3D snapshot JSON for the current camera.
virtual Result< Renderable3DInfo > inspectRenderable3D(std::uint32_t entityId, std::uint32_t generation)=0
Inspect one live Renderable3D using its complete ECS identity.
virtual std::string entityIdMaskJson(int *outWidth, int *outHeight, bool *ok)=0
Per-pixel entity-ID mask JSON (id -> node map).
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
Status.
virtual Result< void > gbufferPng(const std::string &name, const std::string &path)=0
Save a G-buffer attachment ("depth"|"normal") as PNG.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
bool enabled
Pixel size reported by a successful frame/image capture.
Render surface / frame state snapshot (value type).
Generation-qualified snapshot of one live field-backed Renderable3D.