d291dcdc74
agent_api (HTTP server), agent_log (structured logging), agent_events (event bus), agent_console (GameConsole), agent_replay (snapshots), agent_vision (depth/segmentation), agent_fbx (bone remapping), agent_auth (multi-agent), agent_analytics (feature flags + tracking) All modules compile clean with mono. Binary uploaded to S3 v1.0.0. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "core/object/class_db.h"
|
|
#include "core/object/object.h"
|
|
#include "core/os/mutex.h"
|
|
#include "core/string/ustring.h"
|
|
#include "core/variant/dictionary.h"
|
|
#include "core/variant/array.h"
|
|
#include "core/math/rect2.h"
|
|
|
|
class AgentVision : public Object {
|
|
GDCLASS(AgentVision, Object);
|
|
|
|
static AgentVision *singleton;
|
|
|
|
public:
|
|
static AgentVision *get_singleton() { return singleton; }
|
|
|
|
struct BoundingBox {
|
|
String node_name;
|
|
String node_path;
|
|
String node_class;
|
|
Rect2 rect; // 2D screen-space bounding box.
|
|
float distance = 0.0f;
|
|
};
|
|
|
|
private:
|
|
// Previous screenshot for diff mode.
|
|
Vector<uint8_t> previous_screenshot;
|
|
Mutex vision_mutex;
|
|
|
|
// Segmentation color map: node instance ID -> color.
|
|
HashMap<uint64_t, Color> segmentation_colors;
|
|
uint32_t next_color_idx = 1;
|
|
|
|
Color _get_segmentation_color(uint64_t p_instance_id);
|
|
|
|
protected:
|
|
static void _bind_methods();
|
|
|
|
public:
|
|
AgentVision();
|
|
~AgentVision();
|
|
|
|
// Bounding boxes for all visible 3D nodes projected to 2D.
|
|
Array get_bounding_boxes();
|
|
|
|
// Annotated screenshot (overlays node names, bounding boxes on the viewport).
|
|
Vector<uint8_t> get_annotated_screenshot(int p_width = 0);
|
|
|
|
// Screenshot diff — highlighted changes since last capture.
|
|
Vector<uint8_t> get_screenshot_diff();
|
|
|
|
// Segmentation map — each visible object gets a unique color.
|
|
Vector<uint8_t> get_segmentation_map();
|
|
|
|
// Depth buffer as 16-bit grayscale PNG.
|
|
Vector<uint8_t> get_depth_buffer();
|
|
|
|
// Minimap — top-down orthographic capture of the scene.
|
|
Vector<uint8_t> get_minimap(float p_world_size = 100.0f, int p_resolution = 512);
|
|
|
|
// Multi-camera capture.
|
|
Vector<uint8_t> capture_camera(const String &p_camera_name, int p_width = 0, int p_height = 0);
|
|
|
|
// Store current screenshot as previous (for diff).
|
|
void store_previous_screenshot(const Vector<uint8_t> &p_data);
|
|
};
|