ReactOS  0.4.15-dev-2506-g83dbb6b
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 50 of file math.c.

51 {
52  TRACE("pout %p, pc %p, s %f\n", pout, pc, s);
53 
54  pout->r = 0.5f + s * (pc->r - 0.5f);
55  pout->g = 0.5f + s * (pc->g - 0.5f);
56  pout->b = 0.5f + s * (pc->b - 0.5f);
57  pout->a = pc->a;
58  return pout;
59 }
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 61 of file math.c.

62 {
63  FLOAT grey;
64 
65  TRACE("pout %p, pc %p, s %f\n", pout, pc, s);
66 
67  grey = pc->r * 0.2125f + pc->g * 0.7154f + pc->b * 0.0721f;
68  pout->r = grey + s * (pc->r - grey);
69  pout->g = grey + s * (pc->g - grey);
70  pout->b = grey + s * (pc->b - grey);
71  pout->a = pc->a;
72  return pout;
73 }
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 1171 of file math.c.

1172 {
1173  struct ID3DXMatrixStackImpl *object;
1174 
1175  TRACE("flags %#x, stack %p.\n", flags, stack);
1176 
1177  if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
1178  {
1179  *stack = NULL;
1180  return E_OUTOFMEMORY;
1181  }
1182  object->ID3DXMatrixStack_iface.lpVtbl = &ID3DXMatrixStack_Vtbl;
1183  object->ref = 1;
1184 
1185  if (!(object->stack = HeapAlloc(GetProcessHeap(), 0, INITIAL_STACK_SIZE * sizeof(*object->stack))))
1186  {
1187  HeapFree(GetProcessHeap(), 0, object);
1188  *stack = NULL;
1189  return E_OUTOFMEMORY;
1190  }
1191 
1192  object->current = 0;
1193  object->stack_size = INITIAL_STACK_SIZE;
1194  D3DXMatrixIdentity(&object->stack[0]);
1195 
1196  TRACE("Created matrix stack %p.\n", object);
1197 
1198  *stack = &object->ID3DXMatrixStack_iface;
1199  return D3D_OK;
1200 }
coclass MSXML2::XSLTemplate40 object
static const unsigned int INITIAL_STACK_SIZE
Definition: math.c:46
#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:1149
#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 2221 of file math.c.

2222 {
2223  unsigned int i;
2224 
2225  TRACE("pout %p, pin %p, n %u\n", pout, pin, n);
2226 
2227  for (i = 0; i < n; ++i)
2228  {
2229  pout[i] = float_16_to_32(pin[i].value);
2230  }
2231 
2232  return pout;
2233 }
Definition: pdh_main.c:93
GLdouble n
Definition: glext.h:7729
float float_16_to_32(const unsigned short in)
Definition: math.c:2203
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 2187 of file math.c.

2188 {
2189  unsigned int i;
2190 
2191  TRACE("pout %p, pin %p, n %u\n", pout, pin, n);
2192 
2193  for (i = 0; i < n; ++i)
2194  {
2195  pout[i].value = float_32_to_16(pin[i]);
2196  }
2197 
2198  return pout;
2199 }
WORD value
Definition: d3dx9math.h:277
unsigned short float_32_to_16(const float in)
Definition: math.c:2102
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 77 of file math.c.

78 {
79  FLOAT a, d, g, result;
80 
81  TRACE("costheta %f, refractionindex %f\n", costheta, refractionindex);
82 
83  g = sqrtf(refractionindex * refractionindex + costheta * costheta - 1.0f);
84  a = g + costheta;
85  d = g - costheta;
86  result = (costheta * a - 1.0f) * (costheta * a - 1.0f) / ((costheta * d + 1.0f) * (costheta * d + 1.0f)) + 1.0f;
87  result *= 0.5f * d * d / (a * a);
88 
89  return result;
90 }
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 94 of file math.c.

96 {
97  TRACE("out %p, scaling %f, rotationcenter %p, rotation %p, translation %p\n",
98  out, scaling, rotationcenter, rotation, translation);
99 
100  D3DXMatrixIdentity(out);
101 
102  if (rotation)
103  {
104  FLOAT temp00, temp01, temp02, temp10, temp11, temp12, temp20, temp21, temp22;
105 
106  temp00 = 1.0f - 2.0f * (rotation->y * rotation->y + rotation->z * rotation->z);
107  temp01 = 2.0f * (rotation->x * rotation->y + rotation->z * rotation->w);
108  temp02 = 2.0f * (rotation->x * rotation->z - rotation->y * rotation->w);
109  temp10 = 2.0f * (rotation->x * rotation->y - rotation->z * rotation->w);
110  temp11 = 1.0f - 2.0f * (rotation->x * rotation->x + rotation->z * rotation->z);
111  temp12 = 2.0f * (rotation->y * rotation->z + rotation->x * rotation->w);
112  temp20 = 2.0f * (rotation->x * rotation->z + rotation->y * rotation->w);
113  temp21 = 2.0f * (rotation->y * rotation->z - rotation->x * rotation->w);
114  temp22 = 1.0f - 2.0f * (rotation->x * rotation->x + rotation->y * rotation->y);
115 
116  out->u.m[0][0] = scaling * temp00;
117  out->u.m[0][1] = scaling * temp01;
118  out->u.m[0][2] = scaling * temp02;
119  out->u.m[1][0] = scaling * temp10;
120  out->u.m[1][1] = scaling * temp11;
121  out->u.m[1][2] = scaling * temp12;
122  out->u.m[2][0] = scaling * temp20;
123  out->u.m[2][1] = scaling * temp21;
124  out->u.m[2][2] = scaling * temp22;
125 
126  if (rotationcenter)
127  {
128  out->u.m[3][0] = rotationcenter->x * (1.0f - temp00) - rotationcenter->y * temp10
129  - rotationcenter->z * temp20;
130  out->u.m[3][1] = rotationcenter->y * (1.0f - temp11) - rotationcenter->x * temp01
131  - rotationcenter->z * temp21;
132  out->u.m[3][2] = rotationcenter->z * (1.0f - temp22) - rotationcenter->x * temp02
133  - rotationcenter->y * temp12;
134  }
135  }
136  else
137  {
138  out->u.m[0][0] = scaling;
139  out->u.m[1][1] = scaling;
140  out->u.m[2][2] = scaling;
141  }
142 
143  if (translation)
144  {
145  out->u.m[3][0] += translation->x;
146  out->u.m[3][1] += translation->y;
147  out->u.m[3][2] += translation->z;
148  }
149 
150  return out;
151 }
#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 153 of file math.c.

155 {
156  FLOAT tmp1, tmp2, s;
157 
158  TRACE("out %p, scaling %f, rotationcenter %p, rotation %f, translation %p\n",
159  out, scaling, rotationcenter, rotation, translation);
160 
161  s = sinf(rotation / 2.0f);
162  tmp1 = 1.0f - 2.0f * s * s;
163  tmp2 = 2.0f * s * cosf(rotation / 2.0f);
164 
165  D3DXMatrixIdentity(out);
166  out->u.m[0][0] = scaling * tmp1;
167  out->u.m[0][1] = scaling * tmp2;
168  out->u.m[1][0] = -scaling * tmp2;
169  out->u.m[1][1] = scaling * tmp1;
170 
171  if (rotationcenter)
172  {
173  FLOAT x, y;
174 
175  x = rotationcenter->x;
176  y = rotationcenter->y;
177 
178  out->u.m[3][0] = y * tmp2 - x * tmp1 + x;
179  out->u.m[3][1] = -x * tmp2 - y * tmp1 + y;
180  }
181 
182  if (translation)
183  {
184  out->u.m[3][0] += translation->x;
185  out->u.m[3][1] += translation->y;
186  }
187 
188  return out;
189 }
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 191 of file math.c.

