Polyphase Game Engine
Loading...
Searching...
No Matches
PolyphaseEngineAPI Struct Reference

Engine API provided to plugins during OnLoad. More...

#include <PolyphaseEngineAPI.h>

Public Attributes

void(* LogDebug )(const char *fmt,...)
 Log a debug message.
 
void(* LogWarning )(const char *fmt,...)
 Log a warning message.
 
void(* LogError )(const char *fmt,...)
 Log an error message.
 
lua_State *(* GetLua )()
 Get the main Lua state.
 
void(* Lua_settop )(lua_State *L, int idx)
 
void(* Lua_pushvalue )(lua_State *L, int idx)
 
void(* Lua_pop )(lua_State *L, int n)
 
int(* Lua_gettop )(lua_State *L)
 
int(* Lua_type )(lua_State *L, int idx)
 
int(* Lua_isfunction )(lua_State *L, int idx)
 
int(* Lua_istable )(lua_State *L, int idx)
 
int(* Lua_isuserdata )(lua_State *L, int idx)
 
int(* Lua_isnil )(lua_State *L, int idx)
 
int(* Lua_toboolean )(lua_State *L, int idx)
 
double(* Lua_tonumber )(lua_State *L, int idx)
 
const char *(* Lua_tostring )(lua_State *L, int idx)
 
void *(* Lua_touserdata )(lua_State *L, int idx)
 
void(* Lua_pushnil )(lua_State *L)
 
void(* Lua_pushboolean )(lua_State *L, int b)
 
void(* Lua_pushnumber )(lua_State *L, double n)
 
void(* Lua_pushstring )(lua_State *L, const char *s)
 
void(* Lua_pushinteger )(lua_State *L, long long n)
 
void *(* Lua_newuserdata )(lua_State *L, size_t sz)
 
void(* Lua_createtable )(lua_State *L, int narr, int nrec)
 
void(* Lua_setfield )(lua_State *L, int idx, const char *k)
 
void(* Lua_getfield )(lua_State *L, int idx, const char *k)
 
void(* Lua_setglobal )(lua_State *L, const char *name)
 
void(* Lua_getglobal )(lua_State *L, const char *name)
 
void(* Lua_rawset )(lua_State *L, int idx)
 
void(* Lua_rawget )(lua_State *L, int idx)
 
void(* Lua_settable )(lua_State *L, int idx)
 
void(* Lua_gettable )(lua_State *L, int idx)
 
int(* Lua_setmetatable )(lua_State *L, int objindex)
 
int(* Lua_getmetatable )(lua_State *L, int objindex)
 
int(* LuaL_newmetatable )(lua_State *L, const char *tname)
 
void(* LuaL_setmetatable )(lua_State *L, const char *tname)
 
void *(* LuaL_checkudata )(lua_State *L, int ud, const char *tname)
 
double(* LuaL_checknumber )(lua_State *L, int arg)
 
long long(* LuaL_checkinteger )(lua_State *L, int arg)
 
const char *(* LuaL_checkstring )(lua_State *L, int arg)
 
void(* LuaL_setfuncs )(lua_State *L, const void *l, int nup)
 
void(* LuaL_getmetatable )(lua_State *L, const char *tname)
 
World *(* GetWorld )(int32_t index)
 Get a world by index.
 
int32_t(* GetNumWorlds )()
 Get the number of active worlds.
 
Node *(* SpawnNode )(World *world, const char *typeName)
 Spawn a node of the given type in a world.
 
void(* DestroyNode )(Node *node)
 Destroy a node.
 
Node *(* FindNode )(World *world, const char *name)
 Find a node by name in a world.
 
void(* Node3D_GetRotation )(Node3D *node, float *outX, float *outY, float *outZ)
 Get the local rotation of a Node3D in euler angles (degrees).
 
void(* Node3D_SetRotation )(Node3D *node, float x, float y, float z)
 Set the local rotation of a Node3D in euler angles (degrees).
 
void(* Node3D_AddRotation )(Node3D *node, float x, float y, float z)
 Add rotation to a Node3D in euler angles (degrees).
 
void(* Node3D_GetPosition )(Node3D *node, float *outX, float *outY, float *outZ)
 Get the local position of a Node3D.
 
void(* Node3D_SetPosition )(Node3D *node, float x, float y, float z)
 Set the local position of a Node3D.
 
void(* Node3D_GetScale )(Node3D *node, float *outX, float *outY, float *outZ)
 Get the local scale of a Node3D.
 
