ReactOS 0.4.17-dev-934-g091855f
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 D3DXVECTOR2 * LPD3DXVECTOR2
 
typedef struct _D3DVECTOR D3DXVECTOR3
 
typedef struct _D3DVECTOR * LPD3DXVECTOR3
 
typedef struct D3DXVECTOR4 D3DXVECTOR4
 
typedef struct D3DXVECTOR4 * LPD3DXVECTOR4
 
typedef struct _D3DMATRIX D3DXMATRIX
 
typedef struct _D3DMATRIX * LPD3DXMATRIX
 
typedef struct D3DXQUATERNION D3DXQUATERNION
 
typedef struct D3DXQUATERNION * LPD3DXQUATERNION
 
typedef struct D3DXPLANE D3DXPLANE
 
typedef struct D3DXPLANE * LPD3DXPLANE
 
typedef struct D3DXCOLOR D3DXCOLOR
 
typedef struct D3DXCOLOR * LPD3DXCOLOR
 
typedef struct D3DXFLOAT16 D3DXFLOAT16
 
typedef struct D3DXFLOAT16 * LPD3DXFLOAT16
 
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 *texture, FLOAT *red, FLOAT *green, FLOAT *blue)
 
FLOAT *WINAPI D3DXSHRotate (FLOAT *out, UINT order, const D3DXMATRIX *matrix, const FLOAT *in)
 
FLOAT *WINAPI D3DXSHRotateZ (FLOAT *out, UINT order, FLOAT angle, const FLOAT *in)
 
FLOAT *WINAPI D3DXSHScale (FLOAT *out, UINT order, const FLOAT *a, const FLOAT scale)
 
 DEFINE_GUID (IID_ID3DXMatrixStack, 0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85)
 
 DECLARE_INTERFACE_ (ID3DXMatrixStack, IUnknown)
 
HRESULT WINAPI D3DXCreateMatrixStack (DWORD flags, ID3DXMatrixStack **stack)
 

Macro Definition Documentation

◆ D3DX_1BYPI

#define D3DX_1BYPI   ((FLOAT)0.318309886)

Definition at line 28 of file d3dx9math.h.

◆ D3DX_PI

#define D3DX_PI   ((FLOAT)3.141592654)

Definition at line 27 of file d3dx9math.h.

◆ D3DXSH_MAXORDER

#define D3DXSH_MAXORDER   6

Definition at line 31 of file d3dx9math.h.

◆ D3DXSH_MINORDER

#define D3DXSH_MINORDER   2

Definition at line 30 of file d3dx9math.h.

◆ D3DXToDegree

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

Definition at line 34 of file d3dx9math.h.

◆ D3DXToRadian

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

Definition at line 33 of file d3dx9math.h.

◆ ID3DXMatrixStack_AddRef

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

Definition at line 443 of file d3dx9math.h.

◆ ID3DXMatrixStack_GetTop

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

Definition at line 459 of file d3dx9math.h.

◆ ID3DXMatrixStack_LoadIdentity

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

Definition at line 447 of file d3dx9math.h.

◆ ID3DXMatrixStack_LoadMatrix

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

Definition at line 448 of file d3dx9math.h.

◆ ID3DXMatrixStack_MultMatrix

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

Definition at line 449 of file d3dx9math.h.

◆ ID3DXMatrixStack_MultMatrixLocal

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

Definition at line 450 of file d3dx9math.h.

◆ ID3DXMatrixStack_Pop

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

Definition at line 445 of file d3dx9math.h.

◆ ID3DXMatrixStack_Push

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

Definition at line 446 of file d3dx9math.h.

◆ ID3DXMatrixStack_QueryInterface

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

Definition at line 442 of file d3dx9math.h.

◆ ID3DXMatrixStack_Release

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

Definition at line 444 of file d3dx9math.h.

◆ ID3DXMatrixStack_RotateAxis

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

Definition at line 451 of file d3dx9math.h.

◆ ID3DXMatrixStack_RotateAxisLocal

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

Definition at line 452 of file d3dx9math.h.

◆ ID3DXMatrixStack_RotateYawPitchRoll

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

Definition at line 453 of file d3dx9math.h.

◆ ID3DXMatrixStack_RotateYawPitchRollLocal

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

Definition at line 454 of file d3dx9math.h.

◆ ID3DXMatrixStack_Scale

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

Definition at line 455 of file d3dx9math.h.

◆ ID3DXMatrixStack_ScaleLocal

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

Definition at line 456 of file d3dx9math.h.

◆ ID3DXMatrixStack_Translate

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

Definition at line 457 of file d3dx9math.h.

◆ ID3DXMatrixStack_TranslateLocal

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

Definition at line 458 of file d3dx9math.h.

◆ INTERFACE

#define INTERFACE   ID3DXMatrixStack

Definition at line 414 of file d3dx9math.h.

Typedef Documentation

◆ D3DXCOLOR

◆ D3DXFLOAT16

◆ D3DXMATRIX

Definition at line 169 of file d3dx9math.h.

◆ D3DXPLANE

◆ D3DXQUATERNION

◆ D3DXVECTOR2

◆ D3DXVECTOR3

Definition at line 97 of file d3dx9math.h.

◆ D3DXVECTOR4

◆ LPD3DXCOLOR

◆ LPD3DXFLOAT16

◆ LPD3DXMATRIX

Definition at line 169 of file d3dx9math.h.

◆ LPD3DXMATRIXSTACK

typedef interface ID3DXMatrixStack* LPD3DXMATRIXSTACK

Definition at line 408 of file d3dx9math.h.

◆ LPD3DXPLANE

◆ LPD3DXQUATERNION

◆ LPD3DXVECTOR2

◆ LPD3DXVECTOR3

Definition at line 97 of file d3dx9math.h.

◆ LPD3DXVECTOR4

Function Documentation

◆ D3DXColorAdjustContrast()

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

Definition at line 46 of file math.c.

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

Referenced by D3DXColorTest().

◆ D3DXColorAdjustSaturation()

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

Definition at line 57 of file math.c.

58{
59 FLOAT grey;
60
61 TRACE("pout %p, pc %p, s %f\n", pout, pc, s);
62
63 grey = pc->r * 0.2125f + pc->g * 0.7154f + pc->b * 0.0721f;
64 pout->r = grey + s * (pc->r - grey);
65 pout->g = grey + s * (pc->g - grey);
66 pout->b = grey + s * (pc->b - grey);
67 pout->a = pc->a;
68 return pout;
69}
float 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{
1174
1175 TRACE("flags %#lx, stack %p.\n", flags, stack);
1176
1177 if (!(object = calloc(1, 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 = malloc(INITIAL_STACK_SIZE * sizeof(*object->stack))))
1186 {
1187 free(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}
#define D3D_OK
Definition: d3d.h:106
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
static const ID3DXMatrixStackVtbl ID3DXMatrixStack_Vtbl
Definition: math.c:1149
static const unsigned int INITIAL_STACK_SIZE
Definition: math.c:42
GLbitfield flags
Definition: glext.h:7161
#define calloc
Definition: rosglue.h:14
Definition: format.c:80

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}
float float_16_to_32(const unsigned short in)
Definition: math.c:2203
GLdouble n
Definition: glext.h:7729
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
Definition: pdh_main.c:64

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}
unsigned short float_32_to_16(const float in)
Definition: math.c:2102
WORD value
Definition: d3dx9math.h:277

Referenced by convert_float4(), and test_D3DXFloat_Array().

◆ D3DXFresnelTerm()

FLOAT WINAPI D3DXFresnelTerm ( FLOAT  costheta,
FLOAT  refractionindex 
)

Definition at line 73 of file math.c.

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

Referenced by D3DXFresnelTest().

◆ D3DXMatrixAffineTransformation()

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

Definition at line 90 of file math.c.

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

Referenced by D3DXMatrixTest().

◆ D3DXMatrixAffineTransformation2D()

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

Definition at line 149 of file math.c.

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

Referenced by test_Matrix_AffineTransformation2D().

◆ D3DXMatrixDecompose()

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

Definition at line 187 of file math.c.

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

Referenced by test_Matrix_Decompose().

◆ D3DXMatrixDeterminant()

FLOAT WINAPI D3DXMatrixDeterminant ( const D3DXMATRIX *  pm)

Definition at line 232 of file math.c.

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

Referenced by D3DXMatrixTest().

◆ D3DXMatrixInverse()

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

Definition at line 254 of file math.c.

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

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

◆ D3DXMatrixLookAtLH()

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

Definition at line 327 of file math.c.

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

Referenced by D3DXMatrixTest().

◆ D3DXMatrixLookAtRH()

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

Definition at line 360 of file math.c.

362{
363 D3DXVECTOR3 right, upn, vec;
364
365 TRACE("out %p, eye %p, at %p, up %p\n", out, eye, at, up);
366
367 D3DXVec3Subtract(&vec, at, eye);
369 D3DXVec3Cross(&right, up, &vec);
370 D3DXVec3Cross(&upn, &vec, &right);
372 D3DXVec3Normalize(&upn, &upn);
373 out->m[0][0] = -right.x;
374 out->m[1][0] = -right.y;
375 out->m[2][0] = -right.z;
376 out->m[3][0] = D3DXVec3Dot(&right, eye);
377 out->m[0][1] = upn.x;
378 out->m[1][1] = upn.y;
379 out->m[2][1] = upn.z;
380 out->m[3][1] = -D3DXVec3Dot(&upn, eye);
381 out->m[0][2] = -vec.x;
382 out->m[1][2] = -vec.y;
383 out->m[2][2] = -vec.z;
384 out->m[3][2] = D3DXVec3Dot(&vec, eye);
385 out->m[0][3] = 0.0f;
386 out->m[1][3] = 0.0f;
387 out->m[2][3] = 0.0f;
388 out->m[3][3] = 1.0f;
389
390 return out;
391}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixMultiply()

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

Definition at line 393 of file math.c.

394{
396 int i,j;
397
398 TRACE("pout %p, pm1 %p, pm2 %p\n", pout, pm1, pm2);
399
400 for (i=0; i<4; i++)
401 {
402 for (j=0; j<4; j++)
403 {
404 out.m[i][j] = pm1->m[i][0] * pm2->m[0][j] + pm1->m[i][1] * pm2->m[1][j] + pm1->m[i][2] * pm2->m[2][j] + pm1->m[i][3] * pm2->m[3][j];
405 }
406 }
407
408 *pout = out;
409 return pout;
410}
static LPMONITOR2 pm2
Definition: localmon.c:46

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

◆ D3DXMatrixMultiplyTranspose()

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

Definition at line 412 of file math.c.

413{
415 int i, j;
416
417 TRACE("pout %p, pm1 %p, pm2 %p\n", pout, pm1, pm2);
418
419 for (i = 0; i < 4; i++)
420 for (j = 0; j < 4; j++)
421 temp.m[j][i] = pm1->m[i][0] * pm2->m[0][j] + pm1->m[i][1] * pm2->m[1][j] + pm1->m[i][2] * pm2->m[2][j] + pm1->m[i][3] * pm2->m[3][j];
422
423 *pout = temp;
424 return pout;
425}
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by D3DXMatrixTest().

◆ D3DXMatrixOrthoLH()

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

Definition at line 427 of file math.c.

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

Referenced by D3DXMatrixTest().

◆ D3DXMatrixOrthoOffCenterLH()

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

Definition at line 439 of file math.c.

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

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

◆ D3DXMatrixOrthoOffCenterRH()

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

Definition at line 453 of file math.c.

454{
455 TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
456
457 D3DXMatrixIdentity(pout);
458 pout->m[0][0] = 2.0f / (r - l);
459 pout->m[1][1] = 2.0f / (t - b);
460 pout->m[2][2] = 1.0f / (zn -zf);
461 pout->m[3][0] = -1.0f -2.0f *l / (r - l);
462 pout->m[3][1] = 1.0f + 2.0f * t / (b - t);
463 pout->m[3][2] = zn / (zn -zf);
464 return pout;
465}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixOrthoRH()

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

Definition at line 467 of file math.c.

468{
469 TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
470
471 D3DXMatrixIdentity(pout);
472 pout->m[0][0] = 2.0f / w;
473 pout->m[1][1] = 2.0f / h;
474 pout->m[2][2] = 1.0f / (zn - zf);
475 pout->m[3][2] = zn / (zn - zf);
476 return pout;
477}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveFovLH()

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

Definition at line 479 of file math.c.

480{
481 TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
482
483 D3DXMatrixIdentity(pout);
484 pout->m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f));
485 pout->m[1][1] = 1.0f / tanf(fovy/2.0f);
486 pout->m[2][2] = zf / (zf - zn);
487 pout->m[2][3] = 1.0f;
488 pout->m[3][2] = (zf * zn) / (zn - zf);
489 pout->m[3][3] = 0.0f;
490 return pout;
491}
_ACRTIMP float __cdecl tanf(float)
Definition: tanf.c:72

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