192 {
195 
196  TRACE("poutscale %p, poutrotation %p, pouttranslation %p, pm %p\n", poutscale, poutrotation, pouttranslation, pm);
197 
198  /*Compute the scaling part.*/
199  vec.x=pm->u.m[0][0];
200  vec.y=pm->u.m[0][1];
201  vec.z=pm->u.m[0][2];
202  poutscale->x=D3DXVec3Length(&vec);
203 
204  vec.x=pm->u.m[1][0];
205  vec.y=pm->u.m[1][1];
206  vec.z=pm->u.m[1][2];
207  poutscale->y=D3DXVec3Length(&vec);
208 
209  vec.x=pm->u.m[2][0];
210  vec.y=pm->u.m[2][1];
211  vec.z=pm->u.m[2][2];
212  poutscale->z=D3DXVec3Length(&vec);
213 
214  /*Compute the translation part.*/
215  pouttranslation->x=pm->u.m[3][0];
216  pouttranslation->y=pm->u.m[3][1];
217  pouttranslation->z=pm->u.m[3][2];
218 
219  /*Let's calculate the rotation now*/
220  if ( (poutscale->x == 0.0f) || (poutscale->y == 0.0f) || (poutscale->z == 0.0f) ) return D3DERR_INVALIDCALL;
221 
222  normalized.u.m[0][0]=pm->u.m[0][0]/poutscale->x;
223  normalized.u.m[0][1]=pm->u.m[0][1]/poutscale->x;
224  normalized.u.m[0][2]=pm->u.m[0][2]/poutscale->x;
225  normalized.u.m[1][0]=pm->u.m[1][0]/poutscale->y;
226  normalized.u.m[1][1]=pm->u.m[1][1]/poutscale->y;
227  normalized.u.m[1][2]=pm->u.m[1][2]/poutscale->y;
228  normalized.u.m[2][0]=pm->u.m[2][0]/poutscale->z;
229  normalized.u.m[2][1]=pm->u.m[2][1]/poutscale->z;
230  normalized.u.m[2][2]=pm->u.m[2][2]/poutscale->z;
231 
233  return S_OK;
234 }
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:1423
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 236 of file math.c.

237 {
238  FLOAT t[3], v[4];
239 
240  TRACE("pm %p\n", pm);
241 
242  t[0] = pm->u.m[2][2] * pm->u.m[3][3] - pm->u.m[2][3] * pm->u.m[3][2];
243  t[1] = pm->u.m[1][2] * pm->u.m[3][3] - pm->u.m[1][3] * pm->u.m[3][2];
244  t[2] = pm->u.m[1][2] * pm->u.m[2][3] - pm->u.m[1][3] * pm->u.m[2][2];
245  v[0] = pm->u.m[1][1] * t[0] - pm->u.m[2][1] * t[1] + pm->u.m[3][1] * t[2];
246  v[1] = -pm->u.m[1][0] * t[0] + pm->u.m[2][0] * t[1] - pm->u.m[3][0] * t[2];
247 
248  t[0] = pm->u.m[1][0] * pm->u.m[2][1] - pm->u.m[2][0] * pm->u.m[1][1];
249  t[1] = pm->u.m[1][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[1][1];
250  t[2] = pm->u.m[2][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[2][1];
251  v[2] = pm->u.m[3][3] * t[0] - pm->u.m[2][3] * t[1] + pm->u.m[1][3] * t[2];
252  v[3] = -pm->u.m[3][2] * t[0] + pm->u.m[2][2] * t[1] - pm->u.m[1][2] * t[2];
253 
254  return pm->u.m[0][0] * v[0] + pm->u.m[0][1] * v[1] +
255  pm->u.m[0][2] * v[2] + pm->u.m[0][3] * v[3];
256 }
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 258 of file math.c.

259 {
260  FLOAT det, t[3], v[16];
261  UINT i, j;
262 
263  TRACE("pout %p, pdeterminant %p, pm %p\n", pout, pdeterminant, pm);
264 
265  t[0] = pm->u.m[2][2] * pm->u.m[3][3] - pm->u.m[2][3] * pm->u.m[3][2];
266  t[1] = pm->u.m[1][2] * pm->u.m[3][3] - pm->u.m[1][3] * pm->u.m[3][2];
267  t[2] = pm->u.m[1][2] * pm->u.m[2][3] - pm->u.m[1][3] * pm->u.m[2][2];
268  v[0] = pm->u.m[1][1] * t[0] - pm->u.m[2][1] * t[1] + pm->u.m[3][1] * t[2];
269  v[4] = -pm->u.m[1][0] * t[0] + pm->u.m[2][0] * t[1] - pm->u.m[3][0] * t[2];
270 
271  t[0] = pm->u.m[1][0] * pm->u.m[2][1] - pm->u.m[2][0] * pm->u.m[1][1];
272  t[1] = pm->u.m[1][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[1][1];
273  t[2] = pm->u.m[2][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[2][1];
274  v[8] = pm->u.m[3][3] * t[0] - pm->u.m[2][3] * t[1] + pm->u.m[1][3] * t[2];
275  v[12] = -pm->u.m[3][2] * t[0] + pm->u.m[2][2] * t[1] - pm->u.m[1][2] * t[2];
276 
277  det = pm->u.m[0][0] * v[0] + pm->u.m[0][1] * v[4] +
278  pm->u.m[0][2] * v[8] + pm->u.m[0][3] * v[12];
279  if (det == 0.0f)
280  return NULL;
281  if (pdeterminant)
282  *pdeterminant = det;
283 
284  t[0] = pm->u.m[2][2] * pm->u.m[3][3] - pm->u.m[2][3] * pm->u.m[3][2];
285  t[1] = pm->u.m[0][2] * pm->u.m[3][3] - pm->u.m[0][3] * pm->u.m[3][2];
286  t[2] = pm->u.m[0][2] * pm->u.m[2][3] - pm->u.m[0][3] * pm->u.m[2][2];
287  v[1] = -pm->u.m[0][1] * t[0] + pm->u.m[2][1] * t[1] - pm->u.m[3][1] * t[2];
288  v[5] = pm->u.m[0][0] * t[0] - pm->u.m[2][0] * t[1] + pm->u.m[3][0] * t[2];
289 
290  t[0] = pm->u.m[0][0] * pm->u.m[2][1] - pm->u.m[2][0] * pm->u.m[0][1];
291  t[1] = pm->u.m[3][0] * pm->u.m[0][1] - pm->u.m[0][0] * pm->u.m[3][1];
292  t[2] = pm->u.m[2][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[2][1];
293  v[9] = -pm->u.m[3][3] * t[0] - pm->u.m[2][3] * t[1]- pm->u.m[0][3] * t[2];
294  v[13] = pm->u.m[3][2] * t[0] + pm->u.m[2][2] * t[1] + pm->u.m[0][2] * t[2];
295 
296  t[0] = pm->u.m[1][2] * pm->u.m[3][3] - pm->u.m[1][3] * pm->u.m[3][2];
297  t[1] = pm->u.m[0][2] * pm->u.m[3][3] - pm->u.m[0][3] * pm->u.m[3][2];
298  t[2] = pm->u.m[0][2] * pm->u.m[1][3] - pm->u.m[0][3] * pm->u.m[1][2];
299  v[2] = pm->u.m[0][1] * t[0] - pm->u.m[1][1] * t[1] + pm->u.m[3][1] * t[2];
300  v[6] = -pm->u.m[0][0] * t[0] + pm->u.m[1][0] * t[1] - pm->u.m[3][0] * t[2];
301 
302  t[0] = pm->u.m[0][0] * pm->u.m[1][1] - pm->u.m[1][0] * pm->u.m[0][1];
303  t[1] = pm->u.m[3][0] * pm->u.m[0][1] - pm->u.m[0][0] * pm->u.m[3][1];
304  t[2] = pm->u.m[1][0] * pm->u.m[3][1] - pm->u.m[3][0] * pm->u.m[1][1];
305  v[10] = pm->u.m[3][3] * t[0] + pm->u.m[1][3] * t[1] + pm->u.m[0][3] * t[2];
306  v[14] = -pm->u.m[3][2] * t[0] - pm->u.m[1][2] * t[1] - pm->u.m[0][2] * t[2];
307 
308  t[0] = pm->u.m[1][2] * pm->u.m[2][3] - pm->u.m[1][3] * pm->u.m[2][2];
309  t[1] = pm->u.m[0][2] * pm->u.m[2][3] - pm->u.m[0][3] * pm->u.m[2][2];
310  t[2] = pm->u.m[0][2] * pm->u.m[1][3] - pm->u.m[0][3] * pm->u.m[1][2];
311  v[3] = -pm->u.m[0][1] * t[0] + pm->u.m[1][1] * t[1] - pm->u.m[2][1] * t[2];
312  v[7] = pm->u.m[0][0] * t[0] - pm->u.m[1][0] * t[1] + pm->u.m[2][0] * t[2];
313 
314  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]) +
315  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]) -
316  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]);
317 
318  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]) -
319  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]) +
320  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]);
321 
322  det = 1.0f / det;
323 
324  for (i = 0; i < 4; i++)
325  for (j = 0; j < 4; j++)
326  pout->u.m[i][j] = v[4 * i + j] * det;
327 
328  return pout;
329 }
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 331 of file math.c.