void(* Node3D_SetScale )(Node3D *node, float x, float y, float z)
 Set the local scale of a Node3D.
 
Asset *(* LoadAsset )(const char *name)
 Load an asset by name (loads from disk if not already loaded).
 
Asset *(* FetchAsset )(const char *name)
 Fetch an asset by name (returns nullptr if not already loaded).
 
void(* UnloadAsset )(const char *name)
 Unload an asset by name.
 
int32_t(* TinyLLM_Encode )(Asset *model, const char *text, bool addBos, bool addEos, int32_t *outTokens, int32_t maxTokens)
 Encode text to tokens using a TinyLLMAsset's tokenizer.
 
int32_t(* TinyLLM_Decode )(Asset *model, int32_t prevToken, int32_t token, char *outStr, int32_t maxLen)
 Decode a token to string using a TinyLLMAsset's tokenizer.
 
void(* PlaySound2D )(SoundWave *sound, float volume, float pitch)
 Play a 2D sound (non-positional).
 
void(* StopAllSounds )()
 Stop all currently playing sounds.
 
void(* SetMasterVolume )(float volume)
 Set the master audio volume.
 
float(* GetMasterVolume )()
 Get the master audio volume.
 
uint32_t(* Audio_OpenStream )(uint32_t sampleRate, uint32_t numChannels, uint32_t bitsPerSample)
 
void(* Audio_CloseStream )(uint32_t streamId)
 
int32_t(* Audio_SubmitStreamBuffer )(uint32_t streamId, const uint8_t *data, uint32_t byteSize)
 
uint64_t(* Audio_GetStreamPlayedSamples )(uint32_t streamId)
 
void(* Audio_SetStreamVolume )(uint32_t streamId, float volume)
 
void(* Audio_SetStreamPaused )(uint32_t streamId, bool paused)
 
void(* Audio_FlushStream )(uint32_t streamId)
 
bool(* IsKeyDown )(int32_t key)
 Check if a key is currently held down.
 
bool(* IsKeyJustPressed )(int32_t key)
 Check if a key was just pressed this frame.
 
bool(* IsKeyJustReleased )(int32_t key)
 Check if a key was just released this frame.
 
bool(* IsMouseButtonDown )(int32_t button)
 Check if a mouse button is currently held down.
 
bool(* IsMouseButtonJustPressed )(int32_t button)
 Check if a mouse button was just pressed this frame.
 
void(* GetMousePosition )(int32_t *x, int32_t *y)
 Get the current mouse position.
 
void(* GetMouseDelta )(int32_t *deltaX, int32_t *deltaY)
 Get the mouse movement since last frame.
 
int32_t(* GetScrollWheelDelta )()
 Get the scroll wheel delta.
 
float(* GetDeltaTime )()
 Get the time elapsed since last frame (in seconds).
 
float(* GetElapsedTime )()
 Get the total time elapsed since engine start (in seconds).
 
void(* Gizmos_SetColor )(float r, float g, float b, float a)
 Set the gizmo drawing color.
 
void(* Gizmos_SetMatrix )(const float *matrix16)
 Set the gizmo transformation matrix (column-major, 16 floats).
 
void(* Gizmos_ResetState )()
 Reset gizmo state to default (white color, identity matrix).
 
void(* Gizmos_DrawCube )(float cx, float cy, float cz, float sx, float sy, float sz)
 Draw a solid cube gizmo.
 
void(* Gizmos_DrawWireCube )(float cx, float cy, float cz, float sx, float sy, float sz)
 Draw a wireframe cube gizmo.
 
void(* Gizmos_DrawSphere )(float cx, float cy, float cz, float radius)
 Draw a solid sphere gizmo.
 
void(* Gizmos_DrawWireSphere )(float cx, float cy, float cz, float radius)
 Draw a wireframe sphere gizmo.
 
void(* Gizmos_DrawLine )(float x0, float y0, float z0, float x1, float y1, float z1)
 Draw a line gizmo.
 
void(* Gizmos_DrawRay )(float ox, float oy, float oz, float dx, float dy, float dz)
 Draw a ray gizmo (from origin along direction).
 
EditorUIHooks * editorUI
 Pointer to editor UI hooks struct.
 
void(* GetImGuiContext )(ImGuiPluginContext *outCtx)
 Get ImGui context for plugin use (Editor builds only).
 

Detailed Description

Engine API provided to plugins during OnLoad.

All function pointers are guaranteed to be valid for the lifetime of the plugin (from OnLoad to OnUnload).

Member Data Documentation

◆ Audio_CloseStream