◆ D3DXMatrixPerspectiveFovRH()

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

Definition at line 493 of file math.c.

494{
495 TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
496
497 D3DXMatrixIdentity(pout);
498 pout->m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f));
499 pout->m[1][1] = 1.0f / tanf(fovy/2.0f);
500 pout->m[2][2] = zf / (zn - zf);
501 pout->m[2][3] = -1.0f;
502 pout->m[3][2] = (zf * zn) / (zn - zf);
503 pout->m[3][3] = 0.0f;
504 return pout;
505}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveLH()

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

Definition at line 507 of file math.c.

508{
509 TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
510
511 D3DXMatrixIdentity(pout);
512 pout->m[0][0] = 2.0f * zn / w;
513 pout->m[1][1] = 2.0f * zn / h;
514 pout->m[2][2] = zf / (zf - zn);
515 pout->m[3][2] = (zn * zf) / (zn - zf);
516 pout->m[2][3] = 1.0f;
517 pout->m[3][3] = 0.0f;
518 return pout;
519}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveOffCenterLH()

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

Definition at line 521 of file math.c.

522{
523 TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
524
525 D3DXMatrixIdentity(pout);
526 pout->m[0][0] = 2.0f * zn / (r - l);
527 pout->m[1][1] = -2.0f * zn / (b - t);
528 pout->m[2][0] = -1.0f - 2.0f * l / (r - l);
529 pout->m[2][1] = 1.0f + 2.0f * t / (b - t);
530 pout->m[2][2] = - zf / (zn - zf);
531 pout->m[3][2] = (zn * zf) / (zn -zf);
532 pout->m[2][3] = 1.0f;
533 pout->m[3][3] = 0.0f;
534 return pout;
535}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveOffCenterRH()

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

Definition at line 537 of file math.c.

538{
539 TRACE("pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout, l, r, b, t, zn, zf);
540
541 D3DXMatrixIdentity(pout);
542 pout->m[0][0] = 2.0f * zn / (r - l);
543 pout->m[1][1] = -2.0f * zn / (b - t);
544 pout->m[2][0] = 1.0f + 2.0f * l / (r - l);
545 pout->m[2][1] = -1.0f -2.0f * t / (b - t);
546 pout->m[2][2] = zf / (zn - zf);
547 pout->m[3][2] = (zn * zf) / (zn -zf);
548 pout->m[2][3] = -1.0f;
549 pout->m[3][3] = 0.0f;
550 return pout;
551}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixPerspectiveRH()

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

Definition at line 553 of file math.c.

554{
555 TRACE("pout %p, w %f, h %f, zn %f, zf %f\n", pout, w, h, zn, zf);
556
557 D3DXMatrixIdentity(pout);
558 pout->m[0][0] = 2.0f * zn / w;
559 pout->m[1][1] = 2.0f * zn / h;
560 pout->m[2][2] = zf / (zn - zf);
561 pout->m[3][2] = (zn * zf) / (zn - zf);
562 pout->m[2][3] = -1.0f;
563 pout->m[3][3] = 0.0f;
564 return pout;
565}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixReflect()

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

Definition at line 567 of file math.c.

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

Referenced by D3DXMatrixTest().

◆ D3DXMatrixRotationAxis()

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

Definition at line 590 of file math.c.

591{
592 D3DXVECTOR3 nv;
593 FLOAT sangle, cangle, cdiff;
594
595 TRACE("out %p, v %p, angle %f\n", out, v, angle);
596
597 D3DXVec3Normalize(&nv, v);
598 sangle = sinf(angle);
599 cangle = cosf(angle);
600 cdiff = 1.0f - cangle;
601
602 out->m[0][0] = cdiff * nv.x * nv.x + cangle;
603 out->m[1][0] = cdiff * nv.x * nv.y - sangle * nv.z;
604 out->m[2][0] = cdiff * nv.x * nv.z + sangle * nv.y;
605 out->m[3][0] = 0.0f;
606 out->m[0][1] = cdiff * nv.y * nv.x + sangle * nv.z;
607 out->m[1][1] = cdiff * nv.y * nv.y + cangle;
608 out->m[2][1] = cdiff * nv.y * nv.z - sangle * nv.x;
609 out->m[3][1] = 0.0f;
610 out->m[0][2] = cdiff * nv.z * nv.x - sangle * nv.y;
611 out->m[1][2] = cdiff * nv.z * nv.y + sangle * nv.x;
612 out->m[2][2] = cdiff * nv.z * nv.z + cangle;
613 out->m[3][2] = 0.0f;
614 out->m[0][3] = 0.0f;
615 out->m[1][3] = 0.0f;
616 out->m[2][3] = 0.0f;
617 out->m[3][3] = 1.0f;
618
619 return out;
620}
GLfloat angle
Definition: glext.h:10853

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

◆ D3DXMatrixRotationQuaternion()

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

Definition at line 622 of file math.c.

623{
624 TRACE("pout %p, pq %p\n", pout, pq);
625
626 D3DXMatrixIdentity(pout);
627 pout->m[0][0] = 1.0f - 2.0f * (pq->y * pq->y + pq->z * pq->z);
628 pout->m[0][1] = 2.0f * (pq->x *pq->y + pq->z * pq->w);
629 pout->m[0][2] = 2.0f * (pq->x * pq->z - pq->y * pq->w);
630 pout->m[1][0] = 2.0f * (pq->x * pq->y - pq->z * pq->w);
631 pout->m[1][1] = 1.0f - 2.0f * (pq->x * pq->x + pq->z * pq->z);
632 pout->m[1][2] = 2.0f * (pq->y *pq->z + pq->x *pq->w);
633 pout->m[2][0] = 2.0f * (pq->x * pq->z + pq->y * pq->w);
634 pout->m[2][1] = 2.0f * (pq->y *pq->z - pq->x *pq->w);
635 pout->m[2][2] = 1.0f - 2.0f * (pq->x * pq->x + pq->y * pq->y);
636 return pout;
637}

Referenced by D3DXMatrixTest(), and D3DXMatrixTransformation().

◆ D3DXMatrixRotationX()

D3DXMATRIX *WINAPI D3DXMatrixRotationX ( D3DXMATRIX *  pout,
FLOAT  angle 
)

Definition at line 639 of file math.c.

640{
641 TRACE("pout %p, angle %f\n", pout, angle);
642
643 D3DXMatrixIdentity(pout);
644 pout->m[1][1] = cosf(angle);
645 pout->m[2][2] = cosf(angle);
646 pout->m[1][2] = sinf(angle);
647 pout->m[2][1] = -sinf(angle);
648 return pout;
649}

Referenced by D3DXMatrixTest(), and test_D3DXSHRotate().

◆ D3DXMatrixRotationY()

D3DXMATRIX *WINAPI D3DXMatrixRotationY ( D3DXMATRIX *  pout,
FLOAT  angle 
)

Definition at line 651 of file math.c.

652{
653 TRACE("pout %p, angle %f\n", pout, angle);
654
655 D3DXMatrixIdentity(pout);
656 pout->m[0][0] = cosf(angle);
657 pout->m[2][2] = cosf(angle);
658 pout->m[0][2] = -sinf(angle);
659 pout->m[2][0] = sinf(angle);
660 return pout;
661}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixRotationYawPitchRoll()

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

Definition at line 663 of file math.c.

664{
665 FLOAT sroll, croll, spitch, cpitch, syaw, cyaw;
666
667 TRACE("out %p, yaw %f, pitch %f, roll %f\n", out, yaw, pitch, roll);
668
669 sroll = sinf(roll);
670 croll = cosf(roll);
671 spitch = sinf(pitch);
672 cpitch = cosf(pitch);
673 syaw = sinf(yaw);
674 cyaw = cosf(yaw);
675
676 out->m[0][0] = sroll * spitch * syaw + croll * cyaw;
677 out->m[0][1] = sroll * cpitch;
678 out->m[0][2] = sroll * spitch * cyaw - croll * syaw;
679 out->m[0][3] = 0.0f;
680 out->m[1][0] = croll * spitch * syaw - sroll * cyaw;
681 out->m[1][1] = croll * cpitch;
682 out->m[1][2] = croll * spitch * cyaw + sroll * syaw;
683 out->m[1][3] = 0.0f;
684 out->m[2][0] = cpitch * syaw;
685 out->m[2][1] = -spitch;
686 out->m[2][2] = cpitch * cyaw;
687 out->m[2][3] = 0.0f;
688 out->m[3][0] = 0.0f;
689 out->m[3][1] = 0.0f;
690 out->m[3][2] = 0.0f;
691 out->m[3][3] = 1.0f;
692
693 return out;
694}

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

◆ D3DXMatrixRotationZ()

D3DXMATRIX *WINAPI D3DXMatrixRotationZ ( D3DXMATRIX *  pout,
FLOAT  angle 
)

Definition at line 696 of file math.c.

697{
698 TRACE("pout %p, angle %f\n", pout, angle);
699
700 D3DXMatrixIdentity(pout);
701 pout->m[0][0] = cosf(angle);
702 pout->m[1][1] = cosf(angle);
703 pout->m[0][1] = sinf(angle);
704 pout->m[1][0] = -sinf(angle);
705 return pout;
706}

Referenced by D3DXMatrixTest(), and test_D3DXSHRotate().

◆ D3DXMatrixScaling()

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

Definition at line 708 of file math.c.

709{
710 TRACE("pout %p, sx %f, sy %f, sz %f\n", pout, sx, sy, sz);
711
712 D3DXMatrixIdentity(pout);
713 pout->m[0][0] = sx;
714 pout->m[1][1] = sy;
715 pout->m[2][2] = sz;
716 return pout;
717}

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

◆ D3DXMatrixShadow()

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

Definition at line 719 of file math.c.

720{
721 D3DXPLANE Nplane;
722 FLOAT dot;
723
724 TRACE("pout %p, plight %p, pplane %p\n", pout, plight, pplane);
725
726 D3DXPlaneNormalize(&Nplane, pplane);
727 dot = D3DXPlaneDot(&Nplane, plight);
728 pout->m[0][0] = dot - Nplane.a * plight->x;
729 pout->m[0][1] = -Nplane.a * plight->y;
730 pout->m[0][2] = -Nplane.a * plight->z;
731 pout->m[0][3] = -Nplane.a * plight->w;
732 pout->m[1][0] = -Nplane.b * plight->x;
733 pout->m[1][1] = dot - Nplane.b * plight->y;
734 pout->m[1][2] = -Nplane.b * plight->z;
735 pout->m[1][3] = -Nplane.b * plight->w;
736 pout->m[2][0] = -Nplane.c * plight->x;
737 pout->m[2][1] = -Nplane.c * plight->y;
738 pout->m[2][2] = dot - Nplane.c * plight->z;
739 pout->m[2][3] = -Nplane.c * plight->w;
740 pout->m[3][0] = -Nplane.d * plight->x;
741 pout->m[3][1] = -Nplane.d * plight->y;
742 pout->m[3][2] = -Nplane.d * plight->z;
743 pout->m[3][3] = dot - Nplane.d * plight->w;
744 return pout;
745}

Referenced by D3DXMatrixTest().

◆ D3DXMatrixTransformation()

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

Definition at line 747 of file math.c.

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

Referenced by D3DXMatrixTest(), and D3DXMatrixTransformation2D().

◆ D3DXMatrixTransformation2D()

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

Definition at line 823 of file math.c.

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

Referenced by test_Matrix_Transformation2D().

◆ D3DXMatrixTranslation()

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

Definition at line 862 of file math.c.

863{
864 TRACE("pout %p, x %f, y %f, z %f\n", pout, x, y, z);
865
866 D3DXMatrixIdentity(pout);
867 pout->m[3][0] = x;
868 pout->m[3][1] = y;
869 pout->m[3][2] = z;
870 return pout;
871}
GLdouble GLdouble z
Definition: glext.h:5874

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

◆ D3DXMatrixTranspose()

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

Definition at line 873 of file math.c.

874{
875 unsigned int i, j;
877
878 TRACE("out %p, in %p.\n", out, in);
879
880 m = *in;
881
882 for (i = 0; i < 4; ++i)
883 for (j = 0; j < 4; ++j) out->m[i][j] = m.m[j][i];
884
885 return out;
886}
GLuint in
Definition: glext.h:9616
const GLfloat * m
Definition: glext.h:10848

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}

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
@ normal
Definition: optimize.h:166

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{
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}
direction
Definition: netio.c:882

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
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->m[0][0] * plane.a + pm->m[1][0] * plane.b + pm->m[2][0] * plane.c + pm->m[3][0] * plane.d;
1285 pout->b = pm->m[0][1] * plane.a + pm->m[1][1] * plane.b + pm->m[2][1] * plane.c + pm->m[3][1] * plane.d;
1286 pout->c = pm->m[0][2] * plane.a + pm->m[1][2] * plane.b + pm->m[2][2] * plane.c + pm->m[3][2] * plane.d;
1287 pout->d = pm->m[0][3] * plane.a + pm->m[1][3] * plane.b + pm->m[2][3] * plane.c + pm->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

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}
D3DXPLANE *WINAPI D3DXPlaneTransform(D3DXPLANE *pout, const D3DXPLANE *pplane, const D3DXMATRIX *pm)
Definition: math.c:1278
GLuint GLenum matrix
Definition: glext.h:9407

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}
D3DXQUATERNION *WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *out, const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, FLOAT t)
Definition: math.c:1500
GLfloat f
Definition: glext.h:7540

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}

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}

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}
_ACRTIMP float __cdecl acosf(float)
Definition: acosf.c:47

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}

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}

