DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
mathlib.h File Reference
#include "qtypes.h"
+ Include dependency graph for mathlib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  randomseed_t
 
struct  tinydoubleplane_t
 
struct  tinyplane_t
 LadyHavoc: minimal plane structure. More...
 

Macros

#define ANGLEMOD(a)
 
#define bit2i(n)
 \TODO: what is this function supposed to do?
 
#define boolxor(a, b)
 boolean XOR (why doesn't C have the ^^ operator for this purpose?)
 
#define bound(min, num, max)
 
#define BoxesOverlap(a, b, c, d)
 
#define BoxInsideBox(a, b, c, d)
 
#define CrossProduct(a, b, out)
 
#define DEG2RAD(a)
 
#define DotProduct(a, b)
 
#define DotProduct2(a, b)
 
#define DotProduct4(a, b)
 
#define invpow(base, number)
 
#define lhcheeserand(seed)
 
#define lhcheeserandom(seed, MIN, MAX)
 
#define lhrandom(MIN, MAX)
 LadyHavoc: this function never returns exactly MIN or exactly MAX, because of a QuakeC bug in id1 where the line self.nextthink = self.nexthink + random() * 0.5; can result in 0 (self.nextthink is 0 at this point in the code to begin with), causing "stone monsters" that never spawned properly, also MAX is avoided because some people use random() as an index into arrays or for loop conditions, where hitting exactly MAX may be a fatal error.
 
#define log2i(n)
 returns log base 2 of "n" \WARNING: "n" MUST be a power of 2!
 
#define M_PI   3.14159265358979323846
 
#define max(A, B)
 
#define min(A, B)
 
#define NUMVERTEXNORMALS   162
 
#define PlaneDiff(point, plane)
 
#define PlaneDist(point, plane)
 
#define PointInfrontOfTriangle(p, a, b, c)
 
#define Q_rint(x)
 
#define RAD2DEG(a)
 
#define TriangleBBoxOverlapsBox(a, b, c, d, e)
 
#define TriangleNormal(a, b, c, n)
 
#define Vector2Clear(a)
 
#define Vector2Compare(a, b)
 
#define Vector2Copy(in, out)
 
#define Vector2Length(a)
 
#define Vector2Negate(in, out)
 
#define Vector2Normalize2(v, dest)
 
#define Vector2Scale(in, scale, out)
 
#define Vector2Set(vec, x, y)
 
#define Vector4Add(a, b, out)
 
#define Vector4Clear(a)
 
#define Vector4Compare(a, b)
 
#define Vector4Copy(in, out)
 
#define Vector4Lerp(v1, lerp, v2, out)
 
#define Vector4MA(a, scale, b, out)
 
#define Vector4Multiply(a, b, out)
 
#define Vector4Negate(in, out)
 
#define Vector4Normalize2(v, dest)
 
#define Vector4Scale(in, scale, out)
 
#define Vector4Set(vec, r, g, b, a)
 
#define Vector4Subtract(a, b, out)
 
#define VectorAdd(a, b, out)
 
#define VectorCheeseRandom(seed, v)
 
#define VectorClear(a)
 
#define VectorCompare(a, b)
 
#define VectorCopy(in, out)
 
#define VectorCopy4(a, b)
 
#define VectorDistance(a, b)
 
#define VectorDistance2(a, b)
 
#define VectorLehmerRandom(seed, v)
 
#define VectorLength(a)
 
#define VectorLength2(a)
 
#define VectorLerp(v1, lerp, v2, out)
 
#define VectorM(scale1, b1, out)
 
#define VectorMA(a, scale, b, out)
 
#define VectorMAM(scale1, b1, scale2, b2, out)
 
#define VectorMAMAM(scale1, b1, scale2, b2, scale3, b3, out)
 
#define VectorMAMAMAM(scale1, b1, scale2, b2, scale3, b3, scale4, b4, out)
 
#define VectorMultiply(a, b, out)
 
#define VectorNegate(a, b)
 
#define VectorNormalize(v)
 
#define VectorNormalize2(v, dest)
 
#define VectorNormalizeDouble(v)
 
#define VectorRandom(v)
 
#define VectorReflect(a, r, b, out)
 
#define VectorScale(in, scale, out)
 
#define VectorScaleCast(in, scale, outtype, out)
 
#define VectorSet(vec, x, y, z)
 
#define VectorSubtract(a, b, out)
 

Functions

void AngleMatrix (const vec3_t angles, const vec3_t translate, vec_t matrix[][4])
 LadyHavoc: builds a [3][4] matrix.
 
void AnglesFromVectors (vec3_t angles, const vec3_t forward, const vec3_t up, qbool flippitch)
 LadyHavoc: calculates pitch/yaw/roll angles from forward and up vectors.
 
void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
 
void AngleVectorsDuke3DFLU (const vec3_t angles, vec3_t forward, vec3_t left, vec3_t up, double maxShearAngle)
 divVerent: improper matrix version of AngleVectors
 
void AngleVectorsFLU (const vec3_t angles, vec3_t forward, vec3_t left, vec3_t up)
 LadyHavoc: proper matrix version of AngleVectors.
 
void BoxFromPoints (vec3_t mins, vec3_t maxs, int numpoints, vec_t *point3f)
 
int BoxOnPlaneSide (const vec3_t emins, const vec3_t emaxs, const struct mplane_s *p)
 
int BoxOnPlaneSide_Separate (const vec3_t emins, const vec3_t emaxs, const vec3_t normal, const vec_t dist)
 
void BoxPlaneCornerDistances (const vec3_t emins, const vec3_t emaxs, const struct mplane_s *p, vec_t *outnear, vec_t *outfar)
 
void BoxPlaneCornerDistances_Separate (const vec3_t emins, const vec3_t emaxs, const vec3_t normal, vec_t *outnear, vec_t *outfar)
 
void BoxPlaneCorners (const vec3_t emins, const vec3_t emaxs, const struct mplane_s *p, vec3_t outnear, vec3_t outfar)
 
void BoxPlaneCorners_Separate (const vec3_t emins, const vec3_t emaxs, const vec3_t normal, vec3_t outnear, vec3_t outfar)
 
void ByteToNormal (unsigned char num, vec3_t n)
 
unsigned int CeilPowerOf2 (unsigned int value)
 returns the smallest integer greater than or equal to "value", or 0 if "value" is too big
 
int LoopingFrameNumberFromDouble (double t, int loopframes)
 
int Math_atov (const char *s, prvm_vec3_t out)
 
float Math_crandomf (randomseed_t *r)
 
unsigned long long Math_rand64 (randomseed_t *r)
 
float Math_randomf (randomseed_t *r)
 
float Math_randomrangef (randomseed_t *r, float minf, float maxf)
 
int Math_randomrangei (randomseed_t *r, int mini, int maxi)
 
void Math_RandomSeed_FromInts (randomseed_t *r, unsigned int s0, unsigned int s1, unsigned int s2, unsigned int s3)
 
void Math_RandomSeed_Reset (randomseed_t *r)
 
void Mathlib_Init (void)
 
void Matrix4x4_Print (const struct matrix4x4_s *in)
 print a matrix to the console
 
unsigned char NormalToByte (const vec3_t n)
 
void PlaneClassify (struct mplane_s *p)
 
void R_ConcatRotations (const float in1[3 *3], const float in2[3 *3], float out[3 *3])
 
void R_ConcatTransforms (const float in1[3 *4], const float in2[3 *4], float out[3 *4])
 
float RadiusFromBounds (const vec3_t mins, const vec3_t maxs)
 
float RadiusFromBoundsAndOrigin (const vec3_t mins, const vec3_t maxs, const vec3_t origin)
 
void RotatePointAroundVector (vec3_t dst, const vec3_t dir, const vec3_t point, float degrees)
 
float VectorNormalizeLength (vec3_t v)
 returns vector length
 
void VectorVectors (const vec3_t forward, vec3_t right, vec3_t up)
 LadyHavoc: like AngleVectors, but taking a forward vector instead of angles, useful!
 
void VectorVectorsDouble (const double *forward, double *right, double *up)
 

Variables

float m_bytenormals [NUMVERTEXNORMALS][3]
 
vec3_t vec3_origin
 

Macro Definition Documentation

◆ ANGLEMOD

#define ANGLEMOD ( a)
Value:
((a) - 360.0 * floor((a) / 360.0))
float floor(float f)
ret a

Definition at line 67 of file mathlib.h.

Referenced by CL_AdjustAngles(), CL_IsMoveInDirection(), CL_UpdateNetworkEntity(), SV_NewChaseDir(), VM_changepitch(), and VM_changeyaw().

◆ bit2i

#define bit2i ( n)
Value:
log2i((n) << 1)
#define n(x, y)
#define log2i(n)
returns log base 2 of "n" \WARNING: "n" MUST be a power of 2!
Definition mathlib.h:54

\TODO: what is this function supposed to do?

Definition at line 57 of file mathlib.h.

◆ boolxor

#define boolxor ( a,
b )
Value:
(!(a) != !(b))
dp_FragColor b

boolean XOR (why doesn't C have the ^^ operator for this purpose?)

Definition at line 60 of file mathlib.h.

Referenced by S_SetChannelLayout(), and S_Update().

◆ bound

#define bound ( min,
num,
max )
Value:
((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min))
#define max(A, B)
Definition mathlib.h:38
#define min(A, B)
Definition mathlib.h:37

Definition at line 34 of file mathlib.h.

Referenced by BuildGammaTable16(), BuildGammaTable8(), CL_AdjustAngles(), CL_Beams_SetupBuiltinTexture(), CL_ClientMovement_Physics_AdjustAirAccelQW(), CL_ClientMovement_Physics_CPM_PM_Aircontrol(), CL_ClientMovement_Physics_PM_Accelerate(), CL_ClientMovement_Physics_Swim(), CL_DecayLightFlashes(), CL_DrawVideo(), CL_ExaminePrintString(), CL_Frame(), CL_Input(), CL_LerpPoint(), CL_Locs_FindNearest(), CL_MoveLerpEntityStates(), CL_NetworkTimeReceived(), CL_NewParticlesFromEffectinfo(), CL_ParseDownload(), CL_ParseServerMessage(), CL_SelectTraceLine(), CL_SendMove(), CL_UpdateNetworkEntity(), CL_UpdateNetworkEntityTrail(), CL_UpdatePrydonCursor(), CL_UpdateScreen(), Collision_ClipExtendFinish(), Collision_TraceBrushBrushFloat(), Collision_TraceLineBrushFloat(), Con_CheckResize(), Con_MaskPrint(), Crypto_ClientParsePacket(), Crypto_ServerParsePacket_Internal(), Crypto_StoreHostKey(), DrawQ_GetTextColor(), EntityFrame4_WriteFrame(), EntityFrameQuake_WriteFrame(), EntityState5_Priority(), Font_Postprocess(), Font_Postprocess_Update(), fractalnoise(), fractalnoisequick(), GL_SetupTextureParameters(), GL_Texture_CalcImageSize(), Image_MakesRGBColorsFromLinear_Lightmap(), jam_video(), JPEG_LoadImage_BGRA(), JPEG_SaveImage_to_Buffer(), lowpass(), lowpass_limited(), M_Background(), M_DrawSlider(), M_Menu_Options_AdjustSliders(), M_Menu_Options_ColorControl_AdjustSliders(), M_Menu_Options_Effects_AdjustSliders(), M_Menu_Options_Graphics_AdjustSliders(), M_Menu_Video_AdjustSliders(), M_ModList_Draw(), M_Options_ColorControl_Draw(), M_Options_Draw(), M_Options_Effects_Draw(), M_Options_Graphics_Draw(), Mod_FrameGroupify_ParseGroups_Store(), Mod_GenerateLightmaps_CreateLightmaps(), Mod_GenerateLightmaps_GridSample(), Mod_GenerateLightmaps_LightmapSample(), Mod_INTERQUAKEMODEL_Load(), Mod_LoadQ3Shaders_EnumerateWaveFunc(), Mod_Q1BSP_LoadFaces(), Mod_Q1BSP_RecursiveHullCheck(), Mod_Q1BSP_TraceLineAgainstSurfacesFindTextureOnNode(), Mod_Q3BSP_LightPoint(), Mod_Q3BSP_LoadFaces(), Mod_Q3BSP_LoadLightmaps(), Mod_VBSP_LoadFaces(), NetConn_BuildStatusResponse(), NetConn_OpenClientPorts(), NetConn_OpenServerPorts(), OGG_DecodeTags(), Palette_Load(), PRVM_MEM_Alloc(), R_BeginCoronaQuery(), R_Bloom_MakeTexture(), R_Bloom_StartFrame(), R_BufferData_Resize(), R_BuildFogTexture(), R_BuildLightMap(), R_DecalSystem_SplatTriangle(), R_DrawEntityBBoxes_Callback(), R_DrawModelDecals_FadeEntity(), R_DrawParticles(), R_EvaluateQ3WaveFunc(), r_explosion_start(), R_FrameData_Alloc(), R_FrameData_Resize(), R_HDR_UpdateIrisAdaptation(), R_InitParticleTexture(), R_MeshQueue_RenderTransparent(), R_Mod_DrawLight(), R_MotionBlurView(), R_ProcessTransparentTextureSurfaceList(), R_Shadow_BounceGrid_ConvertPixelsAndUpload(), R_Shadow_BounceGrid_GenerateSettings(), R_Shadow_BounceGrid_UpdateSpacing(), R_Shadow_DrawModelShadowMaps(), R_Shadow_LoadLightsFile(), R_Shadow_MakeTextures(), R_Shadow_MakeTextures_MakeCorona(), R_Shadow_MakeTextures_SamplePoint(), R_Shadow_PrepareLight(), R_Shadow_PrepareLights(), R_Shadow_PrepareLights_AddSceneLight(), R_Shadow_SetShadowMode(), R_StainNode(), R_TestQ3WaveFunc(), R_Textures_Frame(), R_TimeReport_EndFrame(), R_UpdateFog(), R_UpdateVariables(), R_Water_StartFrame(), S_ConvertPaintBuffer(), S_MixToBuffer(), S_SetUnderwaterIntensity(), Sbar_Draw(), Sbar_DrawFace(), Sbar_DrawGauge(), Sbar_PrintScoreboardItem(), SCR_CaptureVideo_Avi_SoundFrame(), SCR_CaptureVideo_Ogg_BeginVideo(), SCR_CaptureVideo_Ogg_SoundFrame(), SCR_DrawNetGraph_DrawGraph(), SCR_DrawScreen(), SCR_UpdateVars(), setup_rateindex(), shadebubble(), SND_Spatialize_WithSfx(), SndSys_Init(), SV_ExecuteClientMoves(), SV_MaxPlayers_f(), SV_Ping_f(), SV_Pings_f(), SV_PointSuperContents(), SV_PrepareEntityForSending(), SV_SendClientDatagram(), SV_ServerOptions(), SV_StartParticle(), SV_Status_f(), SV_WriteClientdataToMessage(), SV_WriteEntitiesToClient(), TaskQueue_Frame(), V_CalcRefdefUsing(), V_CalcViewBlend(), VID_ApplyDisplayMode(), VID_BuildGammaTables(), VID_InitModeGL(), VID_JoyState_GetAxis(), VID_TouchscreenArea(), VM_bound(), VM_CL_findradius(), VM_drawsetcliparea(), VM_findkeysforcommand(), VM_FrameBlendFromFrameGroupBlend(), VM_getkeybind(), VM_getsurfacenearpoint(), VM_setkeybind(), VM_substring(), VM_SV_findradius(), VM_SV_newcheckclient(), VM_SV_pointparticles(), VM_SV_te_blood(), VM_SV_te_bloodshower(), VM_SV_te_customflash(), VM_SV_te_explosionrgb(), VM_SV_te_particlecube(), VM_SV_te_particlerain(), VM_SV_te_particlesnow(), and VM_SV_te_spark().

◆ BoxesOverlap

◆ BoxInsideBox

#define BoxInsideBox ( a,
b,
c,
d )
Value:
((a)[0] >= (c)[0] && (b)[0] <= (d)[0] && (a)[1] >= (c)[1] && (b)[1] <= (d)[1] && (a)[2] >= (c)[2] && (b)[2] <= (d)[2])

