API Functions

ARGB32

int(int r, int g, int b)
int(int r, int g, int b, int a)

Create a 32 bit integer ARGB color.

ARGB32ToRGBA32

int(int argb)

Convert a 32 bit integer ARGB color to RGBA.

Abs

Vec4(Vec4 v)
Vec3(Vec3 v)
number(number v)
int(int v)

Return the absolute value of the function input. For vectors, the absolute value is applied to each component individually and the resulting vector is returned.

AddAssetsFolder

boolean(string path)

Mount a local filesystem folder as an assets source.

See Resources & Assets.

AddAssetsPackage

boolean(string path)

Mount an archive stored on the local filesystem as an assets source.

See Resources & Assets.

AlphaScale

Color(Color color, number k)

Scale the alpha component of the input color.

ApplyBloom

int(int view_id, IntRect rect, Texture input, FrameBufferHandle output, Bloom bloom, number threshold, number smoothness, number intensity)

Process input texture and generate a bloom overlay on top of output, input and output must be of the same size.

Use CreateBloomFromFile/CreateBloomFromAssets to create a Bloom object and DestroyBloom to destroy its internal resources after usage.

AudioInit

boolean()

Initialize the audio system.

AudioShutdown

nil()

Shutdown the audio system.

BaseToEuler

Vec3(Vec3 z)
Vec3(Vec3 z, Vec3 y)

Compute the Euler angles triplet for the provided z direction. The up-vector y can be provided to improve coherency of the returned values over time.

BeginProfilerSection

int(string name)
int(string name, string section_details)

Begin a named profiler section. Call EndProfilerSection to end the section.

CaptureProfilerFrame

ProfilerFrame()

Capture the current profiler frame but do not end it. See EndProfilerFrame to capture and end the current profiler frame.

See PrintProfilerFrame to print a profiler frame to the console.

CaptureTexture

int(PipelineResources resources, TextureRef tex, Picture pic)

Capture a texture content to a Picture. Return the frame counter at which the capture will be complete.

A Picture object can be accessed by the CPU.

This function is asynchronous and its result will not be available until the returned frame counter is equal or greater to the frame counter returned by Frame.

Cast_Pipeline_To_ForwardPipeline

ForwardPipeline(Pipeline o)

Ceil

Vec3(Vec3 v)

Returns a vector whose elements are equal to the nearest integer greater than or equal to the vector elements.

ChromaScale

Color(Color color, number k)

Return a copy of the color with its saturation scaled as specified.

Clamp

Vec3(Vec3 v, number min, number max)
Vec3(Vec3 v, Vec3 min, Vec3 max)
number(number v, number min, number max)
int(int v, int min, int max)
Color(Color color, number min, number max)
Color(Color color, Color min, Color max)

Return a vector whose elements are equal to the vector elements clipped to the specified interval.

ClampLen

Vec3(Vec3 v, number min, number max)

Returns a vector in the same direction as the specified vector, but with its length clipped by the specified interval.

ClassifyLine

boolean, Vec3, Vec3(MinMax minmax, Vec3 position, Vec3 direction)

Return true if the provided line intersect the bounding volume, false otherwise.

ClassifySegment

boolean, Vec3, Vec3(MinMax minmax, Vec3 p0, Vec3 p1)

Return true if the provided segment intersect the bounding volume, false otherwise.

CleanPath

string(string path)

Cleanup a local filesystem path according to the host platform conventions.

  • Remove redundant folder separators.
  • Remove redundant . and .. folder entries.
  • Ensure forward slash (/) folder separators on Unix and back slash (\) folder separators on Windows.

ClipSpaceToScreenSpace

Vec3(Vec3 clip, Vec2 resolution)

Convert a 3d position in clip space (homogeneous space) to a 2d position on screen.

Close

boolean(File file)

Close a file handle.

Cm

number(number cm)

Convert a value in centimeters to the Harfang internal unit system.

See Coordinates and Units System.

ColorFromABGR32

Color(int rgba32)

Create a color from a 32 bit ABGR integer.

ColorFromRGBA32

Color(int rgba32)

Create a color from a 32 bit RGBA integer.

ColorFromVector3

Color(Vec3 v)

Create a color from a 3d vector, alpha defaults to 1.

ColorFromVector4

Color(Vec4 v)

Return a 4-dimensional vector as a color.

ColorI

Color(int r, int g, int b)
Color(int r, int g, int b, int a)

Create a color from integer values in the [0;255] range.

ColorToABGR32

int(Color color)

Return a 32 bit ABGR integer from a color.

ColorToGrayscale

number(Color color)

Return the grayscale representation of a color. A weighted average is used to account for human perception of colors.

ColorToRGBA32

int(Color color)

Return a 32 bit RGBA integer from a color.

Compute2DProjectionMatrix

Mat44(number znear, number zfar, number res_x, number res_y, boolean y_up)

Returns a projection matrix from a 2D space to the 3D world, as required by SetViewTransform for example.

ComputeAspectRatioX

Vec2(number width, number height)

Compute the aspect ratio factor for the provided viewport dimensions. Use this method to compute aspect ratio for landscape display.

See ComputeAspectRatioY.

ComputeAspectRatioY

Vec2(number width, number height)

Compute the aspect ratio factor for the provided viewport dimensions. Use this method to compute aspect ratio for portrait display.

See ComputeAspectRatioX.

ComputeMinMaxBoundingSphere

Vec3, number(MinMax minmax)

Compute the bounding sphere for the provided axis-aligned bounding box.

ComputeOrthographicProjectionMatrix

Mat44(number znear, number zfar, number size, Vec2 aspect_ratio)
Mat44(number znear, number zfar, number size, Vec2 aspect_ratio, Vec2 offset)

Compute an orthographic projection matrix.

An orthographic projection has no perspective and all lines parrallel in 3d space will still appear parrallel on screen after projection using the returned matrix.

The size parameter controls the extends of the projected view. When projecting a 3d world this parameter is expressed in meters. Use the aspect_ratio parameter to prevent distortion from induced by non-square viewport.

See ComputeAspectRatioX or ComputeAspectRatioY to compute an aspect ratio factor in paysage or portrait mode.

ComputeOrthographicViewState

ViewState(Mat4 world, number size, number znear, number zfar, Vec2 aspect_ratio)

Compute an orthographic view state.

The size parameter controls the extends of the projected view. When projecting a 3d world this parameter is expressed in meters. Use the aspect_ratio parameter to prevent distortion from induced by non-square viewport.

See ComputeOrthographicProjectionMatrix, ComputeAspectRatioX and ComputeAspectRatioY.

ComputePerspectiveProjectionMatrix

Mat44(number znear, number zfar, number zoom_factor, Vec2 aspect_ratio)
Mat44(number znear, number zfar, number zoom_factor, Vec2 aspect_ratio, Vec2 offset)

Compute a perspective projection matrix, , fov is the field of view angle, see Deg and Rad.

See ZoomFactorToFov, FovToZoomFactor, ComputeAspectRatioX and ComputeAspectRatioY.

ComputePerspectiveViewState

ViewState(Mat4 world, number fov, number znear, number zfar, Vec2 aspect_ratio)

Compute a perspective view state.

See ComputePerspectiveProjectionMatrix, ZoomFactorToFov, FovToZoomFactor, ComputeAspectRatioX and ComputeAspectRatioY.

ComputeRenderState

RenderState(BlendMode blend)
RenderState(BlendMode blend, DepthTest depth_test)
RenderState(BlendMode blend, DepthTest depth_test, FaceCulling culling)
RenderState(BlendMode blend, DepthTest depth_test, FaceCulling culling, boolean write_z)
RenderState(BlendMode blend, DepthTest depth_test, FaceCulling culling, boolean write_z, boolean write_r)
RenderState(BlendMode blend, DepthTest depth_test, FaceCulling culling, boolean write_z, boolean write_r, boolean write_g)
RenderState(BlendMode blend, DepthTest depth_test, FaceCulling culling, boolean write_z, boolean write_r, boolean write_g, boolean write_b)
RenderState(BlendMode blend, DepthTest depth_test, FaceCulling culling, boolean write_z, boolean write_r, boolean write_g, boolean write_b, boolean write_a)
RenderState(BlendMode blend, boolean write_z)
RenderState(BlendMode blend, boolean write_z, boolean write_r)
RenderState(BlendMode blend, boolean write_z, boolean write_r, boolean write_g)
RenderState(BlendMode blend, boolean write_z, boolean write_r, boolean write_g, boolean write_b)
RenderState(BlendMode blend, boolean write_z, boolean write_r, boolean write_g, boolean write_b, boolean write_a)

Compute a render state to control subsequent render calls culling mode, blending mode, Z mask, etc… The same render state can be used by different render calls.

See DrawLines, DrawTriangles and DrawModel.

ComputeSAO

nil(int view_id, IntRect rect, Texture attr0, Texture attr1, Texture noise, FrameBufferHandle output, SAO sao, Mat44 projection, number bias, number radius, int sample_count, number sharpness)

ComputeSortKey

int(number view_depth)

Compute a sorting key to control the rendering order of a display list, view_depth is expected in view space.

ComputeSortKeyFromWorld

int(Vec3 T, Mat4 view)
int(Vec3 T, Mat4 view, Mat4 model)

Compute a sorting key to control the rendering order of a display list.

ComputeTextHeight

number(Font font, string text)

Compute the height of a text string.

ComputeTextRect

Rect(Font font, string text)
Rect(Font font, string text, number xpos)
Rect(Font font, string text, number xpos, number ypos)

Compute the width and height of a text string.

Contains

boolean(MinMax minmax, Vec3 position)

Return true if the provided position is inside the bounding volume, false otherwise.

CopyDir

boolean(string src, string dst)

Copy a directory on the local filesystem, this function does not recurse through subdirectories.

See CopyDirRecursive.

CopyDirRecursive

boolean(string src, string dst)

Copy a directory on the local filesystem, recurse through subdirectories.

CopyFile

boolean(string src, string dst)

Copy a file on the local filesystem.

CosineInterpolate

number(number y0, number y1, number t)

Compute the cosine interpolated value between y0 and y1 at t.

See LinearInterpolate, CubicInterpolate and HermiteInterpolate.

CreateBloomFromAssets

Bloom(string path, BackbufferRatio ratio)

CreateBloomFromFile

Bloom(string path, BackbufferRatio ratio)

CreateCamera

Node(Scene scene, Mat4 mtx, number znear, number zfar)
Node(Scene scene, Mat4 mtx, number znear, number zfar, number fov)

Create a new Node with a Transform and Camera components.

CreateCapsuleModel

Model(VertexLayout decl, number radius, number height, int subdiv_x, int subdiv_y)

Create a capsule render model.

See CreateCubeModel, CreateConeModel, CreateCylinderModel, CreatePlaneModel, CreateSphereModel and DrawModel.

CreateConeModel

Model(VertexLayout decl, number radius, number height, int subdiv_x)

Create a cone render model.

See CreateCubeModel, CreateConeModel, CreateCylinderModel, CreatePlaneModel, CreateSphereModel and DrawModel.

CreateCubeModel

Model(VertexLayout decl, number x, number y, number z)

Create a cube render model.

See CreateCubeModel, CreateConeModel, CreateCylinderModel, CreatePlaneModel, CreateSphereModel and DrawModel.

CreateCylinderModel

Model(VertexLayout decl, number radius, number height, int subdiv_x)

Create a cylinder render model.

See CreateCubeModel, CreateConeModel, CreateCylinderModel, CreatePlaneModel, CreateSphereModel and DrawModel.

CreateForwardPipeline

ForwardPipeline()
ForwardPipeline(int shadow_map_resolution)
ForwardPipeline(int shadow_map_resolution, boolean spot_16bit_shadow_map)

Create a forward pipeline and its resources.

See DestroyForwardPipeline.

CreateForwardPipelineAAAFromAssets

ForwardPipelineAAA(string path, ForwardPipelineAAAConfig config)
ForwardPipelineAAA(string path, ForwardPipelineAAAConfig config, BackbufferRatio ssgi_ratio)
ForwardPipelineAAA(string path, ForwardPipelineAAAConfig config, BackbufferRatio ssgi_ratio, BackbufferRatio ssr_ratio)

CreateForwardPipelineAAAFromFile

ForwardPipelineAAA(string path, ForwardPipelineAAAConfig config)
ForwardPipelineAAA(string path, ForwardPipelineAAAConfig config, BackbufferRatio ssgi_ratio)
ForwardPipelineAAA(string path, ForwardPipelineAAAConfig config, BackbufferRatio ssgi_ratio, BackbufferRatio ssr_ratio)

CreateFrameBuffer

FrameBuffer(Texture color, Texture depth, string name)
FrameBuffer(TextureFormat color_format, TextureFormat depth_format, int aa, string name)
FrameBuffer(int width, int height, TextureFormat color_format, TextureFormat depth_format, int aa, string name)

Create a framebuffer and its texture attachments.

See DestroyFrameBuffer.

CreateInstanceFromAssets

Node, boolean(Scene scene, Mat4 mtx, string name, PipelineResources resources, PipelineInfo pipeline)
Node, boolean(Scene scene, Mat4 mtx, string name, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

Helper function to create a Node with a Transform and an Instance component.

The instance component will be setup and its resources loaded from the assets system.

See Resources & Assets.

CreateInstanceFromFile

Node, boolean(Scene scene, Mat4 mtx, string name, PipelineResources resources, PipelineInfo pipeline)
Node, boolean(Scene scene, Mat4 mtx, string name, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

Helper function to create a Node with a Transform and an Instance component.

The instance component will be setup and its resources loaded from the local filesystem.

See Resources & Assets.

CreateLinearLight

Node(Scene scene, Mat4 mtx)
Node(Scene scene, Mat4 mtx, Color diffuse)
Node(Scene scene, Mat4 mtx, Color diffuse, Color specular)
Node(Scene scene, Mat4 mtx, Color diffuse, Color specular, number priority)
Node(Scene scene, Mat4 mtx, Color diffuse, Color specular, number priority, LightShadowType shadow_type)
Node(Scene scene, Mat4 mtx, Color diffuse, Color specular, number priority, LightShadowType shadow_type, number shadow_bias, Vec4 pssm_split)
Node(Scene scene, Mat4 mtx, Color diffuse, number diffuse_intensity)
Node(Scene scene, Mat4 mtx, Color diffuse, number diffuse_intensity, Color specular)
Node(Scene scene, Mat4 mtx, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity)
Node(Scene scene, Mat4 mtx, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity, number priority)
Node(Scene scene, Mat4 mtx, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity, number priority, LightShadowType shadow_type)
Node(Scene scene, Mat4 mtx, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity, number priority, LightShadowType shadow_type, number shadow_bias, Vec4 pssm_split)

Helper function to create a Node with a Transform and a Light component.

CreateMaterial

Material(PipelineProgramRef prg)
Material(PipelineProgramRef prg, string value_name, Vec4 value)
Material(PipelineProgramRef prg, string value_name_0, Vec4 value_0, string value_name_1, Vec4 value_1)

Helper function to create a material.

See SetMaterialProgram, SetMaterialValue and SetMaterialTexture.

CreateMissingMaterialProgramValuesFromAssets

nil(Material mat, PipelineResources resources)

This function scans the material program uniforms and creates a corresponding entry in the material if missing.

Resources are loaded from the asset system if a default uniform value requires it.

See Resources & Assets.

CreateMissingMaterialProgramValuesFromFile

nil(Material mat, PipelineResources resources)

This function scans the material program uniforms and creates a corresponding entry in the material if missing.

Resources are loaded from the local filesystem if a default uniform value requires it.

CreateObject

Node(Scene scene, Mat4 mtx, ModelRef model, MaterialList materials)

Create a Node with a Transform and Object components.

CreateOrthographicCamera

Node(Scene scene, Mat4 mtx, number znear, number zfar)
Node(Scene scene, Mat4 mtx, number znear, number zfar, number size)

Create a Node with a Transform and a Camera component.

CreatePhysicCube

Node(Scene scene, Vec3 size, Mat4 mtx, ModelRef model_ref, MaterialList materials)
Node(Scene scene, Vec3 size, Mat4 mtx, ModelRef model_ref, MaterialList materials, number mass)

Create a Node with a Transform, Object and RigidBody components.

CreatePhysicSphere

Node(Scene scene, number radius, Mat4 mtx, ModelRef model_ref, MaterialList materials)
Node(Scene scene, number radius, Mat4 mtx, ModelRef model_ref, MaterialList materials, number mass)

Create a Node with a Transform, Object and RigidBody components.

CreatePlaneModel

Model(VertexLayout decl, number width, number length, int subdiv_x, int subdiv_z)

Create a plane render model.

CreatePointLight

Node(Scene scene, Mat4 mtx, number radius)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, Color specular)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, Color specular, number priority)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, Color specular, number priority, LightShadowType shadow_type)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, Color specular, number priority, LightShadowType shadow_type, number shadow_bias)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, number diffuse_intensity)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, number diffuse_intensity, Color specular)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity, number priority)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity, number priority, LightShadowType shadow_type)
Node(Scene scene, Mat4 mtx, number radius, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity, number priority, LightShadowType shadow_type, number shadow_bias)