void(* PolyphaseEngineAPI::Audio_CloseStream) (uint32_t streamId)

◆ Audio_FlushStream

void(* PolyphaseEngineAPI::Audio_FlushStream) (uint32_t streamId)

◆ Audio_GetStreamPlayedSamples

uint64_t(* PolyphaseEngineAPI::Audio_GetStreamPlayedSamples) (uint32_t streamId)

◆ Audio_OpenStream

uint32_t(* PolyphaseEngineAPI::Audio_OpenStream) (uint32_t sampleRate, uint32_t numChannels, uint32_t bitsPerSample)

◆ Audio_SetStreamPaused

void(* PolyphaseEngineAPI::Audio_SetStreamPaused) (uint32_t streamId, bool paused)

◆ Audio_SetStreamVolume

void(* PolyphaseEngineAPI::Audio_SetStreamVolume) (uint32_t streamId, float volume)

◆ Audio_SubmitStreamBuffer

int32_t(* PolyphaseEngineAPI::Audio_SubmitStreamBuffer) (uint32_t streamId, const uint8_t *data, uint32_t byteSize)

◆ DestroyNode

void(* PolyphaseEngineAPI::DestroyNode) (Node *node)

Destroy a node.

Parameters
nodeNode to destroy

◆ editorUI

EditorUIHooks* PolyphaseEngineAPI::editorUI

Pointer to editor UI hooks struct.

This is nullptr in non-editor (game) builds. Check before using to ensure plugin works in both contexts.

◆ FetchAsset

Asset *(* PolyphaseEngineAPI::FetchAsset) (const char *name)

Fetch an asset by name (returns nullptr if not already loaded).

Parameters
nameAsset name
Returns
Asset if already loaded, nullptr otherwise

◆ FindNode

Node *(* PolyphaseEngineAPI::FindNode) (World *world, const char *name)

Find a node by name in a world.

Parameters
worldWorld to search in
nameNode name to find
Returns
Found node, or nullptr if not found

◆ GetDeltaTime

float(* PolyphaseEngineAPI::GetDeltaTime) ()

Get the time elapsed since last frame (in seconds).

Returns
Delta time in seconds

◆ GetElapsedTime

float(* PolyphaseEngineAPI::GetElapsedTime) ()

Get the total time elapsed since engine start (in seconds).

Returns
Elapsed time in seconds

◆ GetImGuiContext

void(* PolyphaseEngineAPI::GetImGuiContext) (ImGuiPluginContext *outCtx)

Get ImGui context for plugin use (Editor builds only).

Plugins MUST call this in OnLoad and set up ImGui context before calling any ImGui functions. Returns nullptr in non-editor builds.

Parameters
outCtxPointer to ImGuiPluginContext to fill

◆ GetLua

lua_State *(* PolyphaseEngineAPI::GetLua) ()

Get the main Lua state.

Returns
Pointer to Lua state, or nullptr if not available

◆ GetMasterVolume

float(* PolyphaseEngineAPI::GetMasterVolume) ()

Get the master audio volume.

Returns
Current master volume

◆ GetMouseDelta

void(* PolyphaseEngineAPI::GetMouseDelta) (int32_t *deltaX, int32_t *deltaY)

Get the mouse movement since last frame.

Parameters
deltaXOutput: mouse X delta
deltaYOutput: mouse Y delta

◆ GetMousePosition

void(* PolyphaseEngineAPI::GetMousePosition) (int32_t *x, int32_t *y)

Get the current mouse position.

Parameters
xOutput: mouse X position
yOutput: mouse Y position

◆ GetNumWorlds

int32_t(* PolyphaseEngineAPI::GetNumWorlds) ()

Get the number of active worlds.

Returns
Number of worlds

◆ GetScrollWheelDelta

int32_t(* PolyphaseEngineAPI::GetScrollWheelDelta) ()

Get the scroll wheel delta.

Returns
Scroll wheel delta (positive = up, negative = down)

◆ GetWorld

World *(* PolyphaseEngineAPI::GetWorld) (int32_t index)

Get a world by index.

Parameters
indexWorld index (usually 0 for main world)
Returns
Pointer to world, or nullptr if index is out of range

◆ Gizmos_DrawCube

void(* PolyphaseEngineAPI::Gizmos_DrawCube) (float cx, float cy, float cz, float sx, float sy, float sz)

Draw a solid cube gizmo.

Parameters
cxCenter X
cyCenter Y
czCenter Z
sxSize X
sySize Y
szSize Z