Definition at line 123 of file mathlib.h.

Referenced by Portal_RecursiveFlow(), R_Q1BSP_RecursiveGetLightInfo_BSP(), and R_Shadow_ChooseSidesFromBox().

◆ CrossProduct

◆ DEG2RAD

#define DEG2RAD ( a)
Value:
((a) * ((float) M_PI / 180.0f))
#define M_PI
Definition mathlib.h:28
precision highp float
Definition shader_glsl.h:53

Definition at line 65 of file mathlib.h.

Referenced by DrawQ_RotPic(), Mod_Decompile_SMD(), and RotatePointAroundVector().

◆ DotProduct

#define DotProduct ( a,
b )
Value:
((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])

Definition at line 98 of file mathlib.h.

Referenced by _R_CullBox(), AnglesFromVectors(), CL_Beam_AddPolygons(), CL_ClientMovement_Move(), CL_ClientMovement_Physics_CPM_PM_Aircontrol(), CL_ClientMovement_Physics_PM_Accelerate(), CL_ClientMovement_Physics_PM_AirAccelerate(), CL_ClientMovement_Physics_Swim(), CL_ClientMovement_Physics_Walk(), CL_ClientMovement_UpdateStatus(), CL_MoveLerpEntityStates(), clippointtosurface(), ClipVelocity(), Collision_CalcPlanesForTriangleBrushFloat(), Collision_ClipTrace_Line_Sphere(), Collision_NewBrushFromPlanes(), Collision_PointInsideBrushFloat(), Collision_TraceLineBrushFloat(), Collision_TraceLineTriangleFloat(), Collision_TracePointBrushFloat(), Collision_TranslateBrush(), Collision_ValidateBrush(), Com_CalcRoll(), furthestplanedist_float(), Mod_BSP_FindNonSolidLocation_r_Triangle(), Mod_BSP_GetPVS(), Mod_BSP_PointInLeaf(), Mod_BuildTextureVectorsFromNormals(), Mod_GenerateLightmaps_LightmapSample(), Mod_GenerateLightmaps_SamplePoint(), Mod_GenerateLightmaps_SamplePoint_SVBSP(), Mod_Q1BSP_LoadFaces(), Mod_Q1BSP_LoadMapBrushes(), Mod_Q1BSP_PointSuperContents(), Mod_Q1BSP_RecursiveHullCheck(), Mod_Q1BSP_RecursiveHullCheckPoint(), Mod_Q1BSP_TraceLineAgainstSurfacesFindTextureOnNode(), Mod_Q1BSP_TraceLineAgainstSurfacesRecursiveBSPNode(), Mod_Q3BSP_TraceLineOfSight_RecursiveNodeCheck(), Mod_ShadowMesh_CalcBBox(), Mod_VBSP_LoadFaces(), nearestplanedist_float(), Portal_CheckPolygon(), Portal_PolygonRecursiveMarkLeafs(), Portal_RecursiveFindLeafForFlow(), Portal_RecursiveFlow(), Portal_RecursiveFlowSearch(), R_BeginCoronaQuery(), R_BuildNormalizationCube(), R_DecalSystem_SpawnTriangle(), R_DecalSystem_SplatEntity(), R_DrawModelDecals_Entity(), R_DrawParticle_TransparentCallback(), R_DrawParticles(), R_HDR_UpdateIrisAdaptation(), R_MeshQueue_AddTransparent(), R_MeshQueue_BeginScene(), R_Model_Sprite_Draw_TransparentCallback(), R_MoveExplosion(), R_Q1BSP_CallRecursiveGetLightInfo(), R_SetupView(), R_Shadow_BounceGrid_Slice(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_ChooseSidesFromBox(), R_Shadow_ComputeShadowCasterCullingPlanes(), R_Shadow_DrawModelShadowMaps(), R_Shadow_LoadLightsFile(), R_Shadow_PrepareModelShadows(), R_Shadow_SelectLightInView(), R_StainNode(), R_UpdateFog(), R_View_SetFrustum(), R_Viewport_ApplyNearClipPlaneFloatGL(), R_Water_AddWaterPlane(), RSurf_FogPoint(), RSurf_FogVertex(), RSurf_PrepareVerticesForBatch(), shadebubble(), SV_Accelerate(), SV_AirAccelerate(), SV_CheckVelocity(), SV_FlyMove(), SV_NudgeOutOfSolid_PivotIsKnownGood(), SV_Physics_Toss(), SV_PushMove(), SV_WallFriction(), V_CalcRefdefUsing(), VectorNormalizeLength(), VM_CL_findradius(), VM_SV_aim(), and VM_SV_findradius().

◆ DotProduct2

#define DotProduct2 ( a,
b )
Value:
((a)[0]*(b)[0]+(a)[1]*(b)[1])

Definition at line 71 of file mathlib.h.

◆ DotProduct4

#define DotProduct4 ( a,
b )
Value:
((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2]+(a)[3]*(b)[3])

Definition at line 81 of file mathlib.h.

Referenced by R_ScissorForBBox(), and R_Viewport_ApplyNearClipPlaneFloatGL().

◆ invpow

#define invpow ( base,
number )
Value:
(log(number) / log(base))
float log(float f)

Definition at line 50 of file mathlib.h.

Referenced by VID_ApplyGammaToColor(), and VID_BuildGammaTables().

◆ lhcheeserand

#define lhcheeserand ( seed)
Value:
((seed) = ((seed) * 987211u) ^ ((seed) >> 13u) ^ 914867)

Definition at line 170 of file mathlib.h.

◆ lhcheeserandom

#define lhcheeserandom ( seed,
MIN,
MAX )
Value:
((double)(lhcheeserand(seed) + 0.5) / ((double)4096.0*1024.0*1024.0) * ((MAX)-(MIN)) + (MIN))
#define lhcheeserand(seed)
Definition mathlib.h:170

Definition at line 171 of file mathlib.h.

◆ lhrandom

#define lhrandom ( MIN,
MAX )
Value:
(((double)(rand() + 0.5) / ((double)RAND_MAX + 1)) * ((MAX)-(MIN)) + (MIN))

LadyHavoc: this function never returns exactly MIN or exactly MAX, because of a QuakeC bug in id1 where the line self.nextthink = self.nexthink + random() * 0.5; can result in 0 (self.nextthink is 0 at this point in the code to begin with), causing "stone monsters" that never spawned properly, also MAX is avoided because some people use random() as an index into arrays or for loop conditions, where hitting exactly MAX may be a fatal error.

Definition at line 48 of file mathlib.h.

Referenced by CDAudio_StartPlaylist(), CL_Beams_SetupBuiltinTexture(), CL_EntityParticles(), CL_NewParticle(), CL_NewParticlesFromEffectinfo(), CL_ParseStatic(), CL_ParticleCube(), CL_ParticleEffect_Fallback(), CL_ParticleExplosion(), CL_ParticleExplosion2(), CL_ParticleRain(), CL_RelinkBeams(), CL_Smoke(), CL_Sparks(), CL_SpawnDecalParticleForSurface(), Image_GenerateConChars(), particletextureblotch(), R_CanSeeBox(), R_DrawParticles(), R_MotionBlurView(), R_StainNode(), S_StartSound_StartPosition_Flags(), SV_CanSeeBox(), VID_BuildGammaTables(), VM_CL_makestatic(), and VM_random().

◆ log2i

#define log2i ( n)
Value:
((((n) & 0xAAAAAAAA) != 0 ? 1 : 0) | (((n) & 0xCCCCCCCC) != 0 ? 2 : 0) | (((n) & 0xF0F0F0F0) != 0 ? 4 : 0) | (((n) & 0xFF00FF00) != 0 ? 8 : 0) | (((n) & 0xFFFF0000) != 0 ? 16 : 0))

returns log base 2 of "n" \WARNING: "n" MUST be a power of 2!

Definition at line 54 of file mathlib.h.

◆ M_PI

◆ max

#define max ( A,
B )
Value:
((A) > (B) ? (A) : (B))

Definition at line 38 of file mathlib.h.

Referenced by BoxFromPoints(), BufStr_Expand(), BufStr_Set(), CL_AllocLightFlash(), CL_Cache_TraceLineSurfaces(), CL_ClientMovement_Physics_CPM_PM_Aircontrol(), CL_ClientMovement_Physics_PM_Accelerate(), CL_ClientMovement_Physics_PM_AirAccelerate(), CL_ClientMovement_Physics_Walk(), CL_DrawVideo(), CL_Effect(), CL_Frame(), CL_Input(), CL_IPLog_Add(), CL_LinkNetworkEntity(), CL_Locs_AddNode(), CL_NetworkTimeReceived(), CL_NewBeam(), CL_OpenVideo(), CL_ParseClientdata(), CL_ParticleRain(), CL_ReadDemoMessage(), CL_SelectTraceLine(), CL_SendMove(), CL_TraceBox(), CL_TraceLine(), CL_UpdateNetworkEntity(), CL_UpdateScreen(), CL_VideoStart(), Collision_NewBrushFromPlanes(), Crypto_ClientParsePacket(), Crypto_StoreHostKey(), EntityFrame5_LostFrame(), EntityFrame5_WriteFrame(), Font_LoadSize(), Font_Postprocess(), fractalnoise(), FS_Inflate(), FS_Search(), furthestplanedist_float(), GetMapList(), GL_Texture_CalcImageSize(), GrowBuf(), hmac(), jam_open(), jam_video(), libavw_decodeframe(), LibAvW_OpenVideo(), LoadFont(), LoadSubtitles(), M_Options_ColorControl_Draw(), M_Options_Draw(), M_Options_Effects_Draw(), M_Options_Graphics_Draw(), Mem_ExpandableArray_AllocRecord(), Mod_BSP_RecursiveRecalcNodeBBox(), Mod_CollisionBIH_TraceBrush(), Mod_CollisionBIH_TraceLineShared(), Mod_DARKPLACESMODEL_Load(), Mod_Decompile_OBJ(), Mod_FrameGroupify_ParseGroups_Store(), Mod_GenerateLightmaps_CreateLightmaps(), Mod_GenerateLightmaps_CreateTriangleInformation(), Mod_GenerateLightmaps_LightmapSample(), Mod_IDS2_Load(), Mod_INTERQUAKEMODEL_Load(), Mod_MakeCollisionBIH(), Mod_MDLMD2MD3_TraceBox(), Mod_MDLMD2MD3_TraceLine(), Mod_Mesh_AddSurface(), Mod_Mesh_AddTriangle(), Mod_Mesh_ComputeBounds(), Mod_Mesh_GetTexture(), Mod_Mesh_IndexForVertex(), Mod_OBJ_Load(), Mod_PSKMODEL_Load(), Mod_Q1BSP_Load(), Mod_Q1BSP_LoadFaces(), Mod_Q1BSP_LoadTextures(), Mod_Q2BSP_Load(), Mod_Q3BSP_Load(), Mod_Q3BSP_LoadFaces(), Mod_Q3BSP_LoadLightmaps(), Mod_Q3BSP_LoadPVS(), Mod_Sprite_SharedSetup(), Mod_VBSP_LoadFaces(), Mod_VertexRangeFromElements(), Mod_ZYMOTICMODEL_Load(), NetConn_ClientParsePacket(), OGG_LoadVorbisFile(), PRVM_CallProfile(), PRVM_MEM_Alloc(), PRVM_Profile(), PRVM_SetTempString(), PRVM_ShortStackTrace(), Q3PatchTesselateFloat(), R_AnimCache_GetEntity(), R_BufferData_Store(), R_BuildFogTexture(), R_DecalSystem_SpawnTriangle(), R_DrawModelDecals_Entity(), R_FrameData_Alloc(), R_HDR_UpdateIrisAdaptation(), R_Mesh_AddBrushMeshFromPlanes(), R_MeshQueue_AddTransparent(), R_Mod_GetLightInfo(), R_Model_Sprite_Draw_TransparentCallback(), R_MotionBlurView(), R_NewExplosion(), R_PicmipForFlags(), R_Q1BSP_CallRecursiveGetLightInfo(), R_Q1BSP_RecursiveGetLightInfo_BSP(), R_SetupShader_Surface(), R_Shadow_BounceGrid_AssignPhotons_Task(), R_Shadow_BounceGrid_Slice(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_BounceGrid_UpdateSpacing(), R_Shadow_MakeTextures(), R_Shadow_PrepareLight(), R_Shadow_RenderLighting(), R_Shadow_UpdateWorldLight(), R_TimeReport_EndFrame(), R_UpdateFog(), R_UpdateTexture(), R_Water_AddWaterPlane(), RadiusFromBounds(), RadiusFromBoundsAndOrigin(), RSurf_FogPoint(), RSurf_FogVertex(), S_PaintAndSubmit(), S_SetUnderwaterIntensity(), S_SoftClipPaintBuffer(), S_Update(), S_UpdateAmbientSounds(), Sbar_DrawInventory(), Sbar_MiniDeathmatchOverlay(), Sbar_Score(), Sbar_ShowFPS(), Sbar_SoloScoreboard(), SCR_CaptureVideo_Ogg_BeginVideo(), SCR_DrawLoadingScreen(), SCR_DrawNetGraph(), SCR_DrawScreen(), SetMinMaxSize(), SetMinMaxSize(), SetMinMaxSizePRVM(), SHOWLMP_decodeshow(), SND_Spatialize_WithSfx(), SV_CanSeeBox(), SV_ExecuteClientMoves(), SV_Name_f(), SV_Physics(), SV_PrepareEntityForSending(), SV_RunThink(), SV_SendClientDatagram(), SV_TraceBox(), SV_TraceLine(), SV_TracePoint(), Sys_Con_NearestColor(), V_CalcRefdefUsing(), V_CalcViewBlend(), VID_ApplyDisplayMode_c(), VID_Mode(), VM_buf_loadfile(), VM_bufstr_add(), VM_CL_R_PolygonVertex(), VM_CL_skel_build(), VM_CL_skel_copybones(), VM_CL_skel_mul_bones(), VM_matchpattern(), VM_max(), VM_SV_skel_build(), VM_SV_skel_copybones(), VM_SV_skel_mul_bones(), World_EntitiesInBox(), and World_SetSize().

◆ min

#define min ( A,
B )
Value:
((A) < (B) ? (A) : (B))

Definition at line 37 of file mathlib.h.

