imguizmo

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowAxisFlip

func AllowAxisFlip(value bool)

// Allow axis to flip // When true (default), the guizmo axis flip for better visibility // When false, they always stay along the positive world/local axis

func BeginFrame

func BeginFrame()

// call BeginFrame right after ImGui_XXXX_NewFrame();

func ComputeMouseRay added in v1.6.0

func ComputeMouseRay(view, projection *float32, mousePosition, rectPosition, rectSize imgui.Vec2, rayOrigin, rayDirection *float32)

// Compute the world-space mouse picking ray from explicit inputs, without reading ImGui IO. // Useful for tests/headless usage. view and projection are column-major float[16] (same // layout as Manipulate). rayOrigin and rayDirection receive a float[3] each.

func DecomposeMatrixToComponents

func DecomposeMatrixToComponents(matrix, translation, rotation, scale *float32)

// helper functions for manualy editing translation/rotation/scale with an input float // translation, rotation and scale float points to 3 floats each // Angles are in degrees (more suitable for human editing) // example: // float matrixTranslation[3], matrixRotation[3], matrixScale[3]; // ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale); // ImGui::InputFloat3("Tr", matrixTranslation, 3); // ImGui::InputFloat3("Rt", matrixRotation, 3); // ImGui::InputFloat3("Sc", matrixScale, 3); // ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16); // // These functions have some numerical stability issues for now. Use with caution.

func DrawAxes added in v1.6.0

func DrawAxes(view, projection, matrices *float32, matrixCount int32)

// Render coordinate system axes (red X, green Y and blue Z). Usefull for debug/tests

func DrawCubes

func DrawCubes(view, projection, matrices *float32, matrixCount int32)

// Render a cube with face color corresponding to face normal. Usefull for debug/tests

func DrawGrid

func DrawGrid(view, projection, matrix *float32, gridSize float32)

func DrawGridCustom added in v1.6.0

func DrawGridCustom(view, projection, matrix *float32, gridSize, majorStep float32, subdivision uint32)

// Render grid with customizable major line step and amount of segments between major lines. // NOTE(m.wlasiuk) : calling this function with majorStep = 1.0f and subdivision = 1 is equivalent to DrawGrid in terms of the end result but performs more calculations

func DrawGridCustomColor added in v1.6.0

func DrawGridCustomColor(view, projection, matrix *float32, gridSize, majorStep float32, subdivision, majorCol, minorCol, centerCol uint32)

// Render grid with customizable major line step and amount of segments between major lines and with possibility to set custom colors for major, minor and center lines

func Enable

func Enable(enable bool)

// enable/disable the gizmo. Stay in the state until next call to Enable. // gizmo is rendered with gray half transparent color when disabled

func GetIDPtr

func GetIDPtr(ptr_id uintptr) imgui.ID

func GetIDStr

func GetIDStr(str_id string) imgui.ID

calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself

func GetIDStrStr

func GetIDStrStr(str_id_begin, str_id_end string) imgui.ID

func IsOver

func IsOver() bool

// return true if mouse cursor is over any gizmo control (axis, plan or screen component)

func IsOverFloatPtr

func IsOverFloatPtr(position *float32, pixelRadius float32) bool

// from a x,y,z point in space and using Manipulation view/projection matrix, check if mouse is in pixel radius distance of that projected point

func IsOverOPERATION

func IsOverOPERATION(op OPERATION) bool

// return true if the cursor is over the operation's gizmo

func IsUsing

func IsUsing() bool

// return true if mouse IsOver or if the gizmo is in moving state

func IsUsingAny

func IsUsingAny() bool

// return true if any gizmo is in moving state

func IsUsingViewManipulate

func IsUsingViewManipulate() bool

// return true if the view gizmo is in moving state

func IsViewManipulateHovered added in v1.2.0

func IsViewManipulateHovered() bool

// only check if your mouse is over the view manipulator - no matter whether it's active or not

func Manipulate

func Manipulate(view, projection *float32, operation OPERATION, mode MODE, matrix *float32) bool

func ManipulateV

func ManipulateV(view, projection *float32, operation OPERATION, mode MODE, matrix, deltaMatrix, snap, localBounds, boundsSnap *float32) bool

ManipulateV parameter default value hint: deltaMatrix: NULL snap: NULL localBounds: NULL boundsSnap: NULL

func PopID

func PopID()

pop from the ID stack.

func PushIDInt

func PushIDInt(int_id int32)

push integer into the ID stack (will hash integer).

func PushIDPtr

func PushIDPtr(ptr_id uintptr)

push pointer into the ID stack (will hash pointer).

func PushIDStr

func PushIDStr(str_id string)