Referenced by D3DXQuaternionTest().

◆ D3DXQuaternionRotationAxis()

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

Definition at line 1407 of file math.c.

1408{
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}

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->m[0][0] + m->m[1][1] + m->m[2][2] + 1.0f;
1430 if (trace > 1.0f)
1431 {
1432 s = 2.0f * sqrtf(trace);
1433 out->x = (m->m[1][2] - m->m[2][1]) / s;
1434 out->y = (m->m[2][0] - m->m[0][2]) / s;
1435 out->z = (m->m[0][1] - m->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->m[i][i] > m->m[maxi][maxi])
1445 maxi = i;
1446 }
1447
1448 switch (maxi)
1449 {
1450 case 0:
1451 s = 2.0f * sqrtf(1.0f + m->m[0][0] - m->m[1][1] - m->m[2][2]);
1452 out->x = 0.25f * s;
1453 out->y = (m->m[0][1] + m->m[1][0]) / s;
1454 out->z = (m->m[0][2] + m->m[2][0]) / s;
1455 out->w = (m->m[1][2] - m->m[2][1]) / s;
1456 break;
1457
1458 case 1:
1459 s = 2.0f * sqrtf(1.0f + m->m[1][1] - m->m[0][0] - m->m[2][2]);
1460 out->x = (m->m[0][1] + m->m[1][0]) / s;
1461 out->y = 0.25f * s;
1462 out->z = (m->m[1][2] + m->m[2][1]) / s;
1463 out->w = (m->m[2][0] - m->m[0][2]) / s;
1464 break;
1465
1466 case 2:
1467 s = 2.0f * sqrtf(1.0f + m->m[2][2] - m->m[0][0] - m->m[1][1]);
1468 out->x = (m->m[0][2] + m->m[2][0]) / s;
1469 out->y = (m->m[1][2] + m->m[2][1]) / s;
1470 out->z = 0.25f * s;
1471 out->w = (m->m[0][1] - m->m[1][0]) / s;
1472 break;
1473 }
1474 }
1475
1476 return out;
1477}
#define trace
Definition: atltest.h:70

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}

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}

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}

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}
D3DXQUATERNION *WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2)
Definition: math.c:1377
static D3DXQUATERNION add_diff(const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, const FLOAT add)
Definition: math.c:1541
D3DXQUATERNION *WINAPI D3DXQuaternionExp(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1318
D3DXQUATERNION *WINAPI D3DXQuaternionLn(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1358
D3DXQUATERNION *WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, const D3DXQUATERNION *pq)
Definition: math.c:1343
#define cout
Definition: iostream.cpp:38
int zero
Definition: sehframes.cpp:29

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}

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

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}

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);
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}
unsigned int dir
Definition: maze.c:112
#define index(s, c)
Definition: various.h:29
#define WARN(fmt,...)
Definition: precomp.h:61
HRESULT WINAPI D3DXSHEvalDirectionalLight(UINT order, const D3DXVECTOR3 *dir, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *Rout, FLOAT *Gout, FLOAT *Bout)
Definition: math.c:2406
static void weightedcapintegrale(FLOAT *out, UINT order, FLOAT angle)
Definition: math.c:2263
FLOAT *WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir)
Definition: math.c:2336
#define D3DX_PI
Definition: d3dx9math.h:27
#define D3DXSH_MAXORDER
Definition: d3dx9math.h:31
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
GLuint index
Definition: glext.h:6031
GLenum cap
Definition: glext.h:9639

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
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}
#define D3DXSH_MINORDER
Definition: d3dx9math.h:30

Referenced by D3DXSHEvalConeLight(), D3DXSHEvalDirectionalLight(), D3DXSHEvalHemisphereLight(), D3DXSHEvalSphericalLight(), D3DXSHProjectCubeMap(), 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
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}

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}
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint GLint bottom
Definition: glext.h:7726

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);
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}
_ACRTIMP float __cdecl asinf(float)
Definition: asinf.c:47

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
static const WCHAR tb[]
Definition: suminfo.c:431

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 out[0] += 0.28209479f * t;
2597 out[6] -= 0.18022375f * t;
2598
2599 ta = 0.15607835f * a[7];
2600 tb = 0.15607835f * b[7];
2601 out[4] += ta * b[5] + tb * a[5];
2602 out[5] += ta * b[4] + tb * a[4];
2603 t = a[4] * b[5] + a[5] * b[4];
2604 out[7] += 0.15607835f * t;
2605
2606 ta = 0.28209479f * a[0] + 0.09011188f * a[6] - 0.15607835f * a[8];
2607 tb = 0.28209479f * b[0] + 0.09011188f * b[6] - 0.15607835f * b[8];
2608 out[5] += ta * b[5] + tb * a[5];
2609 t = a[5] * b[5];
2610 out[0] += 0.28209479f * t;
2611 out[6] += 0.09011188f * t;
2612 out[8] -= 0.15607835f * t;
2613
2614 ta = 0.28209480f * a[0];
2615 tb = 0.28209480f * b[0];
2616 out[6] += ta * b[6] + tb * a[6];
2617 t = a[6] * b[6];
2618 out[0] += 0.28209480f * t;
2619 out[6] += 0.18022376f * t;
2620
2621 ta = 0.28209479f * a[0] + 0.09011188f * a[6] + 0.15607835f * a[8];
2622 tb = 0.28209479f * b[0] + 0.09011188f * b[6] + 0.15607835f * b[8];
2623 out[7] += ta * b[7] + tb * a[7];
2624 t = a[7] * b[7];
2625 out[0] += 0.28209479f * t;
2626 out[6] += 0.09011188f * t;
2627 out[8] += 0.15607835f * t;
2628
2629 ta = 0.28209479f * a[0] - 0.18022375f * a[6];
2630 tb = 0.28209479f * b[0] - 0.18022375f * b[6];
2631 out[8] += ta * b[8] + tb * a[8];
2632 t = a[8] * b[8];
2633 out[0] += 0.28209479f * t;
2634 out[6] -= 0.18022375f * t;
2635
2636 return out;
2637}

Referenced by test_D3DXSHMultiply3().

◆ D3DXSHMultiply4()

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

Definition at line 2639 of file math.c.