Referenced by _Mem_Alloc(), BoxFromPoints(), CL_Cache_TraceLineSurfaces(), CL_ClientMovement_Physics_Swim(), CL_ClientMovement_Physics_Walk(), CL_DrawVideo(), CL_Frame(), CL_Locs_AddNode(), CL_Locs_Reload_f(), CL_NewParticle(), CL_NewParticlesFromEffectinfo(), CL_ParseServerMessage(), CL_ReadDemoMessage(), CL_SelectTraceLine(), CL_SendMove(), CL_TraceBox(), CL_TraceLine(), CL_UpdateNetworkEntity(), CL_UpdateScreen(), Collision_BoundingBoxOfBrushTraceSegment(), Collision_NewBrushFromPlanes(), Con_CenterPrintf(), Con_CompleteCommandLine(), Con_Quakebar(), CSQC_AddPrintText(), dpvsnprintf(), Font_Postprocess(), fractalnoise(), FS_Write(), GetMapList(), GL_Texture_CalcImageSize(), Host_Frame(), jam_video(), Key_Event(), libavw_decodeframe(), LoadSubtitles(), Log_Start(), M_GameOptions_Key(), M_Menu_GameOptions_f(), M_ModList_Draw(), M_ScanSaves(), M_ServerList_Draw(), Memory_Init_Commands(), Mod_BSP_RecursiveRecalcNodeBBox(), Mod_CollisionBIH_TraceBrush(), Mod_CollisionBIH_TraceLineShared(), Mod_GenerateLightmaps_CreateLightmaps(), Mod_GenerateLightmaps_CreateTriangleInformation(), Mod_GenerateLightmaps_InitSampleOffsets(), Mod_LoadQ3Shaders(), Mod_MakeCollisionBIH(), Mod_MDLMD2MD3_TraceBox(), Mod_MDLMD2MD3_TraceLine(), Mod_OBJ_Load(), Mod_Q1BSP_AmbientSoundLevelsForPoint(), Mod_Q1BSP_LoadFaces(), Mod_Q3BSP_Load(), Mod_Q3BSP_LoadFaces(), Mod_VBSP_LoadFaces(), Mod_VertexRangeFromElements(), Mod_ZYMOTICMODEL_Load(), ModList_RebuildList(), nearestplanedist_float(), NetConn_ClientParsePacket(), NetConn_ServerParsePacket(), OGG_LoadVorbisFile(), PK3_BuildFileList(), Portal_PortalThroughPortalPlanes(), PRVM_FreeString(), PRVM_GarbageCollection(), PRVM_MEM_IncreaseEdicts(), QW_CL_NextUpload_f(), R_Bloom_MakeTexture(), R_BuildLightMap(), R_CompleteLightPoint(), R_DrawParticle_TransparentCallback(), R_DrawParticles(), R_DrawPortal_Callback(), R_DrawSurface_TransparentCallback(), R_HDR_UpdateIrisAdaptation(), R_InitBloodTextures(), R_MeshQueue_RenderTransparent(), R_Mod_DrawLight(), R_Mod_GetLightInfo(), R_Q1BSP_CallRecursiveGetLightInfo(), R_Q1BSP_DrawLight_TransparentCallback(), R_Q1BSP_RecursiveGetLightInfo_BSP(), R_Shadow_BounceGrid_Slice(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_BounceGrid_UpdateSpacing(), R_Shadow_DrawCoronas(), R_UpdateTexture(), R_Water_AddWaterPlane(), RSurf_FogPoint(), RSurf_FogVertex(), RSurf_PrepareVerticesForBatch(), S_LoadWavFile(), S_MixToBuffer(), S_PaintAndSubmit(), S_SetUnderwaterIntensity(), Sbar_Draw(), Sbar_DrawFrags(), Sbar_MiniDeathmatchOverlay(), SCR_CaptureVideo_Avi_BeginVideo(), SCR_DrawConsole(), SCR_DrawLoadingScreen(), SCR_DrawScreen(), SetMinMaxSize(), SetMinMaxSize(), SetMinMaxSizePRVM(), SND_Spatialize_WithSfx(), SV_CanSeeBox(), SV_ExecuteClientMoves(), SV_Frame(), SV_Physics_Toss(), SV_PrepareEntityForSending(), SV_ReadClientMove(), SV_SendClientDatagram(), SV_ThreadFunc(), SV_TraceBox(), SV_TraceLine(), SV_TracePoint(), Sys_Con_NearestColor(), Sys_SDL_GetClipboardData(), V_CalcRefdefUsing(), VM_CL_skel_build(), VM_CL_skel_copybones(), VM_CL_skel_mul_bones(), VM_matchpattern(), VM_min(), VM_SV_skel_build(), VM_SV_skel_copybones(), VM_SV_skel_mul_bones(), and World_EntitiesInBox().

◆ NUMVERTEXNORMALS

#define NUMVERTEXNORMALS   162

Definition at line 225 of file mathlib.h.

Referenced by CL_EntityParticles().

◆ PlaneDiff

#define PlaneDiff ( point,
plane )

◆ PlaneDist

#define PlaneDist ( point,
plane )
Value:
((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal))

Definition at line 256 of file mathlib.h.

Referenced by R_Q1BSP_RecursiveGetLightInfo_BSP().

◆ PointInfrontOfTriangle

#define PointInfrontOfTriangle ( p,
a,
b,
c )
Value:
( ((p)[0] - (a)[0]) * (((a)[1] - (b)[1]) * ((c)[2] - (b)[2]) - ((a)[2] - (b)[2]) * ((c)[1] - (b)[1])) \
+ ((p)[1] - (a)[1]) * (((a)[2] - (b)[2]) * ((c)[0] - (b)[0]) - ((a)[0] - (b)[0]) * ((c)[2] - (b)[2])) \
+ ((p)[2] - (a)[2]) * (((a)[0] - (b)[0]) * ((c)[1] - (b)[1]) - ((a)[1] - (b)[1]) * ((c)[0] - (b)[0])) > 0)

Fast PointInfrontOfTriangle. subtracts v1 from v0 and v2, combined into a crossproduct, combined with a dotproduct of the light location relative to the first point of the triangle (any point works, since any triangle is obviously flat), and finally a comparison to determine if the light is infront of the triangle (the goal of this statement) we do not need to normalize the surface normal because both sides of the comparison use it, therefore they are both multiplied the same amount... furthermore a subtract can be done on the point to eliminate one dotproduct this is ((p - a) * cross(a-b,c-b))

Definition at line 143 of file mathlib.h.

143#define PointInfrontOfTriangle(p,a,b,c) \
144( ((p)[0] - (a)[0]) * (((a)[1] - (b)[1]) * ((c)[2] - (b)[2]) - ((a)[2] - (b)[2]) * ((c)[1] - (b)[1])) \
145+ ((p)[1] - (a)[1]) * (((a)[2] - (b)[2]) * ((c)[0] - (b)[0]) - ((a)[0] - (b)[0]) * ((c)[2] - (b)[2])) \
146+ ((p)[2] - (a)[2]) * (((a)[0] - (b)[0]) * ((c)[1] - (b)[1]) - ((a)[1] - (b)[1]) * ((c)[0] - (b)[0])) > 0)

Referenced by Portal_RecursiveFlow(), R_Q1BSP_RecursiveGetLightInfo_BIH(), R_Q1BSP_RecursiveGetLightInfo_BSP(), and R_Shadow_ChooseSidesFromBox().

◆ Q_rint

#define Q_rint ( x)
Value:
((x) > 0 ? (int)((x) + 0.5) : (int)((x) - 0.5))
static int(ZEXPORT *qz_inflate)(z_stream *strm
GLint GLenum GLint x
Definition glquake.h:651

Definition at line 69 of file mathlib.h.

Referenced by MSG_WriteAngle16i(), MSG_WriteAngle8i(), MSG_WriteCoord13i(), and MSG_WriteCoord16i().

◆ RAD2DEG

#define RAD2DEG ( a)
Value:
((a) * (180.0f / (float) M_PI))

Definition at line 66 of file mathlib.h.

Referenced by CL_IsMoveInDirection().

◆ TriangleBBoxOverlapsBox

#define TriangleBBoxOverlapsBox ( a,
b,
c,
d,
e )
Value:
(min((a)[0], min((b)[0], (c)[0])) < (e)[0] && max((a)[0], max((b)[0], (c)[0])) > (d)[0] && min((a)[1], min((b)[1], (c)[1])) < (e)[1] && max((a)[1], max((b)[1], (c)[1])) > (d)[1] && min((a)[2], min((b)[2], (c)[2])) < (e)[2] && max((a)[2], max((b)[2], (c)[2])) > (d)[2])

Definition at line 124 of file mathlib.h.

Referenced by Collision_TraceBrushTriangleMeshFloat(), Portal_RecursiveFlow(), R_Q1BSP_RecursiveGetLightInfo_BSP(), and R_Shadow_ChooseSidesFromBox().

◆ TriangleNormal

#define TriangleNormal ( a,
b,
c,
n )
Value:
( \
(n)[0] = ((a)[1] - (b)[1]) * ((c)[2] - (b)[2]) - ((a)[2] - (b)[2]) * ((c)[1] - (b)[1]), \
(n)[1] = ((a)[2] - (b)[2]) * ((c)[0] - (b)[0]) - ((a)[0] - (b)[0]) * ((c)[2] - (b)[2]), \
(n)[2] = ((a)[0] - (b)[0]) * ((c)[1] - (b)[1]) - ((a)[1] - (b)[1]) * ((c)[0] - (b)[0]) \
)

Definition at line 126 of file mathlib.h.

126#define TriangleNormal(a,b,c,n) ( \
127 (n)[0] = ((a)[1] - (b)[1]) * ((c)[2] - (b)[2]) - ((a)[2] - (b)[2]) * ((c)[1] - (b)[1]), \
128 (n)[1] = ((a)[2] - (b)[2]) * ((c)[0] - (b)[0]) - ((a)[0] - (b)[0]) * ((c)[2] - (b)[2]), \
129 (n)[2] = ((a)[0] - (b)[0]) * ((c)[1] - (b)[1]) - ((a)[1] - (b)[1]) * ((c)[0] - (b)[0]) \
130 )

Referenced by clippointtosurface(), Collision_CalcPlanesForTriangleBrushFloat(), Mod_BuildNormals(), Mod_GenerateLightmaps_CreateLightmaps(), Mod_GenerateLightmaps_CreateTriangleInformation(), Mod_Q1BSP_LoadMapBrushes(), Portal_RecursiveFlow(), R_DecalSystem_SpawnTriangle(), R_Shadow_ChooseSidesFromBox(), R_Shadow_ComputeShadowCasterCullingPlanes(), and VM_getsurfacenormal().

◆ Vector2Clear

#define Vector2Clear ( a)
Value:
((a)[0]=(a)[1]=0)

Definition at line 72 of file mathlib.h.

◆ Vector2Compare

#define Vector2Compare ( a,
b )
Value:
(((a)[0]==(b)[0])&&((a)[1]==(b)[1]))

Definition at line 73 of file mathlib.h.

Referenced by Mod_OBJ_Load().

◆ Vector2Copy

#define Vector2Copy ( in,
out )
Value:
((out)[0]=(in)[0],(out)[1]=(in)[1])

Definition at line 74 of file mathlib.h.

Referenced by Mod_LoadTextureFromQ3Shader(), Mod_OBJ_Load(), and VM_stringwidth().

◆ Vector2Length

#define Vector2Length ( a)
Value:
#define DotProduct2(a, b)
Definition mathlib.h:71
float sqrt(float f)

Definition at line 79 of file mathlib.h.

Referenced by CL_ClientMovement_Physics_Walk(), and SV_UserFriction().

◆ Vector2Negate

#define Vector2Negate ( in,
out )
Value:
((out)[0]=-((in)[0]),(out)[1]=-((in)[1]))

Definition at line 75 of file mathlib.h.

◆ Vector2Normalize2

#define Vector2Normalize2 ( v,
dest )
Value:
{float ilength = (float)DotProduct2((v),(v));if (ilength) ilength = 1.0f / sqrt(ilength);dest[0] = (v)[0] * ilength;dest[1] = (v)[1] * ilength;}
const GLdouble * v
Definition glquake.h:762

Definition at line 78 of file mathlib.h.

Referenced by VID_TouchscreenArea().

◆ Vector2Scale

#define Vector2Scale ( in,
scale,
out )
Value:
((out)[0] = (in)[0] * (scale),(out)[1] = (in)[1] * (scale))
float scale

Definition at line 77 of file mathlib.h.

◆ Vector2Set

#define Vector2Set ( vec,
x,
y )
Value:
((vec)[0]=(x),(vec)[1]=(y))
GLint GLenum GLint GLint y
Definition glquake.h:651

Definition at line 76 of file mathlib.h.

Referenced by VM_stringwidth().

◆ Vector4Add

#define Vector4Add ( a,
b,
out )
Value:
((out)[0]=(a)[0]+(b)[0],(out)[1]=(a)[1]+(b)[1],(out)[2]=(a)[2]+(b)[2],(out)[3]=(a)[3]+(b)[3])

Definition at line 89 of file mathlib.h.

Referenced by R_BuildFogHeightTexture().

◆ Vector4Clear

#define Vector4Clear ( a)

◆ Vector4Compare

#define Vector4Compare ( a,
b )
Value:
(((a)[0]==(b)[0])&&((a)[1]==(b)[1])&&((a)[2]==(b)[2])&&((a)[3]==(b)[3]))

Definition at line 83 of file mathlib.h.

◆ Vector4Copy

#define Vector4Copy ( in,
out )

◆ Vector4Lerp

#define Vector4Lerp ( v1,
lerp,
v2,
out )
Value:
((out)[0] = (v1)[0] + (lerp) * ((v2)[0] - (v1)[0]), (out)[1] = (v1)[1] + (lerp) * ((v2)[1] - (v1)[1]), (out)[2] = (v1)[2] + (lerp) * ((v2)[2] - (v1)[2]), (out)[3] = (v1)[3] + (lerp) * ((v2)[3] - (v1)[3]))
GLfloat GLfloat GLfloat v2
Definition glquake.h:747
GLfloat GLfloat v1
Definition glquake.h:743

Definition at line 93 of file mathlib.h.

Referenced by CL_NewParticlesFromEffectinfo().

◆ Vector4MA

#define Vector4MA ( a,
scale,
b,
out )
Value:
((out)[0] = (a)[0] + (scale) * (b)[0],(out)[1] = (a)[1] + (scale) * (b)[1],(out)[2] = (a)[2] + (scale) * (b)[2],(out)[3] = (a)[3] + (scale) * (b)[3])

Definition at line 92 of file mathlib.h.

◆ Vector4Multiply

#define Vector4Multiply ( a,
b,
out )
Value:
((out)[0]=(a)[0]*(b)[0],(out)[1]=(a)[1]*(b)[1],(out)[2]=(a)[2]*(b)[2],(out)[3]=(a)[3]*(b)[3])

Definition at line 91 of file mathlib.h.

Referenced by R_DrawTextureSurfaceList_ShowSurfaces().

◆ Vector4Negate

#define Vector4Negate ( in,
out )
Value:
((out)[0]=-((in)[0]),(out)[1]=-((in)[1]),(out)[2]=-((in)[2]),(out)[3]=-((in)[3]))

Definition at line 85 of file mathlib.h.

Referenced by Mod_INTERQUAKEMODEL_Load(), and Mod_PSKMODEL_Load().

◆ Vector4Normalize2

#define Vector4Normalize2 ( v,
dest )
Value:
{float ilength = (float)DotProduct4((v),(v));if (ilength) ilength = 1.0f / sqrt(ilength);dest[0] = (v)[0] * ilength;dest[1] = (v)[1] * ilength;dest[2] = (v)[2] * ilength;dest[3] = (v)[3] * ilength;}
#define DotProduct4(a, b)
Definition mathlib.h:81

Definition at line 87 of file mathlib.h.

Referenced by Mod_INTERQUAKEMODEL_Load(), and Mod_PSKMODEL_Load().

◆ Vector4Scale

#define Vector4Scale ( in,
scale,
out )
Value:
((out)[0] = (in)[0] * (scale),(out)[1] = (in)[1] * (scale),(out)[2] = (in)[2] * (scale),(out)[3] = (in)[3] * (scale))

Definition at line 90 of file mathlib.h.

◆ Vector4Set

◆ Vector4Subtract

#define Vector4Subtract ( a,
b,
out )
Value:
((out)[0]=(a)[0]-(b)[0],(out)[1]=(a)[1]-(b)[1],(out)[2]=(a)[2]-(b)[2],(out)[3]=(a)[3]-(b)[3])

Definition at line 88 of file mathlib.h.

◆ VectorAdd

◆ VectorCheeseRandom

#define VectorCheeseRandom ( seed,
v )
Value:
do{(v)[0] = lhcheeserandom(seed,-1, 1);(v)[1] = lhcheeserandom(seed,-1, 1);(v)[2] = lhcheeserandom(seed,-1, 1);}while(DotProduct(v, v) > 1)
#define lhcheeserandom(seed, MIN, MAX)
Definition mathlib.h:171

Definition at line 172 of file mathlib.h.

Referenced by R_Shadow_BounceGrid_AssignPhotons_Task().

◆ VectorClear

#define VectorClear ( a)
Value:
((a)[0]=(a)[1]=(a)[2]=0)

Definition at line 97 of file mathlib.h.