333 {
334  D3DXVECTOR3 right, upn, vec;
335 
336  TRACE("out %p, eye %p, at %p, up %p\n", out, eye, at, up);
337 
338  D3DXVec3Subtract(&vec, at, eye);
340  D3DXVec3Cross(&right, up, &vec);
341  D3DXVec3Cross(&upn, &vec, &right);
343  D3DXVec3Normalize(&upn, &upn);
344  out->u.m[0][0] = right.x;
345  out->u.m[1][0] = right.y;
346  out->u.m[2][0] = right.z;
347  out->u.m[3][0] = -D3DXVec3Dot(&right, eye);
348  out->u.m[0][1] = upn.x;
349  out->u.m[1][1] = upn.y;
350  out->u.m[2][1] = upn.z;
351  out->u.m[3][1] = -D3DXVec3Dot(&upn, eye);
352  out->u.m[0][2] = vec.x;
353  out->u.m[1][2] = vec.y;
354  out->u.m[2][2] = vec.z;
355  out->u.m[3][2] = -D3DXVec3Dot(&vec, eye);
356  out->u.m[0][3] = 0.0f;
357  out->u.m[1][3] = 0.0f;
358  out->u.m[2][3] = 0.0f;
359  out->u.m[3][3] = 1.0f;
360 
361  return out;
362 }
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:1805

Referenced by D3DXMatrixTest().

◆ D3DXMatrixLookAtRH()

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

Definition at line 364 of file math.c.

366 {
367  D3DXVECTOR3 right, upn, vec;
368 
369  TRACE("out %p, eye %p, at %p, up %p\n", out, eye, at, up);
370 
371  D3DXVec3Subtract(&vec, at, eye);
373  D3DXVec3Cross(&right, up, &vec);
374  D3DXVec3Cross(&upn, &vec, &right);
376  D3DXVec3Normalize(&upn, &upn);
377  out->u.m[0][0] = -right.x;
378  out->u.m[1][0] = -right.y;
379  out->u.m[2][0] = -right.z;
380  out->u.m[3][0] = D3DXVec3Dot(&right, eye);
381  out->u.m[0][1] = upn.x;
382  out->u.m[1][1] = upn.y;
383  out->u.m[2][1] = upn.z;
384  out->u.m[3][1] = -D3DXVec3Dot(&upn, eye);
385  out->u.m[0][2] = -vec.x;
386  out->u.m[1][2] = -vec.y;
387  out->u.m[2][2] = -vec.z;
388  out->u.m[3][2] = D3DXVec3Dot(&vec, eye);
389  out->u.m[0][3] = 0.0f;
390  out->u.m[1][3] = 0.0f;
391  out->u.m[2][3] = 0.0f;
392  out->u.m[3][3] = 1.0f;
393 
394  return out;
395 }
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:1805

Referenced by D3DXMatrixTest().

◆ D3DXMatrixMultiply()

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

Definition at line 397 of file math.c.

398 {
399  D3DXMATRIX out;
400  int i,j;
401 
402  TRACE("pout %p, pm1 %p, pm2 %p\n", pout, pm1, pm2);
403 
404  for (i=0; i<4; i++)
405  {
406  for (j=0; j<4; j++)
407  {
408  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];
409  }
410  }
411 
412  *pout = out;
413  return pout;
414 }
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 416 of file math.c.

417 {
419  int i, j;
420 
421  TRACE("pout %p, pm1 %p, pm2 %p\n", pout, pm1, pm2);
422 
423  for (i = 0; i < 4; i++)
424  for (j = 0; j < 4; j++)
425  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];
426 
427  *pout = temp;
428  return pout;
429 }
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 431 of file math.c.

432 {
433  TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
434 
435  D3DXMatrixIdentity(pout);
436  pout->u.m[0][0] = 2.0f / w;
437  pout->u.m[1][1] = 2.0f / h;
438  pout->u.m[2][2] = 1.0f / (zf - zn);
439  pout->u.m[3][2] = zn / (zn - zf);
440  return pout;
441 }
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 443 of file math.c.

444 {
445  TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
446 
447  D3DXMatrixIdentity(pout);
448  pout->u.m[0][0] = 2.0f / (r - l);
449  pout->u.m[1][1] = 2.0f / (t - b);
450  pout->u.m[2][2] = 1.0f / (zf -zn);
451  pout->u.m[3][0] = -1.0f -2.0f *l / (r - l);
452  pout->u.m[3][1] = 1.0f + 2.0f * t / (b - t);
453  pout->u.m[3][2] = zn / (zn -zf);
454  return pout;
455 }
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 457 of file math.c.

458 {
459  TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
460 
461  D3DXMatrixIdentity(pout);
462  pout->u.m[0][0] = 2.0f / (r - l);
463  pout->u.m[1][1] = 2.0f / (t - b);
464  pout->u.m[2][2] = 1.0f / (zn -zf);
465  pout->u.m[3][0] = -1.0f -2.0f *l / (r - l);
466  pout->u.m[3][1] = 1.0f + 2.0f * t / (b - t);
467  pout->u.m[3][2] = zn / (zn -zf);
468  return pout;
469 }
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 471 of file math.c.

472 {
473  TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
474 
475  D3DXMatrixIdentity(pout);
476  pout->u.m[0][0] = 2.0f / w;
477  pout->u.m[1][1] = 2.0f / h;
478  pout->u.m[2][2] = 1.0f / (zn - zf);
479  pout->u.m[3][2] = zn / (zn - zf);
480  return pout;
481 }
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 483 of file math.c.

484 {
485  TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
486 
487  D3DXMatrixIdentity(pout);
488  pout->u.m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f));
489  pout->u.m[1][1] = 1.0f / tanf(fovy/2.0f);
490  pout->u.m[2][2] = zf / (zf - zn);
491  pout->u.m[2][3] = 1.0f;
492  pout->u.m[3][2] = (zf * zn) / (zn - zf);
493  pout->u.m[3][3] = 0.0f;
494  return pout;
495 }
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 497 of file math.c.

498 {
499  TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
500 
501  D3DXMatrixIdentity(pout);
502  pout->u.m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f));
503  pout->u.m[1][1] = 1.0f / tanf(fovy/2.0f);
504  pout->u.m[2][2] = zf / (zn - zf);
505  pout->u.m[2][3] = -1.0f;
506  pout->u.m[3][2] = (zf * zn) / (zn - zf);
507  pout->u.m[3][3] = 0.0f;
508  return pout;
509 }
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 511 of file math.c.

