载入中...
搜索中...
未找到
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
36public:
37 static constexpr const char* capabilityName = "IRenderCapture";
38
40 virtual ~IRenderCapture() = default;
41
43 virtual RenderStatusInfo status() const = 0;
45 virtual void setReadbackEnabled(bool enabled) = 0;
47 virtual bool savePng(const std::string& path, int* outWidth, int* outHeight,
48 std::string* err) = 0;
50 virtual std::string capturePngDataUrl() = 0;
51
53 virtual bool ensureCamera() = 0;
55 virtual bool setCameraPose(float ex, float ey, float ez, float tx, float ty, float tz,
56 float fovYDeg) = 0;
58 virtual bool setCameraPoseYawPitch(float ex, float ey, float ez, float yawDeg,
59 float pitchDeg, float fovYDeg) = 0;
61 virtual std::string cameraPoseJson() = 0;
62
70 std::uint32_t entityId, std::uint32_t generation) = 0;
71
73 virtual std::string visibleEntitiesJson(float fovYDeg, bool* ok) = 0;
75 virtual std::string visibleEntitiesJsonAt(float ex, float ey, float ez, float tx, float ty,
76 float tz, float fovYDeg, bool* ok) = 0;
78 virtual std::string entityIdMaskJson(int* outWidth, int* outHeight, bool* ok) = 0;
80 virtual bool entityIdMaskPng(const std::string& path, std::string* err) = 0;
82 virtual bool gbufferPng(const std::string& name, const std::string& path,
83 std::string* err) = 0;
84};
85
86} // namespace eve
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float z
Definition AnimClip.cpp:738
#define EVENGINE_API_FOUNDATION_INLINE
仅供"只有内联成员"的类型使用的组宏:拥有者 dllexport,消费方不导入。
Definition Export.h:170
std::uint32_t height
std::uint32_t width
std::string name
float roughness
float metallic
std::string path
Definition PlayHost.cpp:110
std::uint32_t generation
bool receiveShadow
Move-only, checked operation results for the common layer.
bool visible
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
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 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 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 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
Status.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
bool enabled
Render surface / frame state snapshot (value type).
Generation-qualified snapshot of one live field-backed Renderable3D.