Referenced by CL_ReadPointFile_f(), CL_SetEntityColormapColors(), CL_TraceLine(), CL_TracePoint(), CL_UpdatePrydonCursor(), Collision_CalcPlanesForTriangleBrushFloat(), Collision_ClipExtendFinish(), Collision_ClipTrace_Line_Sphere(), Collision_NewBrushFromPlanes(), Collision_TraceBrushBrushFloat(), Collision_TraceLineBrushFloat(), Collision_TracePointBrushFloat(), CSQC_AddRenderEdict(), Cvar_UpdateAutoCvar(), EntityFrame_Clear(), EntityFrame_WriteFrame(), EntityStateQW_ReadPlayerUpdate(), Math_atov(), Mod_Alias_CalculateBoundingBox(), Mod_BSP_FindNonSolidLocation(), Mod_INTERQUAKEMODEL_Load(), Mod_LoadModel(), Mod_MDL_AnimateVertices(), Mod_Mesh_ComputeBounds(), Mod_OBJ_Load(), Mod_Q1BSP_Load(), Mod_Q1BSP_TraceBox(), Mod_Q1BSP_TraceLine(), Mod_Q3BSP_LightPoint(), Mod_Q3BSP_LoadFaces(), Mod_ShadowMesh_CalcBBox(), PHYS_UnstickEntityReturnOffset(), Portal_CheckPolygon(), Portal_RecursiveFlow(), Portal_RecursiveFlowSearch(), PRVM_Prog_Load(), R_DrawParticles(), R_DrawPortals(), R_Model_Sprite_Draw_TransparentCallback(), R_RealGetTexture(), R_SetupTexture(), R_Shadow_BounceGrid_AssignPhotons_Task(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_ComputeShadowCasterCullingPlanes(), R_Shadow_LoadWorldLights(), R_Shadow_RenderLighting(), R_Shadow_SetCursorLocationForView(), RSurf_PrepareVerticesForBatch(), Sbar_Draw(), SV_CheckVelocity(), SV_FlyMove(), SV_Physics_Toss(), SV_PushMove(), SV_SpawnServer(), SV_TraceLine(), SV_TracePoint(), SV_WalkMove(), SVVM_free_edict(), V_CalcRefdef(), V_CalcRefdefUsing(), VID_TouchscreenArea(), VM_CL_skel_get_boneabs(), VM_CL_skel_get_bonerel(), VM_ClearTraceGlobals(), VM_getsurfaceclippedpoint(), VM_getsurfacenormal(), VM_getsurfacepoint(), VM_getsurfacepointattribute(), VM_getsurfacetriangle(), VM_normalize(), VM_SV_getlight(), VM_SV_skel_get_boneabs(), and VM_SV_skel_get_bonerel().

◆ VectorCompare

◆ VectorCopy

#define VectorCopy ( in,
out )
Value:
((out)[0]=(in)[0],(out)[1]=(in)[1],(out)[2]=(in)[2])

Definition at line 101 of file mathlib.h.

Referenced by AnglesFromVectors(), applytransform_forward_normal(), BoxFromPoints(), CL_Beam_CalculatePositions(), CL_Cache_TraceLineSurfaces(), CL_ClientMovement_Move(), CL_ClientMovement_Physics_PM_Accelerate(), CL_ClientMovement_Physics_PM_AirAccelerate(), CL_ClientMovement_Physics_Swim(), CL_ClientMovement_Physics_Walk(), CL_ClientMovement_Replay(), CL_ClientMovement_Unstick(), CL_ClientMovement_UpdateStatus(), CL_DecayLightFlashes(), CL_Effect(), CL_GetEntityMatrix(), CL_GetTagMatrix(), CL_ImmediateBloodStain(), CL_LinkEdict(), CL_MeshEntities_Scene_FinalizeRenderEntity(), CL_MoveLerpEntityStates(), CL_movestep(), CL_NetworkTimeReceived(), CL_NewBeam(), CL_NewParticle(), CL_NewParticlesFromEffectinfo(), CL_ParseClientdata(), CL_ParseServerMessage(), CL_ReadDemoMessage(), CL_ReadPointFile_f(), CL_RelinkBeams(), CL_RotateMoves(), CL_SelectTraceLine(), CL_SendMove(), CL_SpawnDecalParticleForPoint(), CL_Trace_Toss(), CL_TraceBox(), CL_TraceLine(), CL_TracePoint(), CL_UpdateEntityShading_GetDirectedFullbright(), CL_UpdateNetworkEntity(), CL_UpdateNetworkEntityTrail(), CL_UpdatePrydonCursor(), CL_VM_Event_Sound(), CL_VM_GetEntitySoundOrigin(), CL_VM_Init(), CL_VM_TransformView(), CL_VM_UpdateDmgGlobals(), clippointtosurface(), Collision_BoundingBoxOfBrushTraceSegment(), Collision_BrushForBox(), Collision_Cache_Lookup(), Collision_CalcPlanesForTriangleBrushFloat(), Collision_ClipExtendPrepare(), Collision_ClipPointToGenericEntity(), Collision_ClipPointToWorld(), Collision_ClipTrace_Box(), Collision_ClipTrace_Line_Sphere(), Collision_CombineTraces(), Collision_NewBrushFromPlanes(), Collision_TraceBrushBrushFloat(), Collision_TraceBrushTriangleFloat(), Collision_TraceBrushTriangleMeshFloat(), Collision_TraceLineBrushFloat(), Collision_TracePointBrushFloat(), Collision_TransformBrush(), Con_MaskPrint(), CSQC_AddRenderEdict(), CSQC_SetGlobals(), Cvar_UpdateAutoCvar(), DropPunchAngle(), EntityFrame_AddFrame_Client(), EntityFrame_AddFrame_Server(), EntityFrame_Clear(), EntityFrame_FetchFrame(), EntityStateQW_ReadPlayerUpdate(), getdrawfontscale(), Mod_Alias_CalculateBoundingBox(), Mod_BSP_FinalizePortals(), Mod_BSP_FindNonSolidLocation(), Mod_BSP_FindNonSolidLocation_r_Triangle(), Mod_CollisionBIH_TraceBrush(), Mod_CollisionBIH_TraceLineShared(), Mod_GenerateLightmaps_CreateLightmaps(), Mod_GenerateLightmaps_CreateLights_ComputeSVBSP(), Mod_GenerateLightmaps_CreateLights_ComputeSVBSP_InsertSurfaces(), Mod_GenerateLightmaps_CreateTriangleInformation(), Mod_GenerateLightmaps_GridSample(), Mod_GenerateLightmaps_LightmapSample(), Mod_GenerateLightmaps_LightPoint(), Mod_GenerateLightmaps_VertexSample(), Mod_INTERQUAKEMODEL_Load(), Mod_MakeCollisionBIH(), Mod_Mesh_ComputeBounds(), Mod_OBJ_Load(), Mod_Q1BSP_Load(), Mod_Q1BSP_LoadFaces(), Mod_Q1BSP_RecursiveHullCheck(), Mod_Q1BSP_RecursiveHullCheckPoint(), Mod_Q1BSP_RoundUpToHullSize(), Mod_Q1BSP_TraceBox(), Mod_Q1BSP_TraceLine(), Mod_Q1BSP_TraceLineAgainstSurfaces(), Mod_Q1BSP_TraceLineAgainstSurfacesFindTextureOnNode(), Mod_Q1BSP_TracePoint(), Mod_Q2BSP_Load(), Mod_Q2BSP_LoadBrushes(), Mod_Q3BSP_Load(), Mod_Q3BSP_LoadBrushes(), Mod_Q3BSP_LoadEntities(), Mod_Q3BSP_LoadFaces(), Mod_Q3BSP_TraceLineOfSight(), Mod_Q3BSP_TraceLineOfSight_RecursiveNodeCheck(), Mod_RemoveDegenerateTriangles(), Mod_ShadowMesh_CalcBBox(), Mod_VBSP_LoadFaces(), Palette_Load(), PHYS_NudgeOutOfSolid(), PHYS_TestEntityPosition(), PHYS_UnstickEntityReturnOffset(), Portal_RecursiveFlow(), Portal_Visibility(), R_BuildLightMap(), R_CanSeeBox(), R_ClearScreen(), R_DecalSystem_SplatEntities(), R_DecalSystem_SplatTriangle(), R_DrawDebugModel(), R_DrawLoc_Callback(), R_DrawModelDecals_Entity(), R_DrawParticles(), R_DrawPortal_Callback(), R_DrawTextureSurfaceList_Sky(), R_HDR_UpdateIrisAdaptation(), R_Mesh_AddVertex(), R_Mod_GetLightInfo(), R_Model_Sprite_Draw_TransparentCallback(), R_MotionBlurView(), R_MoveExplosion(), R_NewExplosion(), R_Q1BSP_CallRecursiveGetLightInfo(), R_Q1BSP_RecursiveGetLightInfo_BIH(), R_Q1BSP_RecursiveGetLightInfo_BSP(), R_RotateSprite(), R_RTLight_Update(), R_ScissorForBBox(), R_Shadow_BounceGrid_AssignPhotons_Task(), R_Shadow_BounceGrid_BlurPixels_Task(), R_Shadow_BounceGrid_BlurPixelsInDirection(), R_Shadow_BounceGrid_ConvertPixelsAndUpload(), R_Shadow_BounceGrid_Slice(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_BounceGrid_UpdateSpacing(), R_Shadow_DrawModelShadowMaps(), R_Shadow_DrawWorldLight(), R_Shadow_EditLights_CopyInfo_f(), R_Shadow_EditLights_Edit_f(), R_Shadow_GetRTLightInfo(), R_Shadow_PrepareLight(), R_Shadow_PrepareModelShadows(), R_Shadow_UpdateWorldLight(), R_SkinFrame_LoadExternal_SkinFrame(), R_StainNode(), R_TrackSprite(), R_UpdateFog(), R_View_SetFrustum(), R_Water_AddWaterPlane(), RotateBBox(), RotatePointAroundVector(), RSurf_PrepareVerticesForBatch(), S_PlaySfxOnChannel(), SetMinMaxSize(), SetMinMaxSize(), SetMinMaxSizePRVM(), SV_AirMove(), SV_ApplyClientMove(), SV_CanSeeBox(), SV_CheckWaterTransition(), SV_CreateBaseline(), SV_EntitiesInBox(), SV_FlyMove(), SV_Impact(), SV_LinkEdict(), SV_LinkEdict_TouchAreaGrid_Call(), SV_movestep(), SV_NudgeOutOfSolid_PivotIsKnownGood(), SV_Physics_ClientEntity(), SV_Physics_ClientEntity_PostThink(), SV_Physics_ClientMove(), SV_Physics_Entity(), SV_Physics_Step(), SV_PlayerPhysics(), SV_PrepareEntityForSending(), SV_PushEntity(), SV_PushMove(), SV_SpawnServer(), SV_StepDirection(), SV_Trace_Toss(), SV_TraceBox(), SV_TraceLine(), SV_TracePoint(), SV_UnstickEntity(), SV_WalkMove(), SV_WallFriction(), SV_WaterMove(), SV_WriteClientdataToMessage(), SV_WriteEntitiesToClient(), V_CalcIntermissionRefdef(), V_CalcRefdef(), V_CalcRefdefUsing(), VID_TouchscreenArea(), VM_CL_ambientsound(), VM_CL_boxparticles(), VM_CL_checkpvs(), VM_CL_droptofloor(), VM_CL_effect(), VM_CL_findradius(), VM_CL_GetEntity(), VM_CL_getinputstate(), VM_CL_getlight(), VM_CL_gettaginfo(), VM_CL_makestatic(), VM_CL_makevectors(), VM_CL_particle(), VM_CL_pointcontents(), VM_CL_pointparticles(), VM_CL_pointsound(), VM_CL_project(), VM_CL_R_AddDynamicLight(), VM_CL_R_ClearScene(), VM_CL_R_SetView(), VM_CL_RotateMoves(), VM_CL_runplayerphysics(), VM_CL_setlistener(), VM_CL_setorigin(), VM_CL_setsize(), VM_CL_skel_get_boneabs(), VM_CL_skel_get_bonerel(), VM_CL_skel_mul_bone(), VM_CL_skel_mul_bones(), VM_CL_skel_set_bone(), VM_CL_SpawnParticle(), VM_CL_SpawnParticleDelayed(), VM_CL_te_beam(), VM_CL_te_blood(), VM_CL_te_bloodshower(), VM_CL_te_customflash(), VM_CL_te_explosion(), VM_CL_te_explosion2(), VM_CL_te_explosionquad(), VM_CL_te_explosionrgb(), VM_CL_te_flamejet(), VM_CL_te_gunshot(), VM_CL_te_gunshotquad(), VM_CL_te_knightspike(), VM_CL_te_lavasplash(), VM_CL_te_lightning1(), VM_CL_te_lightning2(), VM_CL_te_lightning3(), VM_CL_te_particlecube(), VM_CL_te_particlerain(), VM_CL_te_particlesnow(), VM_CL_te_plasmaburn(), VM_CL_te_smallflash(), VM_CL_te_spark(), VM_CL_te_spike(), VM_CL_te_spikequad(), VM_CL_te_superspike(), VM_CL_te_superspikequad(), VM_CL_te_tarexplosion(), VM_CL_te_teleport(), VM_CL_te_wizspike(), VM_CL_tracebox(), VM_CL_traceline(), VM_CL_trailparticles(), VM_CL_unproject(), VM_CL_V_CalcRefdef(), VM_drawcolorcodedstring(), VM_getsurfaceclippedpoint(), VM_getsurfacenearpoint(), VM_getsurfacenormal(), VM_getsurfacepoint(), VM_getsurfacepointattribute(), VM_makevectors(), VM_normalize(), VM_physics_addforce(), VM_physics_addtorque(), VM_randomvec(), VM_SetTraceGlobals(), VM_SV_aim(), VM_SV_ambientsound(), VM_SV_checkpvs(), VM_SV_droptofloor(), VM_SV_effect(), VM_SV_findradius(), VM_SV_getlight(), VM_SV_gettaginfo(), VM_SV_particle(), VM_SV_pointcontents(), VM_SV_pointparticles(), VM_SV_pointsound(), VM_SV_setorigin(), VM_SV_setsize(), VM_SV_skel_get_boneabs(), VM_SV_skel_get_bonerel(), VM_SV_skel_mul_bone(), VM_SV_skel_mul_bones(), VM_SV_skel_set_bone(), VM_SV_tracebox(), VM_SV_traceline(), VM_SV_trailparticles(), VM_vectoangles(), VM_vectorvectors(), World_EntitiesInBox(), World_LinkEdict(), and World_SetSize().

◆ VectorCopy4

#define VectorCopy4 ( a,
b )
Value:
{(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];(b)[3]=(a)[3];}

Definition at line 220 of file mathlib.h.

Referenced by R_Shadow_BounceGrid_ConvertPixelsAndUpload().

◆ VectorDistance

#define VectorDistance ( a,
b )

◆ VectorDistance2

#define VectorDistance2 ( a,
b )
Value:
(((a)[0] - (b)[0]) * ((a)[0] - (b)[0]) + ((a)[1] - (b)[1]) * ((a)[1] - (b)[1]) + ((a)[2] - (b)[2]) * ((a)[2] - (b)[2]))

Definition at line 107 of file mathlib.h.

Referenced by CL_Locs_FindNearest(), clippointtosurface(), Collision_NewBrushFromPlanes(), PHYS_TestEntityPosition(), R_DrawParticles(), R_Mesh_AddVertex(), R_Shadow_PrepareLight(), and RSurf_PrepareVerticesForBatch().

◆ VectorLehmerRandom

#define VectorLehmerRandom ( seed,
v )
Value:
do{(v)[0] = Math_crandomf(seed);(v)[1] = Math_crandomf(seed);(v)[2] = Math_crandomf(seed);}while(DotProduct(v, v) > 1)
float Math_crandomf(randomseed_t *r)
Definition mathlib.c:1059

Definition at line 173 of file mathlib.h.

Referenced by R_Shadow_BounceGrid_AssignPhotons_Task().

◆ VectorLength

◆ VectorLength2

◆ VectorLerp

◆ VectorM

#define VectorM ( scale1,
b1,
out )
Value:
((out)[0] = (scale1) * (b1)[0],(out)[1] = (scale1) * (b1)[1],(out)[2] = (scale1) * (b1)[2])

Definition at line 115 of file mathlib.h.