Create a Node with a Transform and a Light component.

CreateSAOFromAssets

SAO(string path, BackbufferRatio ratio)

CreateSAOFromFile

SAO(string path, BackbufferRatio ratio)

CreateSceneRootNode

Node(Scene scene, string name, Mat4 mtx)

Helper function to create a Node with a Transform component then parent all root nodes in the scene to it.

CreateScript

Node(Scene scene)
Node(Scene scene, string path)

Helper function to create a Node with a Script component.

CreateSphereModel

Model(VertexLayout decl, number radius, int subdiv_x, int subdiv_y)

Create a sphere render model.

See CreateCubeModel, CreateConeModel, CreateCylinderModel, CreatePlaneModel, CreateSphereModel and DrawModel.

CreateSpotLight

Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, Color specular)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, Color specular, number priority)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, Color specular, number priority, LightShadowType shadow_type)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, Color specular, number priority, LightShadowType shadow_type, number shadow_bias)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, number diffuse_intensity)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, number diffuse_intensity, Color specular)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity, number priority)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity, number priority, LightShadowType shadow_type)
Node(Scene scene, Mat4 mtx, number radius, number inner_angle, number outer_angle, Color diffuse, number diffuse_intensity, Color specular, number specular_intensity, number priority, LightShadowType shadow_type, number shadow_bias)

Create a Node with a Transform and a Light component.

CreateTexture

Texture(int width, int height, string name, TextureFlags flags)
Texture(int width, int height, string name, TextureFlags flags, TextureFormat format)

Create an empty texture.

See CreateTextureFromPicture and UpdateTextureFromPicture.

CreateTextureFromPicture

Texture(Picture pic, string name, TextureFlags flags)
Texture(Picture pic, string name, TextureFlags flags, TextureFormat format)

Create a texture from a picture.

See Picture, CreateTexture and UpdateTextureFromPicture.

Crop

Rect(Rect rect, number left, number top, number right, number bottom)
IntRect(IntRect rect, int left, int top, int right, int bottom)

Crop a rectangle. Remove the specified amount of units on each side of the rectangle.

See Grow.

Cross

Vec3(Vec3 a, Vec3 b)

Return the cross product of two vectors.

CrossProductMat3

Mat3(Vec3 V)

Creates a matrix M so that Mv = p⨯v.

Simply put, multiplying this matrix to any vector v is equivalent to compute the cross product between p and v.

CubicInterpolate

number(number y0, number y1, number y2, number y3, number t)
Vec3(Vec3 v0, Vec3 v1, Vec3 v2, Vec3 v3, number t)

Perform a cubic interpolation across four values with t in the [0;1] range between y1 and y2.

See LinearInterpolate, CosineInterpolate and HermiteInterpolate.

CutFileExtension

string(string path)

Return a file path with its extension stripped.

See CutFilePath and CutFileName.

CutFileName

string(string path)

Return the name part of a file path. All folder navigation and extension are stripped.

See CutFileExtension and CutFilePath.

CutFilePath

string(string path)

Return the folder navigation part of a file path. The file name and its extension are stripped.

See CutFileExtension and CutFileName.

Debug

nil(string msg)
nil(string msg, string details)

DebugSceneExplorer

nil(Scene scene, string name)

Decompose

Vec3, Vec3, Vec3(Mat4 m)
Vec3, Vec3, Vec3(Mat4 m, RotationOrder rotation_order)

Decompose a transformation matrix into its translation, scaling and rotation components.

Deg

number(number degrees)

Convert an angle in degrees to the engine unit system.

See Coordinates and Units System.

Deg3

Vec3(number x, number y, number z)

Convert a triplet of angles in degrees to the engine unit system.

See Coordinates and Units System.

DegreeToRadian

number(number degrees)

Convert an angle in degrees to radians.

DestroyBloom

nil(Bloom bloom)

Destroy a bloom post process object and all associated resources.

DestroyForwardPipeline

nil(ForwardPipeline pipeline)

Destroy a forward pipeline object.

DestroyForwardPipelineAAA

nil(ForwardPipelineAAA pipeline)

DestroyFrameBuffer

nil(FrameBuffer frameBuffer)

Destroy a frame buffer and its resources.

DestroyProgram

nil(ProgramHandle h)

Destroy a shader program.

DestroySAO

nil(SAO sao)

Destroy an ambient occlusion post process object and its resources.

DestroyTexture

nil(Texture tex)

Destroy a texture object.

DestroyWindow

boolean(Window window)

Destroy a window object.

Det

number(Mat3 m)

Return the determinant of a matrix.

Dist

number(Vec2 a, Vec2 b)
int(iVec2 a, iVec2 b)
number(Quaternion a, Quaternion b)
number(Vec3 a, Vec3 b)

Return the Euclidean distance between two vectors.

Dist2

number(Vec2 a, Vec2 b)
int(iVec2 a, iVec2 b)
number(Vec3 a, Vec3 b)

Return the squared Euclidean distance between two vectors.

DistanceToPlane

number(Vec4 plane, Vec3 p)

Return the signed distance from point p to a plane.

  • Distance is positive if p is in front of the plane, meaning that the plane normal is pointing towards p.
  • Distance is negative if p is behind the plane, meaning that the plane normal is pointing away from p.
  • Distance is 0.0 if p is lying on the plane.

Dot

number(Vec2 a, Vec2 b)
int(iVec2 a, iVec2 b)
number(Vec3 a, Vec3 b)

Return the dot product of two vectors.

DrawLines

nil(int view_id, Vertices vtx, ProgramHandle prg)
nil(int view_id, Vertices vtx, ProgramHandle prg, RenderState render_state)
nil(int view_id, Vertices vtx, ProgramHandle prg, RenderState render_state, int depth)
nil(int view_id, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures)
nil(int view_id, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState render_state)
nil(int view_id, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState render_state, int depth)
nil(int view_id, UInt16List idx, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures)
nil(int view_id, UInt16List idx, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState render_state)
nil(int view_id, UInt16List idx, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState render_state, int depth)

Draw a list of lines to the specified view.

Use UniformSetValueList and UniformSetTextureList to pass uniform values to the shader program.

DrawModel

nil(int view_id, Model mdl, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, Mat4 matrix)
nil(int view_id, Model mdl, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, Mat4 matrix, RenderState render_state)
nil(int view_id, Model mdl, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, Mat4 matrix, RenderState render_state, int depth)
nil(int view_id, Model mdl, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, Mat4List matrices)
nil(int view_id, Model mdl, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, Mat4List matrices, RenderState render_state)
nil(int view_id, Model mdl, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, Mat4List matrices, RenderState render_state, int depth)

Draw a model to the specified view.

Use UniformSetValueList and UniformSetTextureList to pass uniform values to the shader program.

DrawSprites

nil(int view_id, Mat3 inv_view_R, VertexLayout vtx_layout, Vec3List pos, Vec2 size, ProgramHandle prg)
nil(int view_id, Mat3 inv_view_R, VertexLayout vtx_layout, Vec3List pos, Vec2 size, ProgramHandle prg, RenderState state)
nil(int view_id, Mat3 inv_view_R, VertexLayout vtx_layout, Vec3List pos, Vec2 size, ProgramHandle prg, RenderState state, int depth)
nil(int view_id, Mat3 inv_view_R, VertexLayout vtx_layout, Vec3List pos, Vec2 size, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures)
nil(int view_id, Mat3 inv_view_R, VertexLayout vtx_layout, Vec3List pos, Vec2 size, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState state)
nil(int view_id, Mat3 inv_view_R, VertexLayout vtx_layout, Vec3List pos, Vec2 size, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState state, int depth)

Draw a list of sprites to the specified view.

Use UniformSetValueList and UniformSetTextureList to pass uniform values to the shader program.

Note: This function prepares the sprite on the CPU before submitting them all to the GPU as a single draw call.

DrawText

nil(int view_id, Font font, string text, ProgramHandle prg, string page_uniform, int page_stage, Mat4 mtx)
nil(int view_id, Font font, string text, ProgramHandle prg, string page_uniform, int page_stage, Mat4 mtx, Vec3 pos)
nil(int view_id, Font font, string text, ProgramHandle prg, string page_uniform, int page_stage, Mat4 mtx, Vec3 pos, DrawTextHAlign halign, DrawTextVAlign valign)
nil(int view_id, Font font, string text, ProgramHandle prg, string page_uniform, int page_stage, Mat4 mtx, Vec3 pos, DrawTextHAlign halign, DrawTextVAlign valign, UniformSetValueList values, UniformSetTextureList textures)
nil(int view_id, Font font, string text, ProgramHandle prg, string page_uniform, int page_stage, Mat4 mtx, Vec3 pos, DrawTextHAlign halign, DrawTextVAlign valign, UniformSetValueList values, UniformSetTextureList textures, RenderState state)
nil(int view_id, Font font, string text, ProgramHandle prg, string page_uniform, int page_stage, Mat4 mtx, Vec3 pos, DrawTextHAlign halign, DrawTextVAlign valign, UniformSetValueList values, UniformSetTextureList textures, RenderState state, int depth)

Write text to the specified view using the provided shader program and uniform values.

DrawTriangles

nil(int view_id, Vertices vtx, ProgramHandle prg)
nil(int view_id, Vertices vtx, ProgramHandle prg, RenderState state)
nil(int view_id, Vertices vtx, ProgramHandle prg, RenderState state, int depth)
nil(int view_id, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures)
nil(int view_id, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState state)
nil(int view_id, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState state, int depth)
nil(int view_id, UInt16List idx, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures)
nil(int view_id, UInt16List idx, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState state)
nil(int view_id, UInt16List idx, Vertices vtx, ProgramHandle prg, UniformSetValueList values, UniformSetTextureList textures, RenderState state, int depth)

Draw a list of triangles to the specified view.

Use UniformSetValueList and UniformSetTextureList to pass uniform values to the shader program.

DuplicateNodeAndChildrenFromAssets

NodeList(Scene scene, Node node, PipelineResources resources, PipelineInfo pipeline)

Duplicate a node and its child hierarchy. Resources will be loaded from the assets system.

See Resources & Assets.

DuplicateNodeAndChildrenFromFile

NodeList(Scene scene, Node node, PipelineResources resources, PipelineInfo pipeline)

Duplicate a node and its child hierarchy. Resources will be loaded from the local filesystem.

See Resources & Assets.

DuplicateNodeFromAssets

Node(Scene scene, Node node, PipelineResources resources, PipelineInfo pipeline)

Duplicate a node. Resources will be loaded from the assets system.

See Resources & Assets.

DuplicateNodeFromFile

Node(Scene scene, Node node, PipelineResources resources, PipelineInfo pipeline)

Duplicate a node. Resources will be loaded from the local filesystem.

See Resources & Assets.

DuplicateNodesAndChildrenFromAssets

NodeList(Scene scene, NodeList nodes, PipelineResources resources, PipelineInfo pipeline)

Duplicate each node and children hierarchy of a list. Resources will be loaded from the assets system.

See Resources & Assets.

DuplicateNodesAndChildrenFromFile

NodeList(Scene scene, NodeList nodes, PipelineResources resources, PipelineInfo pipeline)

Duplicate each node and children hierarchy of a list. Resources will be loaded from the local filesystem.

See Resources & Assets.

DuplicateNodesFromAssets

NodeList(Scene scene, NodeList nodes, PipelineResources resources, PipelineInfo pipeline)

Duplicate each node of a list. Resources will be loaded from the assets system.

DuplicateNodesFromFile

NodeList(Scene scene, NodeList nodes, PipelineResources resources, PipelineInfo pipeline)

Duplicate each node of a list. Resources will be loaded from the local filesystem.

See Resources & Assets.

EndProfilerFrame

ProfilerFrame()

End a profiler frame and return it.

See PrintProfilerFrame to print a profiler frame to the console.

EndProfilerSection

nil(int section_idx)

End a named profiler section. Call BeginProfilerSection to begin a new section.

Error

nil(string msg)
nil(string msg, string details)

Exists

boolean(string path)

Return true if a file exists on the local filesystem, false otherwise.

ExtractZRangeFromOrthographicProjectionMatrix

number, number(Mat44 m)

ExtractZRangeFromPerspectiveProjectionMatrix

number, number(Mat44 m)

ExtractZRangeFromProjectionMatrix

number, number(Mat44 m)

Extract z near and z far clipping range from a projection matrix.

ExtractZoomFactorFromProjectionMatrix

number(Mat44 m)

Extract zoom factor from a projection matrix.

See ZoomFactorToFov.

FRRand

number()
number(number range_start)
number(number range_start, number range_end)

Return a random floating point value in the provided range, default range is [-1;1].

FRand

number()
number(number range)

Return a random floating point value in the provided range, default range is [0;1].

See Rand to generate a random integer value.

FaceForward

Vec3(Vec3 v, Vec3 d)

Return the provided vector facing toward the provided direction. If the angle between v and d is less than 90° then v is returned unchanged, v will be returned reversed otherwise.

FactorizePath

string(string path)

Return the input path with all redundant navigation entries stripped (folder separator, .. and . entries).

FileToString

string(string path)

Return the content of a local filesystem as a string.

FitsInside

boolean(Rect a, Rect b)
boolean(IntRect a, IntRect b)

Return wether a fits in b.

Floor

Vec3(Vec3 v)

Returns a vector whose elements are equal to the nearest integer less than or equal to the vector elements.

FovToZoomFactor

number(number fov)

Convert from a fov value in radian to a zoom factor value in meters.

FpsController

nil(boolean key_up, boolean key_down, boolean key_left, boolean key_right, boolean btn, number dx, number dy, Vec3 pos, Vec3 rot, number speed, int dt_t)
nil(Keyboard keyboard, Mouse mouse, Vec3 pos, Vec3 rot, number speed, int dt)

Implement a first-person-shooter like controller.

The input position and rotation parameters are returned modified according to the state of the control keys.

This function is usually used by passing the current camera position and rotation then updating the camera transformation with the returned values.

Frame

int()

Advance the rendering backend to the next frame, execute all queued rendering commands. This function returns the backend current frame.

The frame counter is used by asynchronous functions such as CaptureTexture. You must wait for the frame counter to reach or exceed the value returned by an asynchronous function before accessing its result.

FromHLS

Color(Color color)

Convert input hue/luminance/saturation color to RGBA, alpha channel is left unmodified.

GaussianBlurIsoSurface

IsoSurface(IsoSurface surface, int width, int height, int depth)

Apply a Gaussian blur to an iso-surface.

GetArea

number(MinMax minmax)

Return the area of the volume.

GetCenter

Vec3(MinMax minmax)

Return the center position of the volume.

GetClock

int()

Return the current clock since the last call to TickClock or ResetClock.

See time_to_sec_f to convert the returned time to second.

GetClockDt

int()

Return the elapsed time recorded during the last call to TickClock.

GetColorTexture

Texture(FrameBuffer frameBuffer)

Retrieves color texture attachment.