512 {
513  TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
514 
515  D3DXMatrixIdentity(pout);
516  pout->u.m[0][0] = 2.0f * zn / w;
517  pout->u.m[1][1] = 2.0f * zn / h;
518  pout->u.m[2][2] = zf / (zf - zn);
519  pout->u.m[3][2] = (zn * zf) / (zn - zf);
520  pout->u.m[2][3] = 1.0f;
521  pout->u.m[3][3] = 0.0f;
522  return pout;
523 }
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 525 of file math.c.

526 {
527  TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
528 
529  D3DXMatrixIdentity(pout);
530  pout->u.m[0][0] = 2.0f * zn / (r - l);
531  pout->u.m[1][1] = -2.0f * zn / (b - t);
532  pout->u.m[2][0] = -1.0f - 2.0f * l / (r - l);
533  pout->u.m[2][1] = 1.0f + 2.0f * t / (b - t);
534  pout->u.m[2][2] = - zf / (zn - zf);
535  pout->u.m[3][2] = (zn * zf) / (zn -zf);
536  pout->u.m[2][3] = 1.0f;
537  pout->u.m[3][3] = 0.0f;
538  return pout;
539 }
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 541 of file math.c.

542 {
543  TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
544 
545  D3DXMatrixIdentity(pout);
546  pout->u.m[0][0] = 2.0f * zn / (r - l);
547  pout->u.m[1][1] = -2.0f * zn / (b - t);
548  pout->u.m[2][0] = 1.0f + 2.0f * l / (r - l);
549  pout->u.m[2][1] = -1.0f -2.0f * t / (b - t);
550  pout->u.m[2][2] = zf / (zn - zf);
551  pout->u.m[3][2] = (zn * zf) / (zn -zf);
552  pout->u.m[2][3] = -1.0f;
553  pout->u.m[3][3] = 0.0f;
554  return pout;
555 }
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 557 of file math.c.

558 {
559  TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
560 
561  D3DXMatrixIdentity(pout);
562  pout->u.m[0][0] = 2.0f * zn / w;
563  pout->u.m[1][1] = 2.0f * zn / h;
564  pout->u.m[2][2] = zf / (zn - zf);
565  pout->u.m[3][2] = (zn * zf) / (zn - zf);
566  pout->u.m[2][3] = -1.0f;
567  pout->u.m[3][3] = 0.0f;
568  return pout;
569 }
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 571 of file math.c.

572 {
573  D3DXPLANE Nplane;
574 
575  TRACE("pout %p, pplane %p\n", pout, pplane);
576 
577  D3DXPlaneNormalize(&Nplane, pplane);
578  D3DXMatrixIdentity(pout);
579  pout->u.m[0][0] = 1.0f - 2.0f * Nplane.a * Nplane.a;
580  pout->u.m[0][1] = -2.0f * Nplane.a * Nplane.b;
581  pout->u.m[0][2] = -2.0f * Nplane.a * Nplane.c;
582  pout->u.m[1][0] = -2.0f * Nplane.a * Nplane.b;
583  pout->u.m[1][1] = 1.0f - 2.0f * Nplane.b * Nplane.b;
584  pout->u.m[1][2] = -2.0f * Nplane.b * Nplane.c;
585  pout->u.m[2][0] = -2.0f * Nplane.c * Nplane.a;
586  pout->u.m[2][1] = -2.0f * Nplane.c * Nplane.b;
587  pout->u.m[2][2] = 1.0f - 2.0f * Nplane.c * Nplane.c;
588  pout->u.m[3][0] = -2.0f * Nplane.d * Nplane.a;
589  pout->u.m[3][1] = -2.0f * Nplane.d * Nplane.b;
590  pout->u.m[3][2] = -2.0f * Nplane.d * Nplane.c;
591  return pout;
592 }
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:1253
FLOAT a
Definition: d3dx9math.h:221

Referenced by D3DXMatrixTest().

◆ D3DXMatrixRotationAxis()

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

Definition at line 594 of file math.c.

595 {
596  D3DXVECTOR3 nv;
597  FLOAT sangle, cangle, cdiff;
598 
599  TRACE("out %p, v %p, angle %f\n", out, v, angle);
600 
601  D3DXVec3Normalize(&nv, v);
602  sangle = sinf(angle);
603  cangle = cosf(angle);
604  cdiff = 1.0f - cangle;
605 
606  out->u.m[0][0] = cdiff * nv.x * nv.x + cangle;
607  out->u.m[1][0] = cdiff * nv.x * nv.y - sangle * nv.z;
608  out->u.m[2][0] = cdiff * nv.x * nv.z + sangle * nv.y;
609  out->u.m[3][0] = 0.0f;
610  out->u.m[0][1] = cdiff * nv.y * nv.x + sangle * nv.z;
611  out->u.m[1][1] = cdiff * nv.y * nv.y + cangle;
612  out->u.m[2][1] = cdiff * nv.y * nv.z - sangle * nv.x;
613  out->u.m[3][1] = 0.0f;
614  out->u.m[0][2] = cdiff * nv.z * nv.x - sangle * nv.y;
615  out->u.m[1][2] = cdiff * nv.z * nv.y + sangle * nv.x;
616  out->u.m[2][2] = cdiff * nv.z * nv.z + cangle;
617  out->u.m[3][2] = 0.0f;
618  out->u.m[0][3] = 0.0f;
619  out->u.m[1][3] = 0.0f;
620  out->u.m[2][3] = 0.0f;
621  out->u.m[3][3] = 1.0f;
622 
623  return out;
624 }
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:1805

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

◆ D3DXMatrixRotationQuaternion()

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

Definition at line 626 of file math.c.

627 {
628  TRACE("pout %p, pq %p\n", pout, pq);
629 
630  D3DXMatrixIdentity(pout);
631  pout->u.m[0][0] = 1.0f - 2.0f * (pq->y * pq->y + pq->z * pq->z);
632  pout->u.m[0][1] = 2.0f * (pq->x *pq->y + pq->z * pq->w);
633  pout->u.m[0][2] = 2.0f * (pq->x * pq->z - pq->y * pq->w);
634  pout->u.m[1][0] = 2.0f * (pq->x * pq->y - pq->z * pq->w);
635  pout->u.m[1][1] = 1.0f - 2.0f * (pq->x * pq->x + pq->z * pq->z);
636  pout->u.m[1][2] = 2.0f * (pq->y *pq->z + pq->x *pq->w);
637  pout->u.m[2][0] = 2.0f * (pq->x * pq->z + pq->y * pq->w);
638  pout->u.m[2][1] = 2.0f * (pq->y *pq->z - pq->x *pq->w);
639  pout->u.m[2][2] = 1.0f - 2.0f * (pq->x * pq->x + pq->y * pq->y);
640  return pout;
641 }
#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 643 of file math.c.

644 {
645  TRACE("pout %p, angle %f\n", pout, angle);
646 
647  D3DXMatrixIdentity(pout);
648  pout->u.m[1][1] = cosf(angle);
649  pout->u.m[2][2] = cosf(angle);
650  pout->u.m[1][2] = sinf(angle);
651  pout->u.m[2][1] = -sinf(angle);
652  return pout;
653 }
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 655 of file math.c.

656 {
657  TRACE("pout %p, angle %f\n", pout, angle);
658 
659  D3DXMatrixIdentity(pout);
660  pout->u.m[0][0] = cosf(angle);
661  pout->u.m[2][2] = cosf(angle);
662  pout->u.m[0][2] = -sinf(angle);
663  pout->u.m[2][0] = sinf(angle);
664  return pout;
665 }
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 667 of file math.c.