Referenced by CL_Beam_AddPolygons(), Mod_CollisionBIH_TraceBrush(), R_Shadow_DrawModelShadowMaps(), R_Shadow_PrepareModelShadows(), and R_Shadow_RenderLighting().

◆ VectorMA

#define VectorMA ( a,
scale,
b,
out )
Value:
((out)[0] = (a)[0] + (scale) * (b)[0],(out)[1] = (a)[1] + (scale) * (b)[1],(out)[2] = (a)[2] + (scale) * (b)[2])

Definition at line 114 of file mathlib.h.

Referenced by CL_Beam_AddPolygons(), CL_ClientMovement_Move(), CL_ClientMovement_Physics_PM_Accelerate(), CL_ClientMovement_Physics_PM_AirAccelerate(), CL_ClientMovement_Physics_Swim(), CL_ClientMovement_Physics_Walk(), CL_ClientMovement_UpdateStatus(), CL_LinkNetworkEntity(), CL_NewParticle(), CL_NewParticlesFromEffectinfo(), CL_ParticleEffect_Fallback(), CL_ParticleExplosion(), CL_RelinkBeams(), CL_SpawnDecalParticleForPoint(), CL_Trace_Toss(), CL_UpdateNetworkEntity(), CL_UpdateRenderEntity(), clippointtosurface(), ClipVelocity(), Collision_ClipExtendFinish(), Collision_ClipExtendPrepare(), Collision_ClipTrace_Line_Sphere(), Mod_BSP_FindNonSolidLocation_r_Triangle(), Mod_BSP_LightPoint_RecursiveBSPNode(), Mod_BuildTextureVectorsFromNormals(), Mod_GenerateLightmaps_CreateLightmaps(), Mod_GenerateLightmaps_GridSample(), Mod_GenerateLightmaps_LightPoint(), Mod_GenerateLightmaps_SamplePoint(), Mod_MD3_AnimateVertices(), Mod_MDL_AnimateVertices(), Mod_Q1BSP_RecursiveHullCheck(), Mod_Q1BSP_TraceLineAgainstSurfaces(), Mod_Q1BSP_TraceLineAgainstSurfacesRecursiveBSPNode(), Mod_Q3BSP_LightPoint(), PHYS_NudgeOutOfSolid(), R_BeginCoronaQuery(), R_DecalSystem_SplatTriangle(), R_DrawDebugModel(), R_DrawLoc_Callback(), R_DrawParticle_TransparentCallback(), R_DrawParticles(), R_Model_Sprite_Draw_TransparentCallback(), R_MoveExplosion(), R_NewExplosion(), R_RotateSprite(), R_Shadow_BounceGrid_AssignPhotons_Task(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_BounceGrid_UpdateSpacing(), R_Shadow_DrawModelShadowMaps(), R_Shadow_PrepareModelShadows(), R_Shadow_SetCursorLocationForView(), R_TrackSprite(), RSurf_PrepareVerticesForBatch(), SV_NudgeOutOfSolid_PivotIsKnownGood(), SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), SV_Physics_Entity(), SV_Physics_Toss(), SV_PrepareEntityForSending(), SV_PushMove(), SV_Trace_Toss(), SV_WriteEntitiesToClient(), V_CalcRefdefUsing(), VM_CL_GetEntity(), VM_CL_getlight(), VM_getsurfacetriangle(), VM_SV_aim(), and VM_SV_getlight().

◆ VectorMAM

◆ VectorMAMAM

#define VectorMAMAM ( scale1,
b1,
scale2,
b2,
scale3,
b3,
out )
Value:
((out)[0] = (scale1) * (b1)[0] + (scale2) * (b2)[0] + (scale3) * (b3)[0],(out)[1] = (scale1) * (b1)[1] + (scale2) * (b2)[1] + (scale3) * (b3)[1],(out)[2] = (scale1) * (b1)[2] + (scale2) * (b2)[2] + (scale3) * (b3)[2])

Definition at line 117 of file mathlib.h.

Referenced by CL_ClientMovement_Physics_Swim(), CL_NewParticlesFromEffectinfo(), CL_VM_GetEntitySoundOrigin(), Mod_Q1BSP_AssignNoShadowSkySurfaces(), Mod_Q1BSP_TraceBox(), R_Model_Sprite_Draw_TransparentCallback(), R_View_SetFrustum(), RSurf_PrepareVerticesForBatch(), V_CalcRefdefUsing(), VM_CL_findradius(), and VM_SV_findradius().

◆ VectorMAMAMAM

#define VectorMAMAMAM ( scale1,
b1,
scale2,
b2,
scale3,
b3,
scale4,
b4,
out )
Value:
((out)[0] = (scale1) * (b1)[0] + (scale2) * (b2)[0] + (scale3) * (b3)[0] + (scale4) * (b4)[0],(out)[1] = (scale1) * (b1)[1] + (scale2) * (b2)[1] + (scale3) * (b3)[1] + (scale4) * (b4)[1],(out)[2] = (scale1) * (b1)[2] + (scale2) * (b2)[2] + (scale3) * (b3)[2] + (scale4) * (b4)[2])

Definition at line 118 of file mathlib.h.

Referenced by CL_NewParticlesFromEffectinfo(), RSurf_PrepareVerticesForBatch(), and V_MakeViewIsometric().

◆ VectorMultiply

#define VectorMultiply ( a,
b,
out )
Value:
((out)[0]=(a)[0]*(b)[0],(out)[1]=(a)[1]*(b)[1],(out)[2]=(a)[2]*(b)[2])

Definition at line 102 of file mathlib.h.

Referenced by R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_RenderLighting(), RadiusFromBounds(), and RadiusFromBoundsAndOrigin().

◆ VectorNegate

◆ VectorNormalize

#define VectorNormalize ( v)
Value:
{float ilength = (float)DotProduct((v),(v));if (ilength) ilength = 1.0f / sqrt(ilength);(v)[0] *= ilength;(v)[1] *= ilength;(v)[2] *= ilength;}

Definition at line 104 of file mathlib.h.

Referenced by AnglesFromVectors(), CL_Beam_AddPolygons(), CL_Beam_AddQuad(), CL_Beam_CalculatePositions(), CL_ClientMovement_Physics_CPM_PM_Aircontrol(), CL_ClientMovement_Physics_Walk(), CL_ImmediateBloodStain(), CL_NewParticlesFromEffectinfo(), CL_ParticleEffect_Fallback(), CL_UpdateEntityShading_Entity(), clippointtosurface(), Collision_CalcPlanesForTriangleBrushFloat(), Collision_ClipTrace_Line_Sphere(), Collision_NewBrushFromPlanes(), Collision_TraceBrushBrushFloat(), Image_HeightmapToNormalmap_BGRA(), Mod_BSP_FindNonSolidLocation_r_Triangle(), Mod_BuildNormals(), Mod_BuildTextureVectorsFromNormals(), Mod_DARKPLACESMODEL_Load(), Mod_GenerateLightmaps_CreateLightmaps(), Mod_GenerateLightmaps_GridSample(), Mod_GenerateLightmaps_LightmapSample(), Mod_GenerateLightmaps_LightPoint(), Mod_GenerateLightmaps_SamplePoint(), Mod_Q3BSP_LightPoint(), Mod_ZYMOTICMODEL_Load(), Portal_CheckPolygon(), Portal_RecursiveFlow(), Portal_RecursiveFlowSearch(), R_BuildLightMap(), R_CalcBeam_Vertex3f(), R_CompleteLightPoint(), R_DecalSystem_SpawnTriangle(), R_DecalSystem_SplatEntity(), R_DrawParticle_TransparentCallback(), R_DrawParticles(), R_InitParticleTexture(), R_Model_Sprite_Draw_TransparentCallback(), R_Shadow_BounceGrid_AssignPhotons_Task(), R_Shadow_BounceGrid_ConvertPixelsAndUpload(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_ComputeShadowCasterCullingPlanes(), R_Shadow_DrawLightSprite_TransparentCallback(), R_Shadow_DrawModelShadowMaps(), R_Shadow_PrepareModelShadows(), R_View_SetFrustum(), R_Water_AddWaterPlane(), RSurf_PrepareVerticesForBatch(), shadebubble(), SND_Spatialize_WithSfx(), SV_FlyMove(), SV_WaterMove(), V_ParseDamage(), VectorVectors(), VectorVectorsDouble(), VM_getsurfacenormal(), and VM_SV_aim().

◆ VectorNormalize2

#define VectorNormalize2 ( v,
dest )
Value:
{float ilength = (float)DotProduct((v),(v));if (ilength) ilength = 1.0f / sqrt(ilength);dest[0] = (v)[0] * ilength;dest[1] = (v)[1] * ilength;dest[2] = (v)[2] * ilength;}

Definition at line 105 of file mathlib.h.

Referenced by CL_ClientMovement_Physics_PM_AirAccelerate(), R_DrawParticle_TransparentCallback(), and VM_vectorvectors().

◆ VectorNormalizeDouble

#define VectorNormalizeDouble ( v)
Value:
{double ilength = DotProduct((v),(v));if (ilength) ilength = 1.0 / sqrt(ilength);(v)[0] *= ilength;(v)[1] *= ilength;(v)[2] *= ilength;}

Definition at line 106 of file mathlib.h.

Referenced by Mod_Q1BSP_LoadMapBrushes().

◆ VectorRandom

#define VectorRandom ( v)
Value:
do{(v)[0] = lhrandom(-1, 1);(v)[1] = lhrandom(-1, 1);(v)[2] = lhrandom(-1, 1);}while(DotProduct(v, v) > 1)
#define lhrandom(MIN, MAX)
LadyHavoc: this function never returns exactly MIN or exactly MAX, because of a QuakeC bug in id1 whe...
Definition mathlib.h:48

Definition at line 119 of file mathlib.h.

Referenced by CL_NewParticle(), CL_NewParticlesFromEffectinfo(), CL_ParticleExplosion(), CL_SpawnDecalParticleForPoint(), Mod_GenerateLightmaps_InitSampleOffsets(), and VM_randomvec().

◆ VectorReflect

#define VectorReflect ( a,
r,
b,
out )
Value:
do{double d;d = DotProduct((a), (b)) * -(1.0 + (r));VectorMA((a), (d), (b), (out));}while(0)
#define VectorMA(a, scale, b, out)
Definition mathlib.h:114

Definition at line 121 of file mathlib.h.

Referenced by R_Shadow_BounceGrid_TracePhotons_Shot(), and RSurf_PrepareVerticesForBatch().

◆ VectorScale

#define VectorScale ( in,
scale,
out )
Value:
((out)[0] = (in)[0] * (scale),(out)[1] = (in)[1] * (scale),(out)[2] = (in)[2] * (scale))

Definition at line 111 of file mathlib.h.

Referenced by AnglesFromVectors(), CL_Beam_AddPolygons(), CL_ClientMovement_Physics_CPM_PM_Aircontrol(), CL_ClientMovement_Physics_PM_Accelerate(), CL_ClientMovement_Physics_PM_AirAccelerate(), CL_ClientMovement_Physics_Swim(), CL_ClientMovement_Physics_Walk(), CL_DecayLightFlashes(), CL_GetEntityMatrix(), CL_LinkNetworkEntity(), CL_Locs_Reload_f(), CL_ParticleExplosion(), CL_SetEntityColormapColors(), CL_Trace_Toss(), CL_UpdateNetworkEntity(), CL_UpdateNetworkEntityTrail(), CL_VM_TransformView(), Collision_ClipTrace_Line_Sphere(), Collision_TraceLineTriangleFloat(), Con_MaskPrint(), DropPunchAngle(), Matrix4x4_QuakeToDuke3D(), Mod_BSP_FindNonSolidLocation_r_Triangle(), Mod_GenerateLightmaps_GridSample(), Mod_GenerateLightmaps_InitSampleOffsets(), Mod_GenerateLightmaps_LightmapSample(), Mod_GenerateLightmaps_LightPoint(), Mod_GenerateLightmaps_SamplePoint(), Mod_MD3_AnimateVertices(), Mod_MDL_AnimateVertices(), Portal_CheckPolygon(), Portal_RecursiveFlow(), Portal_RecursiveFlowSearch(), R_DecalSystem_SplatEntity(), R_DrawCorona(), R_DrawModelDecals_Entity(), R_DrawParticle_TransparentCallback(), R_DrawParticles(), R_DrawPortals(), R_DrawTextureSurfaceList_ShowSurfaces(), R_Model_Sprite_Draw_TransparentCallback(), R_NewExplosion(), R_Shadow_BounceGrid_AssignPhotons_Task(), R_Shadow_BounceGrid_CheckEnable(), R_Shadow_BounceGrid_Slice(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_CalcBBoxSideMask(), R_Shadow_DrawLightSprite_TransparentCallback(), R_Shadow_LoadLightsFile(), R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(), R_Shadow_PrepareLight(), R_Shadow_PrepareLights(), R_UpdateFog(), R_View_SetFrustum(), R_Viewport_ApplyNearClipPlaneFloatGL(), RSurf_PrepareVerticesForBatch(), SND_Spatialize_WithSfx(), SV_AirMove(), SV_FlyMove(), SV_Physics_Toss(), SV_PushMove(), SV_Trace_Toss(), SV_UserFriction(), SV_WallFriction(), SV_WaterMove(), V_CalcRefdefUsing(), V_CalcViewBlend(), VectorNormalizeLength(), VM_CL_gettaginfo(), VM_CL_R_AddDynamicLight(), VM_CL_R_SetView(), VM_normalize(), and VM_SV_aim().

◆ VectorScaleCast

#define VectorScaleCast ( in,
scale,
outtype,
out )
Value:
((out)[0] = (outtype) ((in)[0] * (scale)),(out)[1] = (outtype) ((in)[1] * (scale)),(out)[2] = (outtype) ((in)[2] * (scale)))

Definition at line 112 of file mathlib.h.

Referenced by Mod_Alias_MorphMesh_CompileFrames().

◆ VectorSet

#define VectorSet ( vec,
x,
y,
z )
Value:
((vec)[0]=(x),(vec)[1]=(y),(vec)[2]=(z))
GLubyte GLubyte GLubyte z
Definition glquake.h:782

Definition at line 96 of file mathlib.h.

Referenced by CL_AddQWCTFFlagModel(), CL_Beam_CalculatePositions(), CL_ClearState(), CL_ClientMovement_Move(), CL_ClientMovement_Physics_Swim(), CL_ClientMovement_Physics_Walk(), CL_ClientMovement_UpdateStatus(), CL_LinkNetworkEntity(), CL_Locs_AddNode(), CL_MeshEntities_Init(), CL_NewTempEntity(), CL_ParseTempEntity(), CL_ParticleEffect_Fallback(), CL_ParticleRain(), CL_RelinkBeams(), CL_RelinkEffects(), CL_RelinkQWNails(), CL_RelinkStaticEntities(), CL_RelinkWorld(), CL_UpdateEntityShading_Entity(), CL_UpdateEntityShading_GetDirectedFullbright(), CL_UpdateNetworkEntity(), CL_UpdatePrydonCursor(), CL_VM_DrawHud(), Collision_BrushForBox(), CSQC_AddRenderEdict(), CSQC_SetGlobals(), EntityFrame_WriteFrame(), Matrix4x4_QuakeToDuke3D(), Mod_BSP_FinalizePortals(), Mod_BSP_LightPoint(), Mod_CollisionBIH_PointSuperContents_Mesh(), Mod_CollisionBIH_TracePoint_Mesh(), Mod_GenerateLightmaps_CreateLights_ComputeSVBSP(), Mod_GenerateLightmaps_LightmapSample(), Mod_LoadModel(), Mod_Mesh_ComputeBounds(), Mod_Mesh_IndexForVertex(), Mod_Q1BSP_Load(), Mod_Q3BSP_LoadEntities(), R_CanSeeBox(), R_DrawLoc_Callback(), R_Mesh_AddVertex(), R_Shadow_BounceGrid_ConvertPixelsAndUpload(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_BounceGrid_UpdateSpacing(), R_Shadow_ComputeShadowCasterCullingPlanes(), R_Shadow_DrawLightSprite_TransparentCallback(), R_tcMod_ApplyToMatrix(), R_Viewport_ApplyNearClipPlaneFloatGL(), Sbar_ShowFPS(), SV_ApplyClientMove(), SV_CanSeeBox(), SV_Ent_Create_f(), SV_Ent_Remove_f(), SV_FlyMove(), SV_LinkEdict_TouchAreaGrid_Call(), SV_WalkMove(), V_CalcRefdefUsing(), VectorVectors(), VectorVectorsDouble(), VM_CL_getmousepos(), VM_CL_makestatic(), VM_CL_ParticleThemeToGlobals(), VM_CL_project(), VM_CL_R_SetView(), VM_CL_unproject(), VM_getsurfacepointattribute(), and VM_M_getmousepos().

◆ VectorSubtract

#define VectorSubtract ( a,
b,
out )
Value:
((out)[0]=(a)[0]-(b)[0],(out)[1]=(a)[1]-(b)[1],(out)[2]=(a)[2]-(b)[2])

