载入中...
搜索中...
未找到
McpFrameCapture.cpp
浏览该文件的文档.
37std::string reply(Object::Ptr o) { return textContentResult(mcpStringify(Poco::Dynamic::Var(o))); }
67 o->set("producerPass", b.attachment == FrameAttachment::Final ? "present" : shadow ? "csm" : "gbuffer");
69 o->set("storageGroup", b.attachment == FrameAttachment::Depth || b.attachment == FrameAttachment::Velocity
74 o->set("arrayLayer", static_cast<unsigned>(b.attachment) - static_cast<unsigned>(FrameAttachment::Shadow0));
114 encoder.write(reinterpret_cast<const char*>(bytes.data()), static_cast<std::streamsize>(bytes.size()));
130 if (job.future.wait_for(std::chrono::seconds(0)) != std::future_status::ready) return pending(token);
145 } else if (key == "timeoutMs" || key == "x" || key == "y" || key == "channel" || key == "maxWidth" ||
148 if (!value.isInteger() || value.convert<double>() < -2147483648.0 || value.convert<double>() > 2147483647.0)
183 (it->second.generation != caps.generation || it->second.deadline < std::chrono::steady_clock::now()))
189 if (!validArguments(args, {"tokens", "columns", "cellWidth", "cellHeight", "maxBytes"}) || !args ||
195 options.columns = static_cast<uint32_t>(getArgInt(args, "columns", (std::min)(2, int(requested->size()))));
199 if (!options.columns || options.columns > requested->size() || !options.cellWidth || !options.cellHeight ||
239 if (job.generation == caps.generation && job.key == key) return pollJob(jobToken, caps.generation);
320 const std::set<std::string> exportArgs{"token", "buffer", "encoding", "path", "view", "channel",
328 if (name == "eve_frame_capture_status" && token.starts_with("job:")) return pollJob(token, caps.generation);
399 channel->set("stored", std::isfinite(pixel.value().stored[c]) ? Poco::Dynamic::Var(pixel.value().stored[c])
448 if (job.generation == caps.generation && job.key == key) return pollJob(jobToken, caps.generation);
452 if (job.response.empty() && job.future.wait_for(std::chrono::seconds(0)) != std::future_status::ready)
465 const auto jobToken = "job:" + std::to_string(caps.generation) + ":" + std::to_string(nextJob++);
469 [buffer = *it, options, token, snapshotFrame = snapshot.frameId, exporting, encoding, path, jobToken,
492 return {imageContentResult(base64(preview.png), "image/png", mcpStringify(Poco::Dynamic::Var(o)))};
495 if (!destination.parent_path().empty()) std::filesystem::create_directories(destination.parent_path());
557 "capture/job tokens. Image/export return jobToken; poll status until ready. Pixels use original "
655EVE_MCP_TOOL_FAMILY(FrameCapture, mcpFrameCaptureSchemas, callMcpFrameCaptureTool, ContentEnvelope)
std::map< std::string, std::vector< Key >, std::less<> > channels
Definition AnimCurveLibrary.cpp:21
#define EVE_MCP_TOOL_FAMILY(Id, Schemas, Handler, Payload)
Declare one family beside its implementation; CMake derives composition from compiled sources.
Definition McpToolFamilies.hpp:86
Definition DebugAdapter.hpp:16
Definition ActionGuideExport.cpp:13
float getArgFloat(Poco::JSON::Object::Ptr args, const char *key, float def=0.f)
Floating-point argument, or def when absent or not convertible.
Definition McpArgs.hpp:55
@ ContentEnvelope
void resetMcpFrameCapture()
Main-thread disconnect cleanup; workers observe cancellation before publishing files.
Definition McpFrameCapture.cpp:166
std::string_view mcpFrameCaptureSchemas()
Comma-separated schemas for tools/list.
Definition McpFrameCapture.cpp:545
std::string mcpStringify(const Poco::Dynamic::Var &value)
Compact single-line JSON text for a newline-framed MCP payload.
Definition McpJson.hpp:24
std::string textContentResult(const std::string &text, bool isError=false)
MCP tools/call result object carrying one text content item.
Definition McpJson.hpp:84
std::string imageContentResult(const std::string &base64Png, const std::string &mimeType, const std::string &caption)
MCP tools/call result object carrying one image content item.
Definition McpJson.hpp:102
std::string callMcpFrameCaptureTool(std::string_view name, Object::Ptr args)
Definition McpFrameCapture.cpp:174
int getArgInt(Poco::JSON::Object::Ptr args, const char *key, int def=0)
Integer argument, or def when absent or not convertible.
Definition McpArgs.hpp:35
bool isMcpFrameCaptureTool(std::string_view name)
True for the frame snapshot MCP family.
Definition McpFrameCapture.cpp:159
Result< FramePreview > frameContactSheet(std::span< const FrameCaptureBuffer > frames, const FrameContactSheetOptions &options)
Definition FrameContactSheet.cpp:6
std::string getArgString(Poco::JSON::Object::Ptr args, const char *key, const std::string &def={})
String argument, or def when absent or not convertible.
Definition McpArgs.hpp:25
ForceVector add(ForceVector a, ForceVector b)
Definition ForceMath.h:13
@ ReadbackPending
@ Queued
@ Recording
Result< double > frameCaptureLinearDepth(const FrameCaptureBuffer &b, uint32_t x, uint32_t y, const std::array< float, 16 > &matrix)
Reconstruct positive view depth using this snapshot's projection. @thread Any thread with CPU leases.
Definition FrameCaptureImage.cpp:58
Result< FramePixel > frameCapturePixel(const FrameCaptureBuffer &b, uint32_t x, uint32_t y)
Read CPU snapshot only; no callback, rendering, or GPU wait. @thread Any thread with a snapshot lease...
Definition FrameCaptureImage.cpp:12
std::string_view frameAttachmentName(FrameAttachment a)
Stable protocol spelling of an attachment.
Definition FrameCapture.cpp:25
constexpr std::string_view statusCodeName(StatusCode code) noexcept
Return the stable protocol spelling of a status code.
Definition Status.h:46
Result< FrameAttachment > parseFrameAttachment(std::string_view name)
Validate a protocol attachment name without inventing a resource.
Definition FrameCapture.cpp:29
FramePixelFormat
CPU storage encoding; no GPU object escapes the provider.
Definition FrameCapture.h:44
@ Depth32Float
@ Bgra8
@ Rgba16Float
@ HwDepth
@ Depth
@ Velocity
@ Shadow0
@ Final
std::string_view frameCapturePhaseName(FrameCapturePhase p)
Stable protocol spelling of a progress state.
Definition FrameCapture.cpp:34
enum EVENGINE_API_FOUNDATION Array
OT_ARRAY (editable via Runtime array APIs / ReflectedPropertyModel).
Definition Runtime.h:120
Definition Container.h:602
Owning request; timeout uses monotonic wall time, never gameplay time.
Definition FrameCapture.h:63
Bounded, row-major contact sheet of immutable final-color captures.
Definition FrameContactSheet.hpp:9
Explicit CPU preview transformation, separate from costly GPU capture.
Definition FrameCapturePreview.hpp:5
std::array< float, 16 > inverseProjection
Definition FrameCapturePreview.hpp:11