668 {
669  FLOAT sroll, croll, spitch, cpitch, syaw, cyaw;
670 
671  TRACE("out %p, yaw %f, pitch %f, roll %f\n", out, yaw, pitch, roll);
672 
673  sroll = sinf(roll);
674  croll = cosf(roll);
675  spitch = sinf(pitch);
676  cpitch = cosf(pitch);
677  syaw = sinf(yaw);
678  cyaw = cosf(yaw);
679 
680  out->u.m[0][0] = sroll * spitch * syaw + croll * cyaw;
681  out->u.m[0][1] = sroll * cpitch;
682  out->u.m[0][2] = sroll * spitch * cyaw - croll * syaw;
683  out->u.m[0][3] = 0.0f;
684  out->u.m[1][0] = croll * spitch * syaw - sroll * cyaw;
685  out->u.m[1][1] = croll * cpitch;
686  out->u.m[1][2] = croll * spitch * cyaw + sroll * syaw;
687  out->u.m[1][3] = 0.0f;
688  out->u.m[2][0] = cpitch * syaw;
689  out->u.m[2][1] = -spitch;
690  out->u.m[2][2] = cpitch * cyaw;
691  out->u.m[2][3] = 0.0f;
692  out->u.m[3][0] = 0.0f;
693  out->u.m[3][1] = 0.0f;
694  out->u.m[3][2] = 0.0f;
695  out->u.m[3][3] = 1.0f;
696 
697  return out;
698 }
#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 700 of file math.c.

701 {
702  TRACE("pout %p, angle %f\n", pout, angle);
703 
704  D3DXMatrixIdentity(pout);
705  pout->u.m[0][0] = cosf(angle);
706  pout->u.m[1][1] = cosf(angle);
707  pout->u.m[0][1] = sinf(angle);
708  pout->u.m[1][0] = -sinf(angle);
709  return pout;
710 }
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 712 of file math.c.

713 {
714  TRACE("pout %p, sx %f, sy %f, sz %f\n", pout, sx, sy, sz);
715 
716  D3DXMatrixIdentity(pout);
717  pout->u.m[0][0] = sx;
718  pout->u.m[1][1] = sy;
719  pout->u.m[2][2] = sz;
720  return pout;
721 }
#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 723 of file math.c.

724 {
725  D3DXPLANE Nplane;
726  FLOAT dot;
727 
728  TRACE("pout %p, plight %p, pplane %p\n", pout, plight, pplane);
729 
730  D3DXPlaneNormalize(&Nplane, pplane);
731  dot = D3DXPlaneDot(&Nplane, plight);
732  pout->u.m[0][0] = dot - Nplane.a * plight->x;
733  pout->u.m[0][1] = -Nplane.a * plight->y;
734  pout->u.m[0][2] = -Nplane.a * plight->z;
735  pout->u.m[0][3] = -Nplane.a * plight->w;
736  pout->u.m[1][0] = -Nplane.b * plight->x;
737  pout->u.m[1][1] = dot - Nplane.b * plight->y;
738  pout->u.m[1][2] = -Nplane.b * plight->z;
739  pout->u.m[1][3] = -Nplane.b * plight->w;
740  pout->u.m[2][0] = -Nplane.c * plight->x;
741  pout->u.m[2][1] = -Nplane.c * plight->y;
742  pout->u.m[2][2] = dot - Nplane.c * plight->z;
743  pout->u.m[2][3] = -Nplane.c * plight->w;
744  pout->u.m[3][0] = -Nplane.d * plight->x;
745  pout->u.m[3][1] = -Nplane.d * plight->y;
746  pout->u.m[3][2] = -Nplane.d * plight->z;
747  pout->u.m[3][3] = dot - Nplane.d * plight->w;
748  return pout;
749 }
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:1253
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 751 of file math.c.

755 {
756  static const D3DXVECTOR3 zero_vector;
757  D3DXMATRIX m1, msr1, ms, msr, msc, mrc1, mr, mrc, mt;
758  D3DXVECTOR3 sc, rc;
760 
761  TRACE("out %p, scaling_center %p, scaling_rotation %p, scaling %p, rotation_center %p,"
762  " rotation %p, translation %p.\n",
763  out, scaling_center, scaling_rotation, scaling, rotation_center, rotation, translation);
764 
765  if (scaling)
766  {
767  sc = scaling_center ? *scaling_center : zero_vector;
768  D3DXMatrixTranslation(&m1, -sc.x, -sc.y, -sc.z);
769  if (scaling_rotation)
770  {
771  q.x = -scaling_rotation->x;
772  q.y = -scaling_rotation->y;
773  q.z = -scaling_rotation->z;
774  q.w = scaling_rotation->w;
776  D3DXMatrixMultiply(&m1, &m1, &msr1);
777  }
778  D3DXMatrixScaling(&ms, scaling->x, scaling->y, scaling->z);
779  D3DXMatrixMultiply(&m1, &m1, &ms);
780  if (scaling_rotation)
781  {
782  D3DXMatrixRotationQuaternion(&msr, scaling_rotation);
783  D3DXMatrixMultiply(&m1, &m1, &msr);
784  }
785  D3DXMatrixTranslation(&msc, sc.x, sc.y, sc.z);
786  D3DXMatrixMultiply(&m1, &m1, &msc);
787  }
788  else
789  {
790  D3DXMatrixIdentity(&m1);
791  }
792 
793  if (rotation)
794  {
795  rc = rotation_center ? *rotation_center : zero_vector;
796  D3DXMatrixTranslation(&mrc1, -rc.x, -rc.y, -rc.z);
797  D3DXMatrixMultiply(&m1, &m1, &mrc1);
798  D3DXMatrixRotationQuaternion(&mr, rotation);
799  D3DXMatrixMultiply(&m1, &m1, &mr);
800  D3DXMatrixTranslation(&mrc, rc.x, rc.y, rc.z);
801  D3DXMatrixMultiply(&m1, &m1, &mrc);
802  }
803 
804  if (translation)
805  {
806  D3DXMatrixTranslation(&mt, translation->x, translation->y, translation->z);
807  D3DXMatrixMultiply(out, &m1, &mt);
808  }
809  else
810  {
811  *out = m1;
812  }
813 
814  return out;
815 }
D3DXMATRIX *WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z)
Definition: math.c:866
D3DXMATRIX *WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
Definition: math.c:397
#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:712
D3DXMATRIX *WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, const D3DXQUATERNION *pq)
Definition: math.c:626

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 827 of file math.c.

830 {
831  D3DXVECTOR3 r_c, s, s_c, t;
832  D3DXQUATERNION r, s_r;
833 
834  TRACE("out %p, scaling_center %p, scaling_rotation %.8e, scaling %p, rotation_center %p, "
835  "rotation %.8e, translation %p.\n",
836  out, scaling_center, scaling_rotation, scaling, rotation_center, rotation, translation);
837 
838  vec3_from_vec2(&s_c, scaling_center);
839  vec3_from_vec2(&s, scaling);
840  if (scaling)
841  s.z = 1.0f;
842  vec3_from_vec2(&r_c, rotation_center);
843  vec3_from_vec2(&t, translation);
844 
845  if (rotation)
846  {
847  r.w = cosf(rotation / 2.0f);
848  r.x = 0.0f;
849  r.y = 0.0f;
850  r.z = sinf(rotation / 2.0f);
851  }
852 
853  if (scaling_rotation)
854  {
855  s_r.w = cosf(scaling_rotation / 2.0f);
856  s_r.x = 0.0f;
857  s_r.y = 0.0f;
858  s_r.z = sinf(scaling_rotation / 2.0f);
859  }
860 
861  return D3DXMatrixTransformation(out, scaling_center ? &s_c : NULL,
862  scaling_rotation ? &s_r : NULL, scaling ? &s : NULL, rotation_center ? &r_c: NULL,
863  rotation ? &r : NULL, translation ? &t : NULL);
864 }
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:817
#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:751
#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 866 of file math.c.

867 {
868  TRACE("pout %p, x %f, y %f, z %f\n", pout, x, y, z);
869 
870  D3DXMatrixIdentity(pout);
871  pout->u.m[3][0] = x;
872  pout->u.m[3][1] = y;
873  pout->u.m[3][2] = z;
874  return pout;
875 }
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 877 of file math.c.