GetColumn

Vec3(Mat3 m, int n)
Vec3(Mat4 m, int n)
Vec4(Mat44 m, int idx)

Returns the nth column.

GetCurrentWorkingDirectory

string()

Return the system current working directory.

GetDepthTexture

Texture(FrameBuffer frameBuffer)

Retrieves depth texture attachment.

GetFileExtension

string(string path)

Return the extension part of a file path.

GetFileName

string(string path)

Return the name part of a file path (including its extension).

GetFilePath

string(string path)

Return the path part of a file path (excluding file name and extension).

GetForwardPipelineInfo

PipelineInfo()

Return the pipeline info object for the forward pipeline.

GetGamepadNames

StringList()

Return a list of names for all supported gamepad devices on the system.

See ReadGamepad.

GetHeight

number(Rect rect)
int(IntRect rect)

Return the height of a rectangle.

GetJoystickDeviceNames

StringList()

GetJoystickNames

StringList()

GetJsonBool

boolean, boolean(JSON js, string key)

Return the value of a boolean JSON key.

GetJsonFloat

boolean, number(JSON js, string key)

Return the value of a float JSON key.

GetJsonInt

boolean, int(JSON js, string key)

Return the value of an integer JSON key.

GetJsonString

boolean, string(JSON js, string key)

Return the value of a string JSON key.

GetKeyName

string(Key key)
string(Key key, string name)

Return the name for a keyboard key.

GetKeyboardNames

StringList()

Return a list of names for all supported keyboard devices on the system.

See ReadKeyboard.

GetMaterialAlphaCut

boolean(Material mat)

GetMaterialAmbientUsesUV1

boolean(Material mat)

GetMaterialBlendMode

BlendMode(Material mat)

Return a material blending mode.

GetMaterialDepthTest

DepthTest(Material mat)

Return a material depth test function.

GetMaterialDiffuseUsesUV1

boolean(Material mat)

GetMaterialFaceCulling

FaceCulling(Material mat)

Return a material culling mode.

GetMaterialNormalMapInWorldSpace

boolean(Material mat)

GetMaterialSkinning

boolean(Material mat)

GetMaterialSpecularUsesUV1

boolean(Material mat)

GetMaterialTexture

TextureRef(Material mat, string name)

Return the texture reference assigned to a material named uniform.

GetMaterialTextures

StringList(Material mat)

Return the list of names of a material texture uniforms.

GetMaterialValues

StringList(Material mat)

Return the list of names of a material value uniforms.

GetMaterialWriteRGBA

boolean, boolean, boolean, boolean(Material mat)

Return the material color mask.

GetMaterialWriteZ

boolean(Material mat)

Return the material depth write mask.

GetMonitorModes

boolean, MonitorModeList(Monitor monitor)

Return the list of supported monitor modes.

GetMonitorName

string(Monitor monitor)

Return the monitor name.

GetMonitorRect

IntRect(Monitor monitor)

Returns a rectangle going from the position, in screen coordinates, of the upper-left corner of the specified monitor to the position of the lower-right corner.

GetMonitorSizeMM

iVec2(Monitor monitor)

Returns the size, in millimetres, of the display area of the specified monitor.

GetMonitors

MonitorList()

Return a list of monitors connected to the system.

GetMouseNames

StringList()

Return a list of names for all supported mouse devices on the system.

See ReadKeyboard.

GetNodePairContacts

ContactList(Node first, Node second, NodePairContacts node_pair_contacts)

GetNodesInContact

NodeList(Scene scene, Node with, NodePairContacts node_pair_contacts)

GetR

Vec3(Mat4 m)
Vec3(Mat4 m, RotationOrder rotation_order)

See GetRotation.

GetRMatrix

Mat3(Mat4 m)

See GetRotationMatrix.

GetRotation

Vec3(Mat4 m)
Vec3(Mat4 m, RotationOrder rotation_order)

Return the rotation component of a transformation matrix as a Euler triplet.

GetRotationMatrix

Mat3(Mat4 m)

Return the rotation component of a transformation matrix as a Mat3 rotation matrix.

GetRow

Vec3(Mat3 m, int n)
Vec4(Mat4 m, int n)
Vec4(Mat44 m, int idx)

Returns the nth row of a matrix.

GetS

Vec3(Mat4 m)

See GetScale.

GetScale

Vec3(Mat3 m)
Vec3(Mat4 m)

Return the scale component of a matrix a scale vector.

GetSceneForwardPipelineFog

ForwardPipelineFog(Scene scene)

GetSceneForwardPipelineLights

ForwardPipelineLightList(Scene scene)

Filter through the scene lights and return a list of pipeline lights to be used by the scene forward pipeline.

GetSceneForwardPipelinePassViewId

int(SceneForwardPipelinePassViewId views, SceneForwardPipelinePass pass)

Return the view id for a scene forward pipeline pass id.

GetSize

int(File file)
Vec2(Rect rect)
iVec2(IntRect rect)

Return the size in bytes of a local file.

GetSourceDuration

int(SourceRef source)

Return the duration of an audio source.

GetSourceState

SourceState(SourceRef source)

Return the state of an audio source.

GetSourceTimecode

int(SourceRef source)

Return the current timecode of a playing audio source.

GetT

Vec3(Mat4 m)

See GetTranslation.

GetTextures

Texture, Texture(FrameBuffer framebuffer)

Returns color and depth texture attachments.

GetTranslation

Vec3(Mat3 m)
Vec3(Mat4 m)

Return the translation part of a tranformation matrix as a translation vector.

GetUserFolder

string()

Return the system user folder for the current user.

GetVRControllerNames

StringList()

Return a list of names for all supported VR controller devices on the system.

See ReadVRController.

GetVRGenericTrackerNames

StringList()

Return a list of names for all supported VR tracker devices on the system.

GetWidth

number(Rect rect)
int(IntRect rect)

Return the width of a rectangle.

GetWindowClientSize

boolean, int, int(Window window)

Return a window client rectangle. The client area of a window does not include its decorations.

GetWindowContentScale

Vec2(Window window)

GetWindowHandle

VoidPointer(Window window)

Return the system native window handle.

GetWindowInFocus

Window()

Return the system window with input focus.

GetWindowPos

iVec2(Window window)

Return a window position on screen.

GetWindowTitle

boolean, string(Window window)

Return a window title.

GetX

Vec3(Mat3 m)
Vec3(Mat4 m)
number(Rect rect)
int(IntRect rect)

Return the scaled X axis of a transformation matrix.

GetY

Vec3(Mat3 m)
Vec3(Mat4 m)
number(Rect rect)
int(IntRect rect)

Return the scaled Y axis of a transformation matrix.

GetZ

Vec3(Mat3 m)
Vec3(Mat4 m)

Return the scaled Z axis of a transformation matrix.

Grow

Rect(Rect rect, number border)
IntRect(IntRect rect, int border)

Grow a rectangle by the specified amount of units.

See Crop.

HasFileExtension

boolean(string path)

Test the extension of a file path.

HermiteInterpolate

number(number y0, number y1, number y2, number y3, number t, number tension, number bias)

Perform a Hermite interpolation across four values with t in the [0;1] range between y1 and y2. The tension and bias parameters can be used to control the shape of underlying interpolation curve.

See LinearInterpolate, CosineInterpolate and CubicInterpolate.

HideCursor

nil()

Hide the system mouse cursor.

See ShowCursor.

ImGuiAlignTextToFramePadding

nil()

Vertically align upcoming text baseline to FramePadding y coordinate so that it will align properly to regularly framed items.

ImGuiBegin

boolean(string name)
boolean, boolean(string name, boolean open, ImGuiWindowFlags flags)

Start a new window.

ImGuiBeginChild

boolean(string id)
boolean(string id, Vec2 size)
boolean(string id, Vec2 size, boolean border)
boolean(string id, Vec2 size, boolean border, ImGuiWindowFlags flags)

Begin a scrolling region.

ImGuiBeginCombo

boolean(string label, string preview_value)
boolean(string label, string preview_value, ImGuiComboFlags flags)

Begin a ImGui Combo Box.

ImGuiBeginFrame

nil(int width, int height, int dt_clock, MouseState mouse, KeyboardState keyboard)
nil(DearImguiContext ctx, int width, int height, int dt_clock, MouseState mouse, KeyboardState keyboard)

Begin an ImGui frame. This function must be called once per frame before any other ImGui call.

When using multiple contexts, it must be called for each context you intend to use during the current frame.

See ImGuiEndFrame.

ImGuiBeginGroup

nil()

Lock horizontal starting position. Once closing a group it is seen as a single item (so you can use ImGuiIsItemHovered on a group, ImGuiSameLine between groups, etc…).

ImGuiBeginMainMenuBar

boolean()

Create and append to a full screen menu-bar.

Note: Only call ImGuiEndMainMenuBar if this returns true.

ImGuiBeginMenu

boolean(string label)
boolean(string label, boolean enabled)

Create a sub-menu entry.

Note: Only call ImGuiEndMenu if this returns true.

ImGuiBeginMenuBar

boolean()

Start append to the menu-bar of the current window (requires the WindowFlags_MenuBar flag).

Note: Only call ImGuiEndMenuBar if this returns true.

ImGuiBeginPopup

boolean(string id)

Return true if popup is opened and starts outputting to it.

Note: Only call ImGuiEndPopup if this returns true.

ImGuiBeginPopupContextItem

boolean(string id)
boolean(string id, int mouse_button)

ImGui helper to open and begin popup when clicked on last item.

ImGuiBeginPopupContextVoid

boolean()
boolean(string id)
boolean(string id, int mouse_button)

ImGui helper to open and begin popup when clicked in void (where there are no ImGui windows)

ImGuiBeginPopupContextWindow

boolean()
boolean(string id)
boolean(string id, ImGuiPopupFlags flags)

ImGui helper to open and begin popup when clicked on current window.

ImGuiBeginPopupModal

boolean(string name)
boolean(string name, boolean open)
boolean(string name, boolean open, ImGuiWindowFlags flags)

Begin an ImGui modal dialog.

ImGuiBeginTooltip

nil()

Used to create full-featured tooltip windows that aren’t just text.

ImGuiBullet

nil()

Draw a small circle and keep the cursor on the same line. Advances by the same distance as an empty ImGuiTreeNode call.

ImGuiBulletText

nil(string label)

Draw a bullet followed by a static text.

ImGuiButton

boolean(string label)
boolean(string label, Vec2 size)

Button widget returning True if the button was pressed.

ImGuiCalcItemWidth

number()

Returns the width of item given pushed settings and current cursor position.

Note: This is not necessarily the width of last item.

ImGuiCalcTextSize

Vec2(string text)
Vec2(string text, boolean hide_text_after_double_dash)
Vec2(string text, boolean hide_text_after_double_dash, number wrap_width)

Compute the bounding rectangle for the provided text.

ImGuiCaptureKeyboardFromApp

nil(boolean capture)

Force capture keyboard when your widget is being hovered.

ImGuiCaptureMouseFromApp

nil(boolean capture)

Force capture mouse when your widget is being hovered.

ImGuiCheckbox

boolean, boolean(string label, boolean value)

Display a checkbox widget. Returns an interaction flag (user interacted with the widget) and the current widget state (checked or not after user interaction).

was_clicked, my_value = gs.ImGuiCheckBox('My value', my_value)

ImGuiClearInputBuffer

nil()

Force a reset of the ImGui input buffer.

ImGuiCloseCurrentPopup

nil()

Close the popup we have begin-ed into. Clicking on a menu item or selectable automatically closes the current popup.

ImGuiCollapsingHeader

boolean(string label)
boolean(string label, ImGuiTreeNodeFlags flags)
boolean, boolean(string label, boolean p_open)
boolean, boolean(string label, boolean p_open, ImGuiTreeNodeFlags flags)

Draw a collapsing header, returns False if the header is collapsed so that you may skip drawing the header content.

ImGuiColorButton

boolean(string id, Color color)
boolean(string id, Color color, ImGuiColorEditFlags flags)
boolean(string id, Color color, ImGuiColorEditFlags flags, Vec2 size)

Color button widget, display a small colored rectangle.

ImGuiColorEdit

boolean, Color(string label, Color color)
boolean, Color(string label, Color color, ImGuiColorEditFlags flags)

Color editor, returns the widget current color.

ImGuiColumns

nil()
nil(int count)
nil(int count, string id)
nil(int count, string id, boolean with_border)

Begin a column layout section.

To move to the next column use ImGuiNextColumn. To end a column layout section pass 1 to this function.

Note: Current implementation supports a maximum of 64 columns.

ImGuiCombo

boolean, int(string label, int current_item, StringList items)
boolean, int(string label, int current_item, StringList items, int height_in_items)

Combo box widget, return the current selection index. Combo items are passed as an array of string.

ImGuiDragFloat

boolean, number(string label, number v)
boolean, number(string label, number v, number v_speed)
boolean, number(string label, number v, number v_speed, number v_min, number v_max)

Declare a widget to edit a float value. The widget can be dragged over to modify the underlying value.

ImGuiDragIntVec2

boolean, iVec2(string label, iVec2 v)
boolean, iVec2(string label, iVec2 v, number v_speed)
boolean, iVec2(string label, iVec2 v, number v_speed, int v_min, int v_max)

Declare a widget to edit an iVec2 value. The widget can be dragged over to modify the underlying value.

ImGuiDragVec2

boolean, Vec2(string label, Vec2 v)
boolean, Vec2(string label, Vec2 v, number v_speed)
boolean, Vec2(string label, Vec2 v, number v_speed, number v_min, number v_max)

Declare a float edit widget that can be dragged over to modify its value.

ImGuiDragVec3

boolean, Vec3(string label, Vec3 v)
boolean, Vec3(string label, Vec3 v, number v_speed)
boolean, Vec3(string label, Vec3 v, number v_speed, number v_min, number v_max)

Declare a widget to edit a Vec3 value. The widget can be dragged over to modify the underlying value.

ImGuiDragVec4

boolean, Vec4(string label, Vec4 v)
boolean, Vec4(string label, Vec4 v, number v_speed)
boolean, Vec4(string label, Vec4 v, number v_speed, number v_min, number v_max)

Declare a widget to edit a Vec4 value. The widget can be dragged over to modify the underlying value.

ImGuiDummy

nil(Vec2 size)

Add a dummy item of given size.

ImGuiEnd

nil()

End the current window.

ImGuiEndChild

nil()

End a scrolling region.

ImGuiEndCombo

nil()

End a combo widget.

ImGuiEndFrame

nil(DearImguiContext ctx)
nil(DearImguiContext ctx, int view_id)
nil()
nil(int view_id)

End the current ImGui frame.

All ImGui rendering is sent to the specified view. If no view is specified, view 255 is used.

See Drawing to Views.

ImGuiEndGroup

nil()

End the current group.

ImGuiEndMainMenuBar

nil()

End the main menu bar.

See ImGuiBeginMainMenuBar.

ImGuiEndMenu

nil()

End the current sub-menu entry.

ImGuiEndMenuBar

nil()

End the current menu bar.

ImGuiEndPopup

nil()

End the current popup.

ImGuiEndTooltip

nil()

End the current tooltip window.

See ImGuiBeginTooltip.

ImGuiGetColorU32

int(ImGuiCol idx)
int(ImGuiCol idx, number alpha_multiplier)
int(Color color)

Return a style color component as a 32 bit unsigned integer.

See ImGuiPushStyleColor.

ImGuiGetColumnIndex

int()

Returns the index of the current column.

ImGuiGetColumnOffset

number()
number(int column_index)

Returns the current column offset in pixels, from the left side of the content region.

ImGuiGetColumnWidth

number()
number(int column_index)

Returns the current column width in pixels.

ImGuiGetColumnsCount

int()

Return the number of columns in the current layout section.

See ImGuiColumns.

ImGuiGetContentRegionAvail

Vec2()

Get available space for content in the current layout.

ImGuiGetContentRegionAvailWidth

number()

Helper function to return the available width of current content region.

See ImGuiGetContentRegionAvail.

ImGuiGetContentRegionMax

