class

FArcUIWorldWidgetMath

Pure geometry for the world-space UI widget quad — the part that decides where a nameplate sits in the scene, how large its offscreen texture should be at the current distance, whether it needs re-rendering this frame and where a click ray lands on it in widget-local UV. Every method is static and device-free so the headless test pins the exact transforms and hit math the runtime uses. Matrices are row-major (worldMatrix maps a unit quad centered on the origin, XY plane, to world space).

Module
ArcUI
Header
#include "ArcUI/FArcUIWorldWidgetMath.h"
Namespace
Mowo

Properties

TypeNameDescription
static constexpr uint32_tkNeverRenderedDefault 0xFFFFFFFFu.

Public functions

ReturnsNameDescription
Mat4BillboardMatrixCamera-facing billboard: a unit quad scaled to (widthWorld, heightWorld), oriented so its +X follows the camera's right and +Y the camera's up, translated to worldPos.
Mat4OrientedMatrixTransform-oriented quad: the entity's world matrix supplies orientation, localOffset shifts the quad along the entity's local axes, and the quad is scaled to (widthWorld, heightWorld).
floatHeightForWidthThe quad's world height from its design pixel size and physical width: keeps the design aspect (designSize.y / designSize.x).
voidLodResolutionDistance-driven LOD resolution for the offscreen target.
uint32_tLodBucketThe discrete LOD bucket a distance falls in (0 = full res at/under the reference distance, then one step per doubling).
boolShouldRefreshWhether the offscreen texture must be re-rendered this frame: the content changed (contentDirty), or the LOD bucket moved (resolution changed), or nothing has been rendered yet (lastBucket == kNeverRendered).
boolRayQuadUVRay vs.

Function details

BillboardMatrix

C++
static Mat4 BillboardMatrix(const Vec3& worldPos, const Vec3& cameraPos, const Vec3& cameraUp, float widthWorld, float heightWorld)

Camera-facing billboard: a unit quad scaled to (widthWorld, heightWorld), oriented so its +X follows the camera's right and +Y the camera's up, translated to worldPos. cameraUp is the camera's world up (usually (0,1,0)); the right axis is derived from the view direction so the quad never rolls.

OrientedMatrix

C++
static Mat4 OrientedMatrix(const Mat4& entityWorld, const Vec3& localOffset, float widthWorld, float heightWorld)

Transform-oriented quad: the entity's world matrix supplies orientation, localOffset shifts the quad along the entity's local axes, and the quad is scaled to (widthWorld, heightWorld). A plaque bolted to a moving actor.

HeightForWidth

C++
static float HeightForWidth(const Vec2& designSize, float widthWorld)

The quad's world height from its design pixel size and physical width: keeps the design aspect (designSize.y / designSize.x).

LodResolution

C++
static void LodResolution(const Vec2& designSize, float distance, float referenceDistance, uint32_t maxTexels, uint32_t& outWidth, uint32_t& outHeight)

Distance-driven LOD resolution for the offscreen target. At or nearer than referenceDistance the longest edge is maxTexels; it halves per LOD as the widget recedes, clamped to a small floor so far nameplates still render legibly. The design aspect is preserved. Returns integer pixel extents.

LodBucket

C++
static uint32_t LodBucket(float distance, float referenceDistance)

The discrete LOD bucket a distance falls in (0 = full res at/under the reference distance, then one step per doubling). Re-render policy keys off this so a widget drifting slowly does not re-render every frame — only when it crosses a bucket boundary (or its content goes dirty).

ShouldRefresh

C++
static bool ShouldRefresh(bool contentDirty, uint32_t lastBucket, uint32_t currentBucket)

Whether the offscreen texture must be re-rendered this frame: the content changed (contentDirty), or the LOD bucket moved (resolution changed), or nothing has been rendered yet (lastBucket == kNeverRendered).

RayQuadUV

C++
static bool RayQuadUV(const Vec3& rayOrigin, const Vec3& rayDir, const Mat4& worldMatrix, bool singleSided, float& outU, float& outV, float& outDistance)

Ray vs. the quad described by worldMatrix. On a hit, outU/outV are the widget-local UV in [0,1] (origin top-left, matching the offscreen render and the Arc coordinate space), outDistance the ray parameter. Returns false when the ray misses the quad or hits its back face while singleSided is true.

Generated from ArcUI/FArcUIWorldWidgetMath.h via arcui.json · Nov 4, 2026Version 1.0.0