878 {
879  const D3DXMATRIX m = *pm;
880  int i,j;
881 
882  TRACE("pout %p, pm %p\n", pout, pm);
883 
884  for (i=0; i<4; i++)
885  for (j=0; j<4; j++) pout->u.m[i][j] = m.u.m[j][i];
886 
887  return pout;
888 }
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 1204 of file math.c.

1205 {
1206  TRACE("pout %p, pvpoint %p, pvnormal %p\n", pout, pvpoint, pvnormal);
1207 
1208  pout->a = pvnormal->x;
1209  pout->b = pvnormal->y;
1210  pout->c = pvnormal->z;
1211  pout->d = -D3DXVec3Dot(pvpoint, pvnormal);
1212  return pout;
1213 }
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 1215 of file math.c.

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

Referenced by D3DXPlaneTest().

◆ D3DXPlaneIntersectLine()

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

Definition at line 1231 of file math.c.

1232 {
1233  D3DXVECTOR3 direction, normal;
1234  FLOAT dot, temp;
1235 
1236  TRACE("pout %p, pp %p, pv1 %p, pv2 %p\n", pout, pp, pv1, pv2);
1237 
1238  normal.x = pp->a;
1239  normal.y = pp->b;
1240  normal.z = pp->c;
1241  direction.x = pv2->x - pv1->x;
1242  direction.y = pv2->y - pv1->y;
1243  direction.z = pv2->z - pv1->z;
1244  dot = D3DXVec3Dot(&normal, &direction);
1245  if ( !dot ) return NULL;
1246  temp = ( pp->d + D3DXVec3Dot(&normal, pv1) ) / dot;
1247  pout->x = pv1->x - temp * direction.x;
1248  pout->y = pv1->y - temp * direction.y;
1249  pout->z = pv1->z - temp * direction.z;
1250  return pout;
1251 }
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
static calc_node_t temp
Definition: rpn_ieee.c:38
#define NULL
Definition: types.h:112
float FLOAT
Definition: typedefs.h:69
FLOAT a
Definition: d3dx9math.h:221

Referenced by D3DXPlaneTest().

◆ D3DXPlaneNormalize()

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

Definition at line 1253 of file math.c.

1254 {
1255  FLOAT norm;
1256 
1257  TRACE("out %p, p %p\n", out, p);
1258 
1259  norm = sqrtf(p->a * p->a + p->b * p->b + p->c * p->c);
1260  if (norm)
1261  {
1262  out->a = p->a / norm;
1263  out->b = p->b / norm;
1264  out->c = p->c / norm;
1265  out->d = p->d / norm;
1266  }
1267  else
1268  {
1269  out->a = 0.0f;
1270  out->b = 0.0f;
1271  out->c = 0.0f;
1272  out->d = 0.0f;
1273  }
1274 
1275  return out;
1276 }
_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 1278 of file math.c.

1279 {
1280  const D3DXPLANE plane = *pplane;
1281 
1282  TRACE("pout %p, pplane %p, pm %p\n", pout, pplane, pm);
1283 
1284  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;
1285  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;
1286  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;
1287  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;
1288  return pout;
1289 }
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 1291 of file math.c.

1292 {
1293  UINT i;
1294 
1295  TRACE("out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n", out, outstride, in, instride, matrix, elements);
1296 
1297  for (i = 0; i < elements; ++i) {
1299  (D3DXPLANE*)((char*)out + outstride * i),
1300  (const D3DXPLANE*)((const char*)in + instride * i),
1301  matrix);
1302  }
1303  return out;
1304 }
GLuint GLenum matrix
Definition: glext.h:9407
D3DXPLANE *WINAPI D3DXPlaneTransform(D3DXPLANE *pout, const D3DXPLANE *pplane, const D3DXMATRIX *pm)
Definition: math.c:1278
#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 1308 of file math.c.

1309 {
1310  D3DXQUATERNION temp1, temp2;
1311 
1312  TRACE("pout %p, pq1 %p, pq2 %p, pq3 %p, f %f, g %f\n", pout, pq1, pq2, pq3, f, g);
1313 
1314  D3DXQuaternionSlerp(pout, D3DXQuaternionSlerp(&temp1, pq1, pq2, f + g), D3DXQuaternionSlerp(&temp2, pq1, pq3, f+g), g / (f + g));
1315  return pout;
1316 }
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:1500

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionExp()

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

Definition at line 1318 of file math.c.

1319 {
1320  FLOAT norm;
1321 
1322  TRACE("out %p, q %p\n", out, q);
1323 
1324  norm = sqrtf(q->x * q->x + q->y * q->y + q->z * q->z);
1325  if (norm)
1326  {
1327  out->x = sinf(norm) * q->x / norm;
1328  out->y = sinf(norm) * q->y / norm;
1329  out->z = sinf(norm) * q->z / norm;
1330  out->w = cosf(norm);
1331  }
1332  else
1333  {
1334  out->x = 0.0f;
1335  out->y = 0.0f;
1336  out->z = 0.0f;
1337  out->w = 1.0f;
1338  }
1339 
1340  return out;
1341 }
_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 1343 of file math.c.

1344 {
1345  FLOAT norm;
1346 
1347  TRACE("pout %p, pq %p\n", pout, pq);
1348 
1349  norm = D3DXQuaternionLengthSq(pq);
1350 
1351  pout->x = -pq->x / norm;
1352  pout->y = -pq->y / norm;
1353  pout->z = -pq->z / norm;
1354  pout->w = pq->w / norm;
1355  return pout;
1356 }
_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 1358 of file math.c.

1359 {
1360  FLOAT t;
1361 
1362  TRACE("out %p, q %p\n", out, q);
1363 
1364  if ((q->w >= 1.0f) || (q->w == -1.0f))
1365  t = 1.0f;
1366  else
1367  t = acosf(q->w) / sqrtf(1.0f - q->w * q->w);
1368 
1369  out->x = t * q->x;
1370  out->y = t * q->y;
1371  out->z = t * q->z;
1372  out->w = 0.0f;
1373 
1374  return out;
1375 }
_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 1377 of file math.c.

1378 {
1380 
1381  TRACE("pout %p, pq1 %p, pq2 %p\n", pout, pq1, pq2);
1382 
1383  out.x = pq2->w * pq1->x + pq2->x * pq1->w + pq2->y * pq1->z - pq2->z * pq1->y;
1384  out.y = pq2->w * pq1->y - pq2->x * pq1->z + pq2->y * pq1->w + pq2->z * pq1->x;
1385  out.z = pq2->w * pq1->z + pq2->x * pq1->y - pq2->y * pq1->x + pq2->z * pq1->w;
1386  out.w = pq2->w * pq1->w - pq2->x * pq1->x - pq2->y * pq1->y - pq2->z * pq1->z;
1387  *pout = out;
1388  return pout;
1389 }
#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 1391 of file math.c.

1392 {
1393  FLOAT norm;
1394 
1395  TRACE("out %p, q %p\n", out, q);
1396 
1397  norm = D3DXQuaternionLength(q);
1398 
1399  out->x = q->x / norm;
1400  out->y = q->y / norm;
1401  out->z = q->z / norm;
1402  out->w = q->w / norm;
1403 
1404  return out;
1405 }
_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 1407 of file math.c.

1408 {
1409  D3DXVECTOR3 temp;
1410 
1411  TRACE("out %p, v %p, angle %f\n", out, v, angle);
1412 
1414 
1415  out->x = sinf(angle / 2.0f) * temp.x;
1416  out->y = sinf(angle / 2.0f) * temp.y;
1417  out->z = sinf(angle / 2.0f) * temp.z;
1418  out->w = cosf(angle / 2.0f);
1419 
1420  return out;
1421 }
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:1805

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionRotationMatrix()

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