Definition at line 99 of file mathlib.h.

Referenced by CL_Beam_AddPolygons(), CL_Beam_AddQuad(), CL_Beam_CalculatePositions(), CL_ClientMovement_Physics_PM_AirAccelerate(), CL_MoveLerpEntityStates(), CL_NewParticlesFromEffectinfo(), CL_ParticleEffect_Fallback(), CL_ParticleExplosion(), CL_RelinkBeams(), CL_TraceBox(), CL_UpdateNetworkEntity(), CL_UpdateNetworkEntityTrail(), clippointtosurface(), Collision_CalcEdgeDirsForPolygonBrushFloat(), Collision_CalcPlanesForTriangleBrushFloat(), Collision_ClipExtendPrepare(), Collision_ClipTrace_Box(), Collision_ClipTrace_Line_Sphere(), Collision_NewBrushFromPlanes(), Collision_TraceLineTriangleFloat(), Mod_BSP_FindNonSolidLocation_r_Triangle(), Mod_BuildTextureVectorsFromNormals(), Mod_CollisionBIH_TraceBrush(), Mod_GenerateLightmaps_LightPoint(), Mod_GenerateLightmaps_SamplePoint(), Mod_MDLMD2MD3_TraceBox(), Mod_Q1BSP_LoadClipnodes(), Mod_Q1BSP_RoundUpToHullSize(), Mod_Q1BSP_TraceBox(), Mod_Q1BSP_TraceLine(), Mod_Q1BSP_TraceLineAgainstSurfaces(), Mod_Q1BSP_TraceLineAgainstSurfacesFindTextureOnNode(), Mod_RemoveDegenerateTriangles(), Mod_ShadowMesh_CalcBBox(), PHYS_TestEntityPosition(), Portal_CheckPolygon(), Portal_RecursiveFlowSearch(), R_CalcBeam_Vertex3f(), R_CompleteLightPoint(), R_DrawLoc_Callback(), R_DrawParticle_TransparentCallback(), R_Model_Sprite_Draw_TransparentCallback(), R_Shadow_BounceGrid_Slice(), R_Shadow_BounceGrid_TracePhotons_Shot(), R_Shadow_BounceGrid_UpdateSpacing(), R_Shadow_CalcBBoxSideMask(), R_Shadow_ComputeShadowCasterCullingPlanes(), R_Shadow_CullFrustumSides(), R_Shadow_SelectLightInView(), R_TrackSprite(), RadiusFromBoundsAndOrigin(), RSurf_PrepareVerticesForBatch(), SetMinMaxSize(), SetMinMaxSizePRVM(), SND_Spatialize_WithSfx(), SV_NudgeOutOfSolid_PivotIsKnownGood(), SV_PushMove(), SV_TraceBox(), SV_UnstickEntity(), SV_WallFriction(), V_CalcRefdefUsing(), VM_CL_findradius(), VM_getsurfacenearpoint(), VM_SV_aim(), VM_SV_droptofloor(), and VM_SV_findradius().

Function Documentation

◆ AngleMatrix()

void AngleMatrix ( const vec3_t angles,
const vec3_t translate,
vec_t matrix[][4] )

LadyHavoc: builds a [3][4] matrix.

◆ AnglesFromVectors()

void AnglesFromVectors ( vec3_t angles,
const vec3_t forward,
const vec3_t up,
qbool flippitch )

LadyHavoc: calculates pitch/yaw/roll angles from forward and up vectors.

Definition at line 650 of file mathlib.c.

651{
652 if (forward[0] == 0 && forward[1] == 0)
653 {
654 if(forward[2] > 0)
655 {
656 angles[PITCH] = -M_PI * 0.5;
657 angles[YAW] = up ? atan2(-up[1], -up[0]) : 0;
658 }
659 else
660 {
661 angles[PITCH] = M_PI * 0.5;
662 angles[YAW] = up ? atan2(up[1], up[0]) : 0;
663 }
664 angles[ROLL] = 0;
665 }
666 else
667 {
668 angles[YAW] = atan2(forward[1], forward[0]);
669 angles[PITCH] = -atan2(forward[2], sqrt(forward[0]*forward[0] + forward[1]*forward[1]));
670 // note: we know that angles[PITCH] is in ]-pi/2..pi/2[ due to atan2(anything, positive)
671 if (up)
672 {
673 vec_t cp = cos(angles[PITCH]), sp = sin(angles[PITCH]);
674 // note: we know cp > 0, due to the range angles[pitch] is in
675 vec_t cy = cos(angles[YAW]), sy = sin(angles[YAW]);
676 vec3_t tleft, tup;
677 tleft[0] = -sy;
678 tleft[1] = cy;
679 tleft[2] = 0;
680 tup[0] = sp*cy;
681 tup[1] = sp*sy;
682 tup[2] = cp;
683 angles[ROLL] = -atan2(DotProduct(up, tleft), DotProduct(up, tup));
684 // for up == '0 0 1', this is
685 // angles[ROLL] = -atan2(0, cp);
686 // which is 0
687 }
688 else
689 angles[ROLL] = 0;
690
691 // so no up vector is equivalent to '1 0 0'!
692 }
693
694 // now convert radians to degrees, and make all values positive
695 VectorScale(angles, 180.0 / M_PI, angles);
696 if (flippitch)
697 angles[PITCH] *= -1;
698 if (angles[PITCH] < 0) angles[PITCH] += 360;
699 if (angles[YAW] < 0) angles[YAW] += 360;
700 if (angles[ROLL] < 0) angles[ROLL] += 360;
701
702#if 0
703{
704 // debugging code
705 vec3_t tforward, tleft, tup, nforward, nup;
706 VectorCopy(forward, nforward);
707 VectorNormalize(nforward);
708 if (up)
709 {
710 VectorCopy(up, nup);
711 VectorNormalize(nup);
712 AngleVectors(angles, tforward, tleft, tup);
713 if (VectorDistance(tforward, nforward) > 0.01 || VectorDistance(tup, nup) > 0.01)
714 {
715 Con_Printf("vectoangles('%f %f %f', '%f %f %f') = %f %f %f\n", nforward[0], nforward[1], nforward[2], nup[0], nup[1], nup[2], angles[0], angles[1], angles[2]);
716 Con_Printf("^3But that is '%f %f %f', '%f %f %f'\n", tforward[0], tforward[1], tforward[2], tup[0], tup[1], tup[2]);
717 }
718 }
719 else
720 {
721 AngleVectors(angles, tforward, tleft, tup);
722 if (VectorDistance(tforward, nforward) > 0.01)
723 {
724 Con_Printf("vectoangles('%f %f %f') = %f %f %f\n", nforward[0], nforward[1], nforward[2], angles[0], angles[1], angles[2]);
725 Con_Printf("^3But that is '%f %f %f'\n", tforward[0], tforward[1], tforward[2]);
726 }
727 }
728}
729#endif
730}
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
Definition console.c:1514
vector angles
void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition mathlib.c:444
#define VectorNormalize(v)
Definition mathlib.h:104
#define VectorDistance(a, b)
Definition mathlib.h:108
#define VectorCopy(in, out)
Definition mathlib.h:101
#define VectorScale(in, scale, out)
Definition mathlib.h:111
float cos(float f)
float sin(float f)
float vec_t
Definition qtypes.h:68
vec_t vec3_t[3]
Definition qtypes.h:71
#define YAW
Definition qtypes.h:19
#define PITCH
Definition qtypes.h:16
#define ROLL
Definition qtypes.h:22
static vec3_t forward
Definition sv_user.c:305
static vec3_t up
Definition sv_user.c:305

References angles, AngleVectors(), Con_Printf(), cos(), DotProduct, forward, M_PI, PITCH, ROLL, sin(), sqrt(), up, VectorCopy, VectorDistance, VectorNormalize, VectorScale, and YAW.

Referenced by CL_NewParticlesFromEffectinfo(), CL_RotateMoves(), CL_UpdateNetworkEntity(), CL_VM_TransformView(), Matrix4x4_QuakeToDuke3D(), Mod_Decompile_SMD(), R_DecalSystem_SplatEntity(), and VM_vectoangles().

◆ AngleVectors()

void AngleVectors ( const vec3_t angles,
vec3_t forward,
vec3_t right,
vec3_t up )

Definition at line 444 of file mathlib.c.

445{
446 double angle, sr, sp, sy, cr, cp, cy;
447
448 angle = angles[YAW] * (M_PI*2 / 360);
449 sy = sin(angle);
450 cy = cos(angle);
451 angle = angles[PITCH] * (M_PI*2 / 360);
452 sp = sin(angle);
453 cp = cos(angle);
454 if (forward)
455 {
456 forward[0] = cp*cy;
457 forward[1] = cp*sy;
458 forward[2] = -sp;
459 }
460 if (right || up)
461 {
462 if (angles[ROLL])
463 {
464 angle = angles[ROLL] * (M_PI*2 / 360);
465 sr = sin(angle);
466 cr = cos(angle);
467 if (right)
468 {
469 right[0] = -1*(sr*sp*cy+cr*-sy);
470 right[1] = -1*(sr*sp*sy+cr*cy);
471 right[2] = -1*(sr*cp);
472 }
473 if (up)
474 {
475 up[0] = (cr*sp*cy+-sr*-sy);
476 up[1] = (cr*sp*sy+-sr*cy);
477 up[2] = cr*cp;
478 }
479 }
480 else
481 {
482 if (right)
483 {
484 right[0] = sy;
485 right[1] = -cy;
486 right[2] = 0;
487 }
488 if (up)
489 {
490 up[0] = (sp*cy);
491 up[1] = (sp*sy);
492 up[2] = cp;
493 }
494 }
495 }
496}
static vec3_t right
Definition sv_user.c:305

References angles, cos(), forward, M_PI, PITCH, right, ROLL, sin(), up, and YAW.

Referenced by AnglesFromVectors(), CL_ClientMovement_Physics_Swim(), CL_ClientMovement_Physics_Walk(), CL_NewParticlesFromEffectinfo(), CL_RotateMoves(), CL_UpdateEntityShading_GetDirectedFullbright(), CL_UpdateNetworkEntity(), Com_CalcRoll(), R_DecalSystem_SplatEntity(), SV_AirMove(), SV_Physics_Follow(), SV_WallFriction(), SV_WaterMove(), V_CalcRefdefUsing(), VM_CL_makevectors(), and VM_makevectors().

◆ AngleVectorsDuke3DFLU()

void AngleVectorsDuke3DFLU ( const vec3_t angles,
vec3_t forward,
vec3_t left,
vec3_t up,
double maxShearAngle )

divVerent: improper matrix version of AngleVectors

Definition at line 552 of file mathlib.c.

553{
554 double angle, sr, sy, cr, cy;
555 double sxx, sxz, szx, szz;
556 double cosMaxShearAngle = cos(maxShearAngle * (M_PI*2 / 360));
557 double tanMaxShearAngle = tan(maxShearAngle * (M_PI*2 / 360));
558
559 angle = angles[YAW] * (M_PI*2 / 360);
560 sy = sin(angle);
561 cy = cos(angle);
562 angle = angles[PITCH] * (M_PI*2 / 360);
563
564 // We will calculate a shear matrix pitch = [[sxx sxz][szx szz]].
565
566 if (fabs(cos(angle)) > cosMaxShearAngle)
567 {
568 // Pure shear. Keep the original sign of the coefficients.
569 sxx = 1;
570 sxz = 0;
571 szx = -tan(angle);
572 szz = 1;
573 // Covering angle per screen coordinate:
574 // d/dt arctan((sxz + t*szz) / (sxx + t*szx)) @ t=0
575 // d_angle = det(S) / (sxx*sxx + szx*szx)
576 // = 1 / (1 + tan^2 angle)
577 // = cos^2 angle.
578 }
579 else
580 {
581 // A mix of shear and rotation. Implementation-wise, we're
582 // looking at a capsule, and making the screen surface
583 // tangential to it... and if we get here, we're looking at the
584 // two half-spheres of the capsule (and the cylinder part is
585 // handled above).
586 double x, y, h, t, d, f;
587 h = tanMaxShearAngle;
588 x = cos(angle);
589 y = sin(angle);
590 t = h * fabs(y) + sqrt(1 - (h * x) * (h * x));
591 sxx = x * t;
592 sxz = y * t - h * (y > 0 ? 1.0 : -1.0);
593 szx = -y * t;
594 szz = x * t;
595 // BUT: keep the amount of a sphere we see in pitch direction
596 // invariant.
597 // Covering angle per screen coordinate:
598 // d_angle = det(S) / (sxx*sxx + szx*szx)
599 d = (sxx * szz - sxz * szx) / (sxx * sxx + szx * szx);
600 f = cosMaxShearAngle * cosMaxShearAngle / d;
601 sxz *= f;
602 szz *= f;
603 }
604
605 if (forward)
606 {
607 forward[0] = sxx*cy;
608 forward[1] = sxx*sy;
609 forward[2] = szx;
610 }
611 if (left || up)
612 {
613 if (angles[ROLL])
614 {
615 angle = angles[ROLL] * (M_PI*2 / 360);
616 sr = sin(angle);
617 cr = cos(angle);
618 if (left)
619 {
620 left[0] = sr*sxz*cy+cr*-sy;
621 left[1] = sr*sxz*sy+cr*cy;
622 left[2] = sr*szz;
623 }
624 if (up)
625 {
626 up[0] = cr*sxz*cy+-sr*-sy;
627 up[1] = cr*sxz*sy+-sr*cy;
628 up[2] = cr*szz;
629 }
630 }
631 else
632 {
633 if (left)
634 {
635 left[0] = -sy;
636 left[1] = cy;
637 left[2] = 0;
638 }
639 if (up)
640 {
641 up[0] = sxz*cy;
642 up[1] = sxz*sy;
643 up[2] = szz;
644 }
645 }
646 }
647}
float fabs(float f)
float f

References angles, cos(), f, fabs(), forward, M_PI, PITCH, ROLL, sin(), sqrt(), up, x, y, and YAW.

Referenced by Matrix4x4_QuakeToDuke3D().

◆ AngleVectorsFLU()

void AngleVectorsFLU ( const vec3_t angles,
vec3_t forward,
vec3_t left,
vec3_t up )

LadyHavoc: proper matrix version of AngleVectors.

Definition at line 498 of file mathlib.c.

499{
500 double angle, sr, sp, sy, cr, cp, cy;
501
502 angle = angles[YAW] * (M_PI*2 / 360);
503 sy = sin(angle);
504 cy = cos(angle);
505 angle = angles[PITCH] * (M_PI*2 / 360);
506 sp = sin(angle);
507 cp = cos(angle);
508 if (forward)
509 {
510 forward[0] = cp*cy;
511 forward[1] = cp*sy;
512 forward[2] = -sp;
513 }
514 if (left || up)
515 {
516 if (angles[ROLL])
517 {
518 angle = angles[ROLL] * (M_PI*2 / 360);
519 sr = sin(angle);
520 cr = cos(angle);
521 if (left)
522 {
523 left[0] = sr*sp*cy+cr*-sy;
524 left[1] = sr*sp*sy+cr*cy;
525 left[2] = sr*cp;
526 }
527 if (up)
528 {
529 up[0] = cr*sp*cy+-sr*-sy;
530 up[1] = cr*sp*sy+-sr*cy;
531 up[2] = cr*cp;
532 }
533 }
534 else
535 {
536 if (left)
537 {
538 left[0] = -sy;
539 left[1] = cy;
540 left[2] = 0;
541 }
542 if (up)
543 {
544 up[0] = sp*cy;
545 up[1] = sp*sy;
546 up[2] = cp;
547 }
548 }
549 }
550}