◆ Gizmos_DrawLine

void(* PolyphaseEngineAPI::Gizmos_DrawLine) (float x0, float y0, float z0, float x1, float y1, float z1)

Draw a line gizmo.

Parameters
x0Start X
y0Start Y
z0Start Z
x1End X
y1End Y
z1End Z

◆ Gizmos_DrawRay

void(* PolyphaseEngineAPI::Gizmos_DrawRay) (float ox, float oy, float oz, float dx, float dy, float dz)

Draw a ray gizmo (from origin along direction).

Parameters
oxOrigin X
oyOrigin Y
ozOrigin Z
dxDirection X
dyDirection Y
dzDirection Z

◆ Gizmos_DrawSphere

void(* PolyphaseEngineAPI::Gizmos_DrawSphere) (float cx, float cy, float cz, float radius)

Draw a solid sphere gizmo.

Parameters
cxCenter X
cyCenter Y
czCenter Z
radiusSphere radius

◆ Gizmos_DrawWireCube

void(* PolyphaseEngineAPI::Gizmos_DrawWireCube) (float cx, float cy, float cz, float sx, float sy, float sz)

Draw a wireframe cube gizmo.

◆ Gizmos_DrawWireSphere

void(* PolyphaseEngineAPI::Gizmos_DrawWireSphere) (float cx, float cy, float cz, float radius)

Draw a wireframe sphere gizmo.

◆ Gizmos_ResetState

void(* PolyphaseEngineAPI::Gizmos_ResetState) ()

Reset gizmo state to default (white color, identity matrix).

◆ Gizmos_SetColor

void(* PolyphaseEngineAPI::Gizmos_SetColor) (float r, float g, float b, float a)

Set the gizmo drawing color.

Parameters
rRed component (0.0 - 1.0)
gGreen component (0.0 - 1.0)
bBlue component (0.0 - 1.0)
aAlpha component (0.0 - 1.0)

◆ Gizmos_SetMatrix

void(* PolyphaseEngineAPI::Gizmos_SetMatrix) (const float *matrix16)

Set the gizmo transformation matrix (column-major, 16 floats).

Parameters
matrix16Pointer to 16 floats (column-major 4x4 matrix)

◆ IsKeyDown

bool(* PolyphaseEngineAPI::IsKeyDown) (int32_t key)

Check if a key is currently held down.

Parameters
keyKey code (from InputConstants.h)
Returns
true if key is down

◆ IsKeyJustPressed

bool(* PolyphaseEngineAPI::IsKeyJustPressed) (int32_t key)

Check if a key was just pressed this frame.

Parameters
keyKey code (from InputConstants.h)
Returns
true if key was just pressed

◆ IsKeyJustReleased

bool(* PolyphaseEngineAPI::IsKeyJustReleased) (int32_t key)

Check if a key was just released this frame.

Parameters
keyKey code (from InputConstants.h)
Returns
true if key was just released

◆ IsMouseButtonDown

bool(* PolyphaseEngineAPI::IsMouseButtonDown) (int32_t button)

Check if a mouse button is currently held down.

Parameters
buttonMouse button (0=left, 1=right, 2=middle)
Returns
true if button is down

◆ IsMouseButtonJustPressed

bool(* PolyphaseEngineAPI::IsMouseButtonJustPressed) (int32_t button)

Check if a mouse button was just pressed this frame.

Parameters
buttonMouse button (0=left, 1=right, 2=middle)
Returns
true if button was just pressed

◆ LoadAsset

Asset *(* PolyphaseEngineAPI::LoadAsset) (const char *name)

Load an asset by name (loads from disk if not already loaded).

Parameters
nameAsset name
Returns
Loaded asset, or nullptr on failure

◆ LogDebug

void(* PolyphaseEngineAPI::LogDebug) (const char *fmt,...)

Log a debug message.

Parameters
fmtPrintf-style format string

◆ LogError

void(* PolyphaseEngineAPI::LogError) (const char *fmt,...)

Log an error message.

Parameters
fmtPrintf-style format string

◆ LogWarning

void(* PolyphaseEngineAPI::LogWarning) (const char *fmt,...)

Log a warning message.

Parameters
fmtPrintf-style format string

◆ Lua_createtable

void(* PolyphaseEngineAPI::Lua_createtable) (lua_State *L, int narr, int nrec)

◆ Lua_getfield

void(* PolyphaseEngineAPI::Lua_getfield) (lua_State *L, int idx, const char *k)

◆ Lua_getglobal

