CalculateSphereFromProjectionMatrixInverse
0x00bc8fa0 · 466 bytes · __cdecl
_Z42CalculateSphereFromProjectionMatrixInverseRK7VMatrixP6VectorPf
Decompiled
undefined (3 params)
/* CalculateSphereFromProjectionMatrixInverse(VMatrix const&, Vector*, float*) */
void CalculateSphereFromProjectionMatrixInverse(VMatrix *param_1,Vector *param_2,float *param_3)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
float fVar6;
float local_58;
float local_54;
float local_50;
float local_4c;
float local_48;
float local_44;
float local_40;
float local_3c;
float local_38;
float local_34;
float local_30;
float local_2c;
undefined4 local_28;
undefined4 local_24;
undefined4 local_20;
local_20 = 0;
local_28 = 0x3f000000;
local_24 = 0x3f000000;
Vector3DMultiplyPositionProjective(param_1,(Vector *)&local_28,(Vector *)&local_58);
local_28 = 0x3f000000;
local_24 = 0x3f000000;
local_20 = 0x3f800000;
Vector3DMultiplyPositionProjective(param_1,(Vector *)&local_28,(Vector *)&local_4c);
local_28 = 0;
local_24 = 0;
local_20 = 0;
Vector3DMultiplyPositionProjective(param_1,(Vector *)&local_28,(Vector *)&local_40);
local_28 = 0;
local_24 = 0;
local_20 = 0x3f800000;
Vector3DMultiplyPositionProjective(param_1,(Vector *)&local_28,(Vector *)&local_34);
fVar6 = local_4c - local_58;
fVar5 = local_48 - local_54;
fVar4 = local_44 - local_50;
fVar2 = SQRT(fVar5 * fVar5 + fVar6 * fVar6 + fVar4 * fVar4);
fVar1 = (local_54 - local_3c) * (local_54 - local_3c) +
(local_58 - local_40) * (local_58 - local_40) +
(local_50 - local_38) * (local_50 - local_38);
fVar3 = ((((local_48 - local_30) * (local_48 - local_30) +
(local_4c - local_34) * (local_4c - local_34) +
(local_44 - local_2c) * (local_44 - local_2c)) - fVar1) + fVar2 * fVar2) /
(fVar2 + fVar2);
fVar2 = fVar3 / fVar2;
*(float *)param_2 = fVar6 * fVar2 + local_58;
*(float *)(param_2 + 4) = fVar5 * fVar2 + local_54;
*(float *)(param_2 + 8) = fVar4 * fVar2 + local_50;
*param_3 = SQRT(fVar3 * fVar3 + fVar1);
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.