MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / normalizeVec3

Function normalizeVec3

TheForceEngine/TFE_Jedi/Math/core_math.cpp:39–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37 }
38
39 void normalizeVec3(vec3_fixed* vIn, vec3_fixed* vOut)
40 {
41 fixed16_16 distSq = mul16(vIn->x, vIn->x) + mul16(vIn->y, vIn->y) + mul16(vIn->z, vIn->z);
42 fixed16_16 dist = fixedSqrt(distSq);
43
44 if (dist > 0)
45 {
46 vOut->x = div16(vIn->x, dist);
47 vOut->y = div16(vIn->y, dist);
48 vOut->z = div16(vIn->z, dist);
49 }
50 else
51 {
52 vOut->x = 0;
53 vOut->y = 0;
54 vOut->z = 0;
55 }
56 }
57
58 void rotateVectorM3x3(vec3_fixed* inVec, vec3_fixed* outVec, s32* mtx)
59 {

Callers 4

createLightFunction · 0.85
light_transformDirLightsFunction · 0.85
createLightFunction · 0.85
light_transformDirLightsFunction · 0.85

Calls 3

mul16Function · 0.85
fixedSqrtFunction · 0.85
div16Function · 0.85

Tested by

no test coverage detected