void(* PolyphaseEngineAPI::Lua_getglobal) (lua_State *L, const char *name)

◆ Lua_getmetatable

int(* PolyphaseEngineAPI::Lua_getmetatable) (lua_State *L, int objindex)

◆ Lua_gettable

void(* PolyphaseEngineAPI::Lua_gettable) (lua_State *L, int idx)

◆ Lua_gettop

int(* PolyphaseEngineAPI::Lua_gettop) (lua_State *L)

◆ Lua_isfunction

int(* PolyphaseEngineAPI::Lua_isfunction) (lua_State *L, int idx)

◆ Lua_isnil

int(* PolyphaseEngineAPI::Lua_isnil) (lua_State *L, int idx)

◆ Lua_istable

int(* PolyphaseEngineAPI::Lua_istable) (lua_State *L, int idx)

◆ Lua_isuserdata

int(* PolyphaseEngineAPI::Lua_isuserdata) (lua_State *L, int idx)

◆ Lua_newuserdata

void *(* PolyphaseEngineAPI::Lua_newuserdata) (lua_State *L, size_t sz)

◆ Lua_pop

void(* PolyphaseEngineAPI::Lua_pop) (lua_State *L, int n)

◆ Lua_pushboolean

void(* PolyphaseEngineAPI::Lua_pushboolean) (lua_State *L, int b)

◆ Lua_pushinteger

void(* PolyphaseEngineAPI::Lua_pushinteger) (lua_State *L, long long n)

◆ Lua_pushnil

void(* PolyphaseEngineAPI::Lua_pushnil) (lua_State *L)

◆ Lua_pushnumber

void(* PolyphaseEngineAPI::Lua_pushnumber) (lua_State *L, double n)

◆ Lua_pushstring

void(* PolyphaseEngineAPI::Lua_pushstring) (lua_State *L, const char *s)

◆ Lua_pushvalue

void(* PolyphaseEngineAPI::Lua_pushvalue) (lua_State *L, int idx)

◆ Lua_rawget

void(* PolyphaseEngineAPI::Lua_rawget) (lua_State *L, int idx)

◆ Lua_rawset

void(* PolyphaseEngineAPI::Lua_rawset) (lua_State *L, int idx)

◆ Lua_setfield

void(* PolyphaseEngineAPI::Lua_setfield) (lua_State *L, int idx, const char *k)

◆ Lua_setglobal

void(* PolyphaseEngineAPI::Lua_setglobal) (lua_State *L, const char *name)

◆ Lua_setmetatable

int(* PolyphaseEngineAPI::Lua_setmetatable) (lua_State *L, int objindex)

◆ Lua_settable

void(* PolyphaseEngineAPI::Lua_settable) (lua_State *L, int idx)

◆ Lua_settop

void(* PolyphaseEngineAPI::Lua_settop) (lua_State *L, int idx)

◆ Lua_toboolean

int(* PolyphaseEngineAPI::Lua_toboolean) (lua_State *L, int idx)

◆ Lua_tonumber

double(* PolyphaseEngineAPI::Lua_tonumber) (lua_State *L, int idx)

◆ Lua_tostring

const char *(* PolyphaseEngineAPI::Lua_tostring) (lua_State *L, int idx)

◆ Lua_touserdata

void *(* PolyphaseEngineAPI::Lua_touserdata) (lua_State *L, int idx)

◆ Lua_type

int(* PolyphaseEngineAPI::Lua_type) (lua_State *L, int idx)

◆ LuaL_checkinteger

long long(* PolyphaseEngineAPI::LuaL_checkinteger) (lua_State *L, int arg)

◆ LuaL_checknumber

double(* PolyphaseEngineAPI::LuaL_checknumber) (lua_State *L, int arg)

◆ LuaL_checkstring

const char *(* PolyphaseEngineAPI::LuaL_checkstring) (lua_State *L, int arg)

◆ LuaL_checkudata

void *(* PolyphaseEngineAPI::LuaL_checkudata) (lua_State *L, int ud, const char *tname)

◆ LuaL_getmetatable

void(* PolyphaseEngineAPI::LuaL_getmetatable) (lua_State *L, const char *tname)

◆ LuaL_newmetatable

int(* PolyphaseEngineAPI::LuaL_newmetatable) (lua_State *L, const char *tname)

◆ LuaL_setfuncs

void(* PolyphaseEngineAPI::LuaL_setfuncs) (lua_State *L, const void *l, int nup)

◆ LuaL_setmetatable

void(* PolyphaseEngineAPI::LuaL_setmetatable) (lua_State *L, const char *tname)