2640{
2641 FLOAT ta, tb, t;
2642
2643 TRACE("out %p, a %p, b %p\n", out, a, b);
2644
2645 out[0] = 0.28209479f * a[0] * b[0];
2646
2647 ta = 0.28209479f * a[0] - 0.12615663f * a[6] - 0.21850969f * a[8];
2648 tb = 0.28209479f * b[0] - 0.12615663f * b[6] - 0.21850969f * b[8];
2649 out[1] = ta * b[1] + tb * a[1];
2650 t = a[1] * b[1];
2651 out[0] += 0.28209479f * t;
2652 out[6] = -0.12615663f * t;
2653 out[8] = -0.21850969f * t;
2654
2655 ta = 0.21850969f * a[3] - 0.05839917f * a[13] - 0.22617901f * a[15];
2656 tb = 0.21850969f * b[3] - 0.05839917f * b[13] - 0.22617901f * b[15];
2657 out[1] += ta * b[4] + tb * a[4];
2658 out[4] = ta * b[1] + tb * a[1];
2659 t = a[1] * b[4] + a[4] * b[1];
2660 out[3] = 0.21850969f * t;
2661 out[13] = -0.05839917f * t;
2662 out[15] = -0.22617901f * t;
2663
2664 ta = 0.21850969f * a[2] - 0.14304817f * a[12] - 0.18467439f * a[14];
2665 tb = 0.21850969f * b[2] - 0.14304817f * b[12] - 0.18467439f * b[14];
2666 out[1] += ta * b[5] + tb * a[5];
2667 out[5] = ta * b[1] + tb * a[1];
2668 t = a[1] * b[5] + a[5] * b[1];
2669 out[2] = 0.21850969f * t;
2670 out[12] = -0.14304817f * t;
2671 out[14] = -0.18467439f * t;
2672
2673 ta = 0.20230066f * a[11];
2674 tb = 0.20230066f * b[11];
2675 out[1] += ta * b[6] + tb * a[6];
2676 out[6] += ta * b[1] + tb * a[1];
2677 t = a[1] * b[6] + a[6] * b[1];
2678 out[11] = 0.20230066f * t;
2679
2680 ta = 0.22617901f * a[9] + 0.05839917f * a[11];
2681 tb = 0.22617901f * b[9] + 0.05839917f * b[11];
2682 out[1] += ta * b[8] + tb * a[8];
2683 out[8] += ta * b[1] + tb * a[1];
2684 t = a[1] * b[8] + a[8] * b[1];
2685 out[9] = 0.22617901f * t;
2686 out[11] += 0.05839917f * t;
2687
2688 ta = 0.28209480f * a[0] + 0.25231326f * a[6];
2689 tb = 0.28209480f * b[0] + 0.25231326f * b[6];
2690 out[2] += ta * b[2] + tb * a[2];
2691 t = a[2] * b[2];
2692 out[0] += 0.28209480f * t;
2693 out[6] += 0.25231326f * t;
2694
2695 ta = 0.24776671f * a[12];
2696 tb = 0.24776671f * b[12];
2697 out[2] += ta * b[6] + tb * a[6];
2698 out[6] += ta * b[2] + tb * a[2];
2699 t = a[2] * b[6] + a[6] * b[2];
2700 out[12] += 0.24776671f * t;
2701
2702 ta = 0.28209480f * a[0] - 0.12615663f * a[6] + 0.21850969f * a[8];
2703 tb = 0.28209480f * b[0] - 0.12615663f * b[6] + 0.21850969f * b[8];
2704 out[3] += ta * b[3] + tb * a[3];
2705 t = a[3] * b[3];
2706 out[0] += 0.28209480f * t;
2707 out[6] -= 0.12615663f * t;
2708 out[8] += 0.21850969f * t;
2709
2710 ta = 0.20230066f * a[13];
2711 tb = 0.20230066f * b[13];
2712 out[3] += ta * b[6] + tb * a[6];
2713 out[6] += ta * b[3] + tb * a[3];
2714 t = a[3] * b[6] + a[6] * b[3];
2715 out[13] += 0.20230066f * t;
2716
2717 ta = 0.21850969f * a[2] - 0.14304817f * a[12] + 0.18467439f * a[14];
2718 tb = 0.21850969f * b[2] - 0.14304817f * b[12] + 0.18467439f * b[14];
2719 out[3] += ta * b[7] + tb * a[7];
2720 out[7] = ta * b[3] + tb * a[3];
2721 t = a[3] * b[7] + a[7] * b[3];
2722 out[2] += 0.21850969f * t;
2723 out[12] -= 0.14304817f * t;
2724 out[14] += 0.18467439f * t;
2725
2726 ta = -0.05839917f * a[13] + 0.22617901f * a[15];
2727 tb = -0.05839917f * b[13] + 0.22617901f * b[15];
2728 out[3] += ta * b[8] + tb * a[8];
2729 out[8] += ta * b[3] + tb * a[3];
2730 t = a[3] * b[8] + a[8] * b[3];
2731 out[13] -= 0.05839917f * t;
2732 out[15] += 0.22617901f * t;
2733
2734 ta = 0.28209479f * a[0] - 0.18022375f * a[6];
2735 tb = 0.28209479f * b[0] - 0.18022375f * b[6];
2736 out[4] += ta * b[4] + tb * a[4];
2737 t = a[4] * b[4];
2738 out[0] += 0.28209479f * t;
2739 out[6] -= 0.18022375f * t;
2740
2741 ta = 0.15607835f * a[7];
2742 tb = 0.15607835f * b[7];
2743 out[4] += ta * b[5] + tb * a[5];
2744 out[5] += ta * b[4] + tb * a[4];
2745 t = a[4] * b[5] + a[5] * b[4];
2746 out[7] += 0.15607835f * t;
2747
2748 ta = 0.22617901f * a[3] - 0.09403160f * a[13];
2749 tb = 0.22617901f * b[3] - 0.09403160f * b[13];
2750 out[4] += ta * b[9] + tb * a[9];
2751 out[9] += ta * b[4] + tb * a[4];
2752 t = a[4] * b[9] + a[9] * b[4];
2753 out[3] += 0.22617901f * t;
2754 out[13] -= 0.09403160f * t;
2755
2756 ta = 0.18467439f * a[2] - 0.18806319f * a[12];
2757 tb = 0.18467439f * b[2] - 0.18806319f * b[12];
2758 out[4] += ta * b[10] + tb * a [10];
2759 out[10] = ta * b[4] + tb * a[4];
2760 t = a[4] * b[10] + a[10] * b[4];
2761 out[2] += 0.18467439f * t;
2762 out[12] -= 0.18806319f * t;
2763
2764 ta = -0.05839917f * a[3] + 0.14567312f * a[13] + 0.09403160f * a[15];
2765 tb = -0.05839917f * b[3] + 0.14567312f * b[13] + 0.09403160f * b[15];
2766 out[4] += ta * b[11] + tb * a[11];
2767 out[11] += ta * b[4] + tb * a[4];
2768 t = a[4] * b[11] + a[11] * b[4];
2769 out[3] -= 0.05839917f * t;
2770 out[13] += 0.14567312f * t;
2771 out[15] += 0.09403160f * t;
2772
2773 ta = 0.28209479f * a[0] + 0.09011186f * a[6] - 0.15607835f * a[8];
2774 tb = 0.28209479f * b[0] + 0.09011186f * b[6] - 0.15607835f * b[8];
2775 out[5] += ta * b[5] + tb * a[5];
2776 t = a[5] * b[5];
2777 out[0] += 0.28209479f * t;
2778 out[6] += 0.09011186f * t;
2779 out[8] -= 0.15607835f * t;
2780
2781 ta = 0.14867701f * a[14];
2782 tb = 0.14867701f * b[14];
2783 out[5] += ta * b[9] + tb * a[9];
2784 out[9] += ta * b[5] + tb * a[5];
2785 t = a[5] * b[9] + a[9] * b[5];
2786 out[14] += 0.14867701f * t;
2787
2788 ta = 0.18467439f * a[3] + 0.11516472f * a[13] - 0.14867701f * a[15];
2789 tb = 0.18467439f * b[3] + 0.11516472f * b[13] - 0.14867701f * b[15];
2790 out[5] += ta * b[10] + tb * a[10];
2791 out[10] += ta * b[5] + tb * a[5];
2792 t = a[5] * b[10] + a[10] * b[5];
2793 out[3] += 0.18467439f * t;
2794 out[13] += 0.11516472f * t;
2795 out[15] -= 0.14867701f * t;
2796
2797 ta = 0.23359668f * a[2] + 0.05947080f * a[12] - 0.11516472f * a[14];
2798 tb = 0.23359668f * b[2] + 0.05947080f * b[12] - 0.11516472f * b[14];
2799 out[5] += ta * b[11] + tb * a[11];
2800 out[11] += ta * b[5] + tb * a[5];
2801 t = a[5] * b[11] + a[11] * b[5];
2802 out[2] += 0.23359668f * t;
2803 out[12] += 0.05947080f * t;
2804 out[14] -= 0.11516472f * t;
2805
2806 ta = 0.28209479f * a[0];
2807 tb = 0.28209479f * b[0];
2808 out[6] += ta * b[6] + tb * a[6];
2809 t = a[6] * b[6];
2810 out[0] += 0.28209479f * t;
2811 out[6] += 0.18022376f * t;
2812
2813 ta = 0.09011186f * a[6] + 0.28209479f * a[0] + 0.15607835f * a[8];
2814 tb = 0.09011186f * b[6] + 0.28209479f * b[0] + 0.15607835f * b[8];
2815 out[7] += ta * b[7] + tb * a[7];
2816 t = a[7] * b[7];
2817 out[6] += 0.09011186f * t;
2818 out[0] += 0.28209479f * t;
2819 out[8] += 0.15607835f * t;
2820
2821 ta = 0.14867701f * a[9] + 0.18467439f * a[1] + 0.11516472f * a[11];
2822 tb = 0.14867701f * b[9] + 0.18467439f * b[1] + 0.11516472f * b[11];
2823 out[7] += ta * b[10] + tb * a[10];
2824 out[10] += ta * b[7] + tb * a[7];
2825 t = a[7] * b[10] + a[10] * b[7];
2826 out[9] += 0.14867701f * t;
2827 out[1] += 0.18467439f * t;
2828 out[11] += 0.11516472f * t;
2829
2830 ta = 0.05947080f * a[12] + 0.23359668f * a[2] + 0.11516472f * a[14];
2831 tb = 0.05947080f * b[12] + 0.23359668f * b[2] + 0.11516472f * b[14];
2832 out[7] += ta * b[13] + tb * a[13];
2833 out[13] += ta * b[7]+ tb * a[7];
2834 t = a[7] * b[13] + a[13] * b[7];
2835 out[12] += 0.05947080f * t;
2836 out[2] += 0.23359668f * t;
2837 out[14] += 0.11516472f * t;
2838
2839 ta = 0.14867701f * a[15];
2840 tb = 0.14867701f * b[15];
2841 out[7] += ta * b[14] + tb * a[14];
2842 out[14] += ta * b[7] + tb * a[7];
2843 t = a[7] * b[14] + a[14] * b[7];
2844 out[15] += 0.14867701f * t;
2845
2846 ta = 0.28209479f * a[0] - 0.18022375f * a[6];
2847 tb = 0.28209479f * b[0] - 0.18022375f * b[6];
2848 out[8] += ta * b[8] + tb * a[8];
2849 t = a[8] * b[8];
2850 out[0] += 0.28209479f * t;
2851 out[6] -= 0.18022375f * t;
2852
2853 ta = -0.09403160f * a[11];
2854 tb = -0.09403160f * b[11];
2855 out[8] += ta * b[9] + tb * a[9];
2856 out[9] += ta * b[8] + tb * a[8];
2857 t = a[8] * b[9] + a[9] * b[8];
2858 out[11] -= 0.09403160f * t;
2859
2860 ta = -0.09403160f * a[15];
2861 tb = -0.09403160f * b[15];
2862 out[8] += ta * b[13] + tb * a[13];
2863 out[13] += ta * b[8] + tb * a[8];
2864 t = a[8] * b[13] + a[13] * b[8];
2865 out[15] -= 0.09403160f * t;
2866
2867 ta = 0.18467439f * a[2] - 0.18806319f * a[12];
2868 tb = 0.18467439f * b[2] - 0.18806319f * b[12];
2869 out[8] += ta * b[14] + tb * a[14];
2870 out[14] += ta * b[8] + tb * a[8];
2871 t = a[8] * b[14] + a[14] * b[8];
2872 out[2] += 0.18467439f * t;
2873 out[12] -= 0.18806319f * t;
2874
2875 ta = -0.21026104f * a[6] + 0.28209479f * a[0];
2876 tb = -0.21026104f * b[6] + 0.28209479f * b[0];
2877 out[9] += ta * b[9] + tb * a[9];
2878 t = a[9] * b[9];
2879 out[6] -= 0.21026104f * t;
2880 out[0] += 0.28209479f * t;
2881
2882 ta = 0.28209479f * a[0];
2883 tb = 0.28209479f * b[0];
2884 out[10] += ta * b[10] + tb * a[10];
2885 t = a[10] * b[10];
2886 out[0] += 0.28209479f * t;
2887
2888 ta = 0.28209479f * a[0] + 0.12615663f * a[6] - 0.14567312f * a[8];
2889 tb = 0.28209479f * b[0] + 0.12615663f * b[6] - 0.14567312f * b[8];
2890 out[11] += ta * b[11] + tb * a[11];
2891 t = a[11] * b[11];
2892 out[0] += 0.28209479f * t;
2893 out[6] += 0.12615663f * t;
2894 out[8] -= 0.14567312f * t;
2895
2896 ta = 0.28209479f * a[0] + 0.16820885f * a[6];
2897 tb = 0.28209479f * b[0] + 0.16820885f * b[6];
2898 out[12] += ta * b[12] + tb * a[12];
2899 t = a[12] * b[12];
2900 out[0] += 0.28209479f * t;
2901 out[6] += 0.16820885f * t;
2902
2903 ta =0.28209479f * a[0] + 0.14567312f * a[8] + 0.12615663f * a[6];
2904 tb =0.28209479f * b[0] + 0.14567312f * b[8] + 0.12615663f * b[6];
2905 out[13] += ta * b[13] + tb * a[13];
2906 t = a[13] * b[13];
2907 out[0] += 0.28209479f * t;
2908 out[8] += 0.14567312f * t;
2909 out[6] += 0.12615663f * t;
2910
2911 ta = 0.28209479f * a[0];
2912 tb = 0.28209479f * b[0];
2913 out[14] += ta * b[14] + tb * a[14];
2914 t = a[14] * b[14];
2915 out[0] += 0.28209479f * t;
2916
2917 ta = 0.28209479f * a[0] - 0.21026104f * a[6];
2918 tb = 0.28209479f * b[0] - 0.21026104f * b[6];
2919 out[15] += ta * b[15] + tb * a[15];
2920 t = a[15] * b[15];
2921 out[0] += 0.28209479f * t;
2922 out[6] -= 0.21026104f * t;
2923
2924 return out;
2925}