Definition at line 1423 of file math.c.

1424 {
1425  FLOAT s, trace;
1426 
1427  TRACE("out %p, m %p\n", out, m);
1428 
1429  trace = m->u.m[0][0] + m->u.m[1][1] + m->u.m[2][2] + 1.0f;
1430  if (trace > 1.0f)
1431  {
1432  s = 2.0f * sqrtf(trace);
1433  out->x = (m->u.m[1][2] - m->u.m[2][1]) / s;
1434  out->y = (m->u.m[2][0] - m->u.m[0][2]) / s;
1435  out->z = (m->u.m[0][1] - m->u.m[1][0]) / s;
1436  out->w = 0.25f * s;
1437  }
1438  else
1439  {
1440  int i, maxi = 0;
1441 
1442  for (i = 1; i < 3; i++)
1443  {
1444  if (m->u.m[i][i] > m->u.m[maxi][maxi])
1445  maxi = i;
1446  }
1447 
1448  switch (maxi)
1449  {
1450  case 0:
1451  s = 2.0f * sqrtf(1.0f + m->u.m[0][0] - m->u.m[1][1] - m->u.m[2][2]);
1452  out->x = 0.25f * s;
1453  out->y = (m->u.m[0][1] + m->u.m[1][0]) / s;
1454  out->z = (m->u.m[0][2] + m->u.m[2][0]) / s;
1455  out->w = (m->u.m[1][2] - m->u.m[2][1]) / s;
1456  break;
1457 
1458  case 1:
1459  s = 2.0f * sqrtf(1.0f + m->u.m[1][1] - m->u.m[0][0] - m->u.m[2][2]);
1460  out->x = (m->u.m[0][1] + m->u.m[1][0]) / s;
1461  out->y = 0.25f * s;
1462  out->z = (m->u.m[1][2] + m->u.m[2][1]) / s;
1463  out->w = (m->u.m[2][0] - m->u.m[0][2]) / s;
1464  break;
1465 
1466  case 2:
1467  s = 2.0f * sqrtf(1.0f + m->u.m[2][2] - m->u.m[0][0] - m->u.m[1][1]);
1468  out->x = (m->u.m[0][2] + m->u.m[2][0]) / s;
1469  out->y = (m->u.m[1][2] + m->u.m[2][1]) / s;
1470  out->z = 0.25f * s;
1471  out->w = (m->u.m[0][1] - m->u.m[1][0]) / s;
1472  break;
1473  }
1474  }
1475 
1476  return out;
1477 }
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 1479 of file math.c.

1480 {
1481  FLOAT syaw, cyaw, spitch, cpitch, sroll, croll;
1482 
1483  TRACE("out %p, yaw %f, pitch %f, roll %f\n", out, yaw, pitch, roll);
1484 
1485  syaw = sinf(yaw / 2.0f);
1486  cyaw = cosf(yaw / 2.0f);
1487  spitch = sinf(pitch / 2.0f);
1488  cpitch = cosf(pitch / 2.0f);
1489  sroll = sinf(roll / 2.0f);
1490  croll = cosf(roll / 2.0f);
1491 
1492  out->x = syaw * cpitch * sroll + cyaw * spitch * croll;
1493  out->y = syaw * cpitch * croll - cyaw * spitch * sroll;
1494  out->z = cyaw * cpitch * sroll - syaw * spitch * croll;
1495  out->w = cyaw * cpitch * croll + syaw * spitch * sroll;
1496 
1497  return out;
1498 }
#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 1500 of file math.c.

1502 {
1503  FLOAT dot, temp;
1504 
1505  TRACE("out %p, q1 %p, q2 %p, t %f\n", out, q1, q2, t);
1506 
1507  temp = 1.0f - t;
1508  dot = D3DXQuaternionDot(q1, q2);
1509  if (dot < 0.0f)
1510  {
1511  t = -t;
1512  dot = -dot;
1513  }
1514 
1515  if (1.0f - dot > 0.001f)
1516  {
1517  FLOAT theta = acosf(dot);
1518 
1519  temp = sinf(theta * temp) / sinf(theta);
1520  t = sinf(theta * t) / sinf(theta);
1521  }
1522 
1523  out->x = temp * q1->x + t * q2->x;
1524  out->y = temp * q1->y + t * q2->y;
1525  out->z = temp * q1->z + t * q2->z;
1526  out->w = temp * q1->w + t * q2->w;
1527 
1528  return out;
1529 }
_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 1531 of file math.c.

1532 {
1533  D3DXQUATERNION temp1, temp2;
1534 
1535  TRACE("pout %p, pq1 %p, pq2 %p, pq3 %p, pq4 %p, t %f\n", pout, pq1, pq2, pq3, pq4, t);
1536 
1537  D3DXQuaternionSlerp(pout, D3DXQuaternionSlerp(&temp1, pq1, pq4, t), D3DXQuaternionSlerp(&temp2, pq2, pq3, t), 2.0f * t * (1.0f - t));
1538  return pout;
1539 }
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:1500

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 1553 of file math.c.