Vec2()

Return the available content space including window decorations and scrollbar.

ImGuiGetCursorPos

Vec2()

Return the layout cursor position in window space. Next widget declaration will take place at the cursor position.

See ImGuiSetCursorPos and ImGuiSameLine.

ImGuiGetCursorPosX

number()

Helper for ImGuiGetCursorPos.

ImGuiGetCursorPosY

number()

Helper for ImGuiGetCursorPos.

ImGuiGetCursorScreenPos

Vec2()

Return the current layout cursor position in screen space.

ImGuiGetCursorStartPos

Vec2()

Return the current layout “line” starting position.

See ImGuiSameLine.

ImGuiGetFont

ImFont()

Return the current ImGui font.

ImGuiGetFontSize

number()

Return the font size (height in pixels) of the current ImGui font with the current scale applied.

ImGuiGetFontTexUvWhitePixel

Vec2()

Get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API.

ImGuiGetFrameCount

int()

Return the ImGui frame counter.

See ImGuiBeginFrame and ImGuiEndFrame.

ImGuiGetFrameHeightWithSpacing

number()

Return the following value: FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets)

ImGuiGetID

int(string id)

Return a unique ImGui ID.

ImGuiGetItemRectMax

Vec2()

Get bounding rect maximum of last item in screen space.

ImGuiGetItemRectMin

Vec2()

Get bounding rect minimum of last item in screen space.

ImGuiGetItemRectSize

Vec2()

Get bounding rect size of last item in screen space.

ImGuiGetMouseDragDelta

Vec2()
Vec2(ImGuiMouseButton button)
Vec2(ImGuiMouseButton button, number lock_threshold)

Return the distance covered by the mouse cursor since the last button press.

ImGuiGetMousePos

Vec2()

Return the mouse cursor coordinates in screen space.

ImGuiGetMousePosOnOpeningCurrentPopup

Vec2()

Retrieve a backup of the mouse position at the time of opening the current popup.

See ImGuiBeginPopup.

ImGuiGetScrollMaxX

number()

Get maximum scrolling amount on the horizontal axis.

ImGuiGetScrollMaxY

number()

Get maximum scrolling amount on the vertical axis.

ImGuiGetScrollX

number()

Get scrolling amount on the horizontal axis.

ImGuiGetScrollY

number()

Get scrolling amount on the vertical axis.

ImGuiGetTextLineHeight

number()

Return the height of a text line using the current font.

See ImGuiPushFont.

ImGuiGetTextLineHeightWithSpacing

number()

Return the height of a text line using the current font plus vertical spacing between two layout lines.

See ImGuiGetTextLineHeight.

ImGuiGetTime

number()

Return the current ImGui time in seconds.

ImGuiGetTreeNodeToLabelSpacing

number()

Return the horizontal distance preceding label when using ImGuiTreeNode or ImGuiBullet.

The value g.FontSize + style.FramePadding.x * 2 is returned for a regular unframed TreeNode.

ImGuiGetWindowContentRegionMax

Vec2()

Return the content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with ImGuiSetNextWindowContentSize, in window space.

ImGuiGetWindowContentRegionMin

Vec2()

Content boundaries min (roughly (0,0)-Scroll), in window space.

ImGuiGetWindowContentRegionWidth

number()

Return the width of the content region.

ImGuiGetWindowDrawList

ImDrawList()

Get the draw list associated to the current window, to append your own drawing primitives.

ImGuiGetWindowHeight

number()

Return the current window height.

ImGuiGetWindowPos

Vec2()

Return the current window position in screen space.

See ImGuiSetWindowPos.

ImGuiGetWindowSize

Vec2()

Return the current window size.

See ImGuiSetWindowSize.

ImGuiGetWindowWidth

number()

Return the current window width.

ImGuiImage

nil(Texture tex, Vec2 size)
nil(Texture tex, Vec2 size, Vec2 uv0)
nil(Texture tex, Vec2 size, Vec2 uv0, Vec2 uv1)
nil(Texture tex, Vec2 size, Vec2 uv0, Vec2 uv1, Color tint_col)
nil(Texture tex, Vec2 size, Vec2 uv0, Vec2 uv1, Color tint_col, Color border_col)

Display a texture as an image widget.

See ImGuiImageButton.

ImGuiImageButton

boolean(Texture tex, Vec2 size)
boolean(Texture tex, Vec2 size, Vec2 uv0)
boolean(Texture tex, Vec2 size, Vec2 uv0, Vec2 uv1)
boolean(Texture tex, Vec2 size, Vec2 uv0, Vec2 uv1, int frame_padding)
boolean(Texture tex, Vec2 size, Vec2 uv0, Vec2 uv1, int frame_padding, Color bg_col)
boolean(Texture tex, Vec2 size, Vec2 uv0, Vec2 uv1, int frame_padding, Color bg_col, Color tint_col)

Declare an image button displaying the provided texture.

See ImGuiImage.

ImGuiIndent

nil()
nil(number width)

Move content position toward the right.

ImGuiInit

nil(number font_size, ProgramHandle imgui_program, ProgramHandle imgui_image_program)

Initialize the global ImGui context. This function must be called once before any other ImGui function using the global context.

See ImGuiInitContext.

ImGuiInitContext

DearImguiContext(number font_size, ProgramHandle imgui_program, ProgramHandle imgui_image_program)

Initialize an ImGui context. This function must be called once before any other ImGui function using the context.

See ImGuiInit.

ImGuiInputFloat

boolean, number(string label, number v)
boolean, number(string label, number v, number step, number step_fast)
boolean, number(string label, number v, number step, number step_fast, int decimal_precision)
boolean, number(string label, number v, number step, number step_fast, int decimal_precision, ImGuiInputTextFlags flags)

Float field widget.

ImGuiInputInt

boolean, int(string label, int v)
boolean, int(string label, int v, int step, int step_fast)
boolean, int(string label, int v, int step, int step_fast, ImGuiInputTextFlags flags)

Integer field widget.

ImGuiInputIntVec2

boolean, iVec2(string label, iVec2 v)
boolean, iVec2(string label, iVec2 v, ImGuiInputTextFlags flags)

ImGuiInputText

boolean, string(string label, string text, int max_size)
boolean, string(string label, string text, int max_size, ImGuiInputTextFlags flags)

Text input widget, returns the current widget buffer content.

ImGuiInputVec2

boolean, Vec2(string label, Vec2 v)
boolean, Vec2(string label, Vec2 v, int decimal_precision)
boolean, Vec2(string label, Vec2 v, int decimal_precision, ImGuiInputTextFlags flags)

Vec2 field widget.

ImGuiInputVec3

boolean, Vec3(string label, Vec3 v)
boolean, Vec3(string label, Vec3 v, int decimal_precision)
boolean, Vec3(string label, Vec3 v, int decimal_precision, ImGuiInputTextFlags flags)

Vec3 field widget.

ImGuiInputVec4

boolean, Vec4(string label, Vec4 v)
boolean, Vec4(string label, Vec4 v, int decimal_precision)
boolean, Vec4(string label, Vec4 v, int decimal_precision, ImGuiInputTextFlags flags)

Vec4 field widget.

ImGuiInvisibleButton

boolean(string text, Vec2 size)

Invisible button widget, return True if the button was pressed.

ImGuiIsAnyItemActive

boolean()

Return true if any item is active, false otherwise.

ImGuiIsAnyItemHovered

boolean()

Return true if any item is hovered by the mouse cursor, false otherwise.

ImGuiIsItemActive

boolean()

Was the last item active.

e.g. button being held, text field being edited - items that do not interact will always return false.

ImGuiIsItemClicked

boolean()
boolean(int mouse_button)

Was the last item clicked.

ImGuiIsItemHovered

boolean()
boolean(ImGuiHoveredFlags flags)

Was the last item hovered by mouse.

ImGuiIsItemVisible

boolean()

Was the last item visible and not out of sight due to clipping/scrolling.

ImGuiIsKeyDown

boolean(int key_index)

Was the specified key down during the last frame?

ImGuiIsKeyPressed

boolean(int key_index)
boolean(int key_index, boolean repeat)

Was the specified key pressed? A key press implies that the key was down and is currently released.

ImGuiIsKeyReleased

boolean(int key_index)

Was the specified key released during the last frame?

ImGuiIsMouseClicked

boolean(int button)
boolean(int button, boolean repeat)

Was the specified mouse button clicked during the last frame? A mouse click implies that the button pressed earlier and released during the last frame.

ImGuiIsMouseDoubleClicked

boolean(int button)

Was the specified mouse button double-clicked during the last frame? A double-click implies two rapid successive clicks of the same button with the mouse cursor staying in the same position.

ImGuiIsMouseDown

boolean(int button)

Was the specified mouse button down during the last frame?

ImGuiIsMouseDragging

boolean(ImGuiMouseButton button)
boolean(ImGuiMouseButton button, number lock_threshold)

Is mouse dragging?

ImGuiIsMouseHoveringRect

boolean(Vec2 rect_min, Vec2 rect_max)
boolean(Vec2 rect_min, Vec2 rect_max, boolean clip)

Test whether the mouse cursor is hovering the specified rectangle.

ImGuiIsMouseReleased

boolean(int button)

Was the specified mouse button released during the last frame?

ImGuiIsRectVisible

boolean(Vec2 size)
boolean(Vec2 rect_min, Vec2 rect_max)

Test if a rectangle of the specified size starting from cursor position is visible/not clipped. Or test if a rectangle in screen space is visible/not clipped.

ImGuiIsWindowCollapsed

boolean()

Is the current window collapsed.

ImGuiIsWindowFocused

boolean()
boolean(ImGuiFocusedFlags flags)

Is the current window focused.

ImGuiIsWindowHovered

boolean()
boolean(ImGuiHoveredFlags flags)

Is the current window hovered and hoverable (not blocked by a popup), differentiates child windows from each others.

ImGuiLabelText

nil(string label, string text)

Display text+label aligned the same way as value+label widgets.

ImGuiListBox

boolean, int(string label, int current_item, StringList items)
boolean, int(string label, int current_item, StringList items, int height_in_items)

List widget.

ImGuiMenuItem

boolean(string label)
boolean(string label, string shortcut)
boolean(string label, string shortcut, boolean selected)
boolean(string label, string shortcut, boolean selected, boolean enabled)

Return true when activated. Shortcuts are displayed for convenience but not processed at the moment.

ImGuiMouseDrawCursor

nil(boolean draw_cursor)

Enable/disable the ImGui software mouse cursor.

ImGuiNewFrame

nil()

ImGuiNewLine

nil()

Undo a ImGuiSameLine call or force a new line when in an horizontal layout.

ImGuiNextColumn

nil()

Start the next column in multi-column layout.

See ImGuiColumns.

ImGuiOpenPopup

nil(string id)

Mark a named popup as open.

Popup windows are closed when the user:

Popup identifiers are relative to the current ID stack so ImGuiOpenPopup and ImGuiBeginPopup need to be at the same level of the ID stack.

ImGuiPopAllowKeyboardFocus

nil()

Undo the last call to ImGuiPushAllowKeyboardFocus.

ImGuiPopButtonRepeat

nil()

Undo the last call to ImGuiPushButtonRepeat.

ImGuiPopClipRect

nil()

Undo the last call to ImGuiPushClipRect.

ImGuiPopFont

nil()

Undo the last call to ImGuiPushFont.

ImGuiPopID

nil()

Undo the last call to ImGuiPushID.

ImGuiPopItemWidth

nil()

Undo the last call to ImGuiPushItemWidth.

ImGuiPopStyleColor

nil()
nil(int count)

Undo the last call to ImGuiPushStyleColor.

ImGuiPopStyleVar

nil()
nil(int count)

Undo the last call to ImGuiPushStyleVar.

ImGuiPopTextWrapPos

nil()

Undo the last call to ImGuiPushTextWrapPos.

ImGuiProgressBar

nil(number fraction)
nil(number fraction, Vec2 size)
nil(number fraction, Vec2 size, string overlay)

Draw a progress bar, fraction must be between 0.0 and 1.0.

ImGuiPushAllowKeyboardFocus

nil(boolean v)

Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets.

ImGuiPushButtonRepeat

nil(boolean repeat)

In repeat mode, ButtonXXX functions return repeated true in a typematic manner.

Note that you can call ImGuiIsItemActive after any Button to tell if the button is held in the current frame.

ImGuiPushClipRect

nil(Vec2 clip_rect_min, Vec2 clip_rect_max, boolean intersect_with_current_clip_rect)

Push a new clip rectangle onto the clipping stack.

ImGuiPushFont

nil(ImFont font)

Push a font on top of the font stack and make it current for subsequent text rendering operations.

ImGuiPushID

nil(string id)
nil(int id)

Push a string into the ID stack.

ImGuiPushItemWidth

nil(number item_width)

Set the width of items for common large item+label widgets.

  • >0: width in pixels
  • <0: align x pixels to the right of window (so -1 always align width to the right side)
  • =0: default to ~2/3 of the window width

See ImGuiPopItemWidth.

ImGuiPushStyleColor

nil(ImGuiCol idx, Color color)

Push a value on the style stack for the specified style color.

See ImGuiPopStyleColor.

ImGuiPushStyleVar

nil(ImGuiStyleVar idx, number value)
nil(ImGuiStyleVar idx, Vec2 value)

Push a value on the style stack for the specified style variable.

See ImGuiPopStyleVar.

ImGuiPushTextWrapPos

nil()
nil(number wrap_pos_x)

Push word-wrapping position for text commands.

  • <0: No wrapping.
  • =0: Wrap to the end of the window or column.
  • >0: Wrap at wrap_pos_x position in window local space.

See ImGuiPopTextWrapPos.

ImGuiRadioButton

boolean(string label, boolean active)
boolean, int(string label, int v, int v_button)

Radio button widget, return the button state.

ImGuiRender

nil()

ImGuiResetMouseDragDelta

nil()
nil(ImGuiMouseButton button)

ImGuiSameLine

nil()
nil(number pos_x)
nil(number pos_x, number spacing_w)

Call between widgets or groups to layout them horizontally.

ImGuiSelectable

boolean(string label)
boolean(string label, boolean selected)
boolean(string label, boolean selected, ImGuiSelectableFlags flags)
boolean(string label, boolean selected, ImGuiSelectableFlags flags, Vec2 size)

Selectable item.

The following width values are possible:

  • = 0.0: Use remaining width.
  • > 0.0: Specific width.

The following height values are possible:

  • = 0.0: Use label height.
  • > 0.0: Specific height.

ImGuiSeparator

nil()

Output an horizontal line to separate two distinct UI sections.

ImGuiSetColumnOffset

nil(int column_index, number offset_x)

Set the position of a column line in pixels, from the left side of the contents region.

ImGuiSetColumnWidth

nil(int column_index, number width)

Set the column width in pixels.

ImGuiSetCursorPos

nil(Vec2 local_pos)

Set the current widget output cursor position in window space.

ImGuiSetCursorPosX

nil(number x)

See ImGuiSetCursorPos.

ImGuiSetCursorPosY

nil(number y)

See ImGuiSetCursorPos.

ImGuiSetCursorScreenPos

nil(Vec2 pos)

Set the widget cursor output position in screen space.

ImGuiSetItemAllowOverlap

nil()

Allow the last item to be overlapped by a subsequent item. Sometimes useful with invisible buttons, selectables, etc… to catch unused areas.

ImGuiSetItemDefaultFocus

nil()

Make the last item the default focused item of a window.

ImGuiSetKeyboardFocusHere

nil()
nil(int offset)

Focus keyboard on the next widget.

Use positive offset value to access sub components of a multiple component widget. Use -1 to access the previous widget.

ImGuiSetNextItemOpen

nil(boolean is_open)
nil(boolean is_open, ImGuiCond condition)

Set next item open state.

ImGuiSetNextWindowCollapsed

nil(boolean collapsed, ImGuiCond condition)

Set next window collapsed state, call before ImGuiBegin.

ImGuiSetNextWindowContentSize

nil(Vec2 size)

Set the size of the content area of the next declared window. Call before ImGuiBegin.