Referenced by test_D3DXSHMultiply4().

◆ D3DXSHProjectCubeMap()

HRESULT WINAPI D3DXSHProjectCubeMap ( UINT  order,
IDirect3DCubeTexture9 *  texture,
FLOAT *  red,
FLOAT *  green,
FLOAT *  blue 
)

◆ D3DXSHRotate()

FLOAT *WINAPI D3DXSHRotate ( FLOAT *  out,
UINT  order,
const D3DXMATRIX *  matrix,
const FLOAT *  in 
)

Definition at line 3123 of file math.c.

3124{
3125 FLOAT alpha, beta, gamma, sinb, temp[36], temp1[36];
3126
3127 TRACE("out %p, order %u, matrix %p, in %p\n", out, order, matrix, in);
3128
3129 out[0] = in[0];
3130
3132 return out;
3133
3134 if (order <= 3)
3135 {
3136 out[1] = matrix->m[1][1] * in[1] - matrix->m[2][1] * in[2] + matrix->m[0][1] * in[3];
3137 out[2] = -matrix->m[1][2] * in[1] + matrix->m[2][2] * in[2] - matrix->m[0][2] * in[3];
3138 out[3] = matrix->m[1][0] * in[1] - matrix->m[2][0] * in[2] + matrix->m[0][0] * in[3];
3139
3140 if (order == 3)
3141 {
3142 float coeff[] =
3143 {
3144 matrix->m[1][0] * matrix->m[0][0], matrix->m[1][1] * matrix->m[0][1],
3145 matrix->m[1][1] * matrix->m[2][1], matrix->m[1][0] * matrix->m[2][0],
3146 matrix->m[2][0] * matrix->m[2][0], matrix->m[2][1] * matrix->m[2][1],
3147 matrix->m[0][0] * matrix->m[2][0], matrix->m[0][1] * matrix->m[2][1],
3148 matrix->m[0][1] * matrix->m[0][1], matrix->m[1][0] * matrix->m[1][0],
3149 matrix->m[1][1] * matrix->m[1][1], matrix->m[0][0] * matrix->m[0][0],
3150 };
3151
3152 out[4] = (matrix->m[1][1] * matrix->m[0][0] + matrix->m[0][1] * matrix->m[1][0]) * in[4];
3153 out[4] -= (matrix->m[1][0] * matrix->m[2][1] + matrix->m[1][1] * matrix->m[2][0]) * in[5];
3154 out[4] += 1.7320508076f * matrix->m[2][0] * matrix->m[2][1] * in[6];
3155 out[4] -= (matrix->m[0][1] * matrix->m[2][0] + matrix->m[0][0] * matrix->m[2][1]) * in[7];
3156 out[4] += (matrix->m[0][0] * matrix->m[0][1] - matrix->m[1][0] * matrix->m[1][1]) * in[8];
3157
3158 out[5] = (matrix->m[1][1] * matrix->m[2][2] + matrix->m[1][2] * matrix->m[2][1]) * in[5];
3159 out[5] -= (matrix->m[1][1] * matrix->m[0][2] + matrix->m[1][2] * matrix->m[0][1]) * in[4];
3160 out[5] -= 1.7320508076f * matrix->m[2][2] * matrix->m[2][1] * in[6];
3161 out[5] += (matrix->m[0][2] * matrix->m[2][1] + matrix->m[0][1] * matrix->m[2][2]) * in[7];
3162 out[5] -= (matrix->m[0][1] * matrix->m[0][2] - matrix->m[1][1] * matrix->m[1][2]) * in[8];
3163
3164 out[6] = (matrix->m[2][2] * matrix->m[2][2] - 0.5f * (coeff[4] + coeff[5])) * in[6];
3165 out[6] -= (0.5773502692f * (coeff[0] + coeff[1]) - 1.1547005384f * matrix->m[1][2] * matrix->m[0][2]) * in[4];
3166 out[6] += (0.5773502692f * (coeff[2] + coeff[3]) - 1.1547005384f * matrix->m[1][2] * matrix->m[2][2]) * in[5];
3167 out[6] += (0.5773502692f * (coeff[6] + coeff[7]) - 1.1547005384f * matrix->m[0][2] * matrix->m[2][2]) * in[7];
3168 out[6] += (0.2886751347f * (coeff[9] - coeff[8] + coeff[10] - coeff[11]) - 0.5773502692f *
3169 (matrix->m[1][2] * matrix->m[1][2] - matrix->m[0][2] * matrix->m[0][2])) * in[8];
3170
3171 out[7] = (matrix->m[0][0] * matrix->m[2][2] + matrix->m[0][2] * matrix->m[2][0]) * in[7];
3172 out[7] -= (matrix->m[1][0] * matrix->m[0][2] + matrix->m[1][2] * matrix->m[0][0]) * in[4];
3173 out[7] += (matrix->m[1][0] * matrix->m[2][2] + matrix->m[1][2] * matrix->m[2][0]) * in[5];
3174 out[7] -= 1.7320508076f * matrix->m[2][2] * matrix->m[2][0] * in[6];
3175 out[7] -= (matrix->m[0][0] * matrix->m[0][2] - matrix->m[1][0] * matrix->m[1][2]) * in[8];
3176
3177 out[8] = 0.5f * (coeff[11] - coeff[8] - coeff[9] + coeff[10]) * in[8];
3178 out[8] += (coeff[0] - coeff[1]) * in[4];
3179 out[8] += (coeff[2] - coeff[3]) * in[5];
3180 out[8] += 0.86602540f * (coeff[4] - coeff[5]) * in[6];
3181 out[8] += (coeff[7] - coeff[6]) * in[7];
3182 }
3183
3184 return out;
3185 }
3186
3187 if (fabsf(matrix->m[2][2]) != 1.0f)
3188 {
3189 sinb = sqrtf(1.0f - matrix->m[2][2] * matrix->m[2][2]);
3190 alpha = atan2f(matrix->m[2][1] / sinb, matrix->m[2][0] / sinb);
3191 beta = atan2f(sinb, matrix->m[2][2]);
3192 gamma = atan2f(matrix->m[1][2] / sinb, -matrix->m[0][2] / sinb);
3193 }
3194 else
3195 {
3196 alpha = atan2f(matrix->m[0][1], matrix->m[0][0]);
3197 beta = 0.0f;
3198 gamma = 0.0f;
3199 }
3200
3201 D3DXSHRotateZ(temp, order, gamma, in);
3202 rotate_X(temp1, order, 1.0f, temp);
3203 D3DXSHRotateZ(temp, order, beta, temp1);
3204 rotate_X(temp1, order, -1.0f, temp);
3205 D3DXSHRotateZ(out, order, alpha, temp1);
3206
3207 return out;
3208}
FLOAT *WINAPI D3DXSHRotateZ(FLOAT *out, UINT order, FLOAT angle, const FLOAT *in)
Definition: math.c:3210
static void rotate_X(FLOAT *out, UINT order, FLOAT a, FLOAT *in)
Definition: math.c:2927
_ACRTIMP float __cdecl fabsf(float)
_ACRTIMP float __cdecl atan2f(float, float)
Definition: atan2f.c:51
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740

Referenced by test_D3DXSHRotate().

◆ D3DXSHRotateZ()

FLOAT *WINAPI D3DXSHRotateZ ( FLOAT *  out,
UINT  order,
FLOAT  angle,
const FLOAT *  in 
)

Definition at line 3210 of file math.c.

3211{
3212 UINT i, sum = 0;
3213 FLOAT c[5], s[5];
3214
3215 TRACE("out %p, order %u, angle %f, in %p\n", out, order, angle, in);
3216
3218
3219 out[0] = in[0];
3220
3221 for (i = 1; i < order; i++)
3222 {
3223 UINT j;
3224
3225 c[i - 1] = cosf(i * angle);
3226 s[i - 1] = sinf(i * angle);
3227 sum += i * 2;
3228
3229 out[sum - i] = c[i - 1] * in[sum - i];
3230 out[sum - i] += s[i - 1] * in[sum + i];
3231 for (j = i - 1; j > 0; j--)
3232 {
3233 out[sum - j] = 0.0f;
3234 out[sum - j] = c[j - 1] * in[sum - j];
3235 out[sum - j] += s[j - 1] * in[sum + j];
3236 }
3237
3238 if (in == out)
3239 out[sum] = 0.0f;
3240 else
3241 out[sum] = in[sum];
3242
3243 for (j = 1; j < i; j++)
3244 {
3245 out[sum + j] = 0.0f;
3246 out[sum + j] = -s[j - 1] * in[sum - j];
3247 out[sum + j] += c[j - 1] * in[sum + j];
3248 }
3249 out[sum + i] = -s[i - 1] * in[sum - i];
3250 out[sum + i] += c[i - 1] * in[sum + i];
3251 }
3252
3253 return out;
3254}
const GLubyte * c
Definition: glext.h:8905
#define min(a, b)
Definition: monoChain.cc:55
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
#define max(a, b)
Definition: svc.c:63

Referenced by D3DXSHRotate(), and test_D3DXSHRotateZ().

◆ D3DXSHScale()

FLOAT *WINAPI D3DXSHScale ( FLOAT *  out,
UINT  order,
const FLOAT *  a,
const FLOAT  scale 
)

Definition at line 3256 of file math.c.

3257{
3258 UINT i;
3259
3260 TRACE("out %p, order %u, a %p, scale %f\n", out, order, a, scale);
3261
3262 for (i = 0; i < order * order; i++)
3263 out[i] = a[i] * scale;
3264
3265 return out;
3266}

Referenced by D3DXSHProjectCubeMap(), and test_D3DXSHScale().

◆ D3DXVec2BaryCentric()

D3DXVECTOR2 *WINAPI D3DXVec2BaryCentric ( D3DXVECTOR2 *  pout,
const D3DXVECTOR2 *  pv1,
const D3DXVECTOR2 *  pv2,
const D3DXVECTOR2 *  pv3,
FLOAT  f,
FLOAT  g 
)

Definition at line 1625 of file math.c.