1554 {
1555  D3DXQUATERNION q, temp1, temp2, temp3, zero;
1556  D3DXQUATERNION aout, cout;
1557 
1558  TRACE("paout %p, pbout %p, pcout %p, pq0 %p, pq1 %p, pq2 %p, pq3 %p\n", paout, pbout, pcout, pq0, pq1, pq2, pq3);
1559 
1560  zero.x = 0.0f;
1561  zero.y = 0.0f;
1562  zero.z = 0.0f;
1563  zero.w = 0.0f;
1564 
1565  if (D3DXQuaternionDot(pq0, pq1) < 0.0f)
1566  temp2 = add_diff(&zero, pq0, -1.0f);
1567  else
1568  temp2 = *pq0;
1569 
1570  if (D3DXQuaternionDot(pq1, pq2) < 0.0f)
1571  cout = add_diff(&zero, pq2, -1.0f);
1572  else
1573  cout = *pq2;
1574 
1575  if (D3DXQuaternionDot(&cout, pq3) < 0.0f)
1576  temp3 = add_diff(&zero, pq3, -1.0f);
1577  else
1578  temp3 = *pq3;
1579 
1580  D3DXQuaternionInverse(&temp1, pq1);
1581  D3DXQuaternionMultiply(&temp2, &temp1, &temp2);
1582  D3DXQuaternionLn(&temp2, &temp2);
1583  D3DXQuaternionMultiply(&q, &temp1, &cout);
1584  D3DXQuaternionLn(&q, &q);
1585  temp1 = add_diff(&temp2, &q, 1.0f);
1586  temp1.x *= -0.25f;
1587  temp1.y *= -0.25f;
1588  temp1.z *= -0.25f;
1589  temp1.w *= -0.25f;
1590  D3DXQuaternionExp(&temp1, &temp1);
1591  D3DXQuaternionMultiply(&aout, pq1, &temp1);
1592 
1593  D3DXQuaternionInverse(&temp1, &cout);
1594  D3DXQuaternionMultiply(&temp2, &temp1, pq1);
1595  D3DXQuaternionLn(&temp2, &temp2);
1596  D3DXQuaternionMultiply(&q, &temp1, &temp3);
1597  D3DXQuaternionLn(&q, &q);
1598  temp1 = add_diff(&temp2, &q, 1.0f);
1599  temp1.x *= -0.25f;
1600  temp1.y *= -0.25f;
1601  temp1.z *= -0.25f;
1602  temp1.w *= -0.25f;
1603  D3DXQuaternionExp(&temp1, &temp1);
1604  D3DXQuaternionMultiply(pbout, &cout, &temp1);
1605  *paout = aout;
1606  *pcout = cout;
1607 }
static D3DXQUATERNION add_diff(const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, const FLOAT add)
Definition: math.c:1541
#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:1343
D3DXQUATERNION *WINAPI D3DXQuaternionLn(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1358
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
D3DXQUATERNION *WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2)
Definition: math.c:1377
D3DXQUATERNION *WINAPI D3DXQuaternionExp(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1318

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionToAxisAngle()

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

Definition at line 1609 of file math.c.

1610 {
1611  TRACE("pq %p, paxis %p, pangle %p\n", pq, paxis, pangle);
1612 
1613  if (paxis)
1614  {
1615  paxis->x = pq->x;
1616  paxis->y = pq->y;
1617  paxis->z = pq->z;
1618  }
1619  if (pangle)
1620  *pangle = 2.0f * acosf(pq->w);
1621 }
_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 2237 of file math.c.

2238 {
2239  UINT i;
2240 
2241  TRACE("out %p, order %u, a %p, b %p\n", out, order, a, b);
2242 
2243  for (i = 0; i < order * order; i++)
2244  out[i] = a[i] + b[i];
2245 
2246  return out;
2247 }
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 2249 of file math.c.

2250 {
2251  FLOAT s;
2252  UINT i;
2253 
2254  TRACE("order %u, a %p, b %p\n", order, a, b);
2255 
2256  s = a[0] * b[0];
2257  for (i = 1; i < order * order; i++)
2258  s += a[i] * b[i];
2259 
2260  return s;
2261 }
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 2292 of file math.c.

2294 {
2295  FLOAT cap[6], clamped_angle, norm, scale, temp;
2296  UINT i, index, j;
2297 
2298  TRACE("order %u, dir %p, radius %f, red %f, green %f, blue %f, rout %p, gout %p, bout %p\n",
2299  order, dir, radius, Rintensity, Gintensity, Bintensity, rout, gout, bout);
2300 
2301  if (radius <= 0.0f)
2302  return D3DXSHEvalDirectionalLight(order, dir, Rintensity, Gintensity, Bintensity, rout, gout, bout);
2303 
2304  clamped_angle = (radius > D3DX_PI / 2.0f) ? (D3DX_PI / 2.0f) : radius;
2305  norm = sinf(clamped_angle) * sinf(clamped_angle);
2306 
2307  if (order > D3DXSH_MAXORDER)
2308  {
2309  WARN("Order clamped at D3DXSH_MAXORDER\n");
2311  }
2312 
2313  weightedcapintegrale(cap, order, radius);
2314  D3DXSHEvalDirection(rout, order, dir);
2315 
2316  for (i = 0; i < order; i++)
2317  {
2318  scale = cap[i] / norm;
2319 
2320  for (j = 0; j < 2 * i + 1; j++)
2321  {
2322  index = i * i + j;
2323  temp = rout[index] * scale;
2324 
2325  rout[index] = temp * Rintensity;
2326  if (gout)
2327  gout[index] = temp * Gintensity;
2328  if (bout)
2329  bout[index] = temp * Bintensity;
2330  }
2331  }
2332 
2333  return D3D_OK;
2334 }
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:2406
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:2336
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:2263
#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 2336 of file math.c.

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

2407 {
2408  FLOAT s, temp;
2409  UINT j;
2410 
2411  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);
2412 
2413  s = 0.75f;
2414  if ( order > 2 )
2415  s += 5.0f / 16.0f;
2416  if ( order > 4 )
2417  s -= 3.0f / 32.0f;
2418  s /= D3DX_PI;
2419 
2420  D3DXSHEvalDirection(Rout, order, dir);
2421  for (j = 0; j < order * order; j++)
2422  {
2423  temp = Rout[j] / s;
2424 
2425  Rout[j] = Rintensity * temp;
2426  if ( Gout )
2427  Gout[j] = Gintensity * temp;
2428  if ( Bout )
2429  Bout[j] = Bintensity * temp;
2430  }
2431 
2432  return D3D_OK;
2433 }
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
FLOAT *WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir)
Definition: math.c:2336
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 2435 of file math.c.

2437 {
2438  FLOAT a[2], temp[4];
2439  UINT i, j;
2440 
2441  TRACE("order %u, dir %p, rout %p, gout %p, bout %p\n", order, dir, rout, gout, bout);
2442 
2444 
2445  a[0] = (top.r + bottom.r) * 3.0f * D3DX_PI;
2446  a[1] = (top.r - bottom.r) * D3DX_PI;
2447  for (i = 0; i < order; i++)
2448  for (j = 0; j < 2 * i + 1; j++)
2449  if (i < 2)
2450  rout[i * i + j] = temp[i * i + j] * a[i];
2451  else
2452  rout[i * i + j] = 0.0f;
2453 
2454  if (gout)
2455  {
2456  a[0] = (top.g + bottom.g) * 3.0f * D3DX_PI;
2457  a[1] = (top.g - bottom.g) * D3DX_PI;
2458  for (i = 0; i < order; i++)
2459  for (j = 0; j < 2 * i + 1; j++)
2460  if (i < 2)
2461  gout[i * i + j] = temp[i * i + j] * a[i];
2462  else
2463  gout[i * i + j] = 0.0f;
2464  }
2465 
2466  if (bout)
2467  {
2468  a[0] = (top.b + bottom.b) * 3.0f * D3DX_PI;
2469  a[1] = (top.b - bottom.b) * D3DX_PI;
2470  for (i = 0; i < order; i++)
2471  for (j = 0; j < 2 * i + 1; j++)
2472  if (i < 2)
2473  bout[i * i + j] = temp[i * i + j] * a[i];
2474  else
2475  bout[i * i + j] = 0.0f;
2476  }
2477 
2478  return D3D_OK;
2479 }
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
FLOAT *WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir)
Definition: math.c:2336
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 2481 of file math.c.

2483 {
2485  FLOAT cap[6], clamped_angle, dist, temp;
2486  UINT i, index, j;
2487 
2488  TRACE("order %u, dir %p, radius %f, red %f, green %f, blue %f, rout %p, gout %p, bout %p\n",
2489  order, dir, radius, Rintensity, Gintensity, Bintensity, rout, gout, bout);
2490 
2491  if (order > D3DXSH_MAXORDER)
2492  {
2493  WARN("Order clamped at D3DXSH_MAXORDER\n");
2495  }
2496 
2497  if (radius < 0.0f)
2498  radius = -radius;
2499 
2500  dist = D3DXVec3Length(dir);
2501  clamped_angle = (dist <= radius) ? D3DX_PI / 2.0f : asinf(radius / dist);
2502 
2503  weightedcapintegrale(cap, order, clamped_angle);
2505  D3DXSHEvalDirection(rout, order, &normal);
2506 
2507  for (i = 0; i < order; i++)
2508  for (j = 0; j < 2 * i + 1; j++)
2509  {
2510  index = i * i + j;
2511  temp = rout[index] * cap[i];
2512 
2513  rout[index] = temp * Rintensity;
2514  if (gout)
2515  gout[index] = temp * Gintensity;
2516  if (bout)
2517  bout[index] = temp * Bintensity;
2518  }
2519 
2520  return D3D_OK;
2521 }
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:2336
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:2263
#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:1805

Referenced by test_D3DXSHEvalSphericalLight().

◆ D3DXSHMultiply2()

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

Definition at line 2523 of file math.c.

2524 {
2525  FLOAT ta, tb;
2526 
2527  TRACE("out %p, a %p, b %p\n", out, a, b);
2528 
2529  ta = 0.28209479f * a[0];
2530  tb = 0.28209479f * b[0];
2531 
2532  out[0] = 0.28209479f * D3DXSHDot(2, a, b);
2533  out[1] = ta * b[1] + tb * a[1];
2534  out[2] = ta * b[2] + tb * a[2];
2535  out[3] = ta * b[3] + tb * a[3];
2536 
2537  return out;
2538 }
FLOAT WINAPI D3DXSHDot(UINT order, const FLOAT *a, const FLOAT *b)
Definition: math.c:2249
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 2540 of file math.c.

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