ImGuiSetNextWindowContentWidth

nil(number width)

See ImGuiSetNextWindowContentSize.

ImGuiSetNextWindowFocus

nil()

Set the next window to be focused/top-most. Call before ImGuiBegin.

ImGuiSetNextWindowPos

nil(Vec2 pos)
nil(Vec2 pos, ImGuiCond condition)

Set next window position, call before ImGuiBegin.

ImGuiSetNextWindowPosCenter

nil()
nil(ImGuiCond condition)

Set next window position to be centered on screen, call before ImGuiBegin.

ImGuiSetNextWindowSize

nil(Vec2 size)
nil(Vec2 size, ImGuiCond condition)

Set next window size, call before ImGuiBegin. A value of 0 for an axis will auto-fit it.

ImGuiSetNextWindowSizeConstraints

nil(Vec2 size_min, Vec2 size_max)

Set the next window size limits.

Use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down.

ImGuiSetScrollFromPosY

nil(number pos_y)
nil(number pos_y, number center_y_ratio)

Adjust scrolling amount to make a given position visible. Generally ImGuiGetCursorStartPos + offset to compute a valid position.

ImGuiSetScrollHereY

nil()
nil(number center_y_ratio)

Adjust scrolling amount to make current cursor position visible.

  • 0: Top.
  • 0.5: Center.
  • 1: Bottom.

When using to make a default/current item visible, consider using ImGuiSetItemDefaultFocus instead.

ImGuiSetScrollX

nil(number scroll_x)

Set scrolling amount between [0;ImGuiGetScrollMaxX].

ImGuiSetScrollY

nil(number scroll_y)

Set scrolling amount between [0;ImGuiGetScrollMaxY].

ImGuiSetTooltip

nil(string text)

Set tooltip under mouse-cursor, typically used with ImGuiIsItemHovered/ImGuiIsAnyItemHovered. Last call wins.

ImGuiSetWindowCollapsed

nil(string name, boolean collapsed)
nil(string name, boolean collapsed, ImGuiCond condition)

Set named window collapsed state, prefer using ImGuiSetNextWindowCollapsed.

ImGuiSetWindowFocus

nil(string name)

Set named window to be focused/top-most.

ImGuiSetWindowFontScale

nil(number scale)

Per-window font scale.

ImGuiSetWindowPos

nil(string name, Vec2 pos)
nil(string name, Vec2 pos, ImGuiCond condition)

Set named window position.

ImGuiSetWindowSize

nil(string name, Vec2 size)
nil(string name, Vec2 size, ImGuiCond condition)

Set named window size.

ImGuiShutdown

nil()

Shutdown the global ImGui context.

ImGuiSliderFloat

boolean, number(string label, number v, number v_min, number v_max)
boolean, number(string label, number v, number v_min, number v_max, string format)

Float slider widget.

ImGuiSliderInt

boolean, int(string label, int v, int v_min, int v_max)
boolean, int(string label, int v, int v_min, int v_max, string format)

Integer slider widget.

ImGuiSliderIntVec2

boolean, iVec2(string label, iVec2 v, int v_min, int v_max)
boolean, iVec2(string label, iVec2 v, int v_min, int v_max, string format)

ImGuiSliderVec2

boolean, Vec2(string label, Vec2 v, number v_min, number v_max)
boolean, Vec2(string label, Vec2 v, number v_min, number v_max, string format)

Vec2 slider widget.

ImGuiSliderVec3

boolean, Vec3(string label, Vec3 v, number v_min, number v_max)
boolean, Vec3(string label, Vec3 v, number v_min, number v_max, string format)

Vec3 slider widget.

ImGuiSliderVec4

boolean, Vec4(string label, Vec4 v, number v_min, number v_max)
boolean, Vec4(string label, Vec4 v, number v_min, number v_max, string format)

Vec4 slider widget.

ImGuiSmallButton

boolean(string label)

Small button widget fitting the height of a text line, return True if the button was pressed.

ImGuiSpacing

nil()

Add spacing.

ImGuiText

nil(string text)

Static text.

ImGuiTextColored

nil(Color color, string text)

Colored static text.

ImGuiTextDisabled

nil(string text)

Disabled static text.

ImGuiTextUnformatted

nil(string text)

Raw text without formatting. Roughly equivalent to ImGuiText but faster, recommended for long chunks of text.

ImGuiTextWrapped

nil(string text)

Wrapped static text.

Note that this won’t work on an auto-resizing window if there’s no other widgets to extend the window width, you may need to set a size using ImGuiSetNextWindowSize.

ImGuiTreeNode

boolean(string label)

If returning true the node is open and the user is responsible for calling ImGuiTreePop.

ImGuiTreeNodeEx

boolean(string label, ImGuiTreeNodeFlags flags)

See ImGuiTreeNode.

ImGuiTreePop

nil()

Pop the current tree node.

ImGuiTreePush

nil(string id)

Already called by ImGuiTreeNode, but you can call ImGuiTreePush/ImGuiTreePop yourself for layouting purpose.

ImGuiUnindent

nil()
nil(number width)

Move content position back to the left (cancel ImGuiIndent).

ImGuiWantCaptureMouse

boolean()

ImGui wants mouse capture. Use this function to determine when to pause mouse processing from other parts of your program.

Inch

number(number inch)

Convert a value in inches to the Harfang internal unit system.

See Coordinates and Units System.

InputInit

nil()

Initialize the Input system. Must be invoked before any call to WindowSystemInit to work properly.

hg.InputInit()
hg.WindowSystemInit()

InputShutdown

nil()

Shutdown the Input system.

Inside

boolean(Rect rect, iVec2 v)
boolean(Rect rect, Vec2 v)
boolean(Rect rect, Vec3 v)
boolean(Rect rect, Vec4 v)
boolean(IntRect rect, iVec2 v)
boolean(IntRect rect, Vec2 v)
boolean(IntRect rect, Vec3 v)
boolean(IntRect rect, Vec4 v)

Test if a value is inside a containing volume.

IntersectRay

boolean, number, number(MinMax minmax, Vec3 origin, Vec3 direction)

Intersect an infinite ray with an axis-aligned bounding box, if the first returned value is true it is followed by the near and far intersection points.

Intersection

Rect(Rect a, Rect b)
IntRect(IntRect a, IntRect b)

Return the intersection of two rectangles.

Intersects

boolean(Rect a, Rect b)
boolean(IntRect a, IntRect b)

Return true if rect a intersects rect b.

Inverse

Quaternion(Quaternion q)
boolean, Mat3(Mat3 m)
boolean, Mat4(Mat4 m)
Mat44, boolean(Mat44 m)
Vec3(Vec3 v)

Return the inverse of a matrix, vector or quaternion.

InverseFast

Mat4(Mat4 m)

Compute the inverse of an orthonormal transformation matrix. This function is faster than the generic Inverse function but can only deal with a specific set of matrices.

See Inverse.

IsAssetFile

boolean(string name)

Test if an asset file exists in the assets system.

See Resources & Assets.

IsDir

boolean(string path)

Returns true if path is a directory on the local filesystem, false otherwise.

IsEOF

boolean(File file)

Returns true if the cursor is at the end of the file, false otherwise.

IsFile

boolean(string path)

Test if a file exists on the local filesystem.

IsFinite

boolean(number v)

Test if a floating point value is finite.

IsMonitorConnected

boolean(Monitor monitor)

Test if the specified monitor is connected to the host device.

IsPathAbsolute

boolean(string path)

Test if the provided path is an absolute or relative path.

IsPrimaryMonitor

boolean(Monitor monitor)

Return true if the monitor is the primary host device monitor, false otherwise.

IsValid

boolean(File file)
boolean(Texture t)
boolean(FrameBuffer fb)
boolean(ForwardPipelineAAA pipeline)
boolean(IVideoStreamer streamer)

Test if a resource if valid.

IsWindowOpen

boolean(Window window)

Return true if the window is open, false otherwise.

IsoSurfaceSphere

nil(IsoSurface surface, int width, int height, int depth, number x, number y, number z, number radius)
nil(IsoSurface surface, int width, int height, int depth, number x, number y, number z, number radius, number value)
nil(IsoSurface surface, int width, int height, int depth, number x, number y, number z, number radius, number value, number exponent)

Output a sphere to an iso-surface.

IsoSurfaceToModel

boolean(ModelBuilder builder, IsoSurface surface, int width, int height, int depth)
boolean(ModelBuilder builder, IsoSurface surface, int width, int height, int depth, int material)
boolean(ModelBuilder builder, IsoSurface surface, int width, int height, int depth, int material, number isolevel)
boolean(ModelBuilder builder, IsoSurface surface, int width, int height, int depth, int material, number isolevel, number scale_x, number scale_y, number scale_z)

Convert an iso-surface to a render model, this function is geared toward efficiency and meant for realtime.

int_to_VoidPointer

VoidPointer(pointer ptr)

Cast an integer to a void pointer.

This function is only used to provide access to low-level structures and should not be needed most of the time.

Km

number(number km)

Convert a value in kilometers to the Harfang internal unit system.

See Coordinates and Units System.

Len

number(Vec2 v)
int(iVec2 v)
number(Quaternion q)
number(Vec3 v)

Return the length of the vector.

Len2

number(Vec2 v)
int(iVec2 v)
number(Quaternion q)
number(Vec3 v)

Return the length of the vector squared.

Lerp

int(int a, int b, number t)
number(number a, number b, number t)
Vec3(Vec3 a, Vec3 b, number t)
Vec4(Vec4 a, Vec4 b, number t)

See LinearInterpolate.

LerpAsOrthonormalBase

Mat4(Mat4 from, Mat4 to, number k)
Mat4(Mat4 from, Mat4 to, number k, boolean fast)

Linear interpolate between two transformation matrices on the [0;1] interval.

LinearInterpolate

number(number y0, number y1, number t)

Linear interpolate between two values on the [0;1] interval.

See CosineInterpolate, CubicInterpolate and HermiteInterpolate.

ListDir

DirEntryList(string path, DirEntryType type)

Get the content of a directory on the local filesystem, this function does not recurse into subfolders.

See ListDirRecursive.

ListDirRecursive

DirEntryList(string path, DirEntryType type)

Get the content of a directory on the local filesystem, this function recurses into subfolders.

See ListDir.

LoadBMP

boolean(Picture pict, string path)

Load a Picture in BMP file format.

LoadDataFromFile

boolean(string path, Data data)

LoadFontFromAssets

Font(string name)
Font(string name, number size)
Font(string name, number size, int resolution)
Font(string name, number size, int resolution, int padding)
Font(string name, number size, int resolution, int padding, string glyphs)

Load a TrueType (TTF) font from the assets system.

See Resources & Assets.

LoadFontFromFile

Font(string path)
Font(string path, number size)
Font(string path, number size, int resolution)
Font(string path, number size, int resolution, int padding)
Font(string path, number size, int resolution, int padding, string glyphs)

Load a TrueType (TTF) font from the local filesystem.

See Resources & Assets.

LoadForwardPipelineAAAConfigFromAssets

boolean(string path, ForwardPipelineAAAConfig config)

LoadForwardPipelineAAAConfigFromFile

boolean(string path, ForwardPipelineAAAConfig config)

LoadGIF

boolean(Picture pict, string path)

Load a Picture in GIF file format.

LoadJPG

boolean(Picture pict, string path)

Load a Picture in JPEG file format.

LoadJsonFromAssets

JSON(string name)

Load a JSON from the assets system.

See Resources & Assets.

LoadJsonFromFile

JSON(string path)

Load a JSON from the local filesystem.

LoadModelFromAssets

Model(string name)

Load a render model from the assets system.

See DrawModel and Resources & Assets.

LoadModelFromFile

Model(string path)

Load a render model from the local filesystem.

LoadOGGSoundAsset

SoundRef(string name)

LoadOGGSoundFile

SoundRef(string path)

LoadPNG

boolean(Picture pict, string path)

Load a Picture in PNG file format.

LoadPSD

boolean(Picture pict, string path)

Load a Picture in PSD file format.

LoadPicture

boolean(Picture pict, string path)

Load a Picture content from the filesystem.

LoadPipelineProgramFromAssets

PipelineProgram(string name, PipelineResources resources, PipelineInfo pipeline)

Load a pipeline shader program from the assets system.

See Resources & Assets.

LoadPipelineProgramFromFile

PipelineProgram(string path, PipelineResources resources, PipelineInfo pipeline)

Load a pipeline shader program from the local filesystem.

LoadPipelineProgramRefFromAssets

PipelineProgramRef(string name, PipelineResources resources, PipelineInfo pipeline)

LoadPipelineProgramRefFromFile

PipelineProgramRef(string path, PipelineResources resources, PipelineInfo pipeline)

LoadProgramFromAssets

ProgramHandle(string name)
ProgramHandle(string vertex_shader_name, string fragment_shader_name)

Load a shader program from the assets system.

See Resources & Assets.

LoadProgramFromFile

ProgramHandle(string path)
ProgramHandle(string vertex_shader_path, string fragment_shader_path)

Load a shader program from the local filesystem.

LoadSceneBinaryFromAssets

boolean(string name, Scene scene, PipelineResources resources, PipelineInfo pipeline)
boolean(string name, Scene scene, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

Load a scene in binary format from the assets system. Loaded content is added to the existing scene content.

See Resources & Assets.

LoadSceneBinaryFromDataAndAssets

boolean(Data data, string name, Scene scene, PipelineResources resources, PipelineInfo pipeline)
boolean(Data data, string name, Scene scene, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

LoadSceneBinaryFromDataAndFile

boolean(Data data, string name, Scene scene, PipelineResources resources, PipelineInfo pipeline)
boolean(Data data, string name, Scene scene, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

LoadSceneBinaryFromFile

boolean(string path, Scene scene, PipelineResources resources, PipelineInfo pipeline)
boolean(string path, Scene scene, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

Load a scene in binary format from the local filesystem. Loaded content is added to the existing scene content.

LoadSceneFromAssets

boolean(string name, Scene scene, PipelineResources resources, PipelineInfo pipeline)
boolean(string name, Scene scene, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

LoadSceneFromFile

boolean(string path, Scene scene, PipelineResources resources, PipelineInfo pipeline)
boolean(string path, Scene scene, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

LoadSceneJsonFromAssets

boolean(string name, Scene scene, PipelineResources resources, PipelineInfo pipeline)
boolean(string name, Scene scene, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

Load a scene in JSON format from the assets system. Loaded content is added to the existing scene content.

See Resources & Assets.

LoadSceneJsonFromFile

boolean(string path, Scene scene, PipelineResources resources, PipelineInfo pipeline)
boolean(string path, Scene scene, PipelineResources resources, PipelineInfo pipeline, LoadSaveSceneFlags flags)

Load a scene in JSON format from the local filesystem. Loaded content is added to the existing scene content.

LoadTGA

boolean(Picture pict, string path)

Load a Picture in TGA file format.

LoadTextureFlagsFromAssets

TextureFlags(string name)

Load texture flags in the texture metafile from the assets system.

See Resources & Assets.

LoadTextureFlagsFromFile

TextureFlags(string path)

Load texture flags in the texture metafile from the local filesystem.

LoadTextureFromAssets

Texture, TextureInfo(string path, TextureFlags flags)
TextureRef(string path, int flags, PipelineResources resources)

Load a texture from the assets system.

  • When not using pipeline resources the texture informations are returned directly.
  • When using pipeline resources the texture informations can be retrieved from the PipelineResources object.

See Resources & Assets.

LoadTextureFromFile

Texture, TextureInfo(string path, TextureFlags flags)
TextureRef(string path, int flags, PipelineResources resources)

Load a texture from the local filesystem.

  • When not using pipeline resources the texture informations are returned directly.
  • When using pipeline resources the texture informations can be retrieved from the PipelineResources object.

LoadWAVSoundAsset

SoundRef(string name)

Load a sound in WAV format from the assets system and return a reference to it.

See Resources & Assets.

LoadWAVSoundFile

SoundRef(string path)

Load a sound in WAV format from the local filesystem and return a reference to it.

Log

nil(string msg)
nil(string msg, string details)

MakeForwardPipelineLinearLight

ForwardPipelineLight(Mat4 world, Color diffuse, Color specular)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, Vec4 pssm_split)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, Vec4 pssm_split, number priority)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, Vec4 pssm_split, number priority, ForwardPipelineShadowType shadow_type)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, Vec4 pssm_split, number priority, ForwardPipelineShadowType shadow_type, number shadow_bias)

Create a forward pipeline linear light.

See ForwardPipelineLights, PrepareForwardPipelineLights and SubmitModelToForwardPipeline.

MakeForwardPipelinePointLight

ForwardPipelineLight(Mat4 world, Color diffuse, Color specular)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius, number priority)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius, number priority, ForwardPipelineShadowType shadow_type)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius, number priority, ForwardPipelineShadowType shadow_type, number shadow_bias)