1626{
1627 TRACE("pout %p, pv1 %p, pv2 %p, pv3 %p, f %f, g %f\n", pout, pv1, pv2, pv3, f, g);
1628
1629 pout->x = (1.0f-f-g) * (pv1->x) + f * (pv2->x) + g * (pv3->x);
1630 pout->y = (1.0f-f-g) * (pv1->y) + f * (pv2->y) + g * (pv3->y);
1631 return pout;
1632}
FLOAT x
Definition: d3dx9math.h:64
FLOAT y
Definition: d3dx9math.h:64

Referenced by D3DXVector2Test().

◆ D3DXVec2CatmullRom()

D3DXVECTOR2 *WINAPI D3DXVec2CatmullRom ( D3DXVECTOR2 *  pout,
const D3DXVECTOR2 *  pv0,
const D3DXVECTOR2 *  pv1,
const D3DXVECTOR2 *  pv2,
const D3DXVECTOR2 *  pv3,
FLOAT  s 
)

Definition at line 1634 of file math.c.

1635{
1636 TRACE("pout %p, pv0 %p, pv1 %p, pv2 %p, pv3 %p, s %f\n", pout, pv0, pv1, pv2, pv3, s);
1637
1638 pout->x = 0.5f * (2.0f * pv1->x + (pv2->x - pv0->x) *s + (2.0f *pv0->x - 5.0f * pv1->x + 4.0f * pv2->x - pv3->x) * s * s + (pv3->x -3.0f * pv2->x + 3.0f * pv1->x - pv0->x) * s * s * s);
1639 pout->y = 0.5f * (2.0f * pv1->y + (pv2->y - pv0->y) *s + (2.0f *pv0->y - 5.0f * pv1->y + 4.0f * pv2->y - pv3->y) * s * s + (pv3->y -3.0f * pv2->y + 3.0f * pv1->y - pv0->y) * s * s * s);
1640 return pout;
1641}

Referenced by D3DXVector2Test().

◆ D3DXVec2Hermite()

D3DXVECTOR2 *WINAPI D3DXVec2Hermite ( D3DXVECTOR2 *  pout,
const D3DXVECTOR2 *  pv1,
const D3DXVECTOR2 *  pt1,
const D3DXVECTOR2 *  pv2,
const D3DXVECTOR2 *  pt2,
FLOAT  s 
)

Definition at line 1643 of file math.c.

1644{
1645 FLOAT h1, h2, h3, h4;
1646
1647 TRACE("pout %p, pv1 %p, pt1 %p, pv2 %p, pt2 %p, s %f\n", pout, pv1, pt1, pv2, pt2, s);
1648
1649 h1 = 2.0f * s * s * s - 3.0f * s * s + 1.0f;
1650 h2 = s * s * s - 2.0f * s * s + s;
1651 h3 = -2.0f * s * s * s + 3.0f * s * s;
1652 h4 = s * s * s - s * s;
1653
1654 pout->x = h1 * (pv1->x) + h2 * (pt1->x) + h3 * (pv2->x) + h4 * (pt2->x);
1655 pout->y = h1 * (pv1->y) + h2 * (pt1->y) + h3 * (pv2->y) + h4 * (pt2->y);
1656 return pout;
1657}

Referenced by D3DXVector2Test().

◆ D3DXVec2Normalize()

D3DXVECTOR2 *WINAPI D3DXVec2Normalize ( D3DXVECTOR2 *  pout,
const D3DXVECTOR2 *  pv 
)

Definition at line 1659 of file math.c.

1660{
1661 FLOAT norm;
1662
1663 TRACE("pout %p, pv %p\n", pout, pv);
1664
1665 norm = D3DXVec2Length(pv);
1666 if ( !norm )
1667 {
1668 pout->x = 0.0f;
1669 pout->y = 0.0f;
1670 }
1671 else
1672 {
1673 pout->x = pv->x / norm;
1674 pout->y = pv->y / norm;
1675 }
1676
1677 return pout;
1678}

Referenced by compute_text_mesh(), D3DXCreateTextW(), D3DXVector2Test(), and unit_vec2().

◆ D3DXVec2Transform()

D3DXVECTOR4 *WINAPI D3DXVec2Transform ( D3DXVECTOR4 *  pout,
const D3DXVECTOR2 *  pv,
const D3DXMATRIX *  pm 
)

Definition at line 1680 of file math.c.

1681{
1683
1684 TRACE("pout %p, pv %p, pm %p\n", pout, pv, pm);
1685
1686 out.x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[3][0];
1687 out.y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[3][1];
1688 out.z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[3][2];
1689 out.w = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[3][3];
1690 *pout = out;
1691 return pout;
1692}

Referenced by D3DXVec2TransformArray(), and D3DXVector2Test().

◆ D3DXVec2TransformArray()

D3DXVECTOR4 *WINAPI D3DXVec2TransformArray ( D3DXVECTOR4 *  pout,
UINT  outstride,
const D3DXVECTOR2 *  pv,
UINT  vstride,
const D3DXMATRIX *  pm,
UINT  n 
)

Definition at line 1694 of file math.c.

1695{
1696 UINT i;
1697
1698 TRACE("out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n", out, outstride, in, instride, matrix, elements);
1699
1700 for (i = 0; i < elements; ++i) {
1702 (D3DXVECTOR4*)((char*)out + outstride * i),
1703 (const D3DXVECTOR2*)((const char*)in + instride * i),
1704 matrix);
1705 }
1706 return out;
1707}
D3DXVECTOR4 *WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
Definition: math.c:1680

Referenced by test_D3DXVec_Array().

◆ D3DXVec2TransformCoord()

D3DXVECTOR2 *WINAPI D3DXVec2TransformCoord ( D3DXVECTOR2 *  pout,
const D3DXVECTOR2 *  pv,
const D3DXMATRIX *  pm 
)

Definition at line 1709 of file math.c.

1710{
1711 D3DXVECTOR2 v;
1712 FLOAT norm;
1713
1714 TRACE("pout %p, pv %p, pm %p\n", pout, pv, pm);
1715
1716 v = *pv;
1717 norm = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[3][3];
1718
1719 pout->x = (pm->m[0][0] * v.x + pm->m[1][0] * v.y + pm->m[3][0]) / norm;
1720 pout->y = (pm->m[0][1] * v.x + pm->m[1][1] * v.y + pm->m[3][1]) / norm;
1721
1722 return pout;
1723}

Referenced by D3DXVec2TransformCoordArray(), and D3DXVector2Test().

◆ D3DXVec2TransformCoordArray()

D3DXVECTOR2 *WINAPI D3DXVec2TransformCoordArray ( D3DXVECTOR2 *  pout,
UINT  outstride,
const D3DXVECTOR2 *  pv,
UINT  vstride,
const D3DXMATRIX *  pm,
UINT  n 
)

Definition at line 1725 of file math.c.

1726{
1727 UINT i;
1728
1729 TRACE("out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n", out, outstride, in, instride, matrix, elements);
1730
1731 for (i = 0; i < elements; ++i) {
1733 (D3DXVECTOR2*)((char*)out + outstride * i),
1734 (const D3DXVECTOR2*)((const char*)in + instride * i),
1735 matrix);
1736 }
1737 return out;
1738}
D3DXVECTOR2 *WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
Definition: math.c:1709

Referenced by test_D3DXVec_Array().

◆ D3DXVec2TransformNormal()

D3DXVECTOR2 *WINAPI D3DXVec2TransformNormal ( D3DXVECTOR2 *  pout,
const D3DXVECTOR2 *  pv,
const D3DXMATRIX *  pm 
)

Definition at line 1740 of file math.c.

1741{
1742 const D3DXVECTOR2 v = *pv;
1743
1744 TRACE("pout %p, pv %p, pm %p\n", pout, pv, pm);
1745
1746 pout->x = pm->m[0][0] * v.x + pm->m[1][0] * v.y;
1747 pout->y = pm->m[0][1] * v.x + pm->m[1][1] * v.y;
1748 return pout;
1749}

Referenced by D3DXVec2TransformNormalArray(), and D3DXVector2Test().

◆ D3DXVec2TransformNormalArray()

D3DXVECTOR2 *WINAPI D3DXVec2TransformNormalArray ( D3DXVECTOR2 *  pout,
UINT  outstride,
const D3DXVECTOR2 *  pv,
UINT  vstride,
const D3DXMATRIX *  pm,
UINT  n 
)

Definition at line 1751 of file math.c.

1752{
1753 UINT i;
1754
1755 TRACE("out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n", out, outstride, in, instride, matrix, elements);
1756
1757 for (i = 0; i < elements; ++i) {
1759 (D3DXVECTOR2*)((char*)out + outstride * i),
1760 (const D3DXVECTOR2*)((const char*)in + instride * i),
1761 matrix);
1762 }
1763 return out;
1764}
D3DXVECTOR2 *WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
Definition: math.c:1740

Referenced by test_D3DXVec_Array().

◆ D3DXVec3BaryCentric()

D3DXVECTOR3 *WINAPI D3DXVec3BaryCentric ( D3DXVECTOR3 *  pout,
const D3DXVECTOR3 *  pv1,
const D3DXVECTOR3 *  pv2,
const D3DXVECTOR3 *  pv3,
FLOAT  f,
FLOAT  g 
)

Definition at line 1768 of file math.c.

1769{
1770 TRACE("pout %p, pv1 %p, pv2 %p, pv3 %p, f %f, g %f\n", pout, pv1, pv2, pv3, f, g);
1771
1772 pout->x = (1.0f-f-g) * (pv1->x) + f * (pv2->x) + g * (pv3->x);
1773 pout->y = (1.0f-f-g) * (pv1->y) + f * (pv2->y) + g * (pv3->y);
1774 pout->z = (1.0f-f-g) * (pv1->z) + f * (pv2->z) + g * (pv3->z);
1775 return pout;
1776}

Referenced by D3DXVector3Test().

◆ D3DXVec3CatmullRom()

D3DXVECTOR3 *WINAPI D3DXVec3CatmullRom ( D3DXVECTOR3 *  pout,
const D3DXVECTOR3 *  pv0,
const D3DXVECTOR3 *  pv1,
const D3DXVECTOR3 *  pv2,
const D3DXVECTOR3 *  pv3,
FLOAT  s 
)

Definition at line 1778 of file math.c.

1779{
1780 TRACE("pout %p, pv0 %p, pv1 %p, pv2 %p, pv3 %p, s %f\n", pout, pv0, pv1, pv2, pv3, s);
1781
1782 pout->x = 0.5f * (2.0f * pv1->x + (pv2->x - pv0->x) *s + (2.0f *pv0->x - 5.0f * pv1->x + 4.0f * pv2->x - pv3->x) * s * s + (pv3->x -3.0f * pv2->x + 3.0f * pv1->x - pv0->x) * s * s * s);
1783 pout->y = 0.5f * (2.0f * pv1->y + (pv2->y - pv0->y) *s + (2.0f *pv0->y - 5.0f * pv1->y + 4.0f * pv2->y - pv3->y) * s * s + (pv3->y -3.0f * pv2->y + 3.0f * pv1->y - pv0->y) * s * s * s);
1784 pout->z = 0.5f * (2.0f * pv1->z + (pv2->z - pv0->z) *s + (2.0f *pv0->z - 5.0f * pv1->z + 4.0f * pv2->z - pv3->z) * s * s + (pv3->z -3.0f * pv2->z + 3.0f * pv1->z - pv0->z) * s * s * s);
1785 return pout;
1786}

Referenced by D3DXVector3Test().

◆ D3DXVec3Hermite()

D3DXVECTOR3 *WINAPI D3DXVec3Hermite ( D3DXVECTOR3 *  pout,
const D3DXVECTOR3 *  pv1,
const D3DXVECTOR3 *  pt1,
const D3DXVECTOR3 *  pv2,
const D3DXVECTOR3 *  pt2,
FLOAT  s 
)

