KroysViewportApi
Viewport tools, the viewport camera and 3D drawing (capability viewport-tools). Editor target only.
Declaration
Declared in kroys/kroys_plugin.h.
kroys_plugin.h
typedef struct KroysViewportApi { ... } KroysViewportApi;
Members
#uint32_t structSize;Size of this struct as the writer compiled it (sizeof); the reader uses it to detect members appended by later minor versions.
#uint32_t reserved;Padding reserved for later use; leave it 0.
#KroysResult (KROYS_CALL* RegisterTool)(KroysContext context, const KroysViewportToolDesc* desc, const KroysViewportToolCallbacks* callbacks, KroysHandle* outHandle);Capability viewport-tools: a tool on the viewport's plugin toolbar.
#KroysResult (KROYS_CALL* ActivateTool)(KroysContext context, const char* toolId);Activates a tool by local id (null: none).
#KroysResult (KROYS_CALL* GetCamera)(KroysContext context, KroysCameraInfo* outCamera);The viewport camera.
#int32_t (KROYS_CALL* WorldToScreen)(KroysContext context, const float* world, float* outScreen);Projects world[3] to outScreen[2] (pixels from the viewport's top-left); 0 when the point is behind the camera.
#void (KROYS_CALL* DrawLine)(KroysContext context, const float* from, const float* to, uint32_t color, float thickness);Draw primitives: inside a tool's Draw only. Colors are packed RGBA8.
#void (KROYS_CALL* DrawCircle)(KroysContext context, const float* center, const float* normal, float radius, uint32_t color, float thickness);A circle around normal.
#void (KROYS_CALL* DrawBox)(KroysContext context, const float* minimum, const float* maximum, uint32_t color, float thickness);An axis-aligned box from minimum[3] to maximum[3].
#void (KROYS_CALL* DrawPoint)(KroysContext context, const float* position, float size, uint32_t color);A point of size pixels.
#void (KROYS_CALL* DrawLabel)(KroysContext context, const float* position, const char* text, uint32_t color);Text at a world position.
Members
uint32_t structSize; uint32_t reserved; KroysResult (KROYS_CALL* RegisterTool)(KroysContext context, const KroysViewportToolDesc* desc, const KroysViewportToolCallbacks* callbacks, KroysHandle* outHandle); KroysResult (KROYS_CALL* ActivateTool)(KroysContext context, const char* toolId); KroysResult (KROYS_CALL* GetCamera)(KroysContext context, KroysCameraInfo* outCamera); int32_t (KROYS_CALL* WorldToScreen)(KroysContext context, const float* world, float* outScreen); void (KROYS_CALL* DrawLine)(KroysContext context, const float* from, const float* to, uint32_t color, float thickness); void (KROYS_CALL* DrawCircle)(KroysContext context, const float* center, const float* normal, float radius, uint32_t color, float thickness); void (KROYS_CALL* DrawBox)(KroysContext context, const float* minimum, const float* maximum, uint32_t color, float thickness); void (KROYS_CALL* DrawPoint)(KroysContext context, const float* position, float size, uint32_t color); void (KROYS_CALL* DrawLabel)(KroysContext context, const float* position, const char* text, uint32_t color);
KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.