Create a forward pipeline point light.

See ForwardPipelineLights, PrepareForwardPipelineLights and SubmitModelToForwardPipeline.

MakeForwardPipelineSpotLight

ForwardPipelineLight(Mat4 world, Color diffuse, Color specular)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius, number inner_angle)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius, number inner_angle, number outer_angle)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius, number inner_angle, number outer_angle, number priority)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius, number inner_angle, number outer_angle, number priority, ForwardPipelineShadowType shadow_type)
ForwardPipelineLight(Mat4 world, Color diffuse, Color specular, number radius, number inner_angle, number outer_angle, number priority, ForwardPipelineShadowType shadow_type, number shadow_bias)

Create a forward pipeline spot light.

See ForwardPipelineLights, PrepareForwardPipelineLights and SubmitModelToForwardPipeline.

MakeFrustum

Frustum(Mat44 projection)
Frustum(Mat44 projection, Mat4 mtx)

Create a projection frustum. This object can then be used to perform culling using TestVisibility.

# Compute a perspective matrix
proj = hg.ComputePerspectiveProjectionMatrix(0.1, 1000, hg.FovToZoomFactor(math.pi/4), 1280/720)
# Make a frustum from this projection matrix
frustum = hg.MakeFrustum(proj)

MakePlane

Vec4(Vec3 p, Vec3 n)
Vec4(Vec3 p, Vec3 n, Mat4 m)

Geometrical plane in 3D space.

  • p: a point lying on the plane.
  • n: the plane normal.
  • m: an affine transformation matrix that will be applied to p and n.

MakeRectFromWidthHeight

Rect(number x, number y, number w, number h)
IntRect(int x, int y, int w, int h)

Make a rectangle from width and height.

MakeUniformSetTexture

UniformSetTexture(string name, Texture texture, int stage)

Create a uniform set texture object.

This object can be added to a UniformSetTextureList to control the shader program uniform values for a subsequent call to DrawModel.

MakeUniformSetValue

UniformSetValue(string name, number v)
UniformSetValue(string name, Vec2 v)
UniformSetValue(string name, Vec3 v)
UniformSetValue(string name, Vec4 v)
UniformSetValue(string name, Mat3 v)
UniformSetValue(string name, Mat4 v)
UniformSetValue(string name, Mat44 v)

Create a uniform set value object.

This object can be added to a UniformSetValueList to control the shader program uniform values for a subsequent call to DrawModel.

MakeVec3

Vec3(Vec4 v)

Make a Vec3 from a Vec4. The input vector w component is discarded.

MakeVertex

Vertex(Vec3 pos)
Vertex(Vec3 pos, Vec3 nrm)
Vertex(Vec3 pos, Vec3 nrm, Vec2 uv0)
Vertex(Vec3 pos, Vec3 nrm, Vec2 uv0, Color color0)

MakeVideoStreamer

IVideoStreamer(string module_path)

Mat3LookAt

Mat3(Vec3 front)
Mat3(Vec3 front, Vec3 up)

Return a rotation matrix looking down the provided vector. The input vector does not need to be normalized.

Mat4LookAt

Mat4(Vec3 position, Vec3 at)
Mat4(Vec3 position, Vec3 at, Vec3 scale)

Return a look at matrix whose orientation points at the specified position.

Mat4LookAtUp

Mat4(Vec3 position, Vec3 at, Vec3 up)
Mat4(Vec3 position, Vec3 at, Vec3 up, Vec3 scale)

Return a look at matrix whose orientation points at the specified position and up direction.

Mat4LookToward

Mat4(Vec3 position, Vec3 direction)
Mat4(Vec3 position, Vec3 direction, Vec3 scale)

Return a look at matrix whose orientation points toward the specified direction.

Mat4LookTowardUp

Mat4(Vec3 position, Vec3 direction, Vec3 up)
Mat4(Vec3 position, Vec3 direction, Vec3 up, Vec3 scale)

Return a look at matrix whose orientation points toward the specified directions.

Max

Vec2(Vec2 a, Vec2 b)
iVec2(iVec2 a, iVec2 b)
Vec3(Vec3 a, Vec3 b)
number(number a, number b)
int(int a, int b)

Return a vector whose elements are the maximum of each of the two specified vectors.

Min

Vec2(Vec2 a, Vec2 b)
iVec2(iVec2 a, iVec2 b)
Vec3(Vec3 a, Vec3 b)
number(number a, number b)
int(int a, int b)

Return a vector whose elements are the minimum of each of the two specified vectors.

MinMaxFromPositionSize

MinMax(Vec3 position, Vec3 size)

Set min = p - size/2 and max = p + size/2.

MkDir

boolean(string path)
boolean(string path, int permissions)

Create a new directory.

See MkTree.

MkTree

boolean(string path)
boolean(string path, int permissions)

Create a directory tree on the local filesystem. This function is recursive and creates each missing directory in the path.

See MkDir.

Mm

number(number mm)

Convert a value in millimeters to the Harfang internal unit system.

See Coordinates and Units System.

Ms

number(number milliseconds)

Convert a value in milliseconds to the Harfang internal unit system.

See Coordinates and Units System.

Mtr

number(number m)

Convert a value in meters to the Harfang internal unit system.

See Coordinates and Units System.

NewFullscreenWindow

Window(Monitor monitor, int mode_index)
Window(Monitor monitor, int mode_index, MonitorRotation rotation)
Window(string title, Monitor monitor, int mode_index)
Window(string title, Monitor monitor, int mode_index, MonitorRotation rotation)

Create a new fullscreen window.

NewIsoSurface

IsoSurface(int width, int height, int depth)

Return a new iso-surface object.

See IsoSurfaceSphere to draw to an iso-surface and IsoSurfaceToModel to draw it.

NewWindow

Window(int width, int height)
Window(int width, int height, int bpp)
Window(int width, int height, int bpp, WindowVisibility visibility)
Window(string title, int width, int height)
Window(string title, int width, int height, int bpp)
Window(string title, int width, int height, int bpp, WindowVisibility visibility)

Create a new window.

NewWindowFrom

Window(VoidPointer handle)

Wrap a native window handle in a Window object.

Normalize

Vec2(Vec2 v)
iVec2(iVec2 v)
Vec4(Vec4 v)
Quaternion(Quaternion q)
Mat3(Mat3 m)
Vec3(Vec3 v)

Return the input vector scaled so that its length is one.

NormalizePath

string(string path)

Normalize a path according to the following conventions:

  • Replace all whitespaces by underscores.

Offset

Rect(Rect rect, number x, number y)
IntRect(IntRect rect, int x, int y)

Offset a rectangle by the specified amount of units.

Open

File(string path)

Open a file in binary mode.

See OpenText, OpenWrite, OpenWriteText

OpenFileDialog

boolean, string(string title, FileFilterList filters, string file)
boolean, string(string title, FileFilterList filters, string file, string initial_dir)

Open a native OpenFile dialog.

OpenFolderDialog

boolean, string(string title, string folder_name)
boolean, string(string title, string folder_name, string initial_dir)

Open a native OpenFolder dialog.

OpenTemp

File(string template_path)

Return a handle to a temporary file on the local filesystem.

OpenText

File(string path)

Open a file as text. Return a handle to the opened file.

See Open, OpenWrite, OpenWriteText

OpenVRCreateEyeFrameBuffer

OpenVREyeFrameBuffer()
OpenVREyeFrameBuffer(OpenVRAA aa)

Creates and returns an Virtual Reality eye framebuffer, with the desired level of anti-aliasing. This function must be invoked twice, for the left and right eyes.

OpenVRDestroyEyeFrameBuffer

nil(OpenVREyeFrameBuffer eye_fb)

Destroy an eye framebuffer.

OpenVRGetColorTexture

Texture(OpenVREyeFrameBuffer eye)

Return the color texture attached to an eye framebuffer.

OpenVRGetDepthTexture

Texture(OpenVREyeFrameBuffer eye)

Return the depth texture attached to an eye framebuffer.

OpenVRGetFrameBufferSize

iVec2()

OpenVRGetState

OpenVRState(Mat4 body, number znear, number zfar)

Returns the current OpenVR state including the body, head and eye transformations.

OpenVRInit

boolean()

Initialize OpenVR. Start the device display, its controllers and trackers.

OpenVRPostPresentHandoff

nil()

Signal to the OpenVR compositor that it can immediatly start processing the current frame.

OpenVRShutdown

nil()

Shutdown OpenVR.

OpenVRStateToViewState

ViewState, ViewState(OpenVRState state)

Compute the left and right eye view states from an OpenVR state.

See OpenVRGetState.

OpenVRSubmitFrame

nil(OpenVREyeFrameBuffer left, OpenVREyeFrameBuffer right)

Submit the left and right eye textures to the OpenVR compositor.

See OpenVRCreateEyeFrameBuffer.

OpenWrite

File(string path)

Open a file as binary in write mode.

See Open, OpenText, OpenWriteText

OpenWriteText

File(string path)

Open a file as text in write mode.

See Open, OpenText, OpenWrite

Orthonormalize

Mat3(Mat3 m)
Mat4(Mat4 m)

Return a matrix where the row vectors form an orthonormal basis. All vectors are normalized and perpendicular to each other.

Overlap

boolean(MinMax minmax_a, MinMax minmax_b)
boolean(MinMax minmax_a, MinMax minmax_b, Axis axis)

Return true if the provided volume overlaps with this volume, false otherwise. The test can optionally be restricted to a specific axis.

PathJoin

string(StringList elements)

Return a file path from a set of string elements.

PathStartsWith

boolean(string path, string with)

Test if the provided path starts with the provided prefix.

PathStripPrefix

string(string path, string prefix)

Return a copy of the input path stripped of the provided prefix.

PathStripSuffix

string(string path, string suffix)

Return a copy of the input path stripped of the provided suffix.

PathToDisplay

string(string path)

Format a path for display.

PauseSource

nil(SourceRef source)

Pause a playing audio source.

See PlayStereo and PlaySpatialized.

PlaySpatialized

SourceRef(SoundRef snd, SpatializedSourceState state)

Start playing a spatialized sound. Return a handle to the started source.

PlayStereo

SourceRef(SoundRef snd, StereoSourceState state)

Start playing a stereo sound. Return a handle to the started source.

PrepareForwardPipelineLights

ForwardPipelineLights(ForwardPipelineLightList lights)

Prepare a list of forward pipeline lights into a structure ready for submitting to the forward pipeline.

Lights are sorted by priority/type and the most important lights are assigned to available lighting slot of the forward pipeline.

See SubmitModelToForwardPipeline.

PrepareSceneForwardPipelineCommonRenderData

int, SceneForwardPipelinePassViewId(int view_id, Scene scene, SceneForwardPipelineRenderData render_data, ForwardPipeline pipeline, PipelineResources resources, SceneForwardPipelinePassViewId views)
int, SceneForwardPipelinePassViewId(int view_id, Scene scene, SceneForwardPipelineRenderData render_data, ForwardPipeline pipeline, PipelineResources resources, SceneForwardPipelinePassViewId views, string debug_name)

Prepare the common render data to submit a scene to the forward pipeline.

Note: When rendering multiple views of the same scene, common data only needs to be prepared once.

See PrepareSceneForwardPipelineViewDependentRenderData.

PrepareSceneForwardPipelineViewDependentRenderData

int, SceneForwardPipelinePassViewId(int view_id, ViewState view_state, Scene scene, SceneForwardPipelineRenderData render_data, ForwardPipeline pipeline, PipelineResources resources, SceneForwardPipelinePassViewId views)
int, SceneForwardPipelinePassViewId(int view_id, ViewState view_state, Scene scene, SceneForwardPipelineRenderData render_data, ForwardPipeline pipeline, PipelineResources resources, SceneForwardPipelinePassViewId views, string debug_name)

Prepare the view dependent render data to submit a scene to the forward pipeline.

See PrepareSceneForwardPipelineCommonRenderData.

PrintProfilerFrame

nil(ProfilerFrame profiler_frame)

Print a profiler frame to the console. Print all sections in the frame, their duration and event count.

ProcessLoadQueues

int(PipelineResources res)
int(PipelineResources res, int t_budget)

ProcessModelLoadQueue

int(PipelineResources res)
int(PipelineResources res, int t_budget)

ProcessTextureLoadQueue

int(PipelineResources res)
int(PipelineResources res, int t_budget)

Process the texture load queue. This function must be called to load textures queued while loading a scene or model with the LSSF_QueueTextureLoads flag.

See LoadSaveSceneFlags.

ProjectOrthoToClipSpace

boolean, Vec3(Mat44 proj, Vec3 view)

ProjectOrthoToScreenSpace

boolean, Vec3(Mat44 proj, Vec3 view, Vec2 resolution)

ProjectToClipSpace

boolean, Vec3(Mat44 proj, Vec3 view)

Project a world position to the clipping space.

ProjectToScreenSpace

boolean, Vec3(Mat44 proj, Vec3 view, Vec2 resolution)

Project a world position to screen coordinates.

ProjectZToClipSpace

number(number z, Mat44 proj)

Project a depth value to clip space.

Quantize

number(number v, number q)

Return the provided value quantized to the specified step.

QuaternionFromAxisAngle

Quaternion(number angle, Vec3 axis)

Return a quaternion rotation from a 3d axis and a rotation around that axis.

QuaternionFromEuler

Quaternion(number x, number y, number z)
Quaternion(number x, number y, number z, RotationOrder rotation_order)
Quaternion(Vec3 euler)
Quaternion(Vec3 euler, RotationOrder rotation_order)

Return a quaternion 3d rotation from its Euler vector representation.

QuaternionFromMatrix3

Quaternion(Mat3 m)

Return a quaternion rotation from its Mat3 representation.

QuaternionLookAt

Quaternion(Vec3 at)

Return a quaternion 3d rotation oriented toward the specified position when sitting on the world’s origin {0, 0, 0}.

RGBA32

int(int r, int g, int b)
int(int r, int g, int b, int a)

Create a 32 bit integer RGBA color.

Rad

number(number radians)

Convert an angle in radians to the engine unit system.

See Coordinates and Units System.

Rad3

Vec3(number x, number y, number z)

Convert a triplet of angles in radians to the engine unit system.

See Coordinates and Units System.

RadianToDegree

number(number radians)

Convert an angle in radians to degrees.

Rand

int()
int(int range)

Return a random integer value in the provided range, default range is [0;65535].

See FRand to generate a random floating point value.

RandomVec3

Vec3(number min, number max)
Vec3(Vec3 min, Vec3 max)

Return a vector with each component randomized in the inclusive provided range.

RandomVec4

Vec4(number min, number max)
Vec4(Vec4 min, Vec4 max)

Return a vector with each component randomized in the inclusive provided range.

ReadFloat

number(File file)

Read a binary 32 bit floating point value from a local file.

ReadGamepad

GamepadState()
GamepadState(string name)

Read the current state of a named gamepad. If no name is passed, default is implied.

See GetGamepadNames.

ReadJoystick

JoystickState()
JoystickState(string name)

ReadKeyboard

KeyboardState()
KeyboardState(string name)

Read the current state of a named keyboard. If no name is passed, default is implied.

See GetKeyboardNames.

ReadMouse