Definition at line 1788 of file math.c.

1789{
1790 FLOAT h1, h2, h3, h4;
1791
1792 TRACE("pout %p, pv1 %p, pt1 %p, pv2 %p, pt2 %p, s %f\n", pout, pv1, pt1, pv2, pt2, s);
1793
1794 h1 = 2.0f * s * s * s - 3.0f * s * s + 1.0f;
1795 h2 = s * s * s - 2.0f * s * s + s;
1796 h3 = -2.0f * s * s * s + 3.0f * s * s;
1797 h4 = s * s * s - s * s;
1798
1799 pout->x = h1 * (pv1->x) + h2 * (pt1->x) + h3 * (pv2->x) + h4 * (pt2->x);
1800 pout->y = h1 * (pv1->y) + h2 * (pt1->y) + h3 * (pv2->y) + h4 * (pt2->y);
1801 pout->z = h1 * (pv1->z) + h2 * (pt1->z) + h3 * (pv2->z) + h4 * (pt2->z);
1802 return pout;
1803}

Referenced by D3DXVector3Test().

◆ D3DXVec3Normalize()

D3DXVECTOR3 *WINAPI D3DXVec3Normalize ( D3DXVECTOR3 *  pout,
const D3DXVECTOR3 *  pv 
)

Definition at line 1805 of file math.c.

1806{
1807 FLOAT norm;
1808
1809 TRACE("pout %p, pv %p\n", pout, pv);
1810
1811 norm = D3DXVec3Length(pv);
1812 if ( !norm )
1813 {
1814 pout->x = 0.0f;
1815 pout->y = 0.0f;
1816 pout->z = 0.0f;
1817 }
1818 else
1819 {
1820 pout->x = pv->x / norm;
1821 pout->y = pv->y / norm;
1822 pout->z = pv->z / norm;
1823 }
1824
1825 return pout;
1826}

Referenced by compare_text_outline_mesh(), compute_cylinder(), D3DXComputeTangentFrameEx(), D3DXCreateCylinder(), D3DXMatrixLookAtLH(), D3DXMatrixLookAtRH(), D3DXMatrixRotationAxis(), D3DXPlaneFromPoints(), D3DXQuaternionRotationAxis(), D3DXSHEvalSphericalLight(), D3DXSHProjectCubeMap(), D3DXVector3Test(), and parse_normals().

◆ D3DXVec3Project()

D3DXVECTOR3 *WINAPI D3DXVec3Project ( D3DXVECTOR3 *  pout,
const D3DXVECTOR3 *  pv,
const D3DVIEWPORT9 *  pviewport,
const D3DXMATRIX *  pprojection,
const D3DXMATRIX *  pview,
const D3DXMATRIX *  pworld 
)

Definition at line 1828 of file math.c.

1829{
1830 D3DXMATRIX m;
1831
1832 TRACE("pout %p, pv %p, pviewport %p, pprojection %p, pview %p, pworld %p\n", pout, pv, pviewport, pprojection, pview, pworld);
1833
1834 D3DXMatrixIdentity(&m);
1835 if (pworld) D3DXMatrixMultiply(&m, &m, pworld);
1836 if (pview) D3DXMatrixMultiply(&m, &m, pview);
1837 if (pprojection) D3DXMatrixMultiply(&m, &m, pprojection);
1838
1839 D3DXVec3TransformCoord(pout, pv, &m);
1840
1841 if (pviewport)
1842 {
1843 pout->x = pviewport->X + ( 1.0f + pout->x ) * pviewport->Width / 2.0f;
1844 pout->y = pviewport->Y + ( 1.0f - pout->y ) * pviewport->Height / 2.0f;
1845 pout->z = pviewport->MinZ + pout->z * ( pviewport->MaxZ - pviewport->MinZ );
1846 }
1847 return pout;
1848}
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1895

Referenced by D3DXVec3ProjectArray(), and D3DXVector3Test().

◆ D3DXVec3ProjectArray()

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 
)

Definition at line 1850 of file math.c.

1851{
1852 UINT i;
1853
1854 TRACE("out %p, outstride %u, in %p, instride %u, viewport %p, projection %p, view %p, world %p, elements %u\n",
1855 out, outstride, in, instride, viewport, projection, view, world, elements);
1856
1857 for (i = 0; i < elements; ++i) {
1859 (D3DXVECTOR3*)((char*)out + outstride * i),
1860 (const D3DXVECTOR3*)((const char*)in + instride * i),
1861 viewport, projection, view, world);
1862 }
1863 return out;
1864}
D3DXVECTOR3 *WINAPI D3DXVec3Project(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld)
Definition: math.c:1828

Referenced by test_D3DXVec_Array().

◆ D3DXVec3Transform()

D3DXVECTOR4 *WINAPI D3DXVec3Transform ( D3DXVECTOR4 *  pout,
const D3DXVECTOR3 *  pv,
const D3DXMATRIX *  pm 
)

Definition at line 1866 of file math.c.

1867{
1869
1870 TRACE("pout %p, pv %p, pm %p\n", pout, pv, pm);
1871
1872 out.x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[2][0] * pv->z + pm->m[3][0];
1873 out.y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[2][1] * pv->z + pm->m[3][1];
1874 out.z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[2][2] * pv->z + pm->m[3][2];
1875 out.w = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[2][3] * pv->z + pm->m[3][3];
1876 *pout = out;
1877 return pout;
1878}

Referenced by D3DXVec3TransformArray(), and D3DXVector3Test().

◆ D3DXVec3TransformArray()

D3DXVECTOR4 *WINAPI D3DXVec3TransformArray ( D3DXVECTOR4 *  pout,
UINT  outstride,
const D3DXVECTOR3 *  pv,
UINT  vstride,
const D3DXMATRIX *  pm,
UINT  n 
)

Definition at line 1880 of file math.c.

1881{
1882 UINT i;
1883
1884 TRACE("out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n", out, outstride, in, instride, matrix, elements);
1885
1886 for (i = 0; i < elements; ++i) {
1888 (D3DXVECTOR4*)((char*)out + outstride * i),
1889 (const D3DXVECTOR3*)((const char*)in + instride * i),
1890 matrix);
1891 }
1892 return out;
1893}
D3DXVECTOR4 *WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1866

Referenced by test_D3DXVec_Array().

◆ D3DXVec3TransformCoord()

D3DXVECTOR3 *WINAPI D3DXVec3TransformCoord ( D3DXVECTOR3 *  pout,
const D3DXVECTOR3 *  pv,
const D3DXMATRIX *  pm 
)

Definition at line 1895 of file math.c.

1896{
1898 FLOAT norm;
1899
1900 TRACE("pout %p, pv %p, pm %p\n", pout, pv, pm);
1901
1902 norm = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[2][3] *pv->z + pm->m[3][3];
1903
1904 out.x = (pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[2][0] * pv->z + pm->m[3][0]) / norm;
1905 out.y = (pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[2][1] * pv->z + pm->m[3][1]) / norm;
1906 out.z = (pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[2][2] * pv->z + pm->m[3][2]) / norm;
1907
1908 *pout = out;
1909
1910 return pout;
1911}

Referenced by D3DXLoadMeshFromXInMemory(), D3DXVec3Project(), D3DXVec3TransformCoordArray(), D3DXVec3Unproject(), and D3DXVector3Test().

◆ D3DXVec3TransformCoordArray()

D3DXVECTOR3 *WINAPI D3DXVec3TransformCoordArray ( D3DXVECTOR3 *  pout,
UINT  outstride,
const D3DXVECTOR3 *  pv,
UINT  vstride,
const D3DXMATRIX *  pm,
UINT  n 
)

Definition at line 1913 of file math.c.

1914{
1915 UINT i;
1916
1917 TRACE("out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n", out, outstride, in, instride, matrix, elements);
1918
1919 for (i = 0; i < elements; ++i) {
1921 (D3DXVECTOR3*)((char*)out + outstride * i),
1922 (const D3DXVECTOR3*)((const char*)in + instride * i),
1923 matrix);
1924 }
1925 return out;
1926}

Referenced by d3dx9_sprite_Flush(), and test_D3DXVec_Array().

◆ D3DXVec3TransformNormal()

D3DXVECTOR3 *WINAPI D3DXVec3TransformNormal ( D3DXVECTOR3 *  pout,
const D3DXVECTOR3 *  pv,
const D3DXMATRIX *  pm 
)

Definition at line 1928 of file math.c.

1929{
1930 const D3DXVECTOR3 v = *pv;
1931
1932 TRACE("pout %p, pv %p, pm %p\n", pout, pv, pm);
1933
1934 pout->x = pm->m[0][0] * v.x + pm->m[1][0] * v.y + pm->m[2][0] * v.z;
1935 pout->y = pm->m[0][1] * v.x + pm->m[1][1] * v.y + pm->m[2][1] * v.z;
1936 pout->z = pm->m[0][2] * v.x + pm->m[1][2] * v.y + pm->m[2][2] * v.z;
1937 return pout;
1938
1939}

Referenced by D3DXVec3TransformNormalArray(), and D3DXVector3Test().

◆ D3DXVec3TransformNormalArray()

D3DXVECTOR3 *WINAPI D3DXVec3TransformNormalArray ( D3DXVECTOR3 *  pout,
UINT  outstride,
const D3DXVECTOR3 *  pv,
UINT  vstride,
const D3DXMATRIX *  pm,
UINT  n 
)

Definition at line 1941 of file math.c.

1942{
1943 UINT i;
1944
1945 TRACE("out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n", out, outstride, in, instride, matrix, elements);
1946
1947 for (i = 0; i < elements; ++i) {
1949 (D3DXVECTOR3*)((char*)out + outstride * i),
1950 (const D3DXVECTOR3*)((const char*)in + instride * i),
1951 matrix);
1952 }
1953 return out;
1954}
D3DXVECTOR3 *WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1928

Referenced by test_D3DXVec_Array().

◆ D3DXVec3Unproject()

D3DXVECTOR3 *WINAPI D3DXVec3Unproject ( D3DXVECTOR3 *  pout,
const D3DXVECTOR3 *  pv,
const D3DVIEWPORT9 *  pviewport,
const D3DXMATRIX *  pprojection,
const D3DXMATRIX *  pview,
const D3DXMATRIX *  pworld 
)

Definition at line 1956 of file math.c.

1959{
1960 D3DXMATRIX m;
1961
1962 TRACE("out %p, v %p, viewport %p, projection %p, view %p, world %p.\n",
1963 out, v, viewport, projection, view, world);
1964
1965 D3DXMatrixIdentity(&m);
1966 if (world)
1967 D3DXMatrixMultiply(&m, &m, world);
1968 if (view)
1970 if (projection)
1971 D3DXMatrixMultiply(&m, &m, projection);
1973
1974 *out = *v;
1975 if (viewport)
1976 {
1977 out->x = 2.0f * (out->x - viewport->X) / viewport->Width - 1.0f;
1978 out->y = 1.0f - 2.0f * (out->y - viewport->Y) / viewport->Height;
1979 out->z = (out->z - viewport->MinZ) / (viewport->MaxZ - viewport->MinZ);
1980 }
1982 return out;
1983}
D3DXMATRIX *WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, const D3DXMATRIX *pm)
Definition: math.c:254

Referenced by D3DXVec3UnprojectArray(), and D3DXVector3Test().

◆ D3DXVec3UnprojectArray()

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 
)

Definition at line 1985 of file math.c.

