benilla-re systems structs docs

CGWorldFrame::ScreenPointToRay

function · ui · primitive

Address
0x4813b0 · 261 bytes, up to 0x4814b4
Signature
uint32_t __thiscall (CGWorldFrame *this, float a, float b, float *near_point, float *far_point)
Meaning
Normalises a point to the frame rectangle and unprojects it to a world ray, or returns 0 outside it
Confidence
verified, proof one
Finding
ui/worldframe#unprojecting-a-screen-point
Test
ui::glue_481_4813b0_gates, ui::glue_481_4813b0_normalize, ui::glue_481_4813b0_vec_add

Finding: Unprojecting a screen point in ui: the world frame as a widget

0x4813b0 turns a point in the frame's own space into a world ray. With this the world frame and the rectangle at +0x390 (left, bottom, right, top), it computes u = (a − bottom) / (top − bottom) from the first float argument and v = (b − left) / (right − left) from the second, both rounded to single. It returns 0 when either fraction is below 0 or above 1 and writes nothing; a NaN passes both gates. Otherwise it calls UnprojectScreenPoint with u and v, adds the three floats at [camera+8] (the camera at [this+0x65b8]) to both output points, and returns 1. The two outputs are the third and fourth arguments, the near point first.

The derivation is in the doc.

Callers 1

Callees 1

Calls and jumps by a bare address, from tables/calls.tsv.