References angles, cos(), forward, M_PI, PITCH, ROLL, sin(), up, and YAW.

Referenced by SV_PushMove(), and VM_CL_RotateMoves().

◆ BoxFromPoints()

void BoxFromPoints ( vec3_t mins,
vec3_t maxs,
int numpoints,
vec_t * point3f )

Definition at line 877 of file mathlib.c.

878{
879 int i;
880 VectorCopy(point3f, mins);
881 VectorCopy(point3f, maxs);
882 for (i = 1, point3f += 3;i < numpoints;i++, point3f += 3)
883 {
884 mins[0] = min(mins[0], point3f[0]);maxs[0] = max(maxs[0], point3f[0]);
885 mins[1] = min(mins[1], point3f[1]);maxs[1] = max(maxs[1], point3f[1]);
886 mins[2] = min(mins[2], point3f[2]);maxs[2] = max(maxs[2], point3f[2]);
887 }
888}
vector mins
vector maxs
int i

References i, max, maxs, min, mins, and VectorCopy.

Referenced by Mod_BSP_FinalizePortals(), Mod_Q1BSP_LoadFaces(), and Mod_VBSP_LoadFaces().

◆ BoxOnPlaneSide()

int BoxOnPlaneSide ( const vec3_t emins,
const vec3_t emaxs,
const struct mplane_s * p )

◆ BoxOnPlaneSide_Separate()

int BoxOnPlaneSide_Separate ( const vec3_t emins,
const vec3_t emaxs,
const vec3_t normal,
const vec_t dist )

◆ BoxPlaneCornerDistances()

void BoxPlaneCornerDistances ( const vec3_t emins,
const vec3_t emaxs,
const struct mplane_s * p,
vec_t * outnear,
vec_t * outfar )

◆ BoxPlaneCornerDistances_Separate()

void BoxPlaneCornerDistances_Separate ( const vec3_t emins,
const vec3_t emaxs,
const vec3_t normal,
vec_t * outnear,
vec_t * outfar )

Definition at line 428 of file mathlib.c.

429{
430 switch((normal[0] < 0) | ((normal[1] < 0) << 1) | ((normal[2] < 0) << 2))
431 {
432 default:
433 case 0: *outneardist = normal[0] * emaxs[0] + normal[1] * emaxs[1] + normal[2] * emaxs[2];*outfardist = normal[0] * emins[0] + normal[1] * emins[1] + normal[2] * emins[2];break;
434 case 1: *outneardist = normal[0] * emins[0] + normal[1] * emaxs[1] + normal[2] * emaxs[2];*outfardist = normal[0] * emaxs[0] + normal[1] * emins[1] + normal[2] * emins[2];break;
435 case 2: *outneardist = normal[0] * emaxs[0] + normal[1] * emins[1] + normal[2] * emaxs[2];*outfardist = normal[0] * emins[0] + normal[1] * emaxs[1] + normal[2] * emins[2];break;
436 case 3: *outneardist = normal[0] * emins[0] + normal[1] * emins[1] + normal[2] * emaxs[2];*outfardist = normal[0] * emaxs[0] + normal[1] * emaxs[1] + normal[2] * emins[2];break;
437 case 4: *outneardist = normal[0] * emaxs[0] + normal[1] * emaxs[1] + normal[2] * emins[2];*outfardist = normal[0] * emins[0] + normal[1] * emins[1] + normal[2] * emaxs[2];break;
438 case 5: *outneardist = normal[0] * emins[0] + normal[1] * emaxs[1] + normal[2] * emins[2];*outfardist = normal[0] * emaxs[0] + normal[1] * emins[1] + normal[2] * emaxs[2];break;
439 case 6: *outneardist = normal[0] * emaxs[0] + normal[1] * emins[1] + normal[2] * emins[2];*outfardist = normal[0] * emins[0] + normal[1] * emaxs[1] + normal[2] * emaxs[2];break;
440 case 7: *outneardist = normal[0] * emins[0] + normal[1] * emins[1] + normal[2] * emins[2];*outfardist = normal[0] * emaxs[0] + normal[1] * emaxs[1] + normal[2] * emaxs[2];break;
441 }
442}

References normal.

◆ BoxPlaneCorners()

void BoxPlaneCorners ( const vec3_t emins,
const vec3_t emaxs,
const struct mplane_s * p,
vec3_t outnear,
vec3_t outfar )

◆ BoxPlaneCorners_Separate()

void BoxPlaneCorners_Separate ( const vec3_t emins,
const vec3_t emaxs,
const vec3_t normal,
vec3_t outnear,
vec3_t outfar )

Definition at line 390 of file mathlib.c.

391{
392 switch((normal[0] < 0) | ((normal[1] < 0) << 1) | ((normal[2] < 0) << 2))
393 {
394 default:
395 case 0: outnear[0] = emaxs[0];outnear[1] = emaxs[1];outnear[2] = emaxs[2];outfar[0] = emins[0];outfar[1] = emins[1];outfar[2] = emins[2];break;
396 case 1: outnear[0] = emins[0];outnear[1] = emaxs[1];outnear[2] = emaxs[2];outfar[0] = emaxs[0];outfar[1] = emins[1];outfar[2] = emins[2];break;
397 case 2: outnear[0] = emaxs[0];outnear[1] = emins[1];outnear[2] = emaxs[2];outfar[0] = emins[0];outfar[1] = emaxs[1];outfar[2] = emins[2];break;
398 case 3: outnear[0] = emins[0];outnear[1] = emins[1];outnear[2] = emaxs[2];outfar[0] = emaxs[0];outfar[1] = emaxs[1];outfar[2] = emins[2];break;
399 case 4: outnear[0] = emaxs[0];outnear[1] = emaxs[1];outnear[2] = emins[2];outfar[0] = emins[0];outfar[1] = emins[1];outfar[2] = emaxs[2];break;
400 case 5: outnear[0] = emins[0];outnear[1] = emaxs[1];outnear[2] = emins[2];outfar[0] = emaxs[0];outfar[1] = emins[1];outfar[2] = emaxs[2];break;
401 case 6: outnear[0] = emaxs[0];outnear[1] = emins[1];outnear[2] = emins[2];outfar[0] = emins[0];outfar[1] = emaxs[1];outfar[2] = emaxs[2];break;
402 case 7: outnear[0] = emins[0];outnear[1] = emins[1];outnear[2] = emins[2];outfar[0] = emaxs[0];outfar[1] = emaxs[1];outfar[2] = emaxs[2];break;
403 }
404}

References normal.

◆ ByteToNormal()

void ByteToNormal ( unsigned char num,
vec3_t n )

◆ CeilPowerOf2()

unsigned int CeilPowerOf2 ( unsigned int value)

returns the smallest integer greater than or equal to "value", or 0 if "value" is too big

Definition at line 292 of file mathlib.c.

293{
294 unsigned int ceilvalue;
295
296 if (value > (1U << (sizeof(int) * 8 - 1)))
297 return 0;
298
299 ceilvalue = 1;
300 while (ceilvalue < value)
301 ceilvalue <<= 1;
302
303 return ceilvalue;
304}
GLsizei const GLfloat * value
Definition glquake.h:740

References value.

Referenced by Font_LoadSize(), Mod_Q3BSP_LoadLightmaps(), and SndSys_Init().

◆ LoopingFrameNumberFromDouble()

int LoopingFrameNumberFromDouble ( double t,
int loopframes )

Definition at line 891 of file mathlib.c.

892{
893 if (loopframes)
894 return (int)(t - floor(t/loopframes)*loopframes);
895 else
896 return (int)t;
897}

References floor().

Referenced by R_GetCurrentTexture().

◆ Math_atov()

int Math_atov ( const char * s,
prvm_vec3_t out )

Definition at line 856 of file mathlib.c.

857{
858 int i;
859 VectorClear(out);
860 if (*s == '\'')
861 s++;
862 for (i = 0;i < 3;i++)
863 {
864 while (*s == ' ' || *s == '\t')
865 s++;
866 out[i] = atof (s);
867 if (out[i] == 0 && *s != '-' && *s != '+' && (*s < '0' || *s > '9'))
868 break; // not a number
869 while (*s && *s != ' ' && *s !='\t' && *s != '\'')
870 s++;
871 if (*s == '\'')
872 break;
873 }
874 return i;
875}
#define VectorClear(a)
Definition mathlib.h:97

References i, and VectorClear.

Referenced by R_Shadow_DrawModelShadowMaps(), R_Shadow_PrepareModelShadows(), and VM_stov().

◆ Math_crandomf()

float Math_crandomf ( randomseed_t * r)

Definition at line 1059 of file mathlib.c.

1060{
1061 // do this with a signed number and double the result, so we make use of all parts of the cow
1062 long long n = (long long)Math_rand64(r);
1063 return n * (0.5f / 0x80000000 / 0x80000000);
1064}
unsigned long long Math_rand64(randomseed_t *r)
Definition mathlib.c:1042

References Math_rand64(), n, and r.

◆ Math_rand64()

unsigned long long Math_rand64 ( randomseed_t * r)

Definition at line 1042 of file mathlib.c.

1043{
1044 unsigned int o[4];
1045 mul128(r->s, mul_Lecuyer, o);
1046 r->s[0] = o[0];
1047 r->s[1] = o[1];
1048 r->s[2] = o[2];
1049 r->s[3] = o[3];
1050 return ((unsigned long long)o[3] << 32) + o[2];
1051}
static unsigned int mul_Lecuyer[4]
Definition mathlib.c:899
static void mul128(const unsigned int a[], const unsigned int b[], unsigned int dest[4])
Definition mathlib.c:901

References mul128(), mul_Lecuyer, and r.

Referenced by Math_crandomf(), Math_randomf(), and Math_randomrangei().

◆ Math_randomf()

float Math_randomf ( randomseed_t * r)

Definition at line 1053 of file mathlib.c.

1054{
1055 unsigned long long n = Math_rand64(r);
1056 return n * (0.25f / 0x80000000 / 0x80000000);
1057}

References Math_rand64(), n, and r.

Referenced by Math_randomrangef().

◆ Math_randomrangef()

float Math_randomrangef ( randomseed_t * r,
float minf,
float maxf )

Definition at line 1066 of file mathlib.c.

1067{
1068 return Math_randomf(r) * (maxf - minf) + minf;
1069}
float Math_randomf(randomseed_t *r)
Definition mathlib.c:1053

References Math_randomf(), and r.

◆ Math_randomrangei()

int Math_randomrangei ( randomseed_t * r,
int mini,
int maxi )

Definition at line 1071 of file mathlib.c.

1072{
1073 unsigned long long n = Math_rand64(r);
1074 return (int)(((n >> 33) * (maxi - mini) + mini) >> 31);
1075}

References Math_rand64(), n, and r.

◆ Math_RandomSeed_FromInts()

void Math_RandomSeed_FromInts ( randomseed_t * r,
unsigned int s0,
unsigned int s1,
unsigned int s2,
unsigned int s3 )

Definition at line 1034 of file mathlib.c.

1035{
1036 r->s[0] = s0;
1037 r->s[1] = s1;
1038 r->s[2] = s2;
1039 r->s[3] = s3 | 1; // the Lehmer RNG requires that the seed be odd
1040}

References r.

Referenced by R_Shadow_BounceGrid_AssignPhotons_Task().

◆ Math_RandomSeed_Reset()

void Math_RandomSeed_Reset ( randomseed_t * r)

Definition at line 1026 of file mathlib.c.

1027{
1028 r->s[0] = 1;
1029 r->s[1] = 0;
1030 r->s[2] = 0;
1031 r->s[3] = 0;
1032}

References r.

◆ Mathlib_Init()

void Mathlib_Init ( void )

Definition at line 833 of file mathlib.c.

834{
835 int a;
836
837 // LadyHavoc: setup 1.0f / N table for quick recipricols of integers
838 ixtable[0] = 0;
839 for (a = 1;a < 4096;a++)
840 ixtable[a] = 1.0f / a;
841
843}
float ixtable[4096]
Definition mathlib.c:27
static void Math_RandomSeed_UnitTests(void)
Definition mathlib.c:990

References a, ixtable, and Math_RandomSeed_UnitTests().

Referenced by Host_Init().

◆ Matrix4x4_Print()

void Matrix4x4_Print ( const struct matrix4x4_s * in)

print a matrix to the console

◆ NormalToByte()

unsigned char NormalToByte ( const vec3_t n)

◆ PlaneClassify()

void PlaneClassify ( struct mplane_s * p)

◆ R_ConcatRotations()

void R_ConcatRotations ( const float in1[3 *3],
const float in2[3 *3],
float out[3 *3] )

Definition at line 781 of file mathlib.c.

782{
783 out[0*3+0] = in1[0*3+0] * in2[0*3+0] + in1[0*3+1] * in2[1*3+0] + in1[0*3+2] * in2[2*3+0];
784 out[0*3+1] = in1[0*3+0] * in2[0*3+1] + in1[0*3+1] * in2[1*3+1] + in1[0*3+2] * in2[2*3+1];
785 out[0*3+2] = in1[0*3+0] * in2[0*3+2] + in1[0*3+1] * in2[1*3+2] + in1[0*3+2] * in2[2*3+2];
786 out[1*3+0] = in1[1*3+0] * in2[0*3+0] + in1[1*3+1] * in2[1*3+0] + in1[1*3+2] * in2[2*3+0];
787 out[1*3+1] = in1[1*3+0] * in2[0*3+1] + in1[1*3+1] * in2[1*3+1] + in1[1*3+2] * in2[2*3+1];
788 out[1*3+2] = in1[1*3+0] * in2[0*3+2] + in1[1*3+1] * in2[1*3+2] + in1[1*3+2] * in2[2*3+2];
789 out[2*3+0] = in1[2*3+0] * in2[0*3+0] + in1[2*3+1] * in2[1*3+0] + in1[2*3+2] * in2[2*3+0];
790 out[2*3+1] = in1[2*3+0] * in2[0*3+1] + in1[2*3+1] * in2[1*3+1] + in1[2*3+2] * in2[2*3+1];
791 out[2*3+2] = in1[2*3+0] * in2[0*3+2] + in1[2*3+1] * in2[1*3+2] + in1[2*3+2] * in2[2*3+2];
792}

◆ R_ConcatTransforms()

void R_ConcatTransforms ( const float in1[3 *4],
const float in2[3 *4],
float out[3 *4] )

Definition at line 800 of file mathlib.c.

801{
802 out[0*4+0] = in1[0*4+0] * in2[0*4+0] + in1[0*4+1] * in2[1*4+0] + in1[0*4+2] * in2[2*4+0];
803 out[0*4+1] = in1[0*4+0] * in2[0*4+1] + in1[0*4+1] * in2[1*4+1] + in1[0*4+2] * in2[2*4+1];
804 out[0*4+2] = in1[0*4+0] * in2[0*4+2] + in1[0*4+1] * in2[1*4+2] + in1[0*4+2] * in2[2*4+2];
805 out[0*4+3] = in1[0*4+0] * in2[0*4+3] + in1[0*4+1] * in2[1*4+3] + in1[0*4+2] * in2[2*4+3] + in1[0*4+3];
806 out[1*4+0] = in1[1*4+0] * in2[0*4+0] + in1[1*4+1] * in2[1*4+0] + in1[1*4+2] * in2[2*4+0];
807 out[1*4+1] = in1[1*4+0] * in2[0*4+1] + in1[1*4+1] * in2[1*4+1] + in1[1*4+2] * in2[2*4+1];
808 out[1*4+2] = in1[1*4+0] * in2[0*4+2] + in1[1*4+1] * in2[1*4+2] + in1[1*4+2] * in2[2*4+2];
809 out[1*4+3] = in1[1*4+0] * in2[0*4+3] + in1[1*4+1] * in2[1*4+3] + in1[1*4+2] * in2[2*4+3] + in1[1*4+3];
810 out[2*4+0] = in1[2*4+0] * in2[0*4+0] + in1[2*4+1] * in2[1*4+0] + in1[2*4+2] * in2[2*4+0];
811 out[2*4+1] = in1[2*4+0] * in2[0*4+1] + in1[2*4+1] * in2[1*4+1] + in1[2*4+2] * in2[2*4+1];
812 out[2*4+2] = in1[2*4+0] * in2[0*4+2] + in1[2*4+1] * in2[1*4+2] + in1[2*4+2] * in2[2*4+2];
813 out[2*4+3] = in1[2*4+0] * in2[0*4+3] + in1[2*4+1] * in2[1*4+3] + in1[2*4+2] * in2[2*4+3] + in1[2*4+3];
814}

Referenced by Mod_DARKPLACESMODEL_Load(), Mod_Skeletal_BuildTransforms(), and Mod_ZYMOTICMODEL_Load().

◆ RadiusFromBounds()

float RadiusFromBounds ( const vec3_t mins,
const vec3_t maxs )

Definition at line 816 of file mathlib.c.

817{
818 vec3_t m1, m2;
821 return sqrt(max(m1[0], m2[0]) + max(m1[1], m2[1]) + max(m1[2], m2[2]));
822}
#define VectorMultiply(a, b, out)
Definition mathlib.h:102

References max, maxs, mins, sqrt(), and VectorMultiply.

◆ RadiusFromBoundsAndOrigin()

float RadiusFromBoundsAndOrigin ( const vec3_t mins,
const vec3_t maxs,
const vec3_t origin )

Definition at line 824 of file mathlib.c.

825{
826 vec3_t m1, m2;
827 VectorSubtract(mins, origin, m1);VectorMultiply(m1, m1, m1);
828 VectorSubtract(maxs, origin, m2);VectorMultiply(m2, m2, m2);
829 return sqrt(max(m1[0], m2[0]) + max(m1[1], m2[1]) + max(m1[2], m2[2]));
830}
vector origin
#define VectorSubtract(a, b, out)
Definition mathlib.h:99

References max, maxs, mins, origin, sqrt(), VectorMultiply, and VectorSubtract.

◆ RotatePointAroundVector()

void RotatePointAroundVector ( vec3_t dst,
const vec3_t dir,
const vec3_t point,
float degrees )

Definition at line 258 of file mathlib.c.

259{
260 float t0, t1;
261 float angle, c, s;
262 vec3_t vr, vu, vf;
263
264 angle = DEG2RAD(degrees);
265 c = cos(angle);
266 s = sin(angle);
267 VectorCopy(dir, vf);
268 VectorVectors(vf, vr, vu);
269
270 t0 = vr[0] * c + vu[0] * -s;
271 t1 = vr[0] * s + vu[0] * c;
272 dst[0] = (t0 * vr[0] + t1 * vu[0] + vf[0] * vf[0]) * point[0]
273 + (t0 * vr[1] + t1 * vu[1] + vf[0] * vf[1]) * point[1]
274 + (t0 * vr[2] + t1 * vu[2] + vf[0] * vf[2]) * point[2];
275
276 t0 = vr[1] * c + vu[1] * -s;
277 t1 = vr[1] * s + vu[1] * c;
278 dst[1] = (t0 * vr[0] + t1 * vu[0] + vf[1] * vf[0]) * point[0]
279 + (t0 * vr[1] + t1 * vu[1] + vf[1] * vf[1]) * point[1]
280 + (t0 * vr[2] + t1 * vu[2] + vf[1] * vf[2]) * point[2];
281
282 t0 = vr[2] * c + vu[2] * -s;
283 t1 = vr[2] * s + vu[2] * c;
284 dst[2] = (t0 * vr[0] + t1 * vu[0] + vf[2] * vf[0]) * point[0]
285 + (t0 * vr[1] + t1 * vu[1] + vf[2] * vf[1]) * point[1]
286 + (t0 * vr[2] + t1 * vu[2] + vf[2] * vf[2]) * point[2];
287}
void VectorVectors(const vec3_t forward, vec3_t right, vec3_t up)
LadyHavoc: like AngleVectors, but taking a forward vector instead of angles, useful!
Definition mathlib.c:199
#define DEG2RAD(a)
Definition mathlib.h:65
vec2 dir

References cos(), DEG2RAD, dir, sin(), VectorCopy, and VectorVectors().

◆ VectorNormalizeLength()

◆ VectorVectors()

void VectorVectors ( const vec3_t forward,
vec3_t right,
vec3_t up )

LadyHavoc: like AngleVectors, but taking a forward vector instead of angles, useful!

Definition at line 199 of file mathlib.c.

200{
201 // NOTE: this is consistent to AngleVectors applied to AnglesFromVectors
202 if (forward[0] == 0 && forward[1] == 0)
203 {
204 if(forward[2] > 0)
205 {
206 VectorSet(right, 0, -1, 0);
207 VectorSet(up, -1, 0, 0);
208 }
209 else
210 {
211 VectorSet(right, 0, -1, 0);
212 VectorSet(up, 1, 0, 0);
213 }
214 }
215 else
216 {
217 right[0] = forward[1];
218 right[1] = -forward[0];
219 right[2] = 0;
221
222 up[0] = (-forward[2]*forward[0]);
223 up[1] = (-forward[2]*forward[1]);
224 up[2] = (forward[0]*forward[0] + forward[1]*forward[1]);
226 }
227}
#define VectorSet(vec, x, y, z)
Definition mathlib.h:96

References forward, right, up, VectorNormalize, and VectorSet.

Referenced by R_DrawParticle_TransparentCallback(), RotatePointAroundVector(), and VM_vectorvectors().

◆ VectorVectorsDouble()

void VectorVectorsDouble ( const double * forward,
double * right,
double * up )

Definition at line 229 of file mathlib.c.

230{
231 if (forward[0] == 0 && forward[1] == 0)
232 {
233 if(forward[2] > 0)
234 {
235 VectorSet(right, 0, -1, 0);
236 VectorSet(up, -1, 0, 0);
237 }
238 else
239 {
240 VectorSet(right, 0, -1, 0);
241 VectorSet(up, 1, 0, 0);
242 }
243 }
244 else
245 {
246 right[0] = forward[1];
247 right[1] = -forward[0];
248 right[2] = 0;
250
251 up[0] = (-forward[2]*forward[0]);
252 up[1] = (-forward[2]*forward[1]);
253 up[2] = (forward[0]*forward[0] + forward[1]*forward[1]);
255 }
256}

References forward, right, up, VectorNormalize, and VectorSet.

Variable Documentation

◆ m_bytenormals

float m_bytenormals[NUMVERTEXNORMALS][3]
extern

Definition at line 31 of file mathlib.c.

32{
33{-0.525731f, 0.000000f, 0.850651f}, {-0.442863f, 0.238856f, 0.864188f},
34{-0.295242f, 0.000000f, 0.955423f}, {-0.309017f, 0.500000f, 0.809017f},
35{-0.162460f, 0.262866f, 0.951056f}, {0.000000f, 0.000000f, 1.000000f},
36{0.000000f, 0.850651f, 0.525731f}, {-0.147621f, 0.716567f, 0.681718f},
37{0.147621f, 0.716567f, 0.681718f}, {0.000000f, 0.525731f, 0.850651f},
38{0.309017f, 0.500000f, 0.809017f}, {0.525731f, 0.000000f, 0.850651f},
39{0.295242f, 0.000000f, 0.955423f}, {0.442863f, 0.238856f, 0.864188f},
40{0.162460f, 0.262866f, 0.951056f}, {-0.681718f, 0.147621f, 0.716567f},
41{-0.809017f, 0.309017f, 0.500000f}, {-0.587785f, 0.425325f, 0.688191f},
42{-0.850651f, 0.525731f, 0.000000f}, {-0.864188f, 0.442863f, 0.238856f},
43{-0.716567f, 0.681718f, 0.147621f}, {-0.688191f, 0.587785f, 0.425325f},
44{-0.500000f, 0.809017f, 0.309017f}, {-0.238856f, 0.864188f, 0.442863f},
45{-0.425325f, 0.688191f, 0.587785f}, {-0.716567f, 0.681718f, -0.147621f},
46{-0.500000f, 0.809017f, -0.309017f}, {-0.525731f, 0.850651f, 0.000000f},
47{0.000000f, 0.850651f, -0.525731f}, {-0.238856f, 0.864188f, -0.442863f},
48{0.000000f, 0.955423f, -0.295242f}, {-0.262866f, 0.951056f, -0.162460f},
49{0.000000f, 1.000000f, 0.000000f}, {0.000000f, 0.955423f, 0.295242f},
50{-0.262866f, 0.951056f, 0.162460f}, {0.238856f, 0.864188f, 0.442863f},
51{0.262866f, 0.951056f, 0.162460f}, {0.500000f, 0.809017f, 0.309017f},
52{0.238856f, 0.864188f, -0.442863f}, {0.262866f, 0.951056f, -0.162460f},
53{0.500000f, 0.809017f, -0.309017f}, {0.850651f, 0.525731f, 0.000000f},
54{0.716567f, 0.681718f, 0.147621f}, {0.716567f, 0.681718f, -0.147621f},
55{0.525731f, 0.850651f, 0.000000f}, {0.425325f, 0.688191f, 0.587785f},
56{0.864188f, 0.442863f, 0.238856f}, {0.688191f, 0.587785f, 0.425325f},
57{0.809017f, 0.309017f, 0.500000f}, {0.681718f, 0.147621f, 0.716567f},
58{0.587785f, 0.425325f, 0.688191f}, {0.955423f, 0.295242f, 0.000000f},
59{1.000000f, 0.000000f, 0.000000f}, {0.951056f, 0.162460f, 0.262866f},
60{0.850651f, -0.525731f, 0.000000f}, {0.955423f, -0.295242f, 0.000000f},
61{0.864188f, -0.442863f, 0.238856f}, {0.951056f, -0.162460f, 0.262866f},
62{0.809017f, -0.309017f, 0.500000f}, {0.681718f, -0.147621f, 0.716567f},
63{0.850651f, 0.000000f, 0.525731f}, {0.864188f, 0.442863f, -0.238856f},
64{0.809017f, 0.309017f, -0.500000f}, {0.951056f, 0.162460f, -0.262866f},
65{0.525731f, 0.000000f, -0.850651f}, {0.681718f, 0.147621f, -0.716567f},
66{0.681718f, -0.147621f, -0.716567f}, {0.850651f, 0.000000f, -0.525731f},
67{0.809017f, -0.309017f, -0.500000f}, {0.864188f, -0.442863f, -0.238856f},
68{0.951056f, -0.162460f, -0.262866f}, {0.147621f, 0.716567f, -0.681718f},
69{0.309017f, 0.500000f, -0.809017f}, {0.425325f, 0.688191f, -0.587785f},
70{0.442863f, 0.238856f, -0.864188f}, {0.587785f, 0.425325f, -0.688191f},
71{0.688191f, 0.587785f, -0.425325f}, {-0.147621f, 0.716567f, -0.681718f},
72{-0.309017f, 0.500000f, -0.809017f}, {0.000000f, 0.525731f, -0.850651f},
73{-0.525731f, 0.000000f, -0.850651f}, {-0.442863f, 0.238856f, -0.864188f},
74{-0.295242f, 0.000000f, -0.955423f}, {-0.162460f, 0.262866f, -0.951056f},
75{0.000000f, 0.000000f, -1.000000f}, {0.295242f, 0.000000f, -0.955423f},
76{0.162460f, 0.262866f, -0.951056f}, {-0.442863f, -0.238856f, -0.864188f},
77{-0.309017f, -0.500000f, -0.809017f}, {-0.162460f, -0.262866f, -0.951056f},
78{0.000000f, -0.850651f, -0.525731f}, {-0.147621f, -0.716567f, -0.681718f},
79{0.147621f, -0.716567f, -0.681718f}, {0.000000f, -0.525731f, -0.850651f},
80{0.309017f, -0.500000f, -0.809017f}, {0.442863f, -0.238856f, -0.864188f},
81{0.162460f, -0.262866f, -0.951056f}, {0.238856f, -0.864188f, -0.442863f},
82{0.500000f, -0.809017f, -0.309017f}, {0.425325f, -0.688191f, -0.587785f},
83{0.716567f, -0.681718f, -0.147621f}, {0.688191f, -0.587785f, -0.425325f},
84{0.587785f, -0.425325f, -0.688191f}, {0.000000f, -0.955423f, -0.295242f},
85{0.000000f, -1.000000f, 0.000000f}, {0.262866f, -0.951056f, -0.162460f},
86{0.000000f, -0.850651f, 0.525731f}, {0.000000f, -0.955423f, 0.295242f},
87{0.238856f, -0.864188f, 0.442863f}, {0.262866f, -0.951056f, 0.162460f},
88{0.500000f, -0.809017f, 0.309017f}, {0.716567f, -0.681718f, 0.147621f},
89{0.525731f, -0.850651f, 0.000000f}, {-0.238856f, -0.864188f, -0.442863f},
90{-0.500000f, -0.809017f, -0.309017f}, {-0.262866f, -0.951056f, -0.162460f},
91{-0.850651f, -0.525731f, 0.000000f}, {-0.716567f, -0.681718f, -0.147621f},
92{-0.716567f, -0.681718f, 0.147621f}, {-0.525731f, -0.850651f, 0.000000f},
93{-0.500000f, -0.809017f, 0.309017f}, {-0.238856f, -0.864188f, 0.442863f},
94{-0.262866f, -0.951056f, 0.162460f}, {-0.864188f, -0.442863f, 0.238856f},
95{-0.809017f, -0.309017f, 0.500000f}, {-0.688191f, -0.587785f, 0.425325f},
96{-0.681718f, -0.147621f, 0.716567f}, {-0.442863f, -0.238856f, 0.864188f},
97{-0.587785f, -0.425325f, 0.688191f}, {-0.309017f, -0.500000f, 0.809017f},
98{-0.147621f, -0.716567f, 0.681718f}, {-0.425325f, -0.688191f, 0.587785f},
99{-0.162460f, -0.262866f, 0.951056f}, {0.442863f, -0.238856f, 0.864188f},
100{0.162460f, -0.262866f, 0.951056f}, {0.309017f, -0.500000f, 0.809017f},
101{0.147621f, -0.716567f, 0.681718f}, {0.000000f, -0.525731f, 0.850651f},
102{0.425325f, -0.688191f, 0.587785f}, {0.587785f, -0.425325f, 0.688191f},
103{0.688191f, -0.587785f, 0.425325f}, {-0.955423f, 0.295242f, 0.000000f},
104{-0.951056f, 0.162460f, 0.262866f}, {-1.000000f, 0.000000f, 0.000000f},
105{-0.850651f, 0.000000f, 0.525731f}, {-0.955423f, -0.295242f, 0.000000f},
106{-0.951056f, -0.162460f, 0.262866f}, {-0.864188f, 0.442863f, -0.238856f},
107{-0.951056f, 0.162460f, -0.262866f}, {-0.809017f, 0.309017f, -0.500000f},
108{-0.864188f, -0.442863f, -0.238856f}, {-0.951056f, -0.162460f, -0.262866f},
109{-0.809017f, -0.309017f, -0.500000f}, {-0.681718f, 0.147621f, -0.716567f},
110{-0.681718f, -0.147621f, -0.716567f}, {-0.850651f, 0.000000f, -0.525731f},
111{-0.688191f, 0.587785f, -0.425325f}, {-0.587785f, 0.425325f, -0.688191f},
112{-0.425325f, 0.688191f, -0.587785f}, {-0.425325f, -0.688191f, -0.587785f},
113{-0.587785f, -0.425325f, -0.688191f}, {-0.688191f, -0.587785f, -0.425325f},
114};

Referenced by CL_EntityParticles(), and Mod_MDL_AnimateVertices().

◆ vec3_origin