// ID stack/scopes // Read the FAQ (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui. // - Those questions are answered and impacted by understanding of the ID stack system: // - "Q: Why is my widget not reacting when I click on it?" // - "Q: How can I have widgets with an empty label?" // - "Q: How can I have multiple widgets with the same label?" // - Short version: ID are hashes of the entire ID stack. If you are creating widgets in a loop you most likely // want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them. // - You can also use the "Label##foobar" syntax within widget label to distinguish them from each others. // - In this header file we use the "label"/"name" terminology to denote a string that will be displayed + used as an ID, // whereas "str_id" denote a string that is only used as an ID and not normally displayed.// push string into the ID stack (will hash string).

func PushIDStrStr

func PushIDStrStr(str_id_begin, str_id_end string)

push string into the ID stack (will hash string).

func RecomposeMatrixFromComponents

func RecomposeMatrixFromComponents(translation, rotation, scale, matrix *float32)

func SetAlternativeWindow

func SetAlternativeWindow(window *imgui.Window)

func SetAxisLimit

func SetAxisLimit(value float32)

// Configure the limit where axis are hidden

func SetAxisMask

func SetAxisMask(x, y, z bool)

// Set an axis mask to permanently hide a given axis (true -> hidden, false -> shown)

func SetDrawlist

func SetDrawlist()

func SetDrawlistV

func SetDrawlistV(drawlist *imgui.DrawList)
// call inside your own window and before Manipulate() in order to draw gizmo to that window.
// Or pass a specific ImDrawList to draw to (e.g. ImGui::GetForegroundDrawList()).

SetDrawlistV parameter default value hint: drawlist: nullptr

func SetGizmoSizeClipSpace

func SetGizmoSizeClipSpace(value float32)

func SetID

func SetID(id int32)

func SetImGuiContext

func SetImGuiContext(ctx *imgui.Context)

// this is necessary because when imguizmo is compiled into a dll, and imgui into another // globals are not shared between them. // More details at https://stackoverflow.com/questions/19373061/what-happens-to-global-and-static-variables-in-a-shared-library-when-it-is-dynam // expose method to set imgui context

func SetOrthographic

func SetOrthographic(isOrthographic bool)

// default is false

func SetPlaneLimit

func SetPlaneLimit(value float32)

// Configure the limit where planes are hiden

func SetRect

func SetRect(x, y, width, height float32)

func ViewManipulateFloat

func ViewManipulateFloat(view *float32, length float32, position, size imgui.Vec2, backgroundColor uint32)

// // Please note that this cubeview is patented by Autodesk : https://patents.google.com/patent/US7782319B2/en // It seems to be a defensive patent in the US. I don't think it will bring troubles using it as // other software are using the same mechanics. But just in case, you are now warned! //

func ViewManipulateFloatPtr

func ViewManipulateFloatPtr(view, projection *float32, operation OPERATION, mode MODE, matrix *float32, length float32, position, size imgui.Vec2, backgroundColor uint32)

// use this version if you did not call Manipulate before and you are just using ViewManipulate

Types

type COLOR

type COLOR int32

original name: COLOR

const (
	// directionColor[0]
	DIRECTIONX COLOR = 0
	// directionColor[1]
	DIRECTIONY COLOR = 1
	// directionColor[2]
	DIRECTIONZ COLOR = 2
	// planeColor[0]
	PLANEX COLOR = 3
	// planeColor[1]
	PLANEY COLOR = 4
	// planeColor[2]
	PLANEZ COLOR = 5
	// selectionColor
	SELECTION COLOR = 6
	// inactiveColor
	INACTIVE COLOR = 7
	// translationLineColor
	TRANSLATIONLINE     COLOR = 8
	SCALELINE           COLOR = 9
	ROTATIONUSINGBORDER COLOR = 10
	ROTATIONUSINGFILL   COLOR = 11
	HATCHEDAXISLINES    COLOR = 12
	TEXT                COLOR = 13
	TEXTSHADOW          COLOR = 14
	COUNT               COLOR = 15
)

type MODE

type MODE int32

original name: MODE

const (
	LOCAL MODE = 0
	WORLD MODE = 1
)

type MOVETYPE added in v1.6.0

type MOVETYPE int32

Handle type used by the translate/rotate/scale gizmos. original name: MOVETYPE