1986{
1987 UINT i;
1988
1989 TRACE("out %p, outstride %u, in %p, instride %u, viewport %p, projection %p, view %p, world %p, elements %u\n",
1990 out, outstride, in, instride, viewport, projection, view, world, elements);
1991
1992 for (i = 0; i < elements; ++i) {
1994 (D3DXVECTOR3*)((char*)out + outstride * i),
1995 (const D3DXVECTOR3*)((const char*)in + instride * i),
1996 viewport, projection, view, world);
1997 }
1998 return out;
1999}
D3DXVECTOR3 *WINAPI D3DXVec3Unproject(D3DXVECTOR3 *out, const D3DXVECTOR3 *v, const D3DVIEWPORT9 *viewport, const D3DXMATRIX *projection, const D3DXMATRIX *view, const D3DXMATRIX *world)
Definition: math.c:1956

Referenced by test_D3DXVec_Array().

◆ D3DXVec4BaryCentric()

D3DXVECTOR4 *WINAPI D3DXVec4BaryCentric ( D3DXVECTOR4 *  pout,
const D3DXVECTOR4 *  pv1,
const D3DXVECTOR4 *  pv2,
const D3DXVECTOR4 *  pv3,
FLOAT  f,
FLOAT  g 
)

Definition at line 2003 of file math.c.

2004{
2005 TRACE("pout %p, pv1 %p, pv2 %p, pv3 %p, f %f, g %f\n", pout, pv1, pv2, pv3, f, g);
2006
2007 pout->x = (1.0f-f-g) * (pv1->x) + f * (pv2->x) + g * (pv3->x);
2008 pout->y = (1.0f-f-g) * (pv1->y) + f * (pv2->y) + g * (pv3->y);
2009 pout->z = (1.0f-f-g) * (pv1->z) + f * (pv2->z) + g * (pv3->z);
2010 pout->w = (1.0f-f-g) * (pv1->w) + f * (pv2->w) + g * (pv3->w);
2011 return pout;
2012}

Referenced by D3DXVector4Test().

◆ D3DXVec4CatmullRom()

D3DXVECTOR4 *WINAPI D3DXVec4CatmullRom ( D3DXVECTOR4 *  pout,
const D3DXVECTOR4 *  pv0,
const D3DXVECTOR4 *  pv1,
const D3DXVECTOR4 *  pv2,
const D3DXVECTOR4 *  pv3,
FLOAT  s 
)

Definition at line 2014 of file math.c.

2015{
2016 TRACE("pout %p, pv0 %p, pv1 %p, pv2 %p, pv3 %p, s %f\n", pout, pv0, pv1, pv2, pv3, s);
2017
2018 pout->x = 0.5f * (2.0f * pv1->x + (pv2->x - pv0->x) *s + (2.0f *pv0->x - 5.0f * pv1->x + 4.0f * pv2->x - pv3->x) * s * s + (pv3->x -3.0f * pv2->x + 3.0f * pv1->x - pv0->x) * s * s * s);
2019 pout->y = 0.5f * (2.0f * pv1->y + (pv2->y - pv0->y) *s + (2.0f *pv0->y - 5.0f * pv1->y + 4.0f * pv2->y - pv3->y) * s * s + (pv3->y -3.0f * pv2->y + 3.0f * pv1->y - pv0->y) * s * s * s);
2020 pout->z = 0.5f * (2.0f * pv1->z + (pv2->z - pv0->z) *s + (2.0f *pv0->z - 5.0f * pv1->z + 4.0f * pv2->z - pv3->z) * s * s + (pv3->z -3.0f * pv2->z + 3.0f * pv1->z - pv0->z) * s * s * s);
2021 pout->w = 0.5f * (2.0f * pv1->w + (pv2->w - pv0->w) *s + (2.0f *pv0->w - 5.0f * pv1->w + 4.0f * pv2->w - pv3->w) * s * s + (pv3->w -3.0f * pv2->w + 3.0f * pv1->w - pv0->w) * s * s * s);
2022 return pout;
2023}

Referenced by D3DXVector4Test().

◆ D3DXVec4Cross()

D3DXVECTOR4 *WINAPI D3DXVec4Cross ( D3DXVECTOR4 *  pout,
const D3DXVECTOR4 *  pv1,
const D3DXVECTOR4 *  pv2,
const D3DXVECTOR4 *  pv3 
)

Definition at line 2025 of file math.c.

2026{
2028
2029 TRACE("pout %p, pv1 %p, pv2 %p, pv3 %p\n", pout, pv1, pv2, pv3);
2030
2031 out.x = pv1->y * (pv2->z * pv3->w - pv3->z * pv2->w) - pv1->z * (pv2->y * pv3->w - pv3->y * pv2->w) + pv1->w * (pv2->y * pv3->z - pv2->z *pv3->y);
2032 out.y = -(pv1->x * (pv2->z * pv3->w - pv3->z * pv2->w) - pv1->z * (pv2->x * pv3->w - pv3->x * pv2->w) + pv1->w * (pv2->x * pv3->z - pv3->x * pv2->z));
2033 out.z = pv1->x * (pv2->y * pv3->w - pv3->y * pv2->w) - pv1->y * (pv2->x *pv3->w - pv3->x * pv2->w) + pv1->w * (pv2->x * pv3->y - pv3->x * pv2->y);
2034 out.w = -(pv1->x * (pv2->y * pv3->z - pv3->y * pv2->z) - pv1->y * (pv2->x * pv3->z - pv3->x *pv2->z) + pv1->z * (pv2->x * pv3->y - pv3->x * pv2->y));
2035 *pout = out;
2036 return pout;
2037}

Referenced by D3DXVector4Test().

◆ D3DXVec4Hermite()

D3DXVECTOR4 *WINAPI D3DXVec4Hermite ( D3DXVECTOR4 *  pout,
const D3DXVECTOR4 *  pv1,
const D3DXVECTOR4 *  pt1,
const D3DXVECTOR4 *  pv2,
const D3DXVECTOR4 *  pt2,
FLOAT  s 
)

Definition at line 2039 of file math.c.

2040{
2041 FLOAT h1, h2, h3, h4;
2042
2043 TRACE("pout %p, pv1 %p, pt1 %p, pv2 %p, pt2 %p, s %f\n", pout, pv1, pt1, pv2, pt2, s);
2044
2045 h1 = 2.0f * s * s * s - 3.0f * s * s + 1.0f;
2046 h2 = s * s * s - 2.0f * s * s + s;
2047 h3 = -2.0f * s * s * s + 3.0f * s * s;
2048 h4 = s * s * s - s * s;
2049
2050 pout->x = h1 * (pv1->x) + h2 * (pt1->x) + h3 * (pv2->x) + h4 * (pt2->x);
2051 pout->y = h1 * (pv1->y) + h2 * (pt1->y) + h3 * (pv2->y) + h4 * (pt2->y);
2052 pout->z = h1 * (pv1->z) + h2 * (pt1->z) + h3 * (pv2->z) + h4 * (pt2->z);
2053 pout->w = h1 * (pv1->w) + h2 * (pt1->w) + h3 * (pv2->w) + h4 * (pt2->w);
2054 return pout;
2055}

Referenced by D3DXVector4Test().

◆ D3DXVec4Normalize()

D3DXVECTOR4 *WINAPI D3DXVec4Normalize ( D3DXVECTOR4 *  pout,
const D3DXVECTOR4 *  pv 
)

Definition at line 2057 of file math.c.

2058{
2059 FLOAT norm;
2060
2061 TRACE("pout %p, pv %p\n", pout, pv);
2062
2063 norm = D3DXVec4Length(pv);
2064
2065 pout->x = pv->x / norm;
2066 pout->y = pv->y / norm;
2067 pout->z = pv->z / norm;
2068 pout->w = pv->w / norm;
2069
2070 return pout;
2071}

Referenced by D3DXVector4Test().

◆ D3DXVec4Transform()

D3DXVECTOR4 *WINAPI D3DXVec4Transform ( D3DXVECTOR4 *  pout,
const D3DXVECTOR4 *  pv,
const D3DXMATRIX *  pm 
)

Definition at line 2073 of file math.c.

2074{
2076
2077 TRACE("pout %p, pv %p, pm %p\n", pout, pv, pm);
2078
2079 out.x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[2][0] * pv->z + pm->m[3][0] * pv->w;
2080 out.y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[2][1] * pv->z + pm->m[3][1] * pv->w;
2081 out.z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[2][2] * pv->z + pm->m[3][2] * pv->w;
2082 out.w = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[2][3] * pv->z + pm->m[3][3] * pv->w;
2083 *pout = out;
2084 return pout;
2085}

Referenced by D3DXIntersectTri(), D3DXVec4TransformArray(), and D3DXVector4Test().

◆ D3DXVec4TransformArray()

D3DXVECTOR4 *WINAPI D3DXVec4TransformArray ( D3DXVECTOR4 *  pout,
UINT  outstride,
const D3DXVECTOR4 *  pv,
UINT  vstride,
const D3DXMATRIX *  pm,
UINT  n 
)

Definition at line 2087 of file math.c.

2088{
2089 UINT i;
2090
2091 TRACE("out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n", out, outstride, in, instride, matrix, elements);
2092
2093 for (i = 0; i < elements; ++i) {
2095 (D3DXVECTOR4*)((char*)out + outstride * i),
2096 (const D3DXVECTOR4*)((const char*)in + instride * i),
2097 matrix);
2098 }
2099 return out;
2100}
D3DXVECTOR4 *WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv, const D3DXMATRIX *pm)
Definition: math.c:2073

Referenced by test_D3DXVec_Array().

◆ DECLARE_INTERFACE_()

DECLARE_INTERFACE_ ( ID3DXMatrixStack  ,
IUnknown   
)

Definition at line 416 of file d3dx9math.h.

417{
421 STDMETHOD(Pop)(THIS) PURE;
422 STDMETHOD(Push)(THIS) PURE;
423 STDMETHOD(LoadIdentity)(THIS) PURE;
424 STDMETHOD(LoadMatrix)(THIS_ const D3DXMATRIX* pM ) PURE;
425 STDMETHOD(MultMatrix)(THIS_ const D3DXMATRIX* pM ) PURE;
426 STDMETHOD(MultMatrixLocal)(THIS_ const D3DXMATRIX* pM ) PURE;
427 STDMETHOD(RotateAxis)(THIS_ const D3DXVECTOR3* pV, FLOAT Angle) PURE;
428 STDMETHOD(RotateAxisLocal)(THIS_ const D3DXVECTOR3* pV, FLOAT Angle) PURE;
429 STDMETHOD(RotateYawPitchRoll)(THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE;
430 STDMETHOD(RotateYawPitchRollLocal)(THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE;
431 STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE;
432 STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE;
433 STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE;
434 STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE;
435 STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE;
436};
#define PURE
Definition: basetyps.h:64
#define THIS_
Definition: basetyps.h:65
#define THIS
Definition: basetyps.h:66
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
#define STDMETHOD(m)
Definition: basetyps.h:62
_In_ BOOLEAN Release
Definition: cdrom.h:920
_Check_return_ _In_ PQUERY_INTERFACE QueryInterface
Definition: dispmprt.h:1318
REFIID riid
Definition: atlbase.h:39
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:83
#define REFIID
Definition: guiddef.h:118
uint32_t ULONG
Definition: typedefs.h:59

◆ DEFINE_GUID()

DEFINE_GUID ( IID_ID3DXMatrixStack  ,
0xc7885ba7  ,
0xf990  ,
0x4fe7  ,
0x92  ,
0x2d  ,
0x85  ,
0x15  ,
0xe4  ,
0x77  ,
0xdd  ,
0x85   
)