◆ Node3D_AddRotation

void(* PolyphaseEngineAPI::Node3D_AddRotation) (Node3D *node, float x, float y, float z)

Add rotation to a Node3D in euler angles (degrees).

Parameters
nodeThe Node3D to modify
xX rotation delta in degrees
yY rotation delta in degrees
zZ rotation delta in degrees

◆ Node3D_GetPosition

void(* PolyphaseEngineAPI::Node3D_GetPosition) (Node3D *node, float *outX, float *outY, float *outZ)

Get the local position of a Node3D.

Parameters
nodeThe Node3D to query
outXOutput: X position
outYOutput: Y position
outZOutput: Z position

◆ Node3D_GetRotation

void(* PolyphaseEngineAPI::Node3D_GetRotation) (Node3D *node, float *outX, float *outY, float *outZ)

Get the local rotation of a Node3D in euler angles (degrees).

Parameters
nodeThe Node3D to query
outXOutput: X rotation in degrees
outYOutput: Y rotation in degrees
outZOutput: Z rotation in degrees

◆ Node3D_GetScale

void(* PolyphaseEngineAPI::Node3D_GetScale) (Node3D *node, float *outX, float *outY, float *outZ)

Get the local scale of a Node3D.

Parameters
nodeThe Node3D to query
outXOutput: X scale
outYOutput: Y scale
outZOutput: Z scale

◆ Node3D_SetPosition

void(* PolyphaseEngineAPI::Node3D_SetPosition) (Node3D *node, float x, float y, float z)

Set the local position of a Node3D.

Parameters
nodeThe Node3D to modify
xX position
yY position
zZ position

◆ Node3D_SetRotation

void(* PolyphaseEngineAPI::Node3D_SetRotation) (Node3D *node, float x, float y, float z)

Set the local rotation of a Node3D in euler angles (degrees).

Parameters
nodeThe Node3D to modify
xX rotation in degrees
yY rotation in degrees
zZ rotation in degrees

◆ Node3D_SetScale

void(* PolyphaseEngineAPI::Node3D_SetScale) (Node3D *node, float x, float y, float z)

Set the local scale of a Node3D.

Parameters
nodeThe Node3D to modify
xX scale
yY scale
zZ scale

◆ PlaySound2D

void(* PolyphaseEngineAPI::PlaySound2D) (SoundWave *sound, float volume, float pitch)

Play a 2D sound (non-positional).

Parameters
soundSound wave asset to play
volumeVolume multiplier (0.0 - 1.0+)
pitchPitch multiplier (1.0 = normal)

◆ SetMasterVolume

void(* PolyphaseEngineAPI::SetMasterVolume) (float volume)

Set the master audio volume.

Parameters
volumeVolume (0.0 - 1.0)

◆ SpawnNode

Node *(* PolyphaseEngineAPI::SpawnNode) (World *world, const char *typeName)

Spawn a node of the given type in a world.

Parameters
worldWorld to spawn in
typeNameType name of node to spawn (e.g., "Mesh3D", "Camera3D")
Returns
Newly spawned node, or nullptr on failure

◆ StopAllSounds

void(* PolyphaseEngineAPI::StopAllSounds) ()

Stop all currently playing sounds.

◆ TinyLLM_Decode

int32_t(* PolyphaseEngineAPI::TinyLLM_Decode) (Asset *model, int32_t prevToken, int32_t token, char *outStr, int32_t maxLen)

Decode a token to string using a TinyLLMAsset's tokenizer.

Parameters
modelTinyLLMAsset pointer
prevTokenPrevious token (for space handling)
tokenToken to decode
outStrOutput buffer (caller allocates)
maxLenSize of output buffer
Returns
Length of decoded string, or -1 on error

◆ TinyLLM_Encode

int32_t(* PolyphaseEngineAPI::TinyLLM_Encode) (Asset *model, const char *text, bool addBos, bool addEos, int32_t *outTokens, int32_t maxTokens)

Encode text to tokens using a TinyLLMAsset's tokenizer.

Parameters
modelTinyLLMAsset pointer
textText to encode
addBosAdd BOS token
addEosAdd EOS token
outTokensOutput buffer for tokens (caller allocates)
maxTokensSize of output buffer
Returns
Number of tokens written, or -1 on error

◆ UnloadAsset

void(* PolyphaseEngineAPI::UnloadAsset) (const char *name)

Unload an asset by name.

Parameters
nameAsset name to unload

The documentation for this struct was generated from the following file: