ReactOS  0.4.15-dev-1386-g5cb9f87
d3dx9math.h File Reference
#include <d3dx9.h>
#include <math.h>
#include <d3dx9math.inl>
Include dependency graph for d3dx9math.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  D3DXVECTOR2
 
struct  D3DXVECTOR4
 
struct  D3DXQUATERNION
 
struct  D3DXPLANE
 
struct  D3DXCOLOR
 
struct  D3DXFLOAT16
 

Macros

#define D3DX_PI   ((FLOAT)3.141592654)
 
#define D3DX_1BYPI   ((FLOAT)0.318309886)
 
#define D3DXSH_MINORDER   2
 
#define D3DXSH_MAXORDER   6
 
#define D3DXToRadian(degree)   ((degree) * (D3DX_PI / 180.0f))
 
#define D3DXToDegree(radian)   ((radian) * (180.0f / D3DX_PI))
 
#define INTERFACE   ID3DXMatrixStack
 
#define ID3DXMatrixStack_QueryInterface(p, a, b)   (p)->lpVtbl->QueryInterface(p,a,b)
 
#define ID3DXMatrixStack_AddRef(p)   (p)->lpVtbl->AddRef(p)
 
#define ID3DXMatrixStack_Release(p)   (p)->lpVtbl->Release(p)
 
#define ID3DXMatrixStack_Pop(p)   (p)->lpVtbl->Pop(p)
 
#define ID3DXMatrixStack_Push(p)   (p)->lpVtbl->Push(p)
 
#define ID3DXMatrixStack_LoadIdentity(p)   (p)->lpVtbl->LoadIdentity(p)
 
#define ID3DXMatrixStack_LoadMatrix(p, a)   (p)->lpVtbl->LoadMatrix(p,a)
 
#define ID3DXMatrixStack_MultMatrix(p, a)   (p)->lpVtbl->MultMatrix(p,a)
 
#define ID3DXMatrixStack_MultMatrixLocal(p, a)   (p)->lpVtbl->MultMatrixLocal(p,a)
 
#define ID3DXMatrixStack_RotateAxis(p, a, b)   (p)->lpVtbl->RotateAxis(p,a,b)
 
#define ID3DXMatrixStack_RotateAxisLocal(p, a, b)   (p)->lpVtbl->RotateAxisLocal(p,a,b)
 
#define ID3DXMatrixStack_RotateYawPitchRoll(p, a, b, c)   (p)->lpVtbl->RotateYawPitchRoll(p,a,b,c)
 
#define ID3DXMatrixStack_RotateYawPitchRollLocal(p, a, b, c)   (p)->lpVtbl->RotateYawPitchRollLocal(p,a,b,c)
 
#define ID3DXMatrixStack_Scale(p, a, b, c)   (p)->lpVtbl->Scale(p,a,b,c)
 
#define ID3DXMatrixStack_ScaleLocal(p, a, b, c)   (p)->lpVtbl->ScaleLocal(p,a,b,c)
 
#define ID3DXMatrixStack_Translate(p, a, b, c)   (p)->lpVtbl->Translate(p,a,b,c)
 
#define ID3DXMatrixStack_TranslateLocal(p, a, b, c)   (p)->lpVtbl->TranslateLocal(p,a,b,c)
 
#define ID3DXMatrixStack_GetTop(p)   (p)->lpVtbl->GetTop(p)
 

Typedefs

typedef struct D3DXVECTOR2 D3DXVECTOR2
 
typedef struct D3DXVECTOR2LPD3DXVECTOR2
 
typedef struct _D3DVECTOR D3DXVECTOR3
 
typedef struct _D3DVECTORLPD3DXVECTOR3
 
typedef struct D3DXVECTOR4 D3DXVECTOR4
 
typedef struct D3DXVECTOR4LPD3DXVECTOR4
 
typedef struct _D3DMATRIX D3DXMATRIX
 
typedef struct _D3DMATRIXLPD3DXMATRIX
 
typedef struct D3DXQUATERNION D3DXQUATERNION
 
typedef struct D3DXQUATERNIONLPD3DXQUATERNION
 
typedef struct D3DXPLANE D3DXPLANE
 
typedef struct D3DXPLANELPD3DXPLANE
 
typedef struct D3DXCOLOR D3DXCOLOR
 
typedef struct D3DXCOLORLPD3DXCOLOR
 
typedef struct D3DXFLOAT16 D3DXFLOAT16
 
typedef struct D3DXFLOAT16LPD3DXFLOAT16
 
typedef interface ID3DXMatrixStack * LPD3DXMATRIXSTACK
 

Functions

D3DXCOLOR *WINAPI D3DXColorAdjustContrast (D3DXCOLOR *pout, const D3DXCOLOR *pc, FLOAT s)
 
D3DXCOLOR *WINAPI D3DXColorAdjustSaturation (D3DXCOLOR *pout, const D3DXCOLOR *pc, FLOAT s)
 
FLOAT WINAPI D3DXFresnelTerm (FLOAT costheta, FLOAT refractionindex)
 
D3DXMATRIX *WINAPI D3DXMatrixAffineTransformation (D3DXMATRIX *pout, FLOAT scaling, const D3DXVECTOR3 *rotationcenter, const D3DXQUATERNION *rotation, const D3DXVECTOR3 *translation)
 
D3DXMATRIX *WINAPI D3DXMatrixAffineTransformation2D (D3DXMATRIX *pout, FLOAT scaling, const D3DXVECTOR2 *protationcenter, FLOAT rotation, const D3DXVECTOR2 *ptranslation)
 
HRESULT WINAPI D3DXMatrixDecompose (D3DXVECTOR3 *poutscale, D3DXQUATERNION *poutrotation, D3DXVECTOR3 *pouttranslation, const D3DXMATRIX *pm)
 
FLOAT WINAPI D3DXMatrixDeterminant (const D3DXMATRIX *pm)
 
D3DXMATRIX *WINAPI D3DXMatrixInverse (D3DXMATRIX *pout, FLOAT *pdeterminant, const D3DXMATRIX *pm)
 
D3DXMATRIX *WINAPI D3DXMatrixLookAtLH (D3DXMATRIX *pout, const D3DXVECTOR3 *peye, const D3DXVECTOR3 *pat, const D3DXVECTOR3 *pup)
 
D3DXMATRIX *WINAPI D3DXMatrixLookAtRH (D3DXMATRIX *pout, const D3DXVECTOR3 *peye, const D3DXVECTOR3 *pat, const D3DXVECTOR3 *pup)
 
D3DXMATRIX *WINAPI D3DXMatrixMultiply (D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
 
D3DXMATRIX *WINAPI D3DXMatrixMultiplyTranspose (D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
 
D3DXMATRIX *WINAPI D3DXMatrixOrthoLH (D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixOrthoOffCenterLH (D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixOrthoOffCenterRH (D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixOrthoRH (D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveFovLH (D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveFovRH (D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveLH (D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveOffCenterLH (D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveOffCenterRH (D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveRH (D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
 
D3DXMATRIX *WINAPI D3DXMatrixReflect (D3DXMATRIX *pout, const D3DXPLANE *pplane)
 
D3DXMATRIX *WINAPI D3DXMatrixRotationAxis (D3DXMATRIX *pout, const D3DXVECTOR3 *pv, FLOAT angle)
 
D3DXMATRIX *WINAPI D3DXMatrixRotationQuaternion (D3DXMATRIX *pout, const D3DXQUATERNION *pq)
 
D3DXMATRIX *WINAPI D3DXMatrixRotationX (D3DXMATRIX *pout, FLOAT angle)
 
D3DXMATRIX *WINAPI D3DXMatrixRotationY (D3DXMATRIX *pout, FLOAT angle)
 
D3DXMATRIX *WINAPI D3DXMatrixRotationYawPitchRoll (D3DXMATRIX *pout, FLOAT yaw, FLOAT pitch, FLOAT roll)
 
D3DXMATRIX *WINAPI D3DXMatrixRotationZ (D3DXMATRIX *pout, FLOAT angle)
 
D3DXMATRIX *WINAPI D3DXMatrixScaling (D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz)
 
D3DXMATRIX *WINAPI D3DXMatrixShadow (D3DXMATRIX *pout, const D3DXVECTOR4 *plight, const D3DXPLANE *pPlane)
 
D3DXMATRIX *WINAPI D3DXMatrixTransformation (D3DXMATRIX *pout, const D3DXVECTOR3 *pscalingcenter, const D3DXQUATERNION *pscalingrotation, const D3DXVECTOR3 *pscaling, const D3DXVECTOR3 *protationcenter, const D3DXQUATERNION *protation, const D3DXVECTOR3 *ptranslation)
 
D3DXMATRIX *WINAPI D3DXMatrixTransformation2D (D3DXMATRIX *pout, const D3DXVECTOR2 *pscalingcenter, FLOAT scalingrotation, const D3DXVECTOR2 *pscaling, const D3DXVECTOR2 *protationcenter, FLOAT rotation, const D3DXVECTOR2 *ptranslation)
 
D3DXMATRIX *WINAPI D3DXMatrixTranslation (D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z)
 
D3DXMATRIX *WINAPI D3DXMatrixTranspose (D3DXMATRIX *pout, const D3DXMATRIX *pm)
 
D3DXPLANE *WINAPI D3DXPlaneFromPointNormal (D3DXPLANE *pout, const D3DXVECTOR3 *pvpoint, const D3DXVECTOR3 *pvnormal)
 
D3DXPLANE *WINAPI D3DXPlaneFromPoints (D3DXPLANE *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3)
 
D3DXVECTOR3 *WINAPI D3DXPlaneIntersectLine (D3DXVECTOR3 *pout, const D3DXPLANE *pp, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2)
 
D3DXPLANE *WINAPI D3DXPlaneNormalize (D3DXPLANE *pout, const D3DXPLANE *pp)
 
D3DXPLANE *WINAPI D3DXPlaneTransform (D3DXPLANE *pout, const D3DXPLANE *pplane, const D3DXMATRIX *pm)
 
D3DXPLANE *WINAPI D3DXPlaneTransformArray (D3DXPLANE *pout, UINT outstride, const D3DXPLANE *pplane, UINT pstride, const D3DXMATRIX *pm, UINT n)
 
D3DXQUATERNION *WINAPI D3DXQuaternionBaryCentric (D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3, FLOAT f, FLOAT g)
 
D3DXQUATERNION *WINAPI D3DXQuaternionExp (D3DXQUATERNION *pout, const D3DXQUATERNION *pq)
 
D3DXQUATERNION *WINAPI D3DXQuaternionInverse (D3DXQUATERNION *pout, const D3DXQUATERNION *pq)
 
D3DXQUATERNION *WINAPI D3DXQuaternionLn (D3DXQUATERNION *pout, const D3DXQUATERNION *pq)
 
D3DXQUATERNION *WINAPI D3DXQuaternionMultiply (D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2)
 
D3DXQUATERNION *WINAPI D3DXQuaternionNormalize (D3DXQUATERNION *pout, const D3DXQUATERNION *pq)
 
D3DXQUATERNION *WINAPI D3DXQuaternionRotationAxis (D3DXQUATERNION *pout, const D3DXVECTOR3 *pv, FLOAT angle)
 
D3DXQUATERNION *WINAPI D3DXQuaternionRotationMatrix (D3DXQUATERNION *pout, const D3DXMATRIX *pm)
 
D3DXQUATERNION *WINAPI D3DXQuaternionRotationYawPitchRoll (D3DXQUATERNION *pout, FLOAT yaw, FLOAT pitch, FLOAT roll)
 
D3DXQUATERNION *WINAPI D3DXQuaternionSlerp (D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, FLOAT t)
 
D3DXQUATERNION *WINAPI D3DXQuaternionSquad (D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3, const D3DXQUATERNION *pq4, FLOAT t)
 
void WINAPI D3DXQuaternionSquadSetup (D3DXQUATERNION *paout, D3DXQUATERNION *pbout, D3DXQUATERNION *pcout, const D3DXQUATERNION *pq0, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3)
 
void WINAPI D3DXQuaternionToAxisAngle (const D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle)
 
D3DXVECTOR2 *WINAPI D3DXVec2BaryCentric (D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pv3, FLOAT f, FLOAT g)
 
D3DXVECTOR2 *WINAPI D3DXVec2CatmullRom (D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv0, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pv3, FLOAT s)
 
D3DXVECTOR2 *WINAPI D3DXVec2Hermite (D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pt1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pt2, FLOAT s)
 
D3DXVECTOR2 *WINAPI D3DXVec2Normalize (D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv)
 
D3DXVECTOR4 *WINAPI D3DXVec2Transform (D3DXVECTOR4 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
 
D3DXVECTOR4 *WINAPI D3DXVec2TransformArray (D3DXVECTOR4 *pout, UINT outstride, const D3DXVECTOR2 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n)
 
D3DXVECTOR2 *WINAPI D3DXVec2TransformCoord (D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
 
D3DXVECTOR2 *WINAPI D3DXVec2TransformCoordArray (D3DXVECTOR2 *pout, UINT outstride, const D3DXVECTOR2 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n)
 
D3DXVECTOR2 *WINAPI D3DXVec2TransformNormal (D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
 
D3DXVECTOR2 *WINAPI D3DXVec2TransformNormalArray (D3DXVECTOR2 *pout, UINT outstride, const D3DXVECTOR2 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n)
 
D3DXVECTOR3 *WINAPI D3DXVec3BaryCentric (D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3, FLOAT f, FLOAT g)
 
D3DXVECTOR3 *WINAPI D3DXVec3CatmullRom (D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv0, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3, FLOAT s)
 
D3DXVECTOR3 *WINAPI D3DXVec3Hermite (D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pt1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pt2, FLOAT s)
 
D3DXVECTOR3 *WINAPI D3DXVec3Normalize (D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
 
D3DXVECTOR3 *WINAPI D3DXVec3Project (D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld)
 
D3DXVECTOR3 *WINAPI D3DXVec3ProjectArray (D3DXVECTOR3 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld, UINT n)
 
D3DXVECTOR4 *WINAPI D3DXVec3Transform (D3DXVECTOR4 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
 
D3DXVECTOR4 *WINAPI D3DXVec3TransformArray (D3DXVECTOR4 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n)
 
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoord (D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
 
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoordArray (D3DXVECTOR3 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n)
 
D3DXVECTOR3 *WINAPI D3DXVec3TransformNormal (D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
 
D3DXVECTOR3 *WINAPI D3DXVec3TransformNormalArray (D3DXVECTOR3 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n)
 
D3DXVECTOR3 *WINAPI D3DXVec3Unproject (D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld)
 
D3DXVECTOR3 *WINAPI D3DXVec3UnprojectArray (D3DXVECTOR3 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld, UINT n)
 
D3DXVECTOR4 *WINAPI D3DXVec4BaryCentric (D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pv3, FLOAT f, FLOAT g)
 
D3DXVECTOR4 *WINAPI D3DXVec4CatmullRom (D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv0, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pv3, FLOAT s)
 
D3DXVECTOR4 *WINAPI D3DXVec4Cross (D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pv3)
 
D3DXVECTOR4 *WINAPI D3DXVec4Hermite (D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pt1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pt2, FLOAT s)
 
D3DXVECTOR4 *WINAPI D3DXVec4Normalize (D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv)
 
D3DXVECTOR4 *WINAPI D3DXVec4Transform (D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv, const D3DXMATRIX *pm)
 
D3DXVECTOR4 *WINAPI D3DXVec4TransformArray (D3DXVECTOR4 *pout, UINT outstride, const D3DXVECTOR4 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n)
 
D3DXFLOAT16 *WINAPI D3DXFloat32To16Array (D3DXFLOAT16 *pout, const FLOAT *pin, UINT n)
 
FLOAT *WINAPI D3DXFloat16To32Array (FLOAT *pout, const D3DXFLOAT16 *pin, UINT n)
 
FLOAT *WINAPI D3DXSHAdd (FLOAT *out, UINT order, const FLOAT *a, const FLOAT *b)
 
FLOAT WINAPI D3DXSHDot (UINT order, const FLOAT *a, const FLOAT *b)
 
HRESULT WINAPI D3DXSHEvalConeLight (UINT order, const D3DXVECTOR3 *dir, FLOAT radius, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *rout, FLOAT *gout, FLOAT *bout)
 
FLOAT *WINAPI D3DXSHEvalDirection (FLOAT *out, UINT order, const D3DXVECTOR3 *dir)
 
HRESULT WINAPI D3DXSHEvalDirectionalLight (UINT order, const D3DXVECTOR3 *dir, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *rout, FLOAT *gout, FLOAT *bout)
 
HRESULT WINAPI D3DXSHEvalHemisphereLight (UINT order, const D3DXVECTOR3 *dir, D3DXCOLOR top, D3DXCOLOR bottom, FLOAT *rout, FLOAT *gout, FLOAT *bout)
 
HRESULT WINAPI D3DXSHEvalSphericalLight (UINT order, const D3DXVECTOR3 *dir, FLOAT radius, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *rout, FLOAT *gout, FLOAT *bout)
 
FLOAT *WINAPI D3DXSHMultiply2 (FLOAT *out, const FLOAT *a, const FLOAT *b)
 
FLOAT *WINAPI D3DXSHMultiply3 (FLOAT *out, const FLOAT *a, const FLOAT *b)
 
FLOAT *WINAPI D3DXSHMultiply4 (FLOAT *out, const FLOAT *a, const FLOAT *b)
 
HRESULT WINAPI D3DXSHProjectCubeMap (UINT order, IDirect3DCubeTexture9 *cubemap, FLOAT *rout, FLOAT *gout, FLOAT *bout)
 
FLOAT *WINAPI D3DXSHRotate (FLOAT *out, UINT order, const D3DXMATRIX *matrix, const FLOAT *in)
 
FLOAT *WINAPI D3DXSHRotateZ (FLOAT *out, UINT order, FLOAT angle, const FLOAT *in)
 
FLOAT *WINAPI D3DXSHScale (FLOAT *out, UINT order, const FLOAT *a, const FLOAT scale)
 
 DEFINE_GUID (IID_ID3DXMatrixStack, 0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85)
 
 DECLARE_INTERFACE_ (ID3DXMatrixStack, IUnknown)
 
HRESULT WINAPI D3DXCreateMatrixStack (DWORD flags, ID3DXMatrixStack **stack)
 

Macro Definition Documentation

◆ D3DX_1BYPI

#define D3DX_1BYPI   ((FLOAT)0.318309886)

Definition at line 28 of file d3dx9math.h.

◆ D3DX_PI

#define D3DX_PI   ((FLOAT)3.141592654)

Definition at line 27 of file d3dx9math.h.

◆ D3DXSH_MAXORDER

#define D3DXSH_MAXORDER   6

Definition at line 31 of file d3dx9math.h.

◆ D3DXSH_MINORDER

#define D3DXSH_MINORDER   2

Definition at line 30 of file d3dx9math.h.

◆ D3DXToDegree

#define D3DXToDegree (   radian)    ((radian) * (180.0f / D3DX_PI))

Definition at line 34 of file d3dx9math.h.

◆ D3DXToRadian

#define D3DXToRadian (   degree)    ((degree) * (D3DX_PI / 180.0f))

Definition at line 33 of file d3dx9math.h.

◆ ID3DXMatrixStack_AddRef

#define ID3DXMatrixStack_AddRef (   p)    (p)->lpVtbl->AddRef(p)

Definition at line 443 of file d3dx9math.h.

◆ ID3DXMatrixStack_GetTop

#define ID3DXMatrixStack_GetTop (   p)    (p)->lpVtbl->GetTop(p)

Definition at line 459 of file d3dx9math.h.

◆ ID3DXMatrixStack_LoadIdentity

#define ID3DXMatrixStack_LoadIdentity (   p)    (p)->lpVtbl->LoadIdentity(p)

Definition at line 447 of file d3dx9math.h.

◆ ID3DXMatrixStack_LoadMatrix

#define ID3DXMatrixStack_LoadMatrix (   p,
  a 
)    (p)->lpVtbl->LoadMatrix(p,a)

Definition at line 448 of file d3dx9math.h.

◆ ID3DXMatrixStack_MultMatrix

#define ID3DXMatrixStack_MultMatrix (   p,
  a 
)    (p)->lpVtbl->MultMatrix(p,a)

Definition at line 449 of file d3dx9math.h.

◆ ID3DXMatrixStack_MultMatrixLocal

#define ID3DXMatrixStack_MultMatrixLocal (   p,
  a 
)    (p)->lpVtbl->MultMatrixLocal(p,a)

Definition at line 450 of file d3dx9math.h.

◆ ID3DXMatrixStack_Pop

#define ID3DXMatrixStack_Pop (   p)    (p)->lpVtbl->Pop(p)

Definition at line 445 of file d3dx9math.h.

◆ ID3DXMatrixStack_Push

#define ID3DXMatrixStack_Push (   p)    (p)->lpVtbl->Push(p)

Definition at line 446 of file d3dx9math.h.

◆ ID3DXMatrixStack_QueryInterface

#define ID3DXMatrixStack_QueryInterface (   p,
  a,
  b 
)    (p)->lpVtbl->QueryInterface(p,a,b)

Definition at line 442 of file d3dx9math.h.

◆ ID3DXMatrixStack_Release

#define ID3DXMatrixStack_Release (   p)    (p)->lpVtbl->Release(p)

Definition at line 444 of file d3dx9math.h.

◆ ID3DXMatrixStack_RotateAxis

#define ID3DXMatrixStack_RotateAxis (   p,
  a,
  b 
)    (p)->lpVtbl->RotateAxis(p,a,b)

Definition at line 451 of file d3dx9math.h.

◆ ID3DXMatrixStack_RotateAxisLocal

#define ID3DXMatrixStack_RotateAxisLocal (   p,
  a,
  b 
)    (p)->lpVtbl->RotateAxisLocal(p,a,b)

Definition at line 452 of file d3dx9math.h.

◆ ID3DXMatrixStack_RotateYawPitchRoll

#define ID3DXMatrixStack_RotateYawPitchRoll (   p,
  a,
  b,
  c 
)    (p)->lpVtbl->RotateYawPitchRoll(p,a,b,c)

Definition at line 453 of file d3dx9math.h.

◆ ID3DXMatrixStack_RotateYawPitchRollLocal

#define ID3DXMatrixStack_RotateYawPitchRollLocal (   p,
  a,
  b,
  c 
)    (p)->lpVtbl->RotateYawPitchRollLocal(p,a,b,c)

Definition at line 454 of file d3dx9math.h.

◆ ID3DXMatrixStack_Scale

#define ID3DXMatrixStack_Scale (   p,
  a,
  b,
  c 
)    (p)->lpVtbl->Scale(p,a,b,c)

Definition at line 455 of file d3dx9math.h.

◆ ID3DXMatrixStack_ScaleLocal

#define ID3DXMatrixStack_ScaleLocal (   p,
  a,
  b,
  c 
)    (p)->lpVtbl->ScaleLocal(p,a,b,c)

Definition at line 456 of file d3dx9math.h.

◆ ID3DXMatrixStack_Translate

#define ID3DXMatrixStack_Translate (   p,
  a,
  b,
  c 
)    (p)->lpVtbl->Translate(p,a,b,c)

Definition at line 457 of file d3dx9math.h.

◆ ID3DXMatrixStack_TranslateLocal

#define ID3DXMatrixStack_TranslateLocal (   p,
  a,
  b,
  c 
)    (p)->lpVtbl->TranslateLocal(p,a,b,c)

Definition at line 458 of file d3dx9math.h.

◆ INTERFACE

#define INTERFACE   ID3DXMatrixStack

Definition at line 414 of file d3dx9math.h.

Typedef Documentation

◆ D3DXCOLOR

◆ D3DXFLOAT16

◆ D3DXMATRIX

Definition at line 169 of file d3dx9math.h.

◆ D3DXPLANE

◆ D3DXQUATERNION

◆ D3DXVECTOR2

◆ D3DXVECTOR3

Definition at line 97 of file d3dx9math.h.

◆ D3DXVECTOR4

◆ LPD3DXCOLOR

◆ LPD3DXFLOAT16

◆ LPD3DXMATRIX

Definition at line 169 of file d3dx9math.h.

◆ LPD3DXMATRIXSTACK

typedef interface ID3DXMatrixStack* LPD3DXMATRIXSTACK

Definition at line 408 of file d3dx9math.h.

◆ LPD3DXPLANE

◆ LPD3DXQUATERNION

◆ LPD3DXVECTOR2

◆ LPD3DXVECTOR3

Definition at line 97 of file d3dx9math.h.

◆ LPD3DXVECTOR4

Function Documentation

◆ D3DXColorAdjustContrast()

D3DXCOLOR* WINAPI D3DXColorAdjustContrast ( D3DXCOLOR pout,
const D3DXCOLOR pc,
FLOAT  s 
)

Definition at line 46 of file math.c.

47 {
48  TRACE("pout %p, pc %p, s %f\n", pout, pc, s);
49 
50  pout->r = 0.5f + s * (pc->r - 0.5f);
51  pout->g = 0.5f + s * (pc->g - 0.5f);
52  pout->b = 0.5f + s * (pc->b - 0.5f);
53  pout->a = pc->a;
54  return pout;
55 }
FLOAT g
Definition: d3dx9math.h:262
FLOAT a
Definition: d3dx9math.h:262
FLOAT r
Definition: d3dx9math.h:262
#define TRACE(s)
Definition: solgame.cpp:4
GLdouble s
Definition: gl.h:2039
FLOAT b
Definition: d3dx9math.h:262

Referenced by D3DXColorTest().

◆ D3DXColorAdjustSaturation()

D3DXCOLOR* WINAPI D3DXColorAdjustSaturation ( D3DXCOLOR pout,
const D3DXCOLOR pc,
FLOAT  s 
)

Definition at line 57 of file math.c.

58 {
59  FLOAT grey;
60 
61  TRACE("pout %p, pc %p, s %f\n", pout, pc, s);
62 
63  grey = pc->r * 0.2125f + pc->g * 0.7154f + pc->b * 0.0721f;
64  pout->r = grey + s * (pc->r - grey);
65  pout->g = grey + s * (pc->g - grey);
66  pout->b = grey + s * (pc->b - grey);
67  pout->a = pc->a;
68  return pout;
69 }
FLOAT g
Definition: d3dx9math.h:262
FLOAT a
Definition: d3dx9math.h:262
FLOAT r
Definition: d3dx9math.h:262
#define TRACE(s)
Definition: solgame.cpp:4
GLdouble s
Definition: gl.h:2039
FLOAT b
Definition: d3dx9math.h:262
float FLOAT
Definition: typedefs.h:69

Referenced by D3DXColorTest().

◆ D3DXCreateMatrixStack()

HRESULT WINAPI D3DXCreateMatrixStack ( DWORD  flags,
ID3DXMatrixStack **  stack 
)

Definition at line 1167 of file math.c.

1168 {
1169  struct ID3DXMatrixStackImpl *object;
1170 
1171  TRACE("flags %#x, stack %p.\n", flags, stack);
1172 
1173  if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
1174  {
1175  *stack = NULL;
1176  return E_OUTOFMEMORY;
1177  }
1178  object->ID3DXMatrixStack_iface.lpVtbl = &ID3DXMatrixStack_Vtbl;
1179  object->ref = 1;
1180 
1181  if (!(object->stack = HeapAlloc(GetProcessHeap(), 0, INITIAL_STACK_SIZE * sizeof(*object->stack))))
1182  {
1183  HeapFree(GetProcessHeap(), 0, object);
1184  *stack = NULL;
1185  return E_OUTOFMEMORY;
1186  }
1187 
1188  object->current = 0;
1189  object->stack_size = INITIAL_STACK_SIZE;
1190  D3DXMatrixIdentity(&object->stack[0]);
1191 
1192  TRACE("Created matrix stack %p.\n", object);
1193 
1194  *stack = &object->ID3DXMatrixStack_iface;
1195  return D3D_OK;
1196 }
coclass MSXML2::XSLTemplate40 object
static const unsigned int INITIAL_STACK_SIZE
Definition: math.c:42
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: _stack.h:47
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLbitfield flags
Definition: glext.h:7161
#define D3D_OK
Definition: d3d.h:106
static const ID3DXMatrixStackVtbl ID3DXMatrixStack_Vtbl
Definition: math.c:1145
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by test_matrix_stack().

◆ D3DXFloat16To32Array()

FLOAT* WINAPI D3DXFloat16To32Array ( FLOAT pout,
const D3DXFLOAT16 pin,
UINT  n 
)

Definition at line 2217 of file math.c.

2218 {
2219  unsigned int i;
2220 
2221  TRACE("pout %p, pin %p, n %u\n", pout, pin, n);
2222 
2223  for (i = 0; i < n; ++i)
2224  {
2225  pout[i] = float_16_to_32(pin[i].value);
2226  }
2227 
2228  return pout;
2229 }
GLdouble n
Definition: glext.h:7729
float float_16_to_32(const unsigned short in)
Definition: math.c:2199
Definition: regsvr.c:103
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by convert_component(), test_D3DXFillTexture(), test_D3DXFloat_Array(), weld_float16_2(), and weld_float16_4().

◆ D3DXFloat32To16Array()

D3DXFLOAT16* WINAPI D3DXFloat32To16Array ( D3DXFLOAT16 pout,
const FLOAT pin,
UINT  n 
)

Definition at line 2183 of file math.c.

2184 {
2185  unsigned int i;
2186 
2187  TRACE("pout %p, pin %p, n %u\n", pout, pin, n);
2188 
2189  for (i = 0; i < n; ++i)
2190  {
2191  pout[i].value = float_32_to_16(pin[i]);
2192  }
2193 
2194  return pout;
2195 }
WORD value
Definition: d3dx9math.h:277
unsigned short float_32_to_16(const float in)
Definition: math.c:2098
GLdouble n
Definition: glext.h:7729
Definition: regsvr.c:103
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by convert_float4(), and test_D3DXFloat_Array().

◆ D3DXFresnelTerm()

FLOAT WINAPI D3DXFresnelTerm ( FLOAT  costheta,
FLOAT  refractionindex 
)

Definition at line 73 of file math.c.

74 {
75  FLOAT a, d, g, result;
76 
77  TRACE("costheta %f, refractionindex %f\n", costheta, refractionindex);
78 
79  g = sqrtf(refractionindex * refractionindex + costheta * costheta - 1.0f);
80  a = g + costheta;
81  d = g - costheta;
82  result = (costheta * a - 1.0f) * (costheta * a - 1.0f) / ((costheta * d + 1.0f) * (costheta * d + 1.0f)) + 1.0f;
83  result *= 0.5f * d * d / (a * a);
84 
85  return result;
86 }
GLuint64EXT * result
Definition: glext.h:11304
#define a
Definition: ke_i.h:78
GLboolean GLboolean g
Definition: glext.h:6204
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
#define sqrtf(x)
Definition: mymath.h:59
float FLOAT
Definition: typedefs.h:69
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define d
Definition: ke_i.h:81

Referenced by D3DXFresnelTest().

◆ D3DXMatrixAffineTransformation()

D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation ( D3DXMATRIX pout,
FLOAT  scaling,
const D3DXVECTOR3 rotationcenter,
const D3DXQUATERNION rotation,
const D3DXVECTOR3 translation 
)

Definition at line 90 of file math.c.

92 {
93  TRACE("out %p, scaling %f, rotationcenter %p, rotation %p, translation %p\n",
94  out, scaling, rotationcenter, rotation, translation);
95 
96  D3DXMatrixIdentity(out);
97 
98  if (rotation)
99  {
100  FLOAT temp00, temp01, temp02, temp10, temp11, temp12, temp20, temp21, temp22;
101 
102  temp00 = 1.0f - 2.0f * (rotation->y * rotation->y + rotation->z * rotation->z);
103  temp01 = 2.0f * (rotation->x * rotation->y + rotation->z * rotation->w);
104  temp02 = 2.0f * (rotation->x * rotation->z - rotation->y * rotation->w);
105  temp10 = 2.0f * (rotation->x * rotation->y - rotation->z * rotation->w);
106  temp11 = 1.0f - 2.0f * (rotation->x * rotation->x + rotation->z * rotation->z);
107  temp12 = 2.0f * (rotation->y * rotation->z + rotation->x * rotation->w);
108  temp20 = 2.0f * (rotation->x * rotation->z + rotation->y * rotation->w);
109  temp21 = 2.0f * (rotation->y * rotation->z - rotation->x * rotation->w);
110  temp22 = 1.0f - 2.0f * (rotation->x * rotation->x + rotation->y * rotation->y);
111 
112  out->u.m[0][0] = scaling * temp00;
113  out->u.m[0][1] = scaling * temp01;
114  out->u.m[0][2] = scaling * temp02;
115  out->u.m[1][0] = scaling * temp10;
116  out->u.m[1][1] = scaling * temp11;
117  out->u.m[1][2] = scaling * temp12;
118  out->u.m[2][0] = scaling * temp20;
119  out->u.m[2][1] = scaling * temp21;
120  out->u.m[2][2] = scaling * temp22;
121 
122  if (rotationcenter)
123  {
124  out->u.m[3][0] = rotationcenter->x * (1.0f - temp00) - rotationcenter->y * temp10
125  - rotationcenter->z * temp20;
126  out->u.m[3][1] = rotationcenter->y * (1.0f - temp11) - rotationcenter->x * temp01
127  - rotationcenter->z * temp21;
128  out->u.m[3][2] = rotationcenter->z * (1.0f - temp22) - rotationcenter->x * temp02
129  - rotationcenter->y * temp12;
130  }
131  }
132  else
133  {
134  out->u.m[0][0] = scaling;
135  out->u.m[1][1] = scaling;
136  out->u.m[2][2] = scaling;
137  }
138 
139  if (translation)
140  {
141  out->u.m[3][0] += translation->x;
142  out->u.m[3][1] += translation->y;
143  out->u.m[3][2] += translation->z;
144  }
145 
146  return out;
147 }
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
float FLOAT
Definition: typedefs.h:69

Referenced by D3DXMatrixTest().

◆ D3DXMatrixAffineTransformation2D()

D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation2D ( D3DXMATRIX pout,
FLOAT  scaling,
const D3DXVECTOR2 protationcenter,
FLOAT  rotation,
const D3DXVECTOR2 ptranslation 
)

Definition at line 149 of file math.c.

151 {
152  FLOAT tmp1, tmp2, s;
153 
154  TRACE("out %p, scaling %f, rotationcenter %p, rotation %f, translation %p\n",
155  out, scaling, rotationcenter, rotation, translation);
156 
157  s = sinf(rotation / 2.0f);
158  tmp1 = 1.0f - 2.0f * s * s;
159  tmp2 = 2.0f * s * cosf(rotation / 2.0f);
160 
161  D3DXMatrixIdentity(out);
162  out->u.m[0][0] = scaling * tmp1;
163  out->u.m[0][1] = scaling * tmp2;
164  out->u.m[1][0] = -scaling * tmp2;
165  out->u.m[1][1] = scaling * tmp1;
166 
167  if (rotationcenter)
168  {
169  FLOAT x, y;
170 
171  x = rotationcenter->x;
172  y = rotationcenter->y;
173 
174  out->u.m[3][0] = y * tmp2 - x * tmp1 + x;
175  out->u.m[3][1] = -x * tmp2 - y * tmp1 + y;
176  }
177 
178  if (translation)
179  {
180  out->u.m[3][0] += translation->x;
181  out->u.m[3][1] += translation->y;
182  }
183 
184  return out;
185 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define cosf
Definition: cosf.c:6
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
float FLOAT
Definition: typedefs.h:69
#define sinf
Definition: sinf.c:6

Referenced by test_Matrix_AffineTransformation2D().

◆ D3DXMatrixDecompose()

HRESULT WINAPI D3DXMatrixDecompose ( D3DXVECTOR3 poutscale,
D3DXQUATERNION poutrotation,
D3DXVECTOR3 pouttranslation,
const D3DXMATRIX pm 
)

Definition at line 187 of file math.c.

188 {
191 
192  TRACE("poutscale %p, poutrotation %p, pouttranslation %p, pm %p\n", poutscale, poutrotation, pouttranslation, pm);
193 
194  /*Compute the scaling part.*/
195  vec.x=pm->u.m[0][0];
196  vec.y=pm->u.m[0][1];
197  vec.z=pm->u.m[0][2];
198  poutscale->x=D3DXVec3Length(&vec);
199 
200  vec.x=pm->u.m[1][0];
201  vec.y=pm->u.m[1][1];
202  vec.z=pm->u.m[1][2];
203  poutscale->y=D3DXVec3Length(&vec);
204 
205  vec.x=pm->u.m[2][0];
206  vec.y=pm->u.m[2][1];
207  vec.z=pm->u.m[2][2];
208  poutscale->z=D3DXVec3Length(&vec);
209 
210  /*Compute the translation part.*/
211  pouttranslation->x=pm->u.m[3][0];
212  pouttranslation->y=pm->u.m[3][1];
213  pouttranslation->z=pm->u.m[3][2];
214 
215  /*Let's calculate the rotation now*/
216  if ( (poutscale->x == 0.0f) || (poutscale->y == 0.0f) || (poutscale->z == 0.0f) ) return D3DERR_INVALIDCALL;
217 
218  normalized.u.m[0][0]=pm->u.m[0][0]/poutscale->x;
219  normalized.u.m[0][1]=pm->u.m[0][1]/poutscale->x;
220  normalized.u.m[0][2]=pm->u.m[0][2]/poutscale->x;
221  normalized.u.m[1][0]=pm->u.m[1][0]/poutscale->y;
222  normalized.u.m[1][1]=pm->u.m[1][1]/poutscale->y;
223  normalized.u.m[1][2]=pm->u.m[1][2]/poutscale->y;
224  normalized.u.m[2][0]=pm->u.m[2][0]/poutscale->z;
225  normalized.u.m[2][1]=pm->u.m[2][1]/poutscale->z;
226  normalized.u.m[2][2]=pm->u.m[2][2]/poutscale->z;
227 
229  return S_OK;
230 }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
static LPMONITOREX pm
Definition: localmon.c:45
#define D3DERR_INVALIDCALL
#define TRACE(s)
Definition: solgame.cpp:4
D3DXQUATERNION *WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *out, const D3DXMATRIX *m)
Definition: math.c:1419
FT_Vector * vec
Definition: ftbbox.c:448
#define S_OK
Definition: intsafe.h:51
GLint GLenum GLboolean normalized
Definition: glext.h:6117

Referenced by test_Matrix_Decompose().

◆ D3DXMatrixDeterminant()

FLOAT WINAPI D3DXMatrixDeterminant ( const D3DXMATRIX pm)

Definition at line 232 of file math.c.

233 {
234  FLOAT t[3], v[4];
235 
236  TRACE("pm %p\n", pm);
237 
238  t[0] = pm->u.m[2][2] * pm->u.m[3][3] - pm->u.m[2][3] * pm->u.m[3][2];
239  t[1] = pm->u.m[1][2] * pm->u.m[3][3] - pm->u.m[1][3] * pm->u.m[3][2];
240  t[2] = pm->u.m[1][2] * pm->u.m[2][3] - pm->u.m[1][3] * pm->u.m[2][2];
241  v[0] = pm->u.m[1][1] * t[0] - pm->u.m[2][1] * t[1] + pm->u.m[3][1] * t[2];
242  v[1] = -pm->u.m[1][0] * t[0] + pm->u.m[2][0] * t[1] - pm->u.m[3][0] * t[2];
243 
244  t[0] = pm->u.m[1][0] * pm->u.m[2][1] - pm->u.m[2][0] * pm->u.m[1][1];
245  t[1] = pm->u.m[1][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[1][1];
246  t[2] = pm->u.m[2][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[2][1];
247  v[2] = pm->u.m[3][3] * t[0] - pm->u.m[2][3] * t[1] + pm->u.m[1][3] * t[2];
248  v[3] = -pm->u.m[3][2] * t[0] + pm->u.m[2][2] * t[1] - pm->u.m[1][2] * t[2];
249 
250  return pm->u.m[0][0] * v[0] + pm->u.m[0][1] * v[1] +
251  pm->u.m[0][2] * v[2] + pm->u.m[0][3] * v[3];
252 }
static LPMONITOREX pm
Definition: localmon.c:45
GLdouble GLdouble t
Definition: gl.h:2047
#define TRACE(s)
Definition: solgame.cpp:4
const GLdouble * v
Definition: gl.h:2040
float FLOAT
Definition: typedefs.h:69

Referenced by D3DXMatrixTest().

◆ D3DXMatrixInverse()

D3DXMATRIX* WINAPI D3DXMatrixInverse ( D3DXMATRIX pout,
FLOAT pdeterminant,
const D3DXMATRIX pm 
)

Definition at line 254 of file math.c.

255 {
256  FLOAT det, t[3], v[16];
257  UINT i, j;
258 
259  TRACE("pout %p, pdeterminant %p, pm %p\n", pout, pdeterminant, pm);
260 
261  t[0] = pm->u.m[2][2] * pm->u.m[3][3] - pm->u.m[2][3] * pm->u.m[3][2];
262  t[1] = pm->u.m[1][2] * pm->u.m[3][3] - pm->u.m[1][3] * pm->u.m[3][2];
263  t[2] = pm->u.m[1][2] * pm->u.m[2][3] - pm->u.m[1][3] * pm->u.m[2][2];
264  v[0] = pm->u.m[1][1] * t[0] - pm->u.m[2][1] * t[1] + pm->u.m[3][1] * t[2];
265  v[4] = -pm->u.m[1][0] * t[0] + pm->u.m[2][0] * t[1] - pm->u.m[3][0] * t[2];
266 
267  t[0] = pm->u.m[1][0] * pm->u.m[2][1] - pm->u.m[2][0] * pm->u.m[1][1];
268  t[1] = pm->u.m[1][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[1][1];
269  t[2] = pm->u.m[2][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[2][1];
270  v[8] = pm->u.m[3][3] * t[0] - pm->u.m[2][3] * t[1] + pm->u.m[1][3] * t[2];
271  v[12] = -pm->u.m[3][2] * t[0] + pm->u.m[2][2] * t[1] - pm->u.m[1][2] * t[2];
272 
273  det = pm->u.m[0][0] * v[0] + pm->u.m[0][1] * v[4] +
274  pm->u.m[0][2] * v[8] + pm->u.m[0][3] * v[12];
275  if (det == 0.0f)
276  return NULL;
277  if (pdeterminant)
278  *pdeterminant = det;
279 
280  t[0] = pm->u.m[2][2] * pm->u.m[3][3] - pm->u.m[2][3] * pm->u.m[3][2];
281  t[1] = pm->u.m[0][2] * pm->u.m[3][3] - pm->u.m[0][3] * pm->u.m[3][2];
282  t[2] = pm->u.m[0][2] * pm->u.m[2][3] - pm->u.m[0][3] * pm->u.m[2][2];
283  v[1] = -pm->u.m[0][1] * t[0] + pm->u.m[2][1] * t[1] - pm->u.m[3][1] * t[2];
284  v[5] = pm->u.m[0][0] * t[0] - pm->u.m[2][0] * t[1] + pm->u.m[3][0] * t[2];
285 
286  t[0] = pm->u.m[0][0] * pm->u.m[2][1] - pm->u.m[2][0] * pm->u.m[0][1];
287  t[1] = pm->u.m[3][0] * pm->u.m[0][1] - pm->u.m[0][0] * pm->u.m[3][1];
288  t[2] = pm->u.m[2][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[2][1];
289  v[9] = -pm->u.m[3][3] * t[0] - pm->u.m[2][3] * t[1]- pm->u.m[0][3] * t[2];
290  v[13] = pm->u.m[3][2] * t[0] + pm->u.m[2][2] * t[1] + pm->u.m[0][2] * t[2];
291 
292  t[0] = pm->u.m[1][2] * pm->u.m[3][3] - pm->u.m[1][3] * pm->u.m[3][2];
293  t[1] = pm->u.m[0][2] * pm->u.m[3][3] - pm->u.m[0][3] * pm->u.m[3][2];
294  t[2] = pm->u.m[0][2] * pm->u.m[1][3] - pm->u.m[0][3] * pm->u.m[1][2];
295  v[2] = pm->u.m[0][1] * t[0] - pm->u.m[1][1] * t[1] + pm->u.m[3][1] * t[2];
296  v[6] = -pm->u.m[0][0] * t[0] + pm->u.m[1][0] * t[1] - pm->u.m[3][0] * t[2];
297 
298  t[0] = pm->u.m[0][0] * pm->u.m[1][1] - pm->u.m[1][0] * pm->u.m[0][1];
299  t[1] = pm->u.m[3][0] * pm->u.m[0][1] - pm->u.m[0][0] * pm->u.m[3][1];
300  t[2] = pm->u.m[1][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[1][1];
301  v[10] = pm->u.m[3][3] * t[0] + pm->u.m[1][3] * t[1] + pm->u.m[0][3] * t[2];
302  v[14] = -pm->u.m[3][2] * t[0] - pm->u.m[1][2] * t[1] - pm->u.m[0][2] * t[2];
303 
304  t[0] = pm->u.m[1][2] * pm->u.m[2][3] - pm->u.m[1][3] * pm->u.m[2][2];
305  t[1] = pm->u.m[0][2] * pm->u.m[2][3] - pm->u.m[0][3] * pm->u.m[2][2];
306  t[2] = pm->u.m[0][2] * pm->u.m[1][3] - pm->u.m[0][3] * pm->u.m[1][2];
307  v[3] = -pm->u.m[0][1] * t[0] + pm->u.m[1][1] * t[1] - pm->u.m[2][1] * t[2];
308  v[7] = pm->u.m[0][0] * t[0] - pm->u.m[1][0] * t[1] + pm->u.m[2][0] * t[2];
309 
310  v[11] = -pm->u.m[0][0] * (pm->u.m[1][1] * pm->u.m[2][3] - pm->u.m[1][3] * pm->u.m[2][1]) +
311  pm->u.m[1][0] * (pm->u.m[0][1] * pm->u.m[2][3] - pm->u.m[0][3] * pm->u.m[2][1]) -
312  pm->u.m[2][0] * (pm->u.m[0][1] * pm->u.m[1][3] - pm->u.m[0][3] * pm->u.m[1][1]);
313 
314  v[15] = pm->u.m[0][0] * (pm->u.m[1][1] * pm->u.m[2][2] - pm->u.m[1][2] * pm->u.m[2][1]) -
315  pm->u.m[1][0] * (pm->u.m[0][1] * pm->u.m[2][2] - pm->u.m[0][2] * pm->u.m[2][1]) +
316  pm->u.m[2][0] * (pm->u.m[0][1] * pm->u.m[1][2] - pm->u.m[0][2] * pm->u.m[1][1]);
317 
318  det = 1.0f / det;
319 
320  for (i = 0; i < 4; i++)
321  for (j = 0; j < 4; j++)
322  pout->u.m[i][j] = v[4 * i + j] * det;
323 
324  return pout;
325 }
static LPMONITOREX pm
Definition: localmon.c:45
GLdouble GLdouble t
Definition: gl.h:2047
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
const GLdouble * v
Definition: gl.h:2040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
float m[4][4]
Definition: d3d8types.h:1116
float FLOAT
Definition: typedefs.h:69

Referenced by d3dx9_skin_info_UpdateSkinnedMesh(), D3DXIntersectTri(), D3DXMatrixTest(), and D3DXVec3Unproject().

◆ D3DXMatrixLookAtLH()

D3DXMATRIX* WINAPI D3DXMatrixLookAtLH ( D3DXMATRIX pout,
const D3DXVECTOR3 peye,
const D3DXVECTOR3 pat,
const D3DXVECTOR3 pup 
)

Definition at line 327 of file math.c.

329 {
330  D3DXVECTOR3 right, upn, vec;
331 
332  TRACE("out %p, eye %p, at %p, up %p\n", out, eye, at, up);
333 
334  D3DXVec3Subtract(&vec, at, eye);
336  D3DXVec3Cross(&right, up, &vec);
337  D3DXVec3Cross(&upn, &vec, &right);
339  D3DXVec3Normalize(&upn, &upn);
340  out->u.m[0][0] = right.x;
341  out->u.m[1][0] = right.y;
342  out->u.m[2][0] = right.z;
343  out->u.m[3][0] = -D3DXVec3Dot(&right, eye);
344  out->u.m[0][1] = upn.x;
345  out->u.m[1][1] = upn.y;
346  out->u.m[2][1] = upn.z;
347  out->u.m[3][1] = -D3DXVec3Dot(&upn, eye);
348  out->u.m[0][2] = vec.x;
349  out->u.m[1][2] = vec.y;
350  out->u.m[2][2] = vec.z;
351  out->u.m[3][2] = -D3DXVec3Dot(&vec, eye);
352  out->u.m[0][3] = 0.0f;
353  out->u.m[1][3] = 0.0f;
354  out->u.m[2][3] = 0.0f;
355  out->u.m[3][3] = 1.0f;
356 
357  return out;
358 }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
#define up(mutex)
Definition: glue.h:30
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLdouble GLdouble right
Definition: glext.h:10859
FT_Vector * vec
Definition: ftbbox.c:448
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1801

Referenced by D3DXMatrixTest().

◆ D3DXMatrixLookAtRH()

D3DXMATRIX* WINAPI D3DXMatrixLookAtRH ( D3DXMATRIX pout,
const D3DXVECTOR3 peye,
const D3DXVECTOR3 pat,
const D3DXVECTOR3 pup 
)

Definition at line 360 of file math.c.

362 {
363  D3DXVECTOR3 right, upn, vec;
364 
365  TRACE("out %p, eye %p, at %p, up %p\n", out, eye, at, up);
366 
367  D3DXVec3Subtract(&vec, at, eye);
369  D3DXVec3Cross(&right, up, &vec);
370  D3DXVec3Cross(&upn, &vec, &right);
372  D3DXVec3Normalize(&upn, &upn);
373  out->u.m[0][0] = -right.x;
374  out->u.m[1][0] = -right.y;
375  out->u.m[2][0] = -right.z;
376  out->u.m[3][0] = D3DXVec3Dot(&right, eye);
377  out->u.m[0][1] = upn.x;
378  out->u.m[1][1] = upn.y;
379  out->u.m[2][1] = upn.z;
380  out->u.m[3][1] = -D3DXVec3Dot(&upn, eye);
381  out->u.m[0][2] = -vec.x;
382  out->u.m[1][2] = -vec.y;
383  out->u.m[2][2] = -vec.z;
384  out->u.m[3][2] = D3DXVec3Dot(&vec, eye);
385  out->u.m[0][3] = 0.0f;
386  out->u.m[1][3] = 0.0f;
387  out->u.m[2][3] = 0.0f;
388  out->u.m[3][3] = 1.0f;
389 
390  return out;
391 }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
#define up(mutex)
Definition: glue.h:30
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLdouble GLdouble right
Definition: glext.h:10859
FT_Vector * vec
Definition: ftbbox.c:448
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1801

Referenced by D3DXMatrixTest().

◆ D3DXMatrixMultiply()

D3DXMATRIX* WINAPI D3DXMatrixMultiply ( D3DXMATRIX pout,
const D3DXMATRIX pm1,
const D3DXMATRIX pm2 
)

Definition at line 393 of file math.c.

394 {
395  D3DXMATRIX out;
396  int i,j;
397 
398  TRACE("pout %p, pm1 %p, pm2 %p\n", pout, pm1, pm2);
399 
400  for (i=0; i<4; i++)
401  {
402  for (j=0; j<4; j++)
403  {
404  out.u.m[i][j] = pm1->u.m[i][0] * pm2->u.m[0][j] + pm1->u.m[i][1] * pm2->u.m[1][j] + pm1->u.m[i][2] * pm2->u.m[2][j] + pm1->u.m[i][3] * pm2->u.m[3][j];
405  }
406  }
407 
408  *pout = out;
409  return pout;
410 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
float m[4][4]
Definition: d3d8types.h:1116
static LPMONITOR2 pm2
Definition: localmon.c:46

Referenced by d3dx9_skin_info_UpdateSkinnedMesh(), D3DXMatrixTest(), D3DXMatrixTransformation(), D3DXVec3Project(), D3DXVec3Unproject(), D3DXVector3Test(), ID3DXMatrixStackImpl_MultMatrix(), ID3DXMatrixStackImpl_MultMatrixLocal(), ID3DXMatrixStackImpl_RotateAxis(), ID3DXMatrixStackImpl_RotateAxisLocal(), ID3DXMatrixStackImpl_RotateYawPitchRoll(), ID3DXMatrixStackImpl_RotateYawPitchRollLocal(), ID3DXMatrixStackImpl_Scale(), ID3DXMatrixStackImpl_ScaleLocal(), ID3DXMatrixStackImpl_Translate(), ID3DXMatrixStackImpl_TranslateLocal(), and parse_frame().

◆ D3DXMatrixMultiplyTranspose()

D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose ( D3DXMATRIX pout,
const D3DXMATRIX pm1,
const D3DXMATRIX pm2 
)

Definition at line 412 of file math.c.

413 {
415  int i, j;
416 
417  TRACE("pout %p, pm1 %p, pm2 %p\n", pout, pm1, pm2);
418 
419  for (i = 0; i < 4; i++)
420  for (j = 0; j < 4; j++)
421  temp.u.m[j][i] = pm1->u.m[i][0] * pm2->u.m[0][j] + pm1->u.m[i][1] * pm2->u.m[1][j] + pm1->u.m[i][2] * pm2->u.m[2][j] + pm1->u.m[i][3] * pm2->u.m[3][j];
422 
423  *pout = temp;
424  return pout;
425 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static calc_node_t temp
Definition: rpn_ieee.c:38
float m[4][4]
Definition: d3d8types.h:1116
static LPMONITOR2 pm2
Definition: localmon.c:46

Referenced by D3DXMatrixTest().

◆ D3DXMatrixOrthoLH()

D3DXMATRIX* WINAPI D3DXMatrixOrthoLH ( D3DXMATRIX pout,
FLOAT  w,
FLOAT  h,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 427 of file math.c.

428 {
429  TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
430 
431  D3DXMatrixIdentity(pout);
432  pout->u.m[0][0] = 2.0f / w;
433  pout->u.m[1][1] = 2.0f / h;
434  pout->u.m[2][2] = 1.0f / (zf - zn);
435  pout->u.m[3][2] = zn / (zn - zf);
436  return pout;
437 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest(), and draw_quad_with_shader9().

◆ D3DXMatrixOrthoOffCenterLH()

D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH ( D3DXMATRIX pout,
FLOAT  l,
FLOAT  r,
FLOAT  b,
FLOAT  t,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 439 of file math.c.

440 {
441  TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
442 
443  D3DXMatrixIdentity(pout);
444  pout->u.m[0][0] = 2.0f / (r - l);
445  pout->u.m[1][1] = 2.0f / (t - b);
446  pout->u.m[2][2] = 1.0f / (zf -zn);
447  pout->u.m[3][0] = -1.0f -2.0f *l / (r - l);
448  pout->u.m[3][1] = 1.0f + 2.0f * t / (b - t);
449  pout->u.m[3][2] = zn / (zn -zf);
450  return pout;
451 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
#define b
Definition: ke_i.h:79
r l[0]
Definition: byte_order.h:167
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by d3dx9_line_Begin(), D3DXMatrixTest(), set_states(), and test_ID3DXSprite().

◆ D3DXMatrixOrthoOffCenterRH()

D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH ( D3DXMATRIX pout,
FLOAT  l,
FLOAT  r,
FLOAT  b,
FLOAT  t,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 453 of file math.c.

454 {
455  TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
456 
457  D3DXMatrixIdentity(pout);
458  pout->u.m[0][0] = 2.0f / (r - l);
459  pout->u.m[1][1] = 2.0f / (t - b);
460  pout->u.m[2][2] = 1.0f / (zn -zf);
461  pout->u.m[3][0] = -1.0f -2.0f *l / (r - l);
462  pout->u.m[3][1] = 1.0f + 2.0f * t / (b - t);
463  pout->u.m[3][2] = zn / (zn -zf);
464  return pout;
465 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
#define b
Definition: ke_i.h:79
r l[0]
Definition: byte_order.h:167
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest().

◆ D3DXMatrixOrthoRH()

D3DXMATRIX* WINAPI D3DXMatrixOrthoRH ( D3DXMATRIX pout,
FLOAT  w,
FLOAT  h,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 467 of file math.c.

468 {
469  TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
470 
471  D3DXMatrixIdentity(pout);
472  pout->u.m[0][0] = 2.0f / w;
473  pout->u.m[1][1] = 2.0f / h;
474  pout->u.m[2][2] = 1.0f / (zn - zf);
475  pout->u.m[3][2] = zn / (zn - zf);
476  return pout;
477 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveFovLH()

D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH ( D3DXMATRIX pout,
FLOAT  fovy,
FLOAT  aspect,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 479 of file math.c.

480 {
481  TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
482 
483  D3DXMatrixIdentity(pout);
484  pout->u.m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f));
485  pout->u.m[1][1] = 1.0f / tanf(fovy/2.0f);
486  pout->u.m[2][2] = zf / (zf - zn);
487  pout->u.m[2][3] = 1.0f;
488  pout->u.m[3][2] = (zf * zn) / (zn - zf);
489  pout->u.m[3][3] = 0.0f;
490  return pout;
491 }
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
_Check_return_ __CRT_INLINE float tanf(_In_ float x)
Definition: math.h:220
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest(), D3DXVector3Test(), and test_D3DXVec_Array().

◆ D3DXMatrixPerspectiveFovRH()

D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH ( D3DXMATRIX pout,
FLOAT  fovy,
FLOAT  aspect,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 493 of file math.c.

494 {
495  TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
496 
497  D3DXMatrixIdentity(pout);
498  pout->u.m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f));
499  pout->u.m[1][1] = 1.0f / tanf(fovy/2.0f);
500  pout->u.m[2][2] = zf / (zn - zf);
501  pout->u.m[2][3] = -1.0f;
502  pout->u.m[3][2] = (zf * zn) / (zn - zf);
503  pout->u.m[3][3] = 0.0f;
504  return pout;
505 }
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
_Check_return_ __CRT_INLINE float tanf(_In_ float x)
Definition: math.h:220
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveLH()

D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH ( D3DXMATRIX pout,
FLOAT  w,
FLOAT  h,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 507 of file math.c.

508 {
509  TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
510 
511  D3DXMatrixIdentity(pout);
512  pout->u.m[0][0] = 2.0f * zn / w;
513  pout->u.m[1][1] = 2.0f * zn / h;
514  pout->u.m[2][2] = zf / (zf - zn);
515  pout->u.m[3][2] = (zn * zf) / (zn - zf);
516  pout->u.m[2][3] = 1.0f;
517  pout->u.m[3][3] = 0.0f;
518  return pout;
519 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveOffCenterLH()

D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH ( D3DXMATRIX pout,
FLOAT  l,
FLOAT  r,
FLOAT  b,
FLOAT  t,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 521 of file math.c.

522 {
523  TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
524 
525  D3DXMatrixIdentity(pout);
526  pout->u.m[0][0] = 2.0f * zn / (r - l);
527  pout->u.m[1][1] = -2.0f * zn / (b - t);
528  pout->u.m[2][0] = -1.0f - 2.0f * l / (r - l);
529  pout->u.m[2][1] = 1.0f + 2.0f * t / (b - t);
530  pout->u.m[2][2] = - zf / (zn - zf);
531  pout->u.m[3][2] = (zn * zf) / (zn -zf);
532  pout->u.m[2][3] = 1.0f;
533  pout->u.m[3][3] = 0.0f;
534  return pout;
535 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
r l[0]
Definition: byte_order.h:167
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveOffCenterRH()

D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH ( D3DXMATRIX pout,
FLOAT  l,
FLOAT  r,
FLOAT  b,
FLOAT  t,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 537 of file math.c.

538 {
539  TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
540 
541  D3DXMatrixIdentity(pout);
542  pout->u.m[0][0] = 2.0f * zn / (r - l);
543  pout->u.m[1][1] = -2.0f * zn / (b - t);
544  pout->u.m[2][0] = 1.0f + 2.0f * l / (r - l);
545  pout->u.m[2][1] = -1.0f -2.0f * t / (b - t);
546  pout->u.m[2][2] = zf / (zn - zf);
547  pout->u.m[3][2] = (zn * zf) / (zn -zf);
548  pout->u.m[2][3] = -1.0f;
549  pout->u.m[3][3] = 0.0f;
550  return pout;
551 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
r l[0]
Definition: byte_order.h:167
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveRH()

D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH ( D3DXMATRIX pout,
FLOAT  w,
FLOAT  h,
FLOAT  zn,
FLOAT  zf 
)

Definition at line 553 of file math.c.

554 {
555  TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
556 
557  D3DXMatrixIdentity(pout);
558  pout->u.m[0][0] = 2.0f * zn / w;
559  pout->u.m[1][1] = 2.0f * zn / h;
560  pout->u.m[2][2] = zf / (zn - zf);
561  pout->u.m[3][2] = (zn * zf) / (zn - zf);
562  pout->u.m[2][3] = -1.0f;
563  pout->u.m[3][3] = 0.0f;
564  return pout;
565 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest().

◆ D3DXMatrixReflect()

D3DXMATRIX* WINAPI D3DXMatrixReflect ( D3DXMATRIX pout,
const D3DXPLANE pplane 
)

Definition at line 567 of file math.c.

568 {
569  D3DXPLANE Nplane;
570 
571  TRACE("pout %p, pplane %p\n", pout, pplane);
572 
573  D3DXPlaneNormalize(&Nplane, pplane);
574  D3DXMatrixIdentity(pout);
575  pout->u.m[0][0] = 1.0f - 2.0f * Nplane.a * Nplane.a;
576  pout->u.m[0][1] = -2.0f * Nplane.a * Nplane.b;
577  pout->u.m[0][2] = -2.0f * Nplane.a * Nplane.c;
578  pout->u.m[1][0] = -2.0f * Nplane.a * Nplane.b;
579  pout->u.m[1][1] = 1.0f - 2.0f * Nplane.b * Nplane.b;
580  pout->u.m[1][2] = -2.0f * Nplane.b * Nplane.c;
581  pout->u.m[2][0] = -2.0f * Nplane.c * Nplane.a;
582  pout->u.m[2][1] = -2.0f * Nplane.c * Nplane.b;
583  pout->u.m[2][2] = 1.0f - 2.0f * Nplane.c * Nplane.c;
584  pout->u.m[3][0] = -2.0f * Nplane.d * Nplane.a;
585  pout->u.m[3][1] = -2.0f * Nplane.d * Nplane.b;
586  pout->u.m[3][2] = -2.0f * Nplane.d * Nplane.c;
587  return pout;
588 }
FLOAT d
Definition: d3dx9math.h:221
#define TRACE(s)
Definition: solgame.cpp:4
FLOAT c
Definition: d3dx9math.h:221
FLOAT b
Definition: d3dx9math.h:221
float m[4][4]
Definition: d3d8types.h:1116
D3DXPLANE *WINAPI D3DXPlaneNormalize(D3DXPLANE *out, const D3DXPLANE *p)
Definition: math.c:1249
FLOAT a
Definition: d3dx9math.h:221

Referenced by D3DXMatrixTest().

◆ D3DXMatrixRotationAxis()

D3DXMATRIX* WINAPI D3DXMatrixRotationAxis ( D3DXMATRIX pout,
const D3DXVECTOR3 pv,
FLOAT  angle 
)

Definition at line 590 of file math.c.

591 {
592  D3DXVECTOR3 nv;
593  FLOAT sangle, cangle, cdiff;
594 
595  TRACE("out %p, v %p, angle %f\n", out, v, angle);
596 
597  D3DXVec3Normalize(&nv, v);
598  sangle = sinf(angle);
599  cangle = cosf(angle);
600  cdiff = 1.0f - cangle;
601 
602  out->u.m[0][0] = cdiff * nv.x * nv.x + cangle;
603  out->u.m[1][0] = cdiff * nv.x * nv.y - sangle * nv.z;
604  out->u.m[2][0] = cdiff * nv.x * nv.z + sangle * nv.y;
605  out->u.m[3][0] = 0.0f;
606  out->u.m[0][1] = cdiff * nv.y * nv.x + sangle * nv.z;
607  out->u.m[1][1] = cdiff * nv.y * nv.y + cangle;
608  out->u.m[2][1] = cdiff * nv.y * nv.z - sangle * nv.x;
609  out->u.m[3][1] = 0.0f;
610  out->u.m[0][2] = cdiff * nv.z * nv.x - sangle * nv.y;
611  out->u.m[1][2] = cdiff * nv.z * nv.y + sangle * nv.x;
612  out->u.m[2][2] = cdiff * nv.z * nv.z + cangle;
613  out->u.m[3][2] = 0.0f;
614  out->u.m[0][3] = 0.0f;
615  out->u.m[1][3] = 0.0f;
616  out->u.m[2][3] = 0.0f;
617  out->u.m[3][3] = 1.0f;
618 
619  return out;
620 }
GLfloat angle
Definition: glext.h:10853
#define cosf
Definition: cosf.c:6
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
const GLdouble * v
Definition: gl.h:2040
float FLOAT
Definition: typedefs.h:69
#define sinf
Definition: sinf.c:6
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1801

Referenced by D3DXMatrixTest(), ID3DXMatrixStackImpl_RotateAxis(), and ID3DXMatrixStackImpl_RotateAxisLocal().

◆ D3DXMatrixRotationQuaternion()

D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion ( D3DXMATRIX pout,
const D3DXQUATERNION pq 
)

Definition at line 622 of file math.c.

623 {
624  TRACE("pout %p, pq %p\n", pout, pq);
625 
626  D3DXMatrixIdentity(pout);
627  pout->u.m[0][0] = 1.0f - 2.0f * (pq->y * pq->y + pq->z * pq->z);
628  pout->u.m[0][1] = 2.0f * (pq->x *pq->y + pq->z * pq->w);
629  pout->u.m[0][2] = 2.0f * (pq->x * pq->z - pq->y * pq->w);
630  pout->u.m[1][0] = 2.0f * (pq->x * pq->y - pq->z * pq->w);
631  pout->u.m[1][1] = 1.0f - 2.0f * (pq->x * pq->x + pq->z * pq->z);
632  pout->u.m[1][2] = 2.0f * (pq->y *pq->z + pq->x *pq->w);
633  pout->u.m[2][0] = 2.0f * (pq->x * pq->z + pq->y * pq->w);
634  pout->u.m[2][1] = 2.0f * (pq->y *pq->z - pq->x *pq->w);
635  pout->u.m[2][2] = 1.0f - 2.0f * (pq->x * pq->x + pq->y * pq->y);
636  return pout;
637 }
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest(), and D3DXMatrixTransformation().

◆ D3DXMatrixRotationX()

D3DXMATRIX* WINAPI D3DXMatrixRotationX ( D3DXMATRIX pout,
FLOAT  angle 
)

Definition at line 639 of file math.c.

640 {
641  TRACE("pout %p, angle %f\n", pout, angle);
642 
643  D3DXMatrixIdentity(pout);
644  pout->u.m[1][1] = cosf(angle);
645  pout->u.m[2][2] = cosf(angle);
646  pout->u.m[1][2] = sinf(angle);
647  pout->u.m[2][1] = -sinf(angle);
648  return pout;
649 }
GLfloat angle
Definition: glext.h:10853
#define cosf
Definition: cosf.c:6
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116
#define sinf
Definition: sinf.c:6

Referenced by D3DXMatrixTest(), and test_D3DXSHRotate().

◆ D3DXMatrixRotationY()

D3DXMATRIX* WINAPI D3DXMatrixRotationY ( D3DXMATRIX pout,
FLOAT  angle 
)

Definition at line 651 of file math.c.

652 {
653  TRACE("pout %p, angle %f\n", pout, angle);
654 
655  D3DXMatrixIdentity(pout);
656  pout->u.m[0][0] = cosf(angle);
657  pout->u.m[2][2] = cosf(angle);
658  pout->u.m[0][2] = -sinf(angle);
659  pout->u.m[2][0] = sinf(angle);
660  return pout;
661 }
GLfloat angle
Definition: glext.h:10853
#define cosf
Definition: cosf.c:6
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116
#define sinf
Definition: sinf.c:6

Referenced by D3DXMatrixTest().

◆ D3DXMatrixRotationYawPitchRoll()

D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll ( D3DXMATRIX pout,
FLOAT  yaw,
FLOAT  pitch,
FLOAT  roll 
)

Definition at line 663 of file math.c.

664 {
665  FLOAT sroll, croll, spitch, cpitch, syaw, cyaw;
666 
667  TRACE("out %p, yaw %f, pitch %f, roll %f\n", out, yaw, pitch, roll);
668 
669  sroll = sinf(roll);
670  croll = cosf(roll);
671  spitch = sinf(pitch);
672  cpitch = cosf(pitch);
673  syaw = sinf(yaw);
674  cyaw = cosf(yaw);
675 
676  out->u.m[0][0] = sroll * spitch * syaw + croll * cyaw;
677  out->u.m[0][1] = sroll * cpitch;
678  out->u.m[0][2] = sroll * spitch * cyaw - croll * syaw;
679  out->u.m[0][3] = 0.0f;
680  out->u.m[1][0] = croll * spitch * syaw - sroll * cyaw;
681  out->u.m[1][1] = croll * cpitch;
682  out->u.m[1][2] = croll * spitch * cyaw + sroll * syaw;
683  out->u.m[1][3] = 0.0f;
684  out->u.m[2][0] = cpitch * syaw;
685  out->u.m[2][1] = -spitch;
686  out->u.m[2][2] = cpitch * cyaw;
687  out->u.m[2][3] = 0.0f;
688  out->u.m[3][0] = 0.0f;
689  out->u.m[3][1] = 0.0f;
690  out->u.m[3][2] = 0.0f;
691  out->u.m[3][3] = 1.0f;
692 
693  return out;
694 }
#define cosf
Definition: cosf.c:6
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
float FLOAT
Definition: typedefs.h:69
#define sinf
Definition: sinf.c:6

Referenced by D3DXMatrixTest(), ID3DXMatrixStackImpl_RotateYawPitchRoll(), ID3DXMatrixStackImpl_RotateYawPitchRollLocal(), and test_D3DXSHRotate().

◆ D3DXMatrixRotationZ()

D3DXMATRIX* WINAPI D3DXMatrixRotationZ ( D3DXMATRIX pout,
FLOAT  angle 
)

Definition at line 696 of file math.c.

697 {
698  TRACE("pout %p, angle %f\n", pout, angle);
699 
700  D3DXMatrixIdentity(pout);
701  pout->u.m[0][0] = cosf(angle);
702  pout->u.m[1][1] = cosf(angle);
703  pout->u.m[0][1] = sinf(angle);
704  pout->u.m[1][0] = -sinf(angle);
705  return pout;
706 }
GLfloat angle
Definition: glext.h:10853
#define cosf
Definition: cosf.c:6
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116
#define sinf
Definition: sinf.c:6

Referenced by D3DXMatrixTest(), and test_D3DXSHRotate().

◆ D3DXMatrixScaling()

D3DXMATRIX* WINAPI D3DXMatrixScaling ( D3DXMATRIX pout,
FLOAT  sx,
FLOAT  sy,
FLOAT  sz 
)

Definition at line 708 of file math.c.

709 {
710  TRACE("pout %p, sx %f, sy %f, sz %f\n", pout, sx, sy, sz);
711 
712  D3DXMatrixIdentity(pout);
713  pout->u.m[0][0] = sx;
714  pout->u.m[1][1] = sy;
715  pout->u.m[2][2] = sz;
716  return pout;
717 }
#define TRACE(s)
Definition: solgame.cpp:4
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest(), D3DXMatrixTransformation(), ID3DXMatrixStackImpl_Scale(), and ID3DXMatrixStackImpl_ScaleLocal().

◆ D3DXMatrixShadow()

D3DXMATRIX* WINAPI D3DXMatrixShadow ( D3DXMATRIX pout,
const D3DXVECTOR4 plight,
const D3DXPLANE pPlane 
)

Definition at line 719 of file math.c.

720 {
721  D3DXPLANE Nplane;
722  FLOAT dot;
723 
724  TRACE("pout %p, plight %p, pplane %p\n", pout, plight, pplane);
725 
726  D3DXPlaneNormalize(&Nplane, pplane);
727  dot = D3DXPlaneDot(&Nplane, plight);
728  pout->u.m[0][0] = dot - Nplane.a * plight->x;
729  pout->u.m[0][1] = -Nplane.a * plight->y;
730  pout->u.m[0][2] = -Nplane.a * plight->z;
731  pout->u.m[0][3] = -Nplane.a * plight->w;
732  pout->u.m[1][0] = -Nplane.b * plight->x;
733  pout->u.m[1][1] = dot - Nplane.b * plight->y;
734  pout->u.m[1][2] = -Nplane.b * plight->z;
735  pout->u.m[1][3] = -Nplane.b * plight->w;
736  pout->u.m[2][0] = -Nplane.c * plight->x;
737  pout->u.m[2][1] = -Nplane.c * plight->y;
738  pout->u.m[2][2] = dot - Nplane.c * plight->z;
739  pout->u.m[2][3] = -Nplane.c * plight->w;
740  pout->u.m[3][0] = -Nplane.d * plight->x;
741  pout->u.m[3][1] = -Nplane.d * plight->y;
742  pout->u.m[3][2] = -Nplane.d * plight->z;
743  pout->u.m[3][3] = dot - Nplane.d * plight->w;
744  return pout;
745 }
FLOAT d
Definition: d3dx9math.h:221
#define TRACE(s)
Definition: solgame.cpp:4
FLOAT c
Definition: d3dx9math.h:221
FLOAT b
Definition: d3dx9math.h:221
float m[4][4]
Definition: d3d8types.h:1116
float FLOAT
Definition: typedefs.h:69
D3DXPLANE *WINAPI D3DXPlaneNormalize(D3DXPLANE *out, const D3DXPLANE *p)
Definition: math.c:1249
FLOAT a
Definition: d3dx9math.h:221

Referenced by D3DXMatrixTest().

◆ D3DXMatrixTransformation()

D3DXMATRIX* WINAPI D3DXMatrixTransformation ( D3DXMATRIX pout,
const D3DXVECTOR3 pscalingcenter,
const D3DXQUATERNION pscalingrotation,
const D3DXVECTOR3 pscaling,
const D3DXVECTOR3 protationcenter,
const D3DXQUATERNION protation,
const D3DXVECTOR3 ptranslation 
)

Definition at line 747 of file math.c.

751 {
752  static const D3DXVECTOR3 zero_vector;
753  D3DXMATRIX m1, msr1, ms, msr, msc, mrc1, mr, mrc, mt;
754  D3DXVECTOR3 sc, rc;
756 
757  TRACE("out %p, scaling_center %p, scaling_rotation %p, scaling %p, rotation_center %p,"
758  " rotation %p, translation %p.\n",
759  out, scaling_center, scaling_rotation, scaling, rotation_center, rotation, translation);
760 
761  if (scaling)
762  {
763  sc = scaling_center ? *scaling_center : zero_vector;
764  D3DXMatrixTranslation(&m1, -sc.x, -sc.y, -sc.z);
765  if (scaling_rotation)
766  {
767  q.x = -scaling_rotation->x;
768  q.y = -scaling_rotation->y;
769  q.z = -scaling_rotation->z;
770  q.w = scaling_rotation->w;
772  D3DXMatrixMultiply(&m1, &m1, &msr1);
773  }
774  D3DXMatrixScaling(&ms, scaling->x, scaling->y, scaling->z);
775  D3DXMatrixMultiply(&m1, &m1, &ms);
776  if (scaling_rotation)
777  {
778  D3DXMatrixRotationQuaternion(&msr, scaling_rotation);
779  D3DXMatrixMultiply(&m1, &m1, &msr);
780  }
781  D3DXMatrixTranslation(&msc, sc.x, sc.y, sc.z);
782  D3DXMatrixMultiply(&m1, &m1, &msc);
783  }
784  else
785  {
786  D3DXMatrixIdentity(&m1);
787  }
788 
789  if (rotation)
790  {
791  rc = rotation_center ? *rotation_center : zero_vector;
792  D3DXMatrixTranslation(&mrc1, -rc.x, -rc.y, -rc.z);
793  D3DXMatrixMultiply(&m1, &m1, &mrc1);
794  D3DXMatrixRotationQuaternion(&mr, rotation);
795  D3DXMatrixMultiply(&m1, &m1, &mr);
796  D3DXMatrixTranslation(&mrc, rc.x, rc.y, rc.z);
797  D3DXMatrixMultiply(&m1, &m1, &mrc);
798  }
799 
800  if (translation)
801  {
802  D3DXMatrixTranslation(&mt, translation->x, translation->y, translation->z);
803  D3DXMatrixMultiply(out, &m1, &mt);
804  }
805  else
806  {
807  *out = m1;
808  }
809 
810  return out;
811 }
D3DXMATRIX *WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z)
Definition: math.c:862
D3DXMATRIX *WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
Definition: math.c:393
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
D3DXMATRIX *WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz)
Definition: math.c:708
D3DXMATRIX *WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, const D3DXQUATERNION *pq)
Definition: math.c:622

Referenced by D3DXMatrixTest(), and D3DXMatrixTransformation2D().

◆ D3DXMatrixTransformation2D()

D3DXMATRIX* WINAPI D3DXMatrixTransformation2D ( D3DXMATRIX pout,
const D3DXVECTOR2 pscalingcenter,
FLOAT  scalingrotation,
const D3DXVECTOR2 pscaling,
const D3DXVECTOR2 protationcenter,
FLOAT  rotation,
const D3DXVECTOR2 ptranslation 
)

Definition at line 823 of file math.c.

826 {
827  D3DXVECTOR3 r_c, s, s_c, t;
828  D3DXQUATERNION r, s_r;
829 
830  TRACE("out %p, scaling_center %p, scaling_rotation %.8e, scaling %p, rotation_center %p, "
831  "rotation %.8e, translation %p.\n",
832  out, scaling_center, scaling_rotation, scaling, rotation_center, rotation, translation);
833 
834  vec3_from_vec2(&s_c, scaling_center);
835  vec3_from_vec2(&s, scaling);
836  if (scaling)
837  s.z = 1.0f;
838  vec3_from_vec2(&r_c, rotation_center);
839  vec3_from_vec2(&t, translation);
840 
841  if (rotation)
842  {
843  r.w = cosf(rotation / 2.0f);
844  r.x = 0.0f;
845  r.y = 0.0f;
846  r.z = sinf(rotation / 2.0f);
847  }
848 
849  if (scaling_rotation)
850  {
851  s_r.w = cosf(scaling_rotation / 2.0f);
852  s_r.x = 0.0f;
853  s_r.y = 0.0f;
854  s_r.z = sinf(scaling_rotation / 2.0f);
855  }
856 
857  return D3DXMatrixTransformation(out, scaling_center ? &s_c : NULL,
858  scaling_rotation ? &s_r : NULL, scaling ? &s : NULL, rotation_center ? &r_c: NULL,
859  rotation ? &r : NULL, translation ? &t : NULL);
860 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
static void vec3_from_vec2(D3DXVECTOR3 *v3, const D3DXVECTOR2 *v2)
Definition: math.c:813
#define cosf
Definition: cosf.c:6
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLdouble s
Definition: gl.h:2039
#define NULL
Definition: types.h:112
D3DXMATRIX *WINAPI D3DXMatrixTransformation(D3DXMATRIX *out, const D3DXVECTOR3 *scaling_center, const D3DXQUATERNION *scaling_rotation, const D3DXVECTOR3 *scaling, const D3DXVECTOR3 *rotation_center, const D3DXQUATERNION *rotation, const D3DXVECTOR3 *translation)
Definition: math.c:747
#define sinf
Definition: sinf.c:6

Referenced by test_Matrix_Transformation2D().

◆ D3DXMatrixTranslation()

D3DXMATRIX* WINAPI D3DXMatrixTranslation ( D3DXMATRIX pout,
FLOAT  x,
FLOAT  y,
FLOAT  z 
)

Definition at line 862 of file math.c.

863 {
864  TRACE("pout %p, x %f, y %f, z %f\n", pout, x, y, z);
865 
866  D3DXMatrixIdentity(pout);
867  pout->u.m[3][0] = x;
868  pout->u.m[3][1] = y;
869  pout->u.m[3][2] = z;
870  return pout;
871 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble GLdouble z
Definition: glext.h:5874
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest(), D3DXMatrixTransformation(), ID3DXMatrixStackImpl_Translate(), and ID3DXMatrixStackImpl_TranslateLocal().

◆ D3DXMatrixTranspose()

D3DXMATRIX* WINAPI D3DXMatrixTranspose ( D3DXMATRIX pout,
const D3DXMATRIX pm 
)

Definition at line 873 of file math.c.

874 {
875  const D3DXMATRIX m = *pm;
876  int i,j;
877 
878  TRACE("pout %p, pm %p\n", pout, pm);
879 
880  for (i=0; i<4; i++)
881  for (j=0; j<4; j++) pout->u.m[i][j] = m.u.m[j][i];
882 
883  return pout;
884 }
static LPMONITOREX pm
Definition: localmon.c:45
const GLfloat * m
Definition: glext.h:10848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
float m[4][4]
Definition: d3d8types.h:1116

Referenced by D3DXMatrixTest(), and set().

◆ D3DXPlaneFromPointNormal()

D3DXPLANE* WINAPI D3DXPlaneFromPointNormal ( D3DXPLANE pout,
const D3DXVECTOR3 pvpoint,
const D3DXVECTOR3 pvnormal 
)

Definition at line 1200 of file math.c.

1201 {
1202  TRACE("pout %p, pvpoint %p, pvnormal %p\n", pout, pvpoint, pvnormal);
1203 
1204  pout->a = pvnormal->x;
1205  pout->b = pvnormal->y;
1206  pout->c = pvnormal->z;
1207  pout->d = -D3DXVec3Dot(pvpoint, pvnormal);
1208  return pout;
1209 }
FLOAT d
Definition: d3dx9math.h:221
#define TRACE(s)
Definition: solgame.cpp:4
FLOAT c
Definition: d3dx9math.h:221
FLOAT b
Definition: d3dx9math.h:221
FLOAT a
Definition: d3dx9math.h:221

Referenced by D3DXPlaneFromPoints(), and D3DXPlaneTest().

◆ D3DXPlaneFromPoints()

D3DXPLANE* WINAPI D3DXPlaneFromPoints ( D3DXPLANE pout,
const D3DXVECTOR3 pv1,
const D3DXVECTOR3 pv2,
const D3DXVECTOR3 pv3 
)

Definition at line 1211 of file math.c.

1212 {
1213  D3DXVECTOR3 edge1, edge2, normal, Nnormal;
1214 
1215  TRACE("pout %p, pv1 %p, pv2 %p, pv3 %p\n", pout, pv1, pv2, pv3);
1216 
1217  edge1.x = 0.0f; edge1.y = 0.0f; edge1.z = 0.0f;
1218  edge2.x = 0.0f; edge2.y = 0.0f; edge2.z = 0.0f;
1219  D3DXVec3Subtract(&edge1, pv2, pv1);
1220  D3DXVec3Subtract(&edge2, pv3, pv1);
1221  D3DXVec3Cross(&normal, &edge1, &edge2);
1222  D3DXVec3Normalize(&Nnormal, &normal);
1223  D3DXPlaneFromPointNormal(pout, pv1, &Nnormal);
1224  return pout;
1225 }
D3DXPLANE *WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, const D3DXVECTOR3 *pvpoint, const D3DXVECTOR3 *pvnormal)
Definition: math.c:1200
#define TRACE(s)
Definition: solgame.cpp:4
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1801

Referenced by D3DXPlaneTest().

◆ D3DXPlaneIntersectLine()

D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine ( D3DXVECTOR3 pout,
const D3DXPLANE pp,
const D3DXVECTOR3 pv1,
const D3DXVECTOR3 pv2 
)

Definition at line 1227 of file math.c.

1228 {
1229  D3DXVECTOR3 direction, normal;
1230  FLOAT dot, temp;
1231 
1232  TRACE("pout %p, pp %p, pv1 %p, pv2 %p\n", pout, pp, pv1, pv2);
1233 
1234  normal.x = pp->a;
1235  normal.y = pp->b;
1236  normal.z = pp->c;
1237  direction.x = pv2->x - pv1->x;
1238  direction.y = pv2->y - pv1->y;
1239  direction.z = pv2->z - pv1->z;
1240  dot = D3DXVec3Dot(&normal, &direction);
1241  if ( !dot ) return NULL;
1242  temp = ( pp->d + D3DXVec3Dot(&normal, pv1) ) / dot;
1243  pout->x = pv1->x - temp * direction.x;
1244  pout->y = pv1->y - temp * direction.y;
1245  pout->z = pv1->z - temp * direction.z;
1246  return pout;
1247 }
#define pp
Definition: hlsl.yy.c:1208
#define TRACE(s)
Definition: solgame.cpp:4
static calc_node_t temp
Definition: rpn_ieee.c:38
#define NULL
Definition: types.h:112
float FLOAT
Definition: typedefs.h:69

Referenced by D3DXPlaneTest().

◆ D3DXPlaneNormalize()

D3DXPLANE* WINAPI D3DXPlaneNormalize ( D3DXPLANE pout,
const D3DXPLANE pp 
)

Definition at line 1249 of file math.c.

1250 {
1251  FLOAT norm;
1252 
1253  TRACE("out %p, p %p\n", out, p);
1254 
1255  norm = sqrtf(p->a * p->a + p->b * p->b + p->c * p->c);
1256  if (norm)
1257  {
1258  out->a = p->a / norm;
1259  out->b = p->b / norm;
1260  out->c = p->c / norm;
1261  out->d = p->d / norm;
1262  }
1263  else
1264  {
1265  out->a = 0.0f;
1266  out->b = 0.0f;
1267  out->c = 0.0f;
1268  out->d = 0.0f;
1269  }
1270 
1271  return out;
1272 }
_Tp _STLP_CALL norm(const complex< _Tp > &__z)
Definition: _complex.h:741
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
#define sqrtf(x)
Definition: mymath.h:59
float FLOAT
Definition: typedefs.h:69
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by D3DXMatrixReflect(), D3DXMatrixShadow(), and D3DXPlaneTest().

◆ D3DXPlaneTransform()

D3DXPLANE* WINAPI D3DXPlaneTransform ( D3DXPLANE pout,
const D3DXPLANE pplane,
const D3DXMATRIX pm 
)

Definition at line 1274 of file math.c.

1275 {
1276  const D3DXPLANE plane = *pplane;
1277 
1278  TRACE("pout %p, pplane %p, pm %p\n", pout, pplane, pm);
1279 
1280  pout->a = pm->u.m[0][0] * plane.a + pm->u.m[1][0] * plane.b + pm->u.m[2][0] * plane.c + pm->u.m[3][0] * plane.d;
1281  pout->b = pm->u.m[0][1] * plane.a + pm->u.m[1][1] * plane.b + pm->u.m[2][1] * plane.c + pm->u.m[3][1] * plane.d;
1282  pout->c = pm->u.m[0][2] * plane.a + pm->u.m[1][2] * plane.b + pm->u.m[2][2] * plane.c + pm->u.m[3][2] * plane.d;
1283  pout->d = pm->u.m[0][3] * plane.a + pm->u.m[1][3] * plane.b + pm->u.m[2][3] * plane.c + pm->u.m[3][3] * plane.d;
1284  return pout;
1285 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
Definition: glfuncs.h:270
static LPMONITOREX pm
Definition: localmon.c:45
FLOAT d
Definition: d3dx9math.h:221
#define TRACE(s)
Definition: solgame.cpp:4
FLOAT c
Definition: d3dx9math.h:221
FLOAT b
Definition: d3dx9math.h:221
FLOAT a
Definition: d3dx9math.h:221

Referenced by D3DXPlaneTest(), and D3DXPlaneTransformArray().

◆ D3DXPlaneTransformArray()

D3DXPLANE* WINAPI D3DXPlaneTransformArray ( D3DXPLANE pout,
UINT  outstride,
const D3DXPLANE pplane,
UINT  pstride,
const D3DXMATRIX pm,
UINT  n 
)

Definition at line 1287 of file math.c.

1288 {
1289  UINT i;
1290 
1291  TRACE("out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n", out, outstride, in, instride, matrix, elements);
1292 
1293  for (i = 0; i < elements; ++i) {
1295  (D3DXPLANE*)((char*)out + outstride * i),
1296  (const D3DXPLANE*)((const char*)in + instride * i),
1297  matrix);
1298  }
1299  return out;
1300 }
GLuint GLenum matrix
Definition: glext.h:9407
D3DXPLANE *WINAPI D3DXPlaneTransform(D3DXPLANE *pout, const D3DXPLANE *pplane, const D3DXMATRIX *pm)
Definition: math.c:1274
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLuint in
Definition: glext.h:9616
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50

Referenced by test_D3DXVec_Array().

◆ D3DXQuaternionBaryCentric()

D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric ( D3DXQUATERNION pout,
const D3DXQUATERNION pq1,
const D3DXQUATERNION pq2,
const D3DXQUATERNION pq3,
FLOAT  f,
FLOAT  g 
)

Definition at line 1304 of file math.c.

1305 {
1306  D3DXQUATERNION temp1, temp2;
1307 
1308  TRACE("pout %p, pq1 %p, pq2 %p, pq3 %p, f %f, g %f\n", pout, pq1, pq2, pq3, f, g);
1309 
1310  D3DXQuaternionSlerp(pout, D3DXQuaternionSlerp(&temp1, pq1, pq2, f + g), D3DXQuaternionSlerp(&temp2, pq1, pq3, f+g), g / (f + g));
1311  return pout;
1312 }
GLboolean GLboolean g
Definition: glext.h:6204
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
D3DXQUATERNION *WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *out, const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, FLOAT t)
Definition: math.c:1496

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionExp()

D3DXQUATERNION* WINAPI D3DXQuaternionExp ( D3DXQUATERNION pout,
const D3DXQUATERNION pq 
)

Definition at line 1314 of file math.c.

1315 {
1316  FLOAT norm;
1317 
1318  TRACE("out %p, q %p\n", out, q);
1319 
1320  norm = sqrtf(q->x * q->x + q->y * q->y + q->z * q->z);
1321  if (norm)
1322  {
1323  out->x = sinf(norm) * q->x / norm;
1324  out->y = sinf(norm) * q->y / norm;
1325  out->z = sinf(norm) * q->z / norm;
1326  out->w = cosf(norm);
1327  }
1328  else
1329  {
1330  out->x = 0.0f;
1331  out->y = 0.0f;
1332  out->z = 0.0f;
1333  out->w = 1.0f;
1334  }
1335 
1336  return out;
1337 }
_Tp _STLP_CALL norm(const complex< _Tp > &__z)
Definition: _complex.h:741
#define cosf
Definition: cosf.c:6
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define sqrtf(x)
Definition: mymath.h:59
float FLOAT
Definition: typedefs.h:69
#define sinf
Definition: sinf.c:6

Referenced by D3DXQuaternionSquadSetup(), and D3DXQuaternionTest().

◆ D3DXQuaternionInverse()

D3DXQUATERNION* WINAPI D3DXQuaternionInverse ( D3DXQUATERNION pout,
const D3DXQUATERNION pq 
)

Definition at line 1339 of file math.c.

1340 {
1341  FLOAT norm;
1342 
1343  TRACE("pout %p, pq %p\n", pout, pq);
1344 
1345  norm = D3DXQuaternionLengthSq(pq);
1346 
1347  pout->x = -pq->x / norm;
1348  pout->y = -pq->y / norm;
1349  pout->z = -pq->z / norm;
1350  pout->w = pq->w / norm;
1351  return pout;
1352 }
_Tp _STLP_CALL norm(const complex< _Tp > &__z)
Definition: _complex.h:741
#define TRACE(s)
Definition: solgame.cpp:4
float FLOAT
Definition: typedefs.h:69

Referenced by D3DXQuaternionSquadSetup(), and D3DXQuaternionTest().

◆ D3DXQuaternionLn()

D3DXQUATERNION* WINAPI D3DXQuaternionLn ( D3DXQUATERNION pout,
const D3DXQUATERNION pq 
)

Definition at line 1354 of file math.c.

1355 {
1356  FLOAT t;
1357 
1358  TRACE("out %p, q %p\n", out, q);
1359 
1360  if ((q->w >= 1.0f) || (q->w == -1.0f))
1361  t = 1.0f;
1362  else
1363  t = acosf(q->w) / sqrtf(1.0f - q->w * q->w);
1364 
1365  out->x = t * q->x;
1366  out->y = t * q->y;
1367  out->z = t * q->z;
1368  out->w = 0.0f;
1369 
1370  return out;
1371 }
_Check_return_ __CRT_INLINE float acosf(_In_ float x)
Definition: math.h:203
GLdouble GLdouble t
Definition: gl.h:2047
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define sqrtf(x)
Definition: mymath.h:59
float FLOAT
Definition: typedefs.h:69

Referenced by D3DXQuaternionSquadSetup(), and D3DXQuaternionTest().

◆ D3DXQuaternionMultiply()

D3DXQUATERNION* WINAPI D3DXQuaternionMultiply ( D3DXQUATERNION pout,
const D3DXQUATERNION pq1,
const D3DXQUATERNION pq2 
)

Definition at line 1373 of file math.c.

1374 {
1376 
1377  TRACE("pout %p, pq1 %p, pq2 %p\n", pout, pq1, pq2);
1378 
1379  out.x = pq2->w * pq1->x + pq2->x * pq1->w + pq2->y * pq1->z - pq2->z * pq1->y;
1380  out.y = pq2->w * pq1->y - pq2->x * pq1->z + pq2->y * pq1->w + pq2->z * pq1->x;
1381  out.z = pq2->w * pq1->z + pq2->x * pq1->y - pq2->y * pq1->x + pq2->z * pq1->w;
1382  out.w = pq2->w * pq1->w - pq2->x * pq1->x - pq2->y * pq1->y - pq2->z * pq1->z;
1383  *pout = out;
1384  return pout;
1385 }
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44

Referenced by D3DXQuaternionSquadSetup(), and D3DXQuaternionTest().

◆ D3DXQuaternionNormalize()

D3DXQUATERNION* WINAPI D3DXQuaternionNormalize ( D3DXQUATERNION pout,
const D3DXQUATERNION pq 
)

Definition at line 1387 of file math.c.

1388 {
1389  FLOAT norm;
1390 
1391  TRACE("out %p, q %p\n", out, q);
1392 
1393  norm = D3DXQuaternionLength(q);
1394 
1395  out->x = q->x / norm;
1396  out->y = q->y / norm;
1397  out->z = q->z / norm;
1398  out->w = q->w / norm;
1399 
1400  return out;
1401 }
_Tp _STLP_CALL norm(const complex< _Tp > &__z)
Definition: _complex.h:741
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
float FLOAT
Definition: typedefs.h:69

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionRotationAxis()

D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis ( D3DXQUATERNION pout,
const D3DXVECTOR3 pv,
FLOAT  angle 
)

Definition at line 1403 of file math.c.

1404 {
1405  D3DXVECTOR3 temp;
1406 
1407  TRACE("out %p, v %p, angle %f\n", out, v, angle);
1408 
1410 
1411  out->x = sinf(angle / 2.0f) * temp.x;
1412  out->y = sinf(angle / 2.0f) * temp.y;
1413  out->z = sinf(angle / 2.0f) * temp.z;
1414  out->w = cosf(angle / 2.0f);
1415 
1416  return out;
1417 }
GLfloat angle
Definition: glext.h:10853
#define cosf
Definition: cosf.c:6
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
const GLdouble * v
Definition: gl.h:2040
static calc_node_t temp
Definition: rpn_ieee.c:38
#define sinf
Definition: sinf.c:6
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1801

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionRotationMatrix()

D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix ( D3DXQUATERNION pout,
const D3DXMATRIX pm 
)

Definition at line 1419 of file math.c.

1420 {
1421  FLOAT s, trace;
1422 
1423  TRACE("out %p, m %p\n", out, m);
1424 
1425  trace = m->u.m[0][0] + m->u.m[1][1] + m->u.m[2][2] + 1.0f;
1426  if (trace > 1.0f)
1427  {
1428  s = 2.0f * sqrtf(trace);
1429  out->x = (m->u.m[1][2] - m->u.m[2][1]) / s;
1430  out->y = (m->u.m[2][0] - m->u.m[0][2]) / s;
1431  out->z = (m->u.m[0][1] - m->u.m[1][0]) / s;
1432  out->w = 0.25f * s;
1433  }
1434  else
1435  {
1436  int i, maxi = 0;
1437 
1438  for (i = 1; i < 3; i++)
1439  {
1440  if (m->u.m[i][i] > m->u.m[maxi][maxi])
1441  maxi = i;
1442  }
1443 
1444  switch (maxi)
1445  {
1446  case 0:
1447  s = 2.0f * sqrtf(1.0f + m->u.m[0][0] - m->u.m[1][1] - m->u.m[2][2]);
1448  out->x = 0.25f * s;
1449  out->y = (m->u.m[0][1] + m->u.m[1][0]) / s;
1450  out->z = (m->u.m[0][2] + m->u.m[2][0]) / s;
1451  out->w = (m->u.m[1][2] - m->u.m[2][1]) / s;
1452  break;
1453 
1454  case 1:
1455  s = 2.0f * sqrtf(1.0f + m->u.m[1][1] - m->u.m[0][0] - m->u.m[2][2]);
1456  out->x = (m->u.m[0][1] + m->u.m[1][0]) / s;
1457  out->y = 0.25f * s;
1458  out->z = (m->u.m[1][2] + m->u.m[2][1]) / s;
1459  out->w = (m->u.m[2][0] - m->u.m[0][2]) / s;
1460  break;
1461 
1462  case 2:
1463  s = 2.0f * sqrtf(1.0f + m->u.m[2][2] - m->u.m[0][0] - m->u.m[1][1]);
1464  out->x = (m->u.m[0][2] + m->u.m[2][0]) / s;
1465  out->y = (m->u.m[1][2] + m->u.m[2][1]) / s;
1466  out->z = 0.25f * s;
1467  out->w = (m->u.m[0][1] - m->u.m[1][0]) / s;
1468  break;
1469  }
1470  }
1471 
1472  return out;
1473 }
const GLfloat * m
Definition: glext.h:10848
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
#define trace
Definition: atltest.h:70
static FILE * out
Definition: regtests2xml.c:44
GLdouble s
Definition: gl.h:2039
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define sqrtf(x)
Definition: mymath.h:59
float FLOAT
Definition: typedefs.h:69

Referenced by D3DXMatrixDecompose(), and D3DXQuaternionTest().

◆ D3DXQuaternionRotationYawPitchRoll()

D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll ( D3DXQUATERNION pout,
FLOAT  yaw,
FLOAT  pitch,
FLOAT  roll 
)

Definition at line 1475 of file math.c.

1476 {
1477  FLOAT syaw, cyaw, spitch, cpitch, sroll, croll;
1478 
1479  TRACE("out %p, yaw %f, pitch %f, roll %f\n", out, yaw, pitch, roll);
1480 
1481  syaw = sinf(yaw / 2.0f);
1482  cyaw = cosf(yaw / 2.0f);
1483  spitch = sinf(pitch / 2.0f);
1484  cpitch = cosf(pitch / 2.0f);
1485  sroll = sinf(roll / 2.0f);
1486  croll = cosf(roll / 2.0f);
1487 
1488  out->x = syaw * cpitch * sroll + cyaw * spitch * croll;
1489  out->y = syaw * cpitch * croll - cyaw * spitch * sroll;
1490  out->z = cyaw * cpitch * sroll - syaw * spitch * croll;
1491  out->w = cyaw * cpitch * croll + syaw * spitch * sroll;
1492 
1493  return out;
1494 }
#define cosf
Definition: cosf.c:6
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
float FLOAT
Definition: typedefs.h:69
#define sinf
Definition: sinf.c:6

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionSlerp()

D3DXQUATERNION* WINAPI D3DXQuaternionSlerp ( D3DXQUATERNION pout,
const D3DXQUATERNION pq1,
const D3DXQUATERNION pq2,
FLOAT  t 
)

Definition at line 1496 of file math.c.

1498 {
1499  FLOAT dot, temp;
1500 
1501  TRACE("out %p, q1 %p, q2 %p, t %f\n", out, q1, q2, t);
1502 
1503  temp = 1.0f - t;
1504  dot = D3DXQuaternionDot(q1, q2);
1505  if (dot < 0.0f)
1506  {
1507  t = -t;
1508  dot = -dot;
1509  }
1510 
1511  if (1.0f - dot > 0.001f)
1512  {
1513  FLOAT theta = acosf(dot);
1514 
1515  temp = sinf(theta * temp) / sinf(theta);
1516  t = sinf(theta * t) / sinf(theta);
1517  }
1518 
1519  out->x = temp * q1->x + t * q2->x;
1520  out->y = temp * q1->y + t * q2->y;
1521  out->z = temp * q1->z + t * q2->z;
1522  out->w = temp * q1->w + t * q2->w;
1523 
1524  return out;
1525 }
_Check_return_ __CRT_INLINE float acosf(_In_ float x)
Definition: math.h:203
GLdouble GLdouble t
Definition: gl.h:2047
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
static calc_node_t temp
Definition: rpn_ieee.c:38
float FLOAT
Definition: typedefs.h:69
#define sinf
Definition: sinf.c:6

Referenced by D3DXQuaternionBaryCentric(), D3DXQuaternionSquad(), and D3DXQuaternionTest().

◆ D3DXQuaternionSquad()

D3DXQUATERNION* WINAPI D3DXQuaternionSquad ( D3DXQUATERNION pout,
const D3DXQUATERNION pq1,
const D3DXQUATERNION pq2,
const D3DXQUATERNION pq3,
const D3DXQUATERNION pq4,
FLOAT  t 
)

Definition at line 1527 of file math.c.

1528 {
1529  D3DXQUATERNION temp1, temp2;
1530 
1531  TRACE("pout %p, pq1 %p, pq2 %p, pq3 %p, pq4 %p, t %f\n", pout, pq1, pq2, pq3, pq4, t);
1532 
1533  D3DXQuaternionSlerp(pout, D3DXQuaternionSlerp(&temp1, pq1, pq4, t), D3DXQuaternionSlerp(&temp2, pq2, pq3, t), 2.0f * t * (1.0f - t));
1534  return pout;
1535 }
GLdouble GLdouble t
Definition: gl.h:2047
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
D3DXQUATERNION *WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *out, const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, FLOAT t)
Definition: math.c:1496

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionSquadSetup()

void WINAPI D3DXQuaternionSquadSetup ( D3DXQUATERNION paout,
D3DXQUATERNION pbout,
D3DXQUATERNION pcout,
const D3DXQUATERNION pq0,
const D3DXQUATERNION pq1,
const D3DXQUATERNION pq2,
const D3DXQUATERNION pq3 
)

Definition at line 1549 of file math.c.

1550 {
1551  D3DXQUATERNION q, temp1, temp2, temp3, zero;
1552  D3DXQUATERNION aout, cout;
1553 
1554  TRACE("paout %p, pbout %p, pcout %p, pq0 %p, pq1 %p, pq2 %p, pq3 %p\n", paout, pbout, pcout, pq0, pq1, pq2, pq3);
1555 
1556  zero.x = 0.0f;
1557  zero.y = 0.0f;
1558  zero.z = 0.0f;
1559  zero.w = 0.0f;
1560 
1561  if (D3DXQuaternionDot(pq0, pq1) < 0.0f)
1562  temp2 = add_diff(&zero, pq0, -1.0f);
1563  else
1564  temp2 = *pq0;
1565 
1566  if (D3DXQuaternionDot(pq1, pq2) < 0.0f)
1567  cout = add_diff(&zero, pq2, -1.0f);
1568  else
1569  cout = *pq2;
1570 
1571  if (D3DXQuaternionDot(&cout, pq3) < 0.0f)
1572  temp3 = add_diff(&zero, pq3, -1.0f);
1573  else
1574  temp3 = *pq3;
1575 
1576  D3DXQuaternionInverse(&temp1, pq1);
1577  D3DXQuaternionMultiply(&temp2, &temp1, &temp2);
1578  D3DXQuaternionLn(&temp2, &temp2);
1579  D3DXQuaternionMultiply(&q, &temp1, &cout);
1580  D3DXQuaternionLn(&q, &q);
1581  temp1 = add_diff(&temp2, &q, 1.0f);
1582  temp1.x *= -0.25f;
1583  temp1.y *= -0.25f;
1584  temp1.z *= -0.25f;
1585  temp1.w *= -0.25f;
1586  D3DXQuaternionExp(&temp1, &temp1);
1587  D3DXQuaternionMultiply(&aout, pq1, &temp1);
1588 
1589  D3DXQuaternionInverse(&temp1, &cout);
1590  D3DXQuaternionMultiply(&temp2, &temp1, pq1);
1591  D3DXQuaternionLn(&temp2, &temp2);
1592  D3DXQuaternionMultiply(&q, &temp1, &temp3);
1593  D3DXQuaternionLn(&q, &q);
1594  temp1 = add_diff(&temp2, &q, 1.0f);
1595  temp1.x *= -0.25f;
1596  temp1.y *= -0.25f;
1597  temp1.z *= -0.25f;
1598  temp1.w *= -0.25f;
1599  D3DXQuaternionExp(&temp1, &temp1);
1600  D3DXQuaternionMultiply(pbout, &cout, &temp1);
1601  *paout = aout;
1602  *pcout = cout;
1603 }
static D3DXQUATERNION add_diff(const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, const FLOAT add)
Definition: math.c:1537
#define cout
Definition: iostream.cpp:38
int zero
Definition: sehframes.cpp:29
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
D3DXQUATERNION *WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, const D3DXQUATERNION *pq)
Definition: math.c:1339
D3DXQUATERNION *WINAPI D3DXQuaternionLn(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1354
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
D3DXQUATERNION *WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2)
Definition: math.c:1373
D3DXQUATERNION *WINAPI D3DXQuaternionExp(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1314

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionToAxisAngle()

void WINAPI D3DXQuaternionToAxisAngle ( const D3DXQUATERNION pq,
D3DXVECTOR3 paxis,
FLOAT pangle 
)

Definition at line 1605 of file math.c.

1606 {
1607  TRACE("pq %p, paxis %p, pangle %p\n", pq, paxis, pangle);
1608 
1609  if (paxis)
1610  {
1611  paxis->x = pq->x;
1612  paxis->y = pq->y;
1613  paxis->z = pq->z;
1614  }
1615  if (pangle)
1616  *pangle = 2.0f * acosf(pq->w);
1617 }
_Check_return_ __CRT_INLINE float acosf(_In_ float x)
Definition: math.h:203
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by D3DXQuaternionTest().

◆ D3DXSHAdd()

FLOAT* WINAPI D3DXSHAdd ( FLOAT out,
UINT  order,
const FLOAT a,
const FLOAT b 
)

Definition at line 2233 of file math.c.

2234 {
2235  UINT i;
2236 
2237  TRACE("out %p, order %u, a %p, b %p\n", out, order, a, b);
2238 
2239  for (i = 0; i < order * order; i++)
2240  out[i] = a[i] + b[i];
2241 
2242  return out;
2243 }
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by test_D3DXSHAdd().

◆ D3DXSHDot()

FLOAT WINAPI D3DXSHDot ( UINT  order,
const FLOAT a,
const FLOAT b 
)

Definition at line 2245 of file math.c.

2246 {
2247  FLOAT s;
2248  UINT i;
2249 
2250  TRACE("order %u, a %p, b %p\n", order, a, b);
2251 
2252  s = a[0] * b[0];
2253  for (i = 1; i < order * order; i++)
2254  s += a[i] * b[i];
2255 
2256  return s;
2257 }
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
GLdouble s
Definition: gl.h:2039
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
float FLOAT
Definition: typedefs.h:69
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by D3DXSHMultiply2(), and test_D3DXSHDot().

◆ D3DXSHEvalConeLight()

HRESULT WINAPI D3DXSHEvalConeLight ( UINT  order,
const D3DXVECTOR3 dir,
FLOAT  radius,
FLOAT  Rintensity,
FLOAT  Gintensity,
FLOAT  Bintensity,
FLOAT rout,
FLOAT gout,
FLOAT bout 
)

Definition at line 2288 of file math.c.

2290 {
2291  FLOAT cap[6], clamped_angle, norm, scale, temp;
2292  UINT i, index, j;
2293 
2294  TRACE("order %u, dir %p, radius %f, red %f, green %f, blue %f, rout %p, gout %p, bout %p\n",
2295  order, dir, radius, Rintensity, Gintensity, Bintensity, rout, gout, bout);
2296 
2297  if (radius <= 0.0f)
2298  return D3DXSHEvalDirectionalLight(order, dir, Rintensity, Gintensity, Bintensity, rout, gout, bout);
2299 
2300  clamped_angle = (radius > D3DX_PI / 2.0f) ? (D3DX_PI / 2.0f) : radius;
2301  norm = sinf(clamped_angle) * sinf(clamped_angle);
2302 
2303  if (order > D3DXSH_MAXORDER)
2304  {
2305  WARN("Order clamped at D3DXSH_MAXORDER\n");
2307  }
2308 
2309  weightedcapintegrale(cap, order, radius);
2310  D3DXSHEvalDirection(rout, order, dir);
2311 
2312  for (i = 0; i < order; i++)
2313  {
2314  scale = cap[i] / norm;
2315 
2316  for (j = 0; j < 2 * i + 1; j++)
2317  {
2318  index = i * i + j;
2319  temp = rout[index] * scale;
2320 
2321  rout[index] = temp * Rintensity;
2322  if (gout)
2323  gout[index] = temp * Gintensity;
2324  if (bout)
2325  bout[index] = temp * Bintensity;
2326  }
2327  }
2328 
2329  return D3D_OK;
2330 }
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
_Tp _STLP_CALL norm(const complex< _Tp > &__z)
Definition: _complex.h:741
HRESULT WINAPI D3DXSHEvalDirectionalLight(UINT order, const D3DXVECTOR3 *dir, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *Rout, FLOAT *Gout, FLOAT *Bout)
Definition: math.c:2402
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
#define WARN(fmt,...)
Definition: debug.h:112
#define D3DXSH_MAXORDER
Definition: d3dx9math.h:31
FLOAT *WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir)
Definition: math.c:2332
GLenum cap
Definition: glext.h:9639
GLuint index
Definition: glext.h:6031
unsigned int dir
Definition: maze.c:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
#define index(s, c)
Definition: various.h:29
static void weightedcapintegrale(FLOAT *out, UINT order, FLOAT angle)
Definition: math.c:2259
#define D3D_OK
Definition: d3d.h:106
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int UINT
Definition: ndis.h:50
float FLOAT
Definition: typedefs.h:69
#define D3DX_PI
Definition: d3dx9math.h:27
#define sinf
Definition: sinf.c:6

Referenced by test_D3DXSHEvalConeLight().

◆ D3DXSHEvalDirection()

FLOAT* WINAPI D3DXSHEvalDirection ( FLOAT out,
UINT  order,
const D3DXVECTOR3 dir 
)

Definition at line 2332 of file math.c.

2333 {
2334  const FLOAT dirxx = dir->x * dir->x;
2335  const FLOAT dirxy = dir->x * dir->y;
2336  const FLOAT dirxz = dir->x * dir->z;
2337  const FLOAT diryy = dir->y * dir->y;
2338  const FLOAT diryz = dir->y * dir->z;
2339  const FLOAT dirzz = dir->z * dir->z;
2340  const FLOAT dirxxxx = dirxx * dirxx;
2341  const FLOAT diryyyy = diryy * diryy;
2342  const FLOAT dirzzzz = dirzz * dirzz;
2343  const FLOAT dirxyxy = dirxy * dirxy;
2344 
2345  TRACE("out %p, order %u, dir %p\n", out, order, dir);
2346 
2347  if ((order < D3DXSH_MINORDER) || (order > D3DXSH_MAXORDER))
2348  return out;
2349 
2350  out[0] = 0.5f / sqrtf(D3DX_PI);
2351  out[1] = -0.5f / sqrtf(D3DX_PI / 3.0f) * dir->y;
2352  out[2] = 0.5f / sqrtf(D3DX_PI / 3.0f) * dir->z;
2353  out[3] = -0.5f / sqrtf(D3DX_PI / 3.0f) * dir->x;
2354  if (order == 2)
2355  return out;
2356 
2357  out[4] = 0.5f / sqrtf(D3DX_PI / 15.0f) * dirxy;
2358  out[5] = -0.5f / sqrtf(D3DX_PI / 15.0f) * diryz;
2359  out[6] = 0.25f / sqrtf(D3DX_PI / 5.0f) * (3.0f * dirzz - 1.0f);
2360  out[7] = -0.5f / sqrtf(D3DX_PI / 15.0f) * dirxz;
2361  out[8] = 0.25f / sqrtf(D3DX_PI / 15.0f) * (dirxx - diryy);
2362  if (order == 3)
2363  return out;
2364 
2365  out[9] = -sqrtf(70.0f / D3DX_PI) / 8.0f * dir->y * (3.0f * dirxx - diryy);
2366  out[10] = sqrtf(105.0f / D3DX_PI) / 2.0f * dirxy * dir->z;
2367  out[11] = -sqrtf(42.0f / D3DX_PI) / 8.0f * dir->y * (-1.0f + 5.0f * dirzz);
2368  out[12] = sqrtf(7.0f / D3DX_PI) / 4.0f * dir->z * (5.0f * dirzz - 3.0f);
2369  out[13] = sqrtf(42.0f / D3DX_PI) / 8.0f * dir->x * (1.0f - 5.0f * dirzz);
2370  out[14] = sqrtf(105.0f / D3DX_PI) / 4.0f * dir->z * (dirxx - diryy);
2371  out[15] = -sqrtf(70.0f / D3DX_PI) / 8.0f * dir->x * (dirxx - 3.0f * diryy);
2372  if (order == 4)
2373  return out;
2374 
2375  out[16] = 0.75f * sqrtf(35.0f / D3DX_PI) * dirxy * (dirxx - diryy);
2376  out[17] = 3.0f * dir->z * out[9];
2377  out[18] = 0.75f * sqrtf(5.0f / D3DX_PI) * dirxy * (7.0f * dirzz - 1.0f);
2378  out[19] = 0.375f * sqrtf(10.0f / D3DX_PI) * diryz * (3.0f - 7.0f * dirzz);
2379  out[20] = 3.0f / (16.0f * sqrtf(D3DX_PI)) * (35.0f * dirzzzz - 30.f * dirzz + 3.0f);
2380  out[21] = 0.375f * sqrtf(10.0f / D3DX_PI) * dirxz * (3.0f - 7.0f * dirzz);
2381  out[22] = 0.375f * sqrtf(5.0f / D3DX_PI) * (dirxx - diryy) * (7.0f * dirzz - 1.0f);
2382  out[23] = 3.0f * dir->z * out[15];
2383  out[24] = 3.0f / 16.0f * sqrtf(35.0f / D3DX_PI) * (dirxxxx - 6.0f * dirxyxy + diryyyy);
2384  if (order == 5)
2385  return out;
2386 
2387  out[25] = -3.0f/ 32.0f * sqrtf(154.0f / D3DX_PI) * dir->y * (5.0f * dirxxxx - 10.0f * dirxyxy + diryyyy);
2388  out[26] = 0.75f * sqrtf(385.0f / D3DX_PI) * dirxy * dir->z * (dirxx - diryy);
2389  out[27] = sqrtf(770.0f / D3DX_PI) / 32.0f * dir->y * (3.0f * dirxx - diryy) * (1.0f - 9.0f * dirzz);
2390  out[28] = sqrtf(1155.0f / D3DX_PI) / 4.0f * dirxy * dir->z * (3.0f * dirzz - 1.0f);
2391  out[29] = sqrtf(165.0f / D3DX_PI) / 16.0f * dir->y * (14.0f * dirzz - 21.0f * dirzzzz - 1.0f);
2392  out[30] = sqrtf(11.0f / D3DX_PI) / 16.0f * dir->z * (63.0f * dirzzzz - 70.0f * dirzz + 15.0f);
2393  out[31] = sqrtf(165.0f / D3DX_PI) / 16.0f * dir->x * (14.0f * dirzz - 21.0f * dirzzzz - 1.0f);
2394  out[32] = sqrtf(1155.0f / D3DX_PI) / 8.0f * dir->z * (dirxx - diryy) * (3.0f * dirzz - 1.0f);
2395  out[33] = sqrtf(770.0f / D3DX_PI) / 32.0f * dir->x * (dirxx - 3.0f * diryy) * (1.0f - 9.0f * dirzz);
2396  out[34] = 3.0f / 16.0f * sqrtf(385.0f / D3DX_PI) * dir->z * (dirxxxx - 6.0f * dirxyxy + diryyyy);
2397  out[35] = -3.0f/ 32.0f * sqrtf(154.0f / D3DX_PI) * dir->x * (dirxxxx - 10.0f * dirxyxy + 5.0f * diryyyy);
2398 
2399  return out;
2400 }
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
#define D3DXSH_MAXORDER
Definition: d3dx9math.h:31
#define D3DXSH_MINORDER
Definition: d3dx9math.h:30
unsigned int dir
Definition: maze.c:112
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
#define sqrtf(x)
Definition: mymath.h:59
float FLOAT
Definition: typedefs.h:69
#define D3DX_PI
Definition: d3dx9math.h:27

Referenced by D3DXSHEvalConeLight(), D3DXSHEvalDirectionalLight(), D3DXSHEvalHemisphereLight(), D3DXSHEvalSphericalLight(), and test_D3DXSHEvalDirection().

◆ D3DXSHEvalDirectionalLight()

HRESULT WINAPI D3DXSHEvalDirectionalLight ( UINT  order,
const D3DXVECTOR3 dir,
FLOAT  Rintensity,
FLOAT  Gintensity,
FLOAT  Bintensity,
FLOAT rout,
FLOAT gout,
FLOAT bout 
)

Definition at line 2402 of file math.c.

2403 {
2404  FLOAT s, temp;
2405  UINT j;
2406 
2407  TRACE("Order %u, Vector %p, Red %f, Green %f, Blue %f, Rout %p, Gout %p, Bout %p\n", order, dir, Rintensity, Gintensity, Bintensity, Rout, Gout, Bout);
2408 
2409  s = 0.75f;
2410  if ( order > 2 )
2411  s += 5.0f / 16.0f;
2412  if ( order > 4 )
2413  s -= 3.0f / 32.0f;
2414  s /= D3DX_PI;
2415 
2416  D3DXSHEvalDirection(Rout, order, dir);
2417  for (j = 0; j < order * order; j++)
2418  {
2419  temp = Rout[j] / s;
2420 
2421  Rout[j] = Rintensity * temp;
2422  if ( Gout )
2423  Gout[j] = Gintensity * temp;
2424  if ( Bout )
2425  Bout[j] = Bintensity * temp;
2426  }
2427 
2428  return D3D_OK;
2429 }
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
FLOAT *WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir)
Definition: math.c:2332
unsigned int dir
Definition: maze.c:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
GLdouble s
Definition: gl.h:2039
#define D3D_OK
Definition: d3d.h:106
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int UINT
Definition: ndis.h:50
float FLOAT
Definition: typedefs.h:69
#define D3DX_PI
Definition: d3dx9math.h:27

Referenced by D3DXSHEvalConeLight(), test_D3DXSHEvalConeLight(), and test_D3DXSHEvalDirectionalLight().

◆ D3DXSHEvalHemisphereLight()

HRESULT WINAPI D3DXSHEvalHemisphereLight ( UINT  order,
const D3DXVECTOR3 dir,
D3DXCOLOR  top,
D3DXCOLOR  bottom,
FLOAT rout,
FLOAT gout,
FLOAT bout 
)

Definition at line 2431 of file math.c.

2433 {
2434  FLOAT a[2], temp[4];
2435  UINT i, j;
2436 
2437  TRACE("order %u, dir %p, rout %p, gout %p, bout %p\n", order, dir, rout, gout, bout);
2438 
2440 
2441  a[0] = (top.r + bottom.r) * 3.0f * D3DX_PI;
2442  a[1] = (top.r - bottom.r) * D3DX_PI;
2443  for (i = 0; i < order; i++)
2444  for (j = 0; j < 2 * i + 1; j++)
2445  if (i < 2)
2446  rout[i * i + j] = temp[i * i + j] * a[i];
2447  else
2448  rout[i * i + j] = 0.0f;
2449 
2450  if (gout)
2451  {
2452  a[0] = (top.g + bottom.g) * 3.0f * D3DX_PI;
2453  a[1] = (top.g - bottom.g) * D3DX_PI;
2454  for (i = 0; i < order; i++)
2455  for (j = 0; j < 2 * i + 1; j++)
2456  if (i < 2)
2457  gout[i * i + j] = temp[i * i + j] * a[i];
2458  else
2459  gout[i * i + j] = 0.0f;
2460  }
2461 
2462  if (bout)
2463  {
2464  a[0] = (top.b + bottom.b) * 3.0f * D3DX_PI;
2465  a[1] = (top.b - bottom.b) * D3DX_PI;
2466  for (i = 0; i < order; i++)
2467  for (j = 0; j < 2 * i + 1; j++)
2468  if (i < 2)
2469  bout[i * i + j] = temp[i * i + j] * a[i];
2470  else
2471  bout[i * i + j] = 0.0f;
2472  }
2473 
2474  return D3D_OK;
2475 }
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
FLOAT *WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir)
Definition: math.c:2332
GLint GLint bottom
Definition: glext.h:7726
unsigned int dir
Definition: maze.c:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
#define D3D_OK
Definition: d3d.h:106
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int UINT
Definition: ndis.h:50
float FLOAT
Definition: typedefs.h:69
#define D3DX_PI
Definition: d3dx9math.h:27
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by test_D3DXSHEvalHemisphereLight().

◆ D3DXSHEvalSphericalLight()

HRESULT WINAPI D3DXSHEvalSphericalLight ( UINT  order,
const D3DXVECTOR3 dir,
FLOAT  radius,
FLOAT  Rintensity,
FLOAT  Gintensity,
FLOAT  Bintensity,
FLOAT rout,
FLOAT gout,
FLOAT bout 
)

Definition at line 2477 of file math.c.

2479 {
2481  FLOAT cap[6], clamped_angle, dist, temp;
2482  UINT i, index, j;
2483 
2484  TRACE("order %u, dir %p, radius %f, red %f, green %f, blue %f, rout %p, gout %p, bout %p\n",
2485  order, dir, radius, Rintensity, Gintensity, Bintensity, rout, gout, bout);
2486 
2487  if (order > D3DXSH_MAXORDER)
2488  {
2489  WARN("Order clamped at D3DXSH_MAXORDER\n");
2491  }
2492 
2493  if (radius < 0.0f)
2494  radius = -radius;
2495 
2496  dist = D3DXVec3Length(dir);
2497  clamped_angle = (dist <= radius) ? D3DX_PI / 2.0f : asinf(radius / dist);
2498 
2499  weightedcapintegrale(cap, order, clamped_angle);
2501  D3DXSHEvalDirection(rout, order, &normal);
2502 
2503  for (i = 0; i < order; i++)
2504  for (j = 0; j < 2 * i + 1; j++)
2505  {
2506  index = i * i + j;
2507  temp = rout[index] * cap[i];
2508 
2509  rout[index] = temp * Rintensity;
2510  if (gout)
2511  gout[index] = temp * Gintensity;
2512  if (bout)
2513  bout[index] = temp * Bintensity;
2514  }
2515 
2516  return D3D_OK;
2517 }
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
#define WARN(fmt,...)
Definition: debug.h:112
#define D3DXSH_MAXORDER
Definition: d3dx9math.h:31
FLOAT *WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir)
Definition: math.c:2332
GLenum cap
Definition: glext.h:9639
GLuint index
Definition: glext.h:6031
unsigned int dir
Definition: maze.c:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
#define index(s, c)
Definition: various.h:29
static void weightedcapintegrale(FLOAT *out, UINT order, FLOAT angle)
Definition: math.c:2259
#define D3D_OK
Definition: d3d.h:106
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int UINT
Definition: ndis.h:50
float FLOAT
Definition: typedefs.h:69
#define D3DX_PI
Definition: d3dx9math.h:27
_Check_return_ __CRT_INLINE float asinf(_In_ float x)
Definition: math.h:204
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1801

Referenced by test_D3DXSHEvalSphericalLight().

◆ D3DXSHMultiply2()

FLOAT* WINAPI D3DXSHMultiply2 ( FLOAT out,
const FLOAT a,
const FLOAT b 
)

Definition at line 2519 of file math.c.

2520 {
2521  FLOAT ta, tb;
2522 
2523  TRACE("out %p, a %p, b %p\n", out, a, b);
2524 
2525  ta = 0.28209479f * a[0];
2526  tb = 0.28209479f * b[0];
2527 
2528  out[0] = 0.28209479f * D3DXSHDot(2, a, b);
2529  out[1] = ta * b[1] + tb * a[1];
2530  out[2] = ta * b[2] + tb * a[2];
2531  out[3] = ta * b[3] + tb * a[3];
2532 
2533  return out;
2534 }
FLOAT WINAPI D3DXSHDot(UINT order, const FLOAT *a, const FLOAT *b)
Definition: math.c:2245
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
static FILE * out
Definition: regtests2xml.c:44
static const WCHAR tb[]
Definition: suminfo.c:286
float FLOAT
Definition: typedefs.h:69
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by test_D3DXSHMultiply2().

◆ D3DXSHMultiply3()

FLOAT* WINAPI D3DXSHMultiply3 ( FLOAT out,
const FLOAT a,
const FLOAT b 
)

Definition at line 2536 of file math.c.

2537 {
2538  FLOAT t, ta, tb;
2539 
2540  TRACE("out %p, a %p, b %p\n", out, a, b);
2541 
2542  out[0] = 0.28209479f * a[0] * b[0];
2543 
2544  ta = 0.28209479f * a[0] - 0.12615663f * a[6] - 0.21850969f * a[8];
2545  tb = 0.28209479f * b[0] - 0.12615663f * b[6] - 0.21850969f * b[8];
2546  out[1] = ta * b[1] + tb * a[1];
2547  t = a[1] * b[1];
2548  out[0] += 0.28209479f * t;
2549  out[6] = -0.12615663f * t;
2550  out[8] = -0.21850969f * t;
2551 
2552  ta = 0.21850969f * a[5];
2553  tb = 0.21850969f * b[5];
2554  out[1] += ta * b[2] + tb * a[2];
2555  out[2] = ta * b[1] + tb * a[1];
2556  t = a[1] * b[2] +a[2] * b[1];
2557  out[5] = 0.21850969f * t;
2558 
2559  ta = 0.21850969f * a[4];
2560  tb = 0.21850969f * b[4];
2561  out[1] += ta * b[3] + tb * a[3];
2562  out[3] = ta * b[1] + tb * a[1];
2563  t = a[1] * b[3] + a[3] * b[1];
2564  out[4] = 0.21850969f * t;
2565 
2566  ta = 0.28209480f * a[0] + 0.25231326f * a[6];
2567  tb = 0.28209480f * b[0] + 0.25231326f * b[6];
2568  out[2] += ta * b[2] + tb * a[2];
2569  t = a[2] * b[2];
2570  out[0] += 0.28209480f * t;
2571  out[6] += 0.25231326f * t;
2572 
2573  ta = 0.21850969f * a[7];
2574  tb = 0.21850969f * b[7];
2575  out[2] += ta * b[3] + tb * a[3];
2576  out[3] += ta * b[2] + tb * a[2];
2577  t = a[2] * b[3] + a[3] * b[2];
2578  out[7] = 0.21850969f * t;
2579 
2580  ta = 0.28209479f * a[0] - 0.12615663f * a[6] + 0.21850969f * a[8];
2581  tb = 0.28209479f * b[0] - 0.12615663f * b[6] + 0.21850969f * b[8];
2582  out[3] += ta * b[3] + tb * a[3];
2583  t = a[3] * b[3];
2584  out[0] += 0.28209479f * t;
2585  out[6] -= 0.12615663f * t;
2586  out[8] += 0.21850969f * t;
2587 
2588  ta = 0.28209479f * a[0] - 0.18022375f * a[6];
2589  tb = 0.28209479f * b[0] - 0.18022375f * b[6];
2590  out[4] += ta * b[4] + tb * a[4];
2591  t = a[4] * b[4];
2592  out[0] += 0.28209479f * t;
2593  out[6] -= 0.18022375f * t;
2594 
2595  ta = 0.15607835f * a[7];