MouseState()
MouseState(string name)

Read the current state of a named mouse. If no name is passed, default is implied.

See GetMouseNames.

ReadString

string(File file)

Read a binary string from a local file.

Strings are stored as a uint32_t length field followed by the string content in UTF-8.

ReadUInt16

int(File file)

Read a binary 16 bit unsigned integer value from a local file.

ReadUInt32

int(File file)

Read a binary 32 bit unsigned integer value from a local file.

ReadUInt8

int(File file)

Read a binary 8 bit unsigned integer value from a local file.

ReadVRController

VRControllerState()
VRControllerState(string name)

Read the current state of a named VR controller. If no name is passed, default is implied.

See GetVRControllerNames.

ReadVRGenericTracker

VRGenericTrackerState()
VRGenericTrackerState(string name)

Read the current state of a named VR generic tracked. If no name is passed, default is implied.

See GetVRGenericTrackerNames.

Reflect

Vec3(Vec3 v, Vec3 n)

Return the input vector reflected around the specified normal.

Refract

Vec3(Vec3 v, Vec3 n)
Vec3(Vec3 v, Vec3 n, number k_in)
Vec3(Vec3 v, Vec3 n, number k_in, number k_out)

Return the input vector refracted around the provided surface normal.

  • k_in: IOR of the medium the vector is exiting.
  • k_out: IOR of the medium the vector is entering.

RemoveAssetsFolder

nil(string path)

Remove a folder from the assets system.

See Resources & Assets.

RemoveAssetsPackage

nil(string path)

Remove a package from the assets system.

See Resources & Assets.

RenderInit

boolean(Window window)
boolean(Window window, RendererType type)
Window(int width, int height, ResetFlags reset_flags)
Window(int width, int height, ResetFlags reset_flags, TextureFormat format)
Window(int width, int height, ResetFlags reset_flags, TextureFormat format, DebugFlags debug_flags)
Window(int width, int height, RendererType type)
Window(int width, int height, RendererType type, ResetFlags reset_flags)
Window(int width, int height, RendererType type, ResetFlags reset_flags, TextureFormat format)
Window(int width, int height, RendererType type, ResetFlags reset_flags, TextureFormat format, DebugFlags debug_flags)
Window(string window_title, int width, int height, ResetFlags reset_flags)
Window(string window_title, int width, int height, ResetFlags reset_flags, TextureFormat format)
Window(string window_title, int width, int height, ResetFlags reset_flags, TextureFormat format, DebugFlags debug_flags)
Window(string window_title, int width, int height, RendererType type)
Window(string window_title, int width, int height, RendererType type, ResetFlags reset_flags)
Window(string window_title, int width, int height, RendererType type, ResetFlags reset_flags, TextureFormat format)
Window(string window_title, int width, int height, RendererType type, ResetFlags reset_flags, TextureFormat format, DebugFlags debug_flags)

Initialize the render system.

To change the states of the render system afterward use RenderReset.

RenderReset

nil(int width, int height)
nil(int width, int height, ResetFlags flags)
nil(int width, int height, ResetFlags flags, TextureFormat format)

Change the states of the render system at runtime.

RenderResetToWindow

boolean, int, int(Window win, int width, int height)
boolean, int, int(Window win, int width, int height, int reset_flags)

Resize the renderer backbuffer to the provided window client area dimensions. Return true if a reset was needed and carried out.

RenderShutdown

nil()

Shutdown the render system.

ResetClock

nil()

Reset the elapsed time counter.

Reverse

Vec2(Vec2 a)
iVec2(iVec2 a)
Vec3(Vec3 v)

Return the provided vector pointing in the opposite direction.

ReverseRotationOrder

RotationOrder(RotationOrder rotation_order)

Return the rotation order processing each axis in the reverse order of the input rotation order.

Rewind

nil(File file)

Rewind the read/write cursor of an open file.

RmDir

boolean(string path)

Remove an empty folder on the local filesystem.

See RmTree.

RmTree

boolean(string path)

Remove a folder on the local filesystem.

Warning: This function will through all subfolders and erase all files and folders in the target folder.

RotationMat2D

Mat3(number angle, Vec2 pivot)

Return a 2D rotation matrix by a radians around the specified pivot point.

RotationMat3

Mat3(number x, number y, number z)
Mat3(number x, number y, number z, RotationOrder rotation_order)
Mat3(Vec3 euler)
Mat3(Vec3 euler, RotationOrder rotation_order)

Return a 3x3 rotation matrix.

RotationMat4

Mat4(Vec3 euler)
Mat4(Vec3 euler, RotationOrder order)

Return a 4x3 rotation matrix from euler angles. The default rotation order is YXZ.

RotationMatX

Mat3(number angle)

Return a 3x3 rotation matrix around the world X axis {1, 0, 0}.

RotationMatXY

Mat3(number x, number y)

Return a 3x3 rotation matrix around the X axis followed by a rotation around the Y axis.

RotationMatXYZ

Mat3(number x, number y, number z)

Return a 3x3 rotation matrix around the X axis followed by a rotation around the Y axis then a rotation around the Z axis.

RotationMatXZY

Mat3(number x, number y, number z)

Return a 3x3 rotation matrix around the X axis followed by a rotation around the Z axis then a rotation around the Y axis.

RotationMatY

Mat3(number angle)

Return a 3x3 rotation matrix around the world Y axis {0, 1, 0}.

RotationMatYXZ

Mat3(number x, number y, number z)

Return a 3x3 rotation matrix around the Y axis followed by a rotation around the X axis then a rotation around the Z axis.

RotationMatYZX

Mat3(number x, number y, number z)

Return a 3x3 rotation matrix around the Y axis followed by a rotation around the Z axis then a rotation around the X axis.

RotationMatZ

Mat3(number angle)

Return a 3x3 rotation matrix around the world Z axis {0, 0, 1}.

RotationMatZXY

Mat3(number x, number y, number z)

Return a 3x3 rotation matrix around the Z axis followed by a rotation around the X axis then a rotation around the Y axis.

RotationMatZYX

Mat3(number x, number y, number z)

Return a 3x3 rotation matrix around the Z axis followed by a rotation around the Y axis then a rotation around the X axis.

SRanipalGetState

SRanipalState()

Return the current SRanipal device state.

SRanipalInit

boolean()

Initial the SRanipal eye detection SDK.

SRanipalIsViveProEye

boolean()

Return true if the eye detection device in use is Vive Pro Eye.

SRanipalLaunchEyeCalibration

nil()

Launch the eye detection calibration sequence.

SRanipalShutdown

nil()

Shutdown the SRanipal eye detection SDK.

SaveBMP

boolean(Picture pict, string path)

Save a Picture in BMP file format.

SaveDataToFile

boolean(string path, Data data)

SaveFileDialog

boolean, string(string title, FileFilterList filters, string file)
boolean, string(string title, FileFilterList filters, string file, string initial_dir)

Open a native SaveFile dialog.

SaveForwardPipelineAAAConfigToFile

boolean(string path, ForwardPipelineAAAConfig config)

SaveGeometryToFile

boolean(string path, Geometry geo)

Save a geometry to the local filesystem.

Note that in order to render a geometry it must have been converted to model by the asset compiler.

See GeometryBuilder and ModelBuilder.

SaveJsonToFile

boolean(JSON js, string path)

Save a JSON object to the local filesystem.

SavePNG

boolean(Picture pict, string path)

Save a Picture in PNG file format.

SaveSceneBinaryToData

boolean(Data data, Scene scene, PipelineResources resources)
boolean(Data data, Scene scene, PipelineResources resources, LoadSaveSceneFlags flags)

SaveSceneBinaryToFile

boolean(string path, Scene scene, PipelineResources resources)
boolean(string path, Scene scene, PipelineResources resources, LoadSaveSceneFlags flags)

SaveSceneJsonToFile

boolean(string path, Scene scene, PipelineResources resources)
boolean(string path, Scene scene, PipelineResources resources, LoadSaveSceneFlags flags)

SaveTGA

boolean(Picture pict, string path)

Save a Picture in TGA file format.

ScaleMat3

Mat3(Vec2 S)
Mat3(Vec3 S)

Return a 3x3 scale matrix from a 2D vector.

ScaleMat4

Mat4(Vec3 scale)
Mat4(number scale)

Return a 4x3 scale matrix from the parameter scaling vector.

SceneClearSystems

nil(Scene scene)
nil(Scene scene, SceneLuaVM vm)
nil(Scene scene, SceneBullet3Physics physics)
nil(Scene scene, SceneBullet3Physics physics, SceneLuaVM vm)

Clear scene and all optional systems.

SceneGarbageCollectSystems

int(Scene scene)
int(Scene scene, SceneLuaVM vm)
int(Scene scene, SceneBullet3Physics physics)
int(Scene scene, SceneBullet3Physics physics, SceneLuaVM vm)

Garbage collect a scene and all its optional systems.

SceneSyncToSystemsFromAssets

nil(Scene scene, SceneLuaVM vm)
nil(Scene scene, SceneBullet3Physics physics)
nil(Scene scene, SceneBullet3Physics physics, SceneLuaVM vm)

Synchronize optional systems (eg. physics or script) states with the scene states. Load resources from the assets system if required.

See Resources & Assets.

SceneSyncToSystemsFromFile

nil(Scene scene, SceneLuaVM vm)
nil(Scene scene, SceneBullet3Physics physics)
nil(Scene scene, SceneBullet3Physics physics, SceneLuaVM vm)

Synchronize optional systems (eg. physics or script) states with the scene states. Load resources from the local filesystem if required.

See Resources & Assets.

SceneUpdateSystems

nil(Scene scene, SceneClocks clocks, int dt)
nil(Scene scene, SceneClocks clocks, int dt, SceneLuaVM vm)
nil(Scene scene, SceneClocks clocks, int dt, SceneBullet3Physics physics, int step, int max_physics_step)
nil(Scene scene, SceneClocks clocks, int dt, SceneBullet3Physics physics, int step, int max_physics_step, SceneLuaVM vm)
nil(Scene scene, SceneClocks clocks, int dt, SceneBullet3Physics physics, NodePairContacts contacts, int step, int max_physics_step)
nil(Scene scene, SceneClocks clocks, int dt, SceneBullet3Physics physics, NodePairContacts contacts, int step, int max_physics_step, SceneLuaVM vm)

Update a scene and all its optional systems.

ScreenSpaceToClipSpace

Vec3(Vec3 screen, Vec2 resolution)

Transform a screen position to clip space.

Sec

number(number seconds)

Convert a value in seconds to the Harfang internal unit system.

See Coordinates and Units System.

Seed

nil(int seed)

Set the starting seed of the pseudo-random number generator.

Seek

boolean(File file, int offset, SeekMode mode)

Move the handle cursor to a specific position in the file.

SendVRControllerHapticPulse

nil(int duration)
nil(int duration, string name)

Send an haptic pulse to a named VR controller.

See GetVRControllerNames.

SetAxises

nil(Mat3 m, Vec3 X, Vec3 Y, Vec3 Z)

Inject X, Y and Z axises into a 3x3 matrix.

SetColumn

nil(Mat3 m, int n, Vec3 column)
nil(Mat4 m, int n, Vec3 v)
nil(Mat44 m, int idx, Vec4 v)

Returns the nth column.

SetHeight

nil(Rect rect, number height)
nil(IntRect rect, int height)

Set a rectangle height.

SetJsonValue

nil(JSON js, string key, string value)
nil(JSON js, string key, boolean value)
nil(JSON js, string key, int value)
nil(JSON js, string key, number value)

Set a JSON key value.

SetListener

nil(Mat4 world, Vec3 velocity)

Set the listener transformation and velocity for spatialization by the audio system.

SetLogDetailed

nil(boolean is_detailed)

Display the details field of log outputs.

SetLogLevel

nil(LogLevel log_level)

Control which log levels should be displayed.

See Log, Warn, Error and Debug.

SetMaterialAlphaCut

nil(Material mat, boolean enable)

SetMaterialAmbientUsesUV1

nil(Material mat, boolean enable)

SetMaterialBlendMode

nil(Material mat, BlendMode mode)

Set material blend mode.

SetMaterialDepthTest

nil(Material mat, DepthTest test)

Set material depth test.

SetMaterialDiffuseUsesUV1

nil(Material mat, boolean enable)

SetMaterialFaceCulling

nil(Material mat, FaceCulling culling)

Set material face culling.

SetMaterialNormalMapInWorldSpace

nil(Material mat, boolean enable)

SetMaterialProgram

nil(Material mat, PipelineProgramRef program)

Set material pipeline program.

You should call UpdateMaterialPipelineProgramVariant after changing a material pipeline program so that the correct variant is selected according to the material states.

SetMaterialSkinning

nil(Material mat, boolean enable)

SetMaterialSpecularUsesUV1

nil(Material mat, boolean enable)

SetMaterialTexture

nil(Material mat, string name, TextureRef texture, int stage)

Set a material uniform texture and texture stage.

Note: The texture stage specified should match the uniform declaration in the shader program.

SetMaterialTextureRef

nil(Material mat, string name, TextureRef texture)

Set a material uniform texture reference.

See PipelineResources.

SetMaterialValue

nil(Material mat, string name, number v)
nil(Material mat, string name, Vec2 v)
nil(Material mat, string name, Vec3 v)
nil(Material mat, string name, Vec4 v)
nil(Material mat, string name, Mat3 m)
nil(Material mat, string name, Mat4 m)
nil(Material mat, string name, Mat44 m)

Set a material uniform value.

SetMaterialWriteRGBA

nil(Material mat, boolean write_r, boolean write_g, boolean write_b, boolean write_a)

Set a material color write mask.

SetMaterialWriteZ

nil(Material mat, boolean enable)

Set a material depth write mask.

SetRenderDebug

nil(DebugFlags flags)

Set render system debug flags.

SetRow

nil(Mat3 m, int n, Vec3 row)
nil(Mat4 m, int n, Vec4 v)
nil(Mat44 m, int idx, Vec4 v)

Sets the nth row of a matrix.

SetS

nil(Mat4 m, Vec3 scale)

Shortcut for SetScale.

SetSaturation

Color(Color color, number saturation)

Return a copy of the input RGBA color with its saturation set to the specified value, alpha channel is left unmodified.

See ToHLS and FromHLS.

SetScale

nil(Mat3 m, Vec3 S)
nil(Mat4 m, Vec3 scale)

Set the scaling part of the transformation matrix.

SetSourcePanning

nil(SourceRef source, number panning)

Set a playing audio source panning.

SetSourceRepeat

nil(SourceRef source, SourceRepeat repeat)

Set audio source repeat mode.

SetSourceTimecode

boolean(SourceRef source, int t)

Set timecode of the audio source.

SetSourceTransform

nil(SourceRef source, Mat4 world, Vec3 velocity)

Set a playing spatialized audio source transformation.

SetSourceVolume

nil(SourceRef source, number volume)

Set audio source volume.

SetT

nil(Mat4 m, Vec3 T)

Shortcut for SetTranslation.

SetTransform

nil(Mat4 mtx)

Set the model matrix for the next drawn primitive.

If not called, model will be rendered with the identity model matrix.

SetTranslation

nil(Mat3 m, Vec3 T)
nil(Mat3 m, Vec2 T)
nil(Mat4 m, Vec3 T)

Sets the 2D translation part, i.e. the first 2 elements of the last matrix row.

SetView2D

nil(int id, int x, int y, int res_x, int res_y)
nil(int id, int x, int y, int res_x, int res_y, number znear, number zfar)
nil(int id, int x, int y, int res_x, int res_y, number znear, number zfar, ClearFlags flags, Color color, number depth, int stencil)
nil(int id, int x, int y, int res_x, int res_y, number znear, number zfar, ClearFlags flags, Color color, number depth, int stencil, boolean y_up)

High-level wrapper function to setup a view for 2D rendering.

This function calls SetViewClear, SetViewRect then SetViewTransform.

SetViewClear