const (
	MTNONE         MOVETYPE = 0
	MTMOVEX        MOVETYPE = 1
	MTMOVEY        MOVETYPE = 2
	MTMOVEZ        MOVETYPE = 3
	MTMOVEYZ       MOVETYPE = 4
	MTMOVEZX       MOVETYPE = 5
	MTMOVEXY       MOVETYPE = 6
	MTMOVESCREEN   MOVETYPE = 7
	MTROTATEX      MOVETYPE = 8
	MTROTATEY      MOVETYPE = 9
	MTROTATEZ      MOVETYPE = 10
	MTROTATESCREEN MOVETYPE = 11
	MTSCALEX       MOVETYPE = 12
	MTSCALEY       MOVETYPE = 13
	MTSCALEZ       MOVETYPE = 14
	MTSCALEXYZ     MOVETYPE = 15
)

func GetActiveHandleType added in v1.6.0

func GetActiveHandleType() MOVETYPE

// Returns which handle is actively being dragged, or MT_NONE.

func GetActiveMoveType added in v1.6.0

func GetActiveMoveType() MOVETYPE

// Aliases matching the MOVETYPE enum name.

func GetHoveredHandleType added in v1.6.0

func GetHoveredHandleType() MOVETYPE

// Returns which handle is currently hovered, or MT_NONE.

func GetHoveredMoveType added in v1.6.0

func GetHoveredMoveType() MOVETYPE

type OPERATION

type OPERATION int32

call it when you want a gizmo Needs view and projection matrices. matrix parameter is the source matrix (where will be gizmo be drawn) and might be transformed by the function. Return deltaMatrix is optional translation is applied in world space original name: OPERATION

const (
	TRANSLATEX   OPERATION = 1
	TRANSLATEY   OPERATION = 2
	TRANSLATEZ   OPERATION = 4
	ROTATEX      OPERATION = 8
	ROTATEY      OPERATION = 16
	ROTATEZ      OPERATION = 32
	ROTATESCREEN OPERATION = 64
	SCALEX       OPERATION = 128
	SCALEY       OPERATION = 256
	SCALEZ       OPERATION = 512
	BOUNDS       OPERATION = 1024
	SCALEXU      OPERATION = 2048
	SCALEYU      OPERATION = 4096
	SCALEZU      OPERATION = 8192
	TRANSLATE    OPERATION = 7
	ROTATE       OPERATION = 120
	SCALE        OPERATION = 896
	// universal
	SCALEU    OPERATION = 14336
	UNIVERSAL OPERATION = 14463
)

type Style

type Style struct {
	CData *C.Style
}

func GetStyle

func GetStyle() *Style

func NewEmptyStyle added in v1.2.0

func NewEmptyStyle() *Style

NewEmptyStyle creates Style with its 0 value.

func NewStyle

func NewStyle() *Style

func NewStyleFromC

func NewStyleFromC[SRC any](cvalue SRC) *Style

NewStyleFromC creates Style from its C pointer. SRC ~= *C.Style

func (Style) C

func (self Style) C() (C.Style, func())

C is like Handle but returns plain type instead of pointer.

func (*Style) CenterCircleSize

func (self *Style) CenterCircleSize() float32

func (*Style) Colors

func (self *Style) Colors() [15]imgui.Vec4

func (*Style) Destroy

func (self *Style) Destroy()

func (*Style) Handle

func (self *Style) Handle() (result *C.Style, fin func())

Handle returns C version of Style and its finalizer func.

func (*Style) HatchedAxisLineThickness

func (self *Style) HatchedAxisLineThickness() float32

func (*Style) RotationLineThickness

func (self *Style) RotationLineThickness() float32

func (*Style) RotationOuterLineThickness

func (self *Style) RotationOuterLineThickness() float32

func (*Style) ScaleLineCircleSize

func (self *Style) ScaleLineCircleSize() float32

func (*Style) ScaleLineThickness

func (self *Style) ScaleLineThickness() float32

func (Style) SetCenterCircleSize

func (self Style) SetCenterCircleSize(v float32)

func (Style) SetColors

func (self Style) SetColors(v *[15]imgui.Vec4)

func (Style) SetHatchedAxisLineThickness

func (self Style) SetHatchedAxisLineThickness(v float32)

func (Style) SetRotationLineThickness

func (self Style) SetRotationLineThickness(v float32)

func (Style) SetRotationOuterLineThickness

func (self Style) SetRotationOuterLineThickness(v float32)

func (Style) SetScaleLineCircleSize

func (self Style) SetScaleLineCircleSize(v float32)

func (Style) SetScaleLineThickness

func (self Style) SetScaleLineThickness(v float32)

func (Style) SetTranslationLineArrowSize

func (self Style) SetTranslationLineArrowSize(v float32)

func (Style) SetTranslationLineThickness

func (self Style) SetTranslationLineThickness(v float32)

func (*Style) TranslationLineArrowSize

func (self *Style) TranslationLineArrowSize() float32

func (*Style) TranslationLineThickness

func (self *Style) TranslationLineThickness() float32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址