nil(int view_id, ClearFlags flags)
nil(int view_id, ClearFlags flags, int rgba)
nil(int view_id, ClearFlags flags, int rgba, number depth)
nil(int view_id, ClearFlags flags, int rgba, number depth, int stencil)
nil(int view_id, ClearFlags flags, Color col)
nil(int view_id, ClearFlags flags, Color col, number depth)
nil(int view_id, ClearFlags flags, Color col, number depth, int stencil)

Set a view clear parameters.

See Drawing to Views.

SetViewFrameBuffer

nil(int view_id, FrameBufferHandle handle)

Set view output framebuffer.

See Drawing to Views.

SetViewMode

nil(int view_id, ViewMode mode)

Set view draw ordering mode.

SetViewOrthographic

nil(int id, int x, int y, int res_x, int res_y, Mat4 world)
nil(int id, int x, int y, int res_x, int res_y, Mat4 world, number znear, number zfar)
nil(int id, int x, int y, int res_x, int res_y, Mat4 world, number znear, number zfar, number size)
nil(int id, int x, int y, int res_x, int res_y, Mat4 world, number znear, number zfar, number size, ClearFlags flags, Color color, number depth, int stencil)

High-level wrapper function to setup a view for 3D orthographic rendering.

This function calls SetViewClear, SetViewRect then SetViewTransform.

SetViewPerspective

nil(int id, int x, int y, int res_x, int res_y, Mat4 world)
nil(int id, int x, int y, int res_x, int res_y, Mat4 world, number znear, number zfar)
nil(int id, int x, int y, int res_x, int res_y, Mat4 world, number znear, number zfar, number zoom_factor)
nil(int id, int x, int y, int res_x, int res_y, Mat4 world, number znear, number zfar, number zoom_factor, ClearFlags flags, Color color, number depth, int stencil)

High-level wrapper function to setup a view for 3D perspective rendering.

This function calls SetViewClear, SetViewRect then SetViewTransform.

SetViewRect

nil(int view_id, int x, int y, int w, int h)

SetViewTransform

nil(int view_id, Mat4 view, Mat44 proj)

Set view transforms, namely the view and projection matrices.

SetWidth

nil(Rect rect, number width)
nil(IntRect rect, int width)

Set a rectangle width.

SetWindowClientSize

boolean(Window window, int width, int height)

Set the window client size. The client area of a window excludes its decoration.

SetWindowPos

boolean(Window window, iVec2 position)

Set window position.

SetWindowTitle

boolean(Window window, string title)

Set window title.

SetX

nil(Mat3 m, Vec3 X)
nil(Mat4 m, Vec3 X)
nil(Rect rect, number x)
nil(IntRect rect, int x)

Sets the first row.

SetY

nil(Mat3 m, Vec3 Y)
nil(Mat4 m, Vec3 Y)
nil(Rect rect, number y)
nil(IntRect rect, int y)

Sets the second row.

SetZ

nil(Mat3 m, Vec3 Z)
nil(Mat4 m, Vec3 Z)

Sets the third row.

ShowCursor

nil()

Show the system mouse cursor.

See HideCursor.

Sign

Vec3(Vec3 v)

Returns a vector whose elements are -1 if the corresponding vector element is < 0 and 1 if it’s >= 0.

SkipClock

nil()

Skip elapsed time since the last call to TickClock.

Sleep

nil(int duration)

Sleep the caller thread, this function will resume execution after waiting for at least the specified amount of time.

Slerp

Quaternion(Quaternion a, Quaternion b, number t)

Interpolate between the rotation represented by two quaternions. The Spherical Linear Interpolation will always take the shortest path between the two rotations.

StopAllSources

nil()

Stop all playing audio sources.

StopSource

nil(SourceRef source)

Stop a playing audio source.

StreamOGGAssetSpatialized

SourceRef(string name, SpatializedSourceState state)

StreamOGGAssetStereo

SourceRef(string name, StereoSourceState state)

StreamOGGFileSpatialized

SourceRef(string path, SpatializedSourceState state)

StreamOGGFileStereo

SourceRef(string path, StereoSourceState state)

StreamWAVAssetSpatialized

SourceRef(string name, SpatializedSourceState state)

Start an audio stream from a WAV file from the assets system.

See SetSourceTransform and Resources & Assets.

StreamWAVAssetStereo

SourceRef(string name, StereoSourceState state)

Start an audio stream from a WAV file from the assets system.

See Resources & Assets.

StreamWAVFileSpatialized

SourceRef(string path, SpatializedSourceState state)

Start an audio stream from a WAV file on the local filesystem.

See SetSourceTransform.

StreamWAVFileStereo

SourceRef(string path, StereoSourceState state)

Start an audio stream from a WAV file on the local filesystem.

See Resources & Assets.

StringToFile

boolean(string path, string value)

Return the content of a file on the local filesystem as a string.

SubmitModelToForwardPipeline

int(int view_id, Model mdl, ForwardPipeline pipeline, PipelineProgram prg, int prg_variant, int pipeline_stage, Color ambient, ForwardPipelineLights lights, ForwardPipelineFog fog, Mat4 mtx)

Submit a model to the forward pipeline.

See SetViewMode.

SubmitSceneToForwardPipeline

SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, SceneForwardPipelineRenderData render_data, PipelineResources resources)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, SceneForwardPipelineRenderData render_data, PipelineResources resources, FrameBufferHandle frame_buffer)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, SceneForwardPipelineRenderData render_data, PipelineResources resources, FrameBufferHandle frame_buffer, string debug_name)
int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, SceneForwardPipelineRenderData render_data, PipelineResources resources, SceneForwardPipelinePassViewId views, ForwardPipelineAAA aaa, ForwardPipelineAAAConfig aaa_config, int frame)
int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, SceneForwardPipelineRenderData render_data, PipelineResources resources, SceneForwardPipelinePassViewId views, ForwardPipelineAAA aaa, ForwardPipelineAAAConfig aaa_config, int frame, FrameBufferHandle frame_buffer)
int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, SceneForwardPipelineRenderData render_data, PipelineResources resources, SceneForwardPipelinePassViewId views, ForwardPipelineAAA aaa, ForwardPipelineAAAConfig aaa_config, int frame, FrameBufferHandle frame_buffer, string debug_name)

Submit a scene to a forward pipeline.

See PrepareSceneForwardPipelineCommonRenderData and PrepareSceneForwardPipelineViewDependentRenderData if you need to render the same scene from different points of view.

SubmitSceneToPipeline

SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, PipelineResources resources)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, PipelineResources resources, FrameBufferHandle fb)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, PipelineResources resources, FrameBufferHandle fb, string debug_name)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, boolean fov_axis_is_horizontal, ForwardPipeline pipeline, PipelineResources resources)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, boolean fov_axis_is_horizontal, ForwardPipeline pipeline, PipelineResources resources, FrameBufferHandle fb)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, boolean fov_axis_is_horizontal, ForwardPipeline pipeline, PipelineResources resources, FrameBufferHandle fb, string debug_name)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, PipelineResources resources, ForwardPipelineAAA aaa, ForwardPipelineAAAConfig aaa_config, int frame)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, PipelineResources resources, ForwardPipelineAAA aaa, ForwardPipelineAAAConfig aaa_config, int frame, FrameBufferHandle frame_buffer)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, ViewState view_state, ForwardPipeline pipeline, PipelineResources resources, ForwardPipelineAAA aaa, ForwardPipelineAAAConfig aaa_config, int frame, FrameBufferHandle frame_buffer, string debug_name)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, boolean fov_axis_is_horizontal, ForwardPipeline pipeline, PipelineResources resources, ForwardPipelineAAA aaa, ForwardPipelineAAAConfig aaa_config, int frame)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, boolean fov_axis_is_horizontal, ForwardPipeline pipeline, PipelineResources resources, ForwardPipelineAAA aaa, ForwardPipelineAAAConfig aaa_config, int frame, FrameBufferHandle frame_buffer)
SceneForwardPipelinePassViewId, int(int view_id, Scene scene, IntRect rect, boolean fov_axis_is_horizontal, ForwardPipeline pipeline, PipelineResources resources, ForwardPipelineAAA aaa, ForwardPipelineAAAConfig aaa_config, int frame, FrameBufferHandle frame_buffer, string debug_name)

See SubmitSceneToForwardPipeline.

SwapFileExtension

string(string path, string ext)

Return the input file path with its extension replaced.

Tell

int(File file)

Return the current handle cursor position in bytes.

TestVisibility

Visibility(Frustum frustum, int count, Vec3 points)
Visibility(Frustum frustum, int count, Vec3 points, number distance)
Visibility(Frustum frustum, Vec3 origin, number radius)
Visibility(Frustum frustum, MinMax minmax)

Test if a list of 3d points are inside or outside a Frustum.

TickClock

int()

Advance the engine clock and return the elapsed time since the last call to this function. See GetClock to retrieve the current clock.

See GetClockDt.

ToEuler

Vec3(Quaternion q)
Vec3(Quaternion q, RotationOrder rotation_order)
Vec3(Mat3 m)
Vec3(Mat3 m, RotationOrder rotation_order)

Convert a quaternion rotation to its Euler vector representation.

ToFloatRect

Rect(IntRect rect)

Return an integer rectangle as a floating point rectangle.

ToHLS

Color(Color color)

Convert input RGBA color to hue/luminance/saturation, alpha channel is left unmodified.

ToIntRect

IntRect(Rect rect)

Return a floating point rectangle as an integer rectangle.

ToMatrix3

Mat3(Quaternion q)

Convert a quaternion rotation to its Mat3 representation.

Touch

nil(int view_id)

Submit an empty primitive to the view.

See Frame.

TransformFrustum

Frustum(Frustum frustum, Mat4 mtx)

Return the input frustum transformed by the provided world matrix.

TransformationMat4

Mat4(Vec3 pos, Vec3 rot)
Mat4(Vec3 pos, Vec3 rot, Vec3 scale)
Mat4(Vec3 pos, Mat3 rot)
Mat4(Vec3 pos, Mat3 rot, Vec3 scale)

Creates a 4x3 transformation matrix from the translation vector p, the 3x3 rotation Matrix m (or YXZ euler rotation vector e) and the scaling vector s.

This is a more efficient version of TranslationMat4(p) * ScaleMat4(s) * m

TranslationMat3

Mat3(Vec2 T)
Mat3(Vec3 T)

Return a 2D translation 3x3 matrix from the first 2 components (x,y) of the parameter vector.

TranslationMat4

Mat4(Vec3 t)

Return a 4x3 translation matrix from the parameter displacement vector.

Transpose

Mat3(Mat3 m)

Return the transpose of the input matrix.

For a pure rotation matrix this returns the opposite transformation so that M*MT=I.

time_from_day

int(int day)

Convert days to time.

See Coordinates and Units System.

time_from_hour

int(int hour)

Convert hours to time.

See Coordinates and Units System.

time_from_min

int(int min)

Convert minutes to time.

See Coordinates and Units System.

time_from_ms

int(int ms)

Convert milliseconds to time.

See Coordinates and Units System.

time_from_ms_f

int(number ms)

Convert milliseconds to time.

See Coordinates and Units System.

time_from_ns

int(int ns)

Convert nanoseconds to time.

See Coordinates and Units System.

time_from_sec

int(int sec)

Convert seconds to time.

See Coordinates and Units System.

time_from_sec_f

int(number sec)

Convert fractional seconds to time.

See Coordinates and Units System.

time_from_us

int(int us)

Convert microseconds to time.

See Coordinates and Units System.

time_from_us_f

int(number us)

Convert fractional microseconds to time.

See Coordinates and Units System.

time_now

int()

Return the current system time.

time_to_day

int(int t)

Convert time to days.

time_to_hour

int(int t)

Convert time to hours.

time_to_min

int(int t)

Convert time to minutes.

time_to_ms

int(int t)

Convert time to milliseconds.

time_to_ms_f

number(int t)

Convert time to miliseconds.

time_to_ns

int(int t)

Convert time to nanoseconds.

time_to_sec

int(int t)

Convert time to seconds.

time_to_sec_f

number(int t)

Convert time to fractional seconds.

time_to_string

string(int t)

Return time as a human-readable string.

time_to_us

int(int t)

Convert time to microseconds.

time_to_us_f

number(int t)

Convert time to fractional microseconds.

Union

MinMax(MinMax minmax_a, MinMax minmax_b)
MinMax(MinMax minmax, Vec3 position)

Compute the union of this bounding volume with another volume or a 3d position.

boolean(string path)

Remove a file from the local filesystem.

UnloadSound

nil(SoundRef snd)

Unload a sound from the audio system.

UnprojectFromClipSpace

boolean, Vec3(Mat44 inv_proj, Vec3 clip)

Unproject a clip space position to view space.

UnprojectFromScreenSpace

boolean, Vec3(Mat44 inv_proj, Vec3 screen, Vec2 resolution)

Unproject a screen space position to view space.

UnprojectOrthoFromClipSpace

boolean, Vec3(Mat44 inv_proj, Vec3 clip)

UnprojectOrthoFromScreenSpace

boolean, Vec3(Mat44 inv_proj, Vec3 screen, Vec2 resolution)

UpdateMaterialPipelineProgramVariant

nil(Material mat, PipelineResources resources)

Select the proper pipeline program variant for the current material state.

UpdateTexture

boolean, Texture, iVec2, TextureFormat(IVideoStreamer streamer, pointer handle, Texture texture, iVec2 size, TextureFormat format)
boolean, Texture, iVec2, TextureFormat(IVideoStreamer streamer, pointer handle, Texture texture, iVec2 size, TextureFormat format, boolean destroy)

UpdateTextureFromPicture

nil(Texture tex, Picture pic)

Update texture content from the provided picture.

Note: The picture is expected to be in a format compatible with the texture format.

UpdateWindow

boolean(Window window)

Update a window on the host system.

Vec3I

Vec3(int x, int y, int z)

Create a vector from integer values in the [0;255] range.

Vec4I

Vec4(int x, int y, int z)
Vec4(int x, int y, int z, int w)

Create a vector from integer values in the [0;255] range.

VectorMat3

Mat3(Vec3 V)

Return a vector as a matrix.

VertexLayoutPosFloatColorFloat

VertexLayout()

VertexLayoutPosFloatColorUInt8

VertexLayout()

VertexLayoutPosFloatNormFloat

VertexLayout()

Simple vertex layout with float position and normal.

vtx_layout = VertexLayout()
vtx_layout.Begin()
vtx_layout.Add(hg.A_Position, 3, hg.AT_Float)
vtx_layout.Add(hg.A_Normal, 3, hg.AT_Float)
vtx_layout.End()

VertexLayoutPosFloatNormUInt8

VertexLayout()

Simple vertex layout with float position and 8-bit unsigned integer normal.

vtx_layout = VertexLayout()
vtx_layout.Begin()
vtx_layout.Add(hg.A_Position, 3, hg.AT_Float)
vtx_layout.Add(hg.A_Normal, 3, hg.AT_Uint8, True, True)
vtx_layout.End()

VertexLayoutPosFloatNormUInt8TexCoord0UInt8

VertexLayout()

VertexLayoutPosFloatTexCoord0UInt8

VertexLayout()

Warn

nil(string msg)
nil(string msg, string details)

WindowHasFocus

boolean(Window window)

Return true if the provided window has focus, false otherwise.

WindowSystemInit

nil()

Initialize the Window system.

WindowSystemShutdown

nil()

Shutdown the window system.

See WindowSystemInit.

Wrap

number(number v, number start, number end)
int(int v, int start, int end)

Wrap the input value so that it fits in the specified inclusive range.

WriteFloat

boolean(File file, number value)

Write a binary 32 bit floating point value to a file.

WriteString

boolean(File file, string value)

Write a string to a file as 32 bit integer size followed by the string content in UTF8.

WriteUInt16

boolean(File file, int value)

Write a binary 16 bit unsigned integer to a file.

WriteUInt32

boolean(File file, int value)

Write a binary 32 bit unsigned integer to a file.

WriteUInt8

boolean(File file, int value)

Write a binary 8 bit unsigned integer to a file.

ZoomFactorToFov

number(number zoom_factor)

Convert from a zoom factor value in meters to a fov value in radian.