ReactOS 0.4.17-dev-966-gf06eace
math.c File Reference
#include "wine/test.h"
#include "d3dx9.h"
#include <math.h>
#include <stdint.h>
Include dependency graph for math.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define expect_vec2(expected, vector, ulps)   expect_vec2_(__LINE__, expected, vector, ulps)
 
#define expect_vec3(expected, vector, ulps)   expect_vec3_(__LINE__, expected, vector, ulps)
 
#define expect_vec4(expected, vector, ulps)   expect_vec4_(__LINE__, expected, vector, ulps)
 
#define expect_color(expected, color, ulps)   expect_color_(__LINE__, expected, color, ulps)
 
#define expect_plane(expected, plane, ulps)   expect_plane_(__LINE__, expected, plane, ulps)
 
#define expect_quaternion(expected, quaternion, ulps)   expect_quaternion_(__LINE__, expected, quaternion, ulps)
 
#define expect_matrix(expected, matrix, ulps)   expect_matrix_(__LINE__, expected, matrix, ulps)
 
#define expect_vec4_array(count, expected, vector, ulps)   expect_vec4_array_(__LINE__, count, expected, vector, ulps)
 

Functions

static BOOL compare_uint (unsigned int x, unsigned int y, unsigned int max_diff)
 
static BOOL compare_float (float f, float g, unsigned int ulps)
 
static BOOL compare_vec2 (const D3DXVECTOR2 *v1, const D3DXVECTOR2 *v2, unsigned int ulps)
 
static BOOL compare_vec3 (const D3DXVECTOR3 *v1, const D3DXVECTOR3 *v2, unsigned int ulps)
 
static BOOL compare_vec4 (const D3DXVECTOR4 *v1, const D3DXVECTOR4 *v2, unsigned int ulps)
 
static BOOL compare_color (const D3DXCOLOR *c1, const D3DXCOLOR *c2, unsigned int ulps)
 
static BOOL compare_plane (const D3DXPLANE *p1, const D3DXPLANE *p2, unsigned int ulps)
 
static BOOL compare_quaternion (const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, unsigned int ulps)
 
static BOOL compare_matrix (const D3DXMATRIX *m1, const D3DXMATRIX *m2, unsigned int ulps)
 
static void expect_vec2_ (unsigned int line, const D3DXVECTOR2 *expected, const D3DXVECTOR2 *vector, unsigned int ulps)
 
static void expect_vec3_ (unsigned int line, const D3DXVECTOR3 *expected, const D3DXVECTOR3 *vector, unsigned int ulps)
 
static void expect_vec4_ (unsigned int line, const D3DXVECTOR4 *expected, const D3DXVECTOR4 *vector, unsigned int ulps)
 
static void expect_color_ (unsigned int line, const D3DXCOLOR *expected, const D3DXCOLOR *color, unsigned int ulps)
 
static void expect_plane_ (unsigned int line, const D3DXPLANE *expected, const D3DXPLANE *plane, unsigned int ulps)
 
static void expect_quaternion_ (unsigned int line, const D3DXQUATERNION *expected, const D3DXQUATERNION *quaternion, unsigned int ulps)
 
static void expect_matrix_ (unsigned int line, const D3DXMATRIX *expected, const D3DXMATRIX *matrix, unsigned int ulps)
 
static void expect_vec4_array_ (unsigned int line, unsigned int count, const D3DXVECTOR4 *expected, const D3DXVECTOR4 *vector, unsigned int ulps)
 
static void set_matrix (D3DXMATRIX *mat, float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
 
static HWND create_window (void)
 
static IDirect3DDevice9 * create_device (IDirect3D9 *d3d9, HWND focus_window)
 
static void D3DXColorTest (void)
 
static void D3DXFresnelTest (void)
 
static void D3DXMatrixTest (void)
 
static void D3DXPlaneTest (void)
 
static void D3DXQuaternionTest (void)
 
static void D3DXVector2Test (void)
 
static void D3DXVector3Test (void)
 
static void D3DXVector4Test (void)
 
static void test_matrix_stack (void)
 
static void test_Matrix_AffineTransformation2D (void)
 
static void test_Matrix_Decompose (void)
 
static void test_Matrix_Transformation2D (void)
 
static void test_D3DXVec_Array (void)
 
static void test_D3DXFloat_Array (void)
 
static void test_D3DXSHAdd (void)
 
static void test_D3DXSHDot (void)
 
static void test_D3DXSHEvalConeLight (void)
 
static void test_D3DXSHEvalDirection (void)
 
static void test_D3DXSHEvalDirectionalLight (void)
 
static void test_D3DXSHEvalHemisphereLight (void)
 
static void test_D3DXSHEvalSphericalLight (void)
 
static void test_D3DXSHMultiply2 (void)
 
static void test_D3DXSHMultiply3 (void)
 
static void test_D3DXSHMultiply4 (void)
 
static void test_D3DXSHRotate (void)
 
static void test_D3DXSHRotateZ (void)
 
static void test_D3DXSHScale (void)
 
static void test_D3DXSHProjectCubeMap (void)
 
 START_TEST (math)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file math.c.

◆ expect_color

#define expect_color (   expected,
  color,
  ulps 
)    expect_color_(__LINE__, expected, color, ulps)

Definition at line 135 of file math.c.

◆ expect_matrix

#define expect_matrix (   expected,
  matrix,
  ulps 
)    expect_matrix_(__LINE__, expected, matrix, ulps)

Definition at line 164 of file math.c.

◆ expect_plane

#define expect_plane (   expected,
  plane,
  ulps 
)    expect_plane_(__LINE__, expected, plane, ulps)

Definition at line 144 of file math.c.

◆ expect_quaternion

#define expect_quaternion (   expected,
  quaternion,
  ulps 
)    expect_quaternion_(__LINE__, expected, quaternion, ulps)

Definition at line 153 of file math.c.

◆ expect_vec2

#define expect_vec2 (   expected,
  vector,
  ulps 
)    expect_vec2_(__LINE__, expected, vector, ulps)

Definition at line 108 of file math.c.

◆ expect_vec3

#define expect_vec3 (   expected,
  vector,
  ulps 
)    expect_vec3_(__LINE__, expected, vector, ulps)

Definition at line 117 of file math.c.

◆ expect_vec4

#define expect_vec4 (   expected,
  vector,
  ulps 
)    expect_vec4_(__LINE__, expected, vector, ulps)

Definition at line 126 of file math.c.

◆ expect_vec4_array

#define expect_vec4_array (   count,
  expected,
  vector,
  ulps 
)    expect_vec4_array_(__LINE__, count, expected, vector, ulps)

Definition at line 183 of file math.c.

Function Documentation

◆ compare_color()

static BOOL compare_color ( const D3DXCOLOR *  c1,
const D3DXCOLOR *  c2,
unsigned int  ulps 
)
static

Definition at line 68 of file math.c.

69{
70 return compare_float(c1->r, c2->r, ulps)
71 && compare_float(c1->g, c2->g, ulps)
72 && compare_float(c1->b, c2->b, ulps)
73 && compare_float(c1->a, c2->a, ulps);
74}
unsigned int ulps
Definition: effect.c:4467
#define compare_float(got, exp)
Definition: mesh.c:43
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 expect_color_().

◆ compare_float()

static BOOL compare_float ( float  f,
float  g,
unsigned int  ulps 
)
static

Definition at line 35 of file math.c.

36{
37 int x = *(int *)&f;
38 int y = *(int *)&g;
39
40 if (x < 0)
41 x = INT_MIN - x;
42 if (y < 0)
43 y = INT_MIN - y;
44
45 return compare_uint(x, y, ulps);
46}
#define INT_MIN
Definition: limits.h:25
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean g
Definition: glext.h:6204
static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
Definition: math.c:28

◆ compare_matrix()

static BOOL compare_matrix ( const D3DXMATRIX *  m1,
const D3DXMATRIX *  m2,
unsigned int  ulps 
)
static

Definition at line 92 of file math.c.

93{
94 unsigned int i, j;
95
96 for (i = 0; i < 4; ++i)
97 {
98 for (j = 0; j < 4; ++j)
99 {
100 if (!compare_float(m1->m[i][j], m2->m[i][j], ulps))
101 return FALSE;
102 }
103 }
104
105 return TRUE;
106}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
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
float m[4][4]
Definition: d3d8types.h:1116

Referenced by expect_matrix_().

◆ compare_plane()

static BOOL compare_plane ( const D3DXPLANE *  p1,
const D3DXPLANE *  p2,
unsigned int  ulps 
)
static

Definition at line 76 of file math.c.

77{
78 return compare_float(p1->a, p2->a, ulps)
79 && compare_float(p1->b, p2->b, ulps)
80 && compare_float(p1->c, p2->c, ulps)
81 && compare_float(p1->d, p2->d, ulps);
82}
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 expect_plane_(), and test_D3DXVec_Array().

◆ compare_quaternion()

static BOOL compare_quaternion ( const D3DXQUATERNION *  q1,
const D3DXQUATERNION *  q2,
unsigned int  ulps 
)
static

Definition at line 84 of file math.c.

85{
86 return compare_float(q1->x, q2->x, ulps)
87 && compare_float(q1->y, q2->y, ulps)
88 && compare_float(q1->z, q2->z, ulps)
89 && compare_float(q1->w, q2->w, ulps);
90}

Referenced by expect_quaternion_(), and test_Matrix_Decompose().

◆ compare_uint()

static BOOL compare_uint ( unsigned int  x,
unsigned int  y,
unsigned int  max_diff 
)
static

Definition at line 28 of file math.c.

29{
30 unsigned int diff = x > y ? x - y : y - x;
31
32 return diff <= max_diff;
33}

Referenced by compare_float().

◆ compare_vec2()

static BOOL compare_vec2 ( const D3DXVECTOR2 *  v1,
const D3DXVECTOR2 *  v2,
unsigned int  ulps 
)
static

Definition at line 48 of file math.c.

49{
50 return compare_float(v1->x, v2->x, ulps) && compare_float(v1->y, v2->y, ulps);
51}
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063

Referenced by expect_vec2_().

◆ compare_vec3()

static BOOL compare_vec3 ( const D3DXVECTOR3 *  v1,
const D3DXVECTOR3 *  v2,
unsigned int  ulps 
)
static

Definition at line 53 of file math.c.

54{
55 return compare_float(v1->x, v2->x, ulps)
56 && compare_float(v1->y, v2->y, ulps)
57 && compare_float(v1->z, v2->z, ulps);
58}

Referenced by expect_vec3_().

◆ compare_vec4()

static BOOL compare_vec4 ( const D3DXVECTOR4 *  v1,
const D3DXVECTOR4 *  v2,
unsigned int  ulps 
)
static

Definition at line 60 of file math.c.

61{
62 return compare_float(v1->x, v2->x, ulps)
63 && compare_float(v1->y, v2->y, ulps)
64 && compare_float(v1->z, v2->z, ulps)
65 && compare_float(v1->w, v2->w, ulps);
66}

Referenced by expect_vec4_(), and expect_vec4_array_().

◆ create_device()

static IDirect3DDevice9 * create_device ( IDirect3D9 *  d3d9,
HWND  focus_window 
)
static

Definition at line 224 of file math.c.

225{
226 D3DPRESENT_PARAMETERS present_parameters = {0};
227 unsigned int adapter_ordinal;
230
231 adapter_ordinal = D3DADAPTER_DEFAULT;
232 present_parameters.BackBufferWidth = 640;
233 present_parameters.BackBufferHeight = 480;
234 present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
235 present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
236 present_parameters.hDeviceWindow = focus_window;
237 present_parameters.Windowed = TRUE;
238 present_parameters.EnableAutoDepthStencil = TRUE;
239 present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
240
241 if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, adapter_ordinal, D3DDEVTYPE_HAL, focus_window,
242 behavior_flags, &present_parameters, &device)))
243 return device;
244
245 present_parameters.AutoDepthStencilFormat = D3DFMT_D16;
246 if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, adapter_ordinal, D3DDEVTYPE_HAL, focus_window,
247 behavior_flags, &present_parameters, &device)))
248 return device;
249
250 behavior_flags = (behavior_flags
253
254 if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, adapter_ordinal, D3DDEVTYPE_HAL, focus_window,
255 behavior_flags, &present_parameters, &device)))
256 return device;
257
258 return NULL;
259}
@ D3DFMT_D16
Definition: d3d8types.h:644
@ D3DFMT_A8R8G8B8
Definition: d3d8types.h:604
@ D3DFMT_D24S8
Definition: d3d8types.h:643
@ D3DSWAPEFFECT_DISCARD
Definition: d3d8types.h:851
@ D3DDEVTYPE_HAL
Definition: d3d8types.h:576
#define IDirect3D9_CreateDevice(p, a, b, c, d, e, f)
Definition: d3d9.h:224
#define NULL
Definition: types.h:112
DWORD IDirect3DDevice9
Definition: dxva2api.idl:22
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define D3DADAPTER_DEFAULT
Definition: d3d8.h:53
#define D3DCREATE_HARDWARE_VERTEXPROCESSING
Definition: d3d8.h:41
#define D3DCREATE_SOFTWARE_VERTEXPROCESSING
Definition: d3d8.h:40
#define D3DCREATE_MIXED_VERTEXPROCESSING
Definition: d3d8.h:42
D3DSWAPEFFECT SwapEffect
Definition: d3d8types.h:1128
D3DFORMAT BackBufferFormat
Definition: d3d8types.h:1123
D3DFORMAT AutoDepthStencilFormat
Definition: d3d8types.h:1132
Definition: devices.h:37

◆ create_window()

static HWND create_window ( void  )
static

Definition at line 214 of file math.c.

215{
216 RECT r = {0, 0, 640, 480};
217
219
220 return CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
221 0, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, NULL, NULL);
222}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4469
Definition: dcommon.idl:28

Referenced by test_D3DXSHProjectCubeMap().

◆ D3DXColorTest()

static void D3DXColorTest ( void  )
static

Definition at line 261 of file math.c.

262{
263 D3DXCOLOR color, color1, color2, expected, got;
264 LPD3DXCOLOR funcpointer;
265 FLOAT scale;
266
267 color.r = 0.2f; color.g = 0.75f; color.b = 0.41f; color.a = 0.93f;
268 color1.r = 0.6f; color1.g = 0.55f; color1.b = 0.23f; color1.a = 0.82f;
269 color2.r = 0.3f; color2.g = 0.5f; color2.b = 0.76f; color2.a = 0.11f;
270
271 scale = 0.3f;
272
273/*_______________D3DXColorAdd________________*/
274 expected.r = 0.9f; expected.g = 1.05f; expected.b = 0.99f; expected.a = 0.93f;
275 D3DXColorAdd(&got,&color1,&color2);
276 expect_color(&expected, &got, 1);
277 /* Test the NULL case */
278 funcpointer = D3DXColorAdd(&got,NULL,&color2);
279 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
280 funcpointer = D3DXColorAdd(NULL,NULL,&color2);
281 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
282 funcpointer = D3DXColorAdd(NULL,NULL,NULL);
283 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
284
285/*_______________D3DXColorAdjustContrast______*/
286 expected.r = 0.41f; expected.g = 0.575f; expected.b = 0.473f; expected.a = 0.93f;
288 expect_color(&expected, &got, 0);
289
290/*_______________D3DXColorAdjustSaturation______*/
291 expected.r = 0.486028f; expected.g = 0.651028f; expected.b = 0.549028f; expected.a = 0.93f;
293 expect_color(&expected, &got, 16);
294
295/*_______________D3DXColorLerp________________*/
296 expected.r = 0.32f; expected.g = 0.69f; expected.b = 0.356f; expected.a = 0.897f;
297 D3DXColorLerp(&got,&color,&color1,scale);
298 expect_color(&expected, &got, 0);
299 /* Test the NULL case */
300 funcpointer = D3DXColorLerp(&got,NULL,&color1,scale);
301 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
302 funcpointer = D3DXColorLerp(NULL,NULL,&color1,scale);
303 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
304 funcpointer = D3DXColorLerp(NULL,NULL,NULL,scale);
305 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
306
307/*_______________D3DXColorModulate________________*/
308 expected.r = 0.18f; expected.g = 0.275f; expected.b = 0.1748f; expected.a = 0.0902f;
309 D3DXColorModulate(&got,&color1,&color2);
310 expect_color(&expected, &got, 0);
311 /* Test the NULL case */
312 funcpointer = D3DXColorModulate(&got,NULL,&color2);
313 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
314 funcpointer = D3DXColorModulate(NULL,NULL,&color2);
315 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
316 funcpointer = D3DXColorModulate(NULL,NULL,NULL);
317 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
318
319/*_______________D3DXColorNegative________________*/
320 expected.r = 0.8f; expected.g = 0.25f; expected.b = 0.59f; expected.a = 0.93f;
321 D3DXColorNegative(&got,&color);
322 expect_color(&expected, &got, 1);
323 /* Test the greater than 1 case */
324 color1.r = 0.2f; color1.g = 1.75f; color1.b = 0.41f; color1.a = 0.93f;
325 expected.r = 0.8f; expected.g = -0.75f; expected.b = 0.59f; expected.a = 0.93f;
326 D3DXColorNegative(&got,&color1);
327 expect_color(&expected, &got, 1);
328 /* Test the negative case */
329 color1.r = 0.2f; color1.g = -0.75f; color1.b = 0.41f; color1.a = 0.93f;
330 expected.r = 0.8f; expected.g = 1.75f; expected.b = 0.59f; expected.a = 0.93f;
331 D3DXColorNegative(&got,&color1);
332 expect_color(&expected, &got, 1);
333 /* Test the NULL case */
334 funcpointer = D3DXColorNegative(&got,NULL);
335 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
336 funcpointer = D3DXColorNegative(NULL,NULL);
337 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
338
339/*_______________D3DXColorScale________________*/
340 expected.r = 0.06f; expected.g = 0.225f; expected.b = 0.123f; expected.a = 0.279f;
342 expect_color(&expected, &got, 1);
343 /* Test the NULL case */
344 funcpointer = D3DXColorScale(&got,NULL,scale);
345 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
346 funcpointer = D3DXColorScale(NULL,NULL,scale);
347 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
348
349/*_______________D3DXColorSubtract_______________*/
350 expected.r = -0.1f; expected.g = 0.25f; expected.b = -0.35f; expected.a = 0.82f;
351 D3DXColorSubtract(&got,&color,&color2);
352 expect_color(&expected, &got, 1);
353 /* Test the NULL case */
354 funcpointer = D3DXColorSubtract(&got,NULL,&color2);
355 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
356 funcpointer = D3DXColorSubtract(NULL,NULL,&color2);
357 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
358 funcpointer = D3DXColorSubtract(NULL,NULL,NULL);
359 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
360}
#define ok(value,...)
Definition: atltest.h:57
D3DXCOLOR * D3DXColorSubtract(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2)
D3DXCOLOR * D3DXColorAdd(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2)
D3DXCOLOR * D3DXColorLerp(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2, float s)
D3DXCOLOR * D3DXColorScale(D3DXCOLOR *out, D3DXCOLOR c, float s)
D3DXCOLOR * D3DXColorModulate(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2)
D3DXCOLOR *WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, const D3DXCOLOR *pc, FLOAT s)
Definition: math.c:46
D3DXCOLOR *WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, const D3DXCOLOR *pc, FLOAT s)
Definition: math.c:57
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
GLuint color
Definition: glext.h:6243
BOOL expected
Definition: store.c:2000
#define expect_color(expected, color, ulps)
Definition: math.c:135
float FLOAT
Definition: typedefs.h:69

Referenced by START_TEST().

◆ D3DXFresnelTest()

static void D3DXFresnelTest ( void  )
static

Definition at line 362 of file math.c.

363{
364 float fresnel;
365 BOOL equal;
366
367 fresnel = D3DXFresnelTerm(0.5f, 1.5f);
368 equal = compare_float(fresnel, 8.91867128e-02f, 1);
369 ok(equal, "Got unexpected Fresnel term %.8e.\n", fresnel);
370}
FLOAT WINAPI D3DXFresnelTerm(FLOAT costheta, FLOAT refractionindex)
Definition: math.c:73
unsigned int BOOL
Definition: ntddk_ex.h:94
#define equal(x, y)
Definition: reader.cc:56

Referenced by START_TEST().

◆ D3DXMatrixTest()

static void D3DXMatrixTest ( void  )
static

Definition at line 372 of file math.c.

373{
374 D3DXMATRIX expectedmat, gotmat, mat, mat2, mat3;
375 BOOL expected, got, equal;
376 float angle, determinant;
379 D3DXVECTOR3 at, axis, eye, last;
382
383 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
384 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
385 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
386 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
387 mat.m[0][0] = 10.0f; mat.m[1][1] = 20.0f; mat.m[2][2] = 30.0f;
388 mat.m[3][3] = -40.0f;
389
390 mat2.m[0][0] = 1.0f; mat2.m[1][0] = 2.0f; mat2.m[2][0] = 3.0f;
391 mat2.m[3][0] = 4.0f; mat2.m[0][1] = 5.0f; mat2.m[1][1] = 6.0f;
392 mat2.m[2][1] = 7.0f; mat2.m[3][1] = 8.0f; mat2.m[0][2] = -8.0f;
393 mat2.m[1][2] = -7.0f; mat2.m[2][2] = -6.0f; mat2.m[3][2] = -5.0f;
394 mat2.m[0][3] = -4.0f; mat2.m[1][3] = -3.0f; mat2.m[2][3] = -2.0f;
395 mat2.m[3][3] = -1.0f;
396
397 plane.a = -3.0f; plane.b = -1.0f; plane.c = 4.0f; plane.d = 7.0f;
398
399 q.x = 1.0f; q.y = -4.0f; q.z =7.0f; q.w = -11.0f;
400 r.x = 0.87f; r.y = 0.65f; r.z =0.43f; r.w= 0.21f;
401
402 at.x = -2.0f; at.y = 13.0f; at.z = -9.0f;
403 axis.x = 1.0f; axis.y = -3.0f; axis.z = 7.0f;
404 eye.x = 8.0f; eye.y = -5.0f; eye.z = 5.75f;
405 last.x = 9.7f; last.y = -8.6; last.z = 1.3f;
406
407 light.x = 9.6f; light.y = 8.5f; light.z = 7.4; light.w = 6.3;
408
409 angle = D3DX_PI/3.0f;
410
411/*____________D3DXMatrixAffineTransformation______*/
412 set_matrix(&expectedmat,
413 -459.239990f, -576.719971f, -263.440002f, 0.0f,
414 519.760010f, -352.440002f, -277.679993f, 0.0f,
415 363.119995f, -121.040001f, -117.479996f, 0.0f,
416 -1239.0f, 667.0f, 567.0f, 1.0f);
417 D3DXMatrixAffineTransformation(&gotmat, 3.56f, &at, &q, &axis);
418 expect_matrix(&expectedmat, &gotmat, 0);
419
420 /* Test the NULL case */
421 expectedmat.m[3][0] = 1.0f; expectedmat.m[3][1] = -3.0f; expectedmat.m[3][2] = 7.0f; expectedmat.m[3][3] = 1.0f;
422 D3DXMatrixAffineTransformation(&gotmat, 3.56f, NULL, &q, &axis);
423 expect_matrix(&expectedmat, &gotmat, 0);
424
425 expectedmat.m[3][0] = -1240.0f; expectedmat.m[3][1] = 670.0f; expectedmat.m[3][2] = 560.0f; expectedmat.m[3][3] = 1.0f;
426 D3DXMatrixAffineTransformation(&gotmat, 3.56f, &at, &q, NULL);
427 expect_matrix(&expectedmat, &gotmat, 0);
428
429 expectedmat.m[3][0] = 0.0f; expectedmat.m[3][1] = 0.0f; expectedmat.m[3][2] = 0.0f; expectedmat.m[3][3] = 1.0f;
430 D3DXMatrixAffineTransformation(&gotmat, 3.56f, NULL, &q, NULL);
431 expect_matrix(&expectedmat, &gotmat, 0);
432
433 set_matrix(&expectedmat,
434 3.56f, 0.0f, 0.0f, 0.0f,
435 0.0f, 3.56f, 0.0f, 0.0f,
436 0.0f, 0.0f, 3.56f, 0.0f,
437 1.0f, -3.0f, 7.0f, 1.0f);
438 D3DXMatrixAffineTransformation(&gotmat, 3.56f, NULL, NULL, &axis);
439 expect_matrix(&expectedmat, &gotmat, 0);
440
441 D3DXMatrixAffineTransformation(&gotmat, 3.56f, &at, NULL, &axis);
442 expect_matrix(&expectedmat, &gotmat, 0);
443
444 expectedmat.m[3][0] = 0.0f; expectedmat.m[3][1] = 0.0f; expectedmat.m[3][2] = 0.0f; expectedmat.m[3][3] = 1.0f;
445 D3DXMatrixAffineTransformation(&gotmat, 3.56f, &at, NULL, NULL);
446 expect_matrix(&expectedmat, &gotmat, 0);
447
448 D3DXMatrixAffineTransformation(&gotmat, 3.56f, NULL, NULL, NULL);
449 expect_matrix(&expectedmat, &gotmat, 0);
450
451/*____________D3DXMatrixfDeterminant_____________*/
452 determinant = D3DXMatrixDeterminant(&mat);
453 equal = compare_float(determinant, -147888.0f, 0);
454 ok(equal, "Got unexpected determinant %.8e.\n", determinant);
455
456/*____________D3DXMatrixInverse______________*/
457 set_matrix(&expectedmat,
458 16067.0f/73944.0f, -10165.0f/147888.0f, -2729.0f/147888.0f, -1631.0f/49296.0f,
459 -565.0f/36972.0f, 2723.0f/73944.0f, -1073.0f/73944.0f, 289.0f/24648.0f,
460 -389.0f/2054.0f, 337.0f/4108.0f, 181.0f/4108.0f, 317.0f/4108.0f,
461 163.0f/5688.0f, -101.0f/11376.0f, -73.0f/11376.0f, -127.0f/3792.0f);
462 D3DXMatrixInverse(&gotmat, &determinant, &mat);
463 expect_matrix(&expectedmat, &gotmat, 1);
464 equal = compare_float(determinant, -147888.0f, 0);
465 ok(equal, "Got unexpected determinant %.8e.\n", determinant);
466 determinant = 5.0f;
467 ret = D3DXMatrixInverse(&gotmat, &determinant, &mat2);
468 ok(!ret, "Unexpected return value %p.\n", ret);
469 expect_matrix(&expectedmat, &gotmat, 1);
470 ok(compare_float(determinant, 5.0f, 0) || broken(!determinant), /* Vista 64 bit testbot */
471 "Unexpected determinant %.8e.\n", determinant);
472
473/*____________D3DXMatrixIsIdentity______________*/
474 expected = FALSE;
475 memset(&mat3, 0, sizeof(mat3));
476 got = D3DXMatrixIsIdentity(&mat3);
477 ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
478 D3DXMatrixIdentity(&mat3);
479 expected = TRUE;
480 got = D3DXMatrixIsIdentity(&mat3);
481 ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
482 mat3.m[0][0] = 0.000009f;
483 expected = FALSE;
484 got = D3DXMatrixIsIdentity(&mat3);
485 ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
486 /* Test the NULL case */
487 expected = FALSE;
488 got = D3DXMatrixIsIdentity(NULL);
489 ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
490
491/*____________D3DXMatrixLookAtLH_______________*/
492 set_matrix(&expectedmat,
493 -0.82246518f, -0.40948939f, -0.39480308f, 0.0f,
494 -0.55585691f, 0.43128574f, 0.71064550f, 0.0f,
495 -0.12072885f, 0.80393475f, -0.58233452f, 0.0f,
496 4.4946337f, 0.80971903f, 10.060076f, 1.0f);
497 D3DXMatrixLookAtLH(&gotmat, &eye, &at, &axis);
498 expect_matrix(&expectedmat, &gotmat, 32);
499
500/*____________D3DXMatrixLookAtRH_______________*/
501 set_matrix(&expectedmat,
502 0.82246518f, -0.40948939f, 0.39480308f, 0.0f,
503 0.55585691f, 0.43128574f, -0.71064550f, 0.0f,
504 0.12072885f, 0.80393475f, 0.58233452f, 0.0f,
505 -4.4946337f, 0.80971903f, -10.060076f, 1.0f);
506 D3DXMatrixLookAtRH(&gotmat, &eye, &at, &axis);
507 expect_matrix(&expectedmat, &gotmat, 32);
508
509/*____________D3DXMatrixMultiply______________*/
510 set_matrix(&expectedmat,
511 73.0f, 193.0f, -197.0f, -77.0f,
512 231.0f, 551.0f, -489.0f, -169.0f,
513 239.0f, 523.0f, -400.0f, -116.0f,
514 -164.0f, -320.0f, 187.0f, 31.0f);
515 D3DXMatrixMultiply(&gotmat, &mat, &mat2);
516 expect_matrix(&expectedmat, &gotmat, 0);
517
518/*____________D3DXMatrixMultiplyTranspose____*/
519 set_matrix(&expectedmat,
520 73.0f, 231.0f, 239.0f, -164.0f,
521 193.0f, 551.0f, 523.0f, -320.0f,
522 -197.0f, -489.0f, -400.0f, 187.0f,
523 -77.0f, -169.0f, -116.0f, 31.0f);
524 D3DXMatrixMultiplyTranspose(&gotmat, &mat, &mat2);
525 expect_matrix(&expectedmat, &gotmat, 0);
526
527/*____________D3DXMatrixOrthoLH_______________*/
528 set_matrix(&expectedmat,
529 0.8f, 0.0f, 0.0f, 0.0f,
530 0.0f, 0.27027027f, 0.0f, 0.0f,
531 0.0f, 0.0f, -0.15151515f, 0.0f,
532 0.0f, 0.0f, -0.48484848f, 1.0f);
533 D3DXMatrixOrthoLH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f);
534 expect_matrix(&expectedmat, &gotmat, 16);
535
536/*____________D3DXMatrixOrthoOffCenterLH_______________*/
537 set_matrix(&expectedmat,
538 3.6363636f, 0.0f, 0.0f, 0.0f,
539 0.0f, 0.18018018f, 0.0f, 0.0f,
540 0.0f, 0.0f, -0.045662100f, 0.0f,
541 -1.7272727f, -0.56756757f, 0.42465753f, 1.0f);
542 D3DXMatrixOrthoOffCenterLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6);
543 expect_matrix(&expectedmat, &gotmat, 32);
544
545/*____________D3DXMatrixOrthoOffCenterRH_______________*/
546 set_matrix(&expectedmat,
547 3.6363636f, 0.0f, 0.0f, 0.0f,
548 0.0f, 0.18018018f, 0.0f, 0.0f,
549 0.0f, 0.0f, 0.045662100f, 0.0f,
550 -1.7272727f, -0.56756757f, 0.42465753f, 1.0f);
551 D3DXMatrixOrthoOffCenterRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6);
552 expect_matrix(&expectedmat, &gotmat, 32);
553
554/*____________D3DXMatrixOrthoRH_______________*/
555 set_matrix(&expectedmat,
556 0.8f, 0.0f, 0.0f, 0.0f,
557 0.0f, 0.27027027f, 0.0f, 0.0f,
558 0.0f, 0.0f, 0.15151515f, 0.0f,
559 0.0f, 0.0f, -0.48484848f, 1.0f);
560 D3DXMatrixOrthoRH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f);
561 expect_matrix(&expectedmat, &gotmat, 16);
562
563/*____________D3DXMatrixPerspectiveFovLH_______________*/
564 set_matrix(&expectedmat,
565 13.288858f, 0.0f, 0.0f, 0.0f,
566 0.0f, 9.9666444f, 0.0f, 0.0f,
567 0.0f, 0.0f, 0.78378378f, 1.0f,
568 0.0f, 0.0f, 1.8810811f, 0.0f);
569 D3DXMatrixPerspectiveFovLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
570 expect_matrix(&expectedmat, &gotmat, 4);
571
572/*____________D3DXMatrixPerspectiveFovRH_______________*/
573 set_matrix(&expectedmat,
574 13.288858f, 0.0f, 0.0f, 0.0f,
575 0.0f, 9.9666444f, 0.0f, 0.0f,
576 0.0f, 0.0f, -0.78378378f, -1.0f,
577 0.0f, 0.0f, 1.8810811f, 0.0f);
578 D3DXMatrixPerspectiveFovRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
579 expect_matrix(&expectedmat, &gotmat, 4);
580
581/*____________D3DXMatrixPerspectiveLH_______________*/
582 set_matrix(&expectedmat,
583 -24.0f, 0.0f, 0.0f, 0.0f,
584 0.0f, -6.4f, 0.0f, 0.0f,
585 0.0f, 0.0f, 0.78378378f, 1.0f,
586 0.0f, 0.0f, 1.8810811f, 0.0f);
587 D3DXMatrixPerspectiveLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
588 expect_matrix(&expectedmat, &gotmat, 4);
589
590/*____________D3DXMatrixPerspectiveOffCenterLH_______________*/
591 set_matrix(&expectedmat,
592 11.636364f, 0.0f, 0.0f, 0.0f,
593 0.0f, 0.57657658f, 0.0f, 0.0f,
594 -1.7272727f, -0.56756757f, 0.84079602f, 1.0f,
595 0.0f, 0.0f, -2.6905473f, 0.0f);
596 D3DXMatrixPerspectiveOffCenterLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 3.2f, -16.9f);
597 expect_matrix(&expectedmat, &gotmat, 8);
598
599/*____________D3DXMatrixPerspectiveOffCenterRH_______________*/
600 set_matrix(&expectedmat,
601 11.636364f, 0.0f, 0.0f, 0.0f,
602 0.0f, 0.57657658f, 0.0f, 0.0f,
603 1.7272727f, 0.56756757f, -0.84079602f, -1.0f,
604 0.0f, 0.0f, -2.6905473f, 0.0f);
605 D3DXMatrixPerspectiveOffCenterRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 3.2f, -16.9f);
606 expect_matrix(&expectedmat, &gotmat, 8);
607
608/*____________D3DXMatrixPerspectiveRH_______________*/
609 set_matrix(&expectedmat,
610 -24.0f, -0.0f, 0.0f, 0.0f,
611 0.0f, -6.4f, 0.0f, 0.0f,
612 0.0f, 0.0f, -0.78378378f, -1.0f,
613 0.0f, 0.0f, 1.8810811f, 0.0f);
614 D3DXMatrixPerspectiveRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
615 expect_matrix(&expectedmat, &gotmat, 4);
616
617/*____________D3DXMatrixReflect______________*/
618 set_matrix(&expectedmat,
619 0.30769235f, -0.23076922f, 0.92307687f, 0.0f,
620 -0.23076922, 0.92307693f, 0.30769232f, 0.0f,
621 0.92307687f, 0.30769232f, -0.23076922f, 0.0f,
622 1.6153846f, 0.53846157f, -2.1538463f, 1.0f);
623 D3DXMatrixReflect(&gotmat, &plane);
624 expect_matrix(&expectedmat, &gotmat, 32);
625
626/*____________D3DXMatrixRotationAxis_____*/
627 set_matrix(&expectedmat,
628 0.50847453f, 0.76380461f, 0.39756277f, 0.0f,
629 -0.81465209f, 0.57627118f, -0.065219201f, 0.0f,
630 -0.27891868f, -0.29071301f, 0.91525424f, 0.0f,
631 0.0f, 0.0f, 0.0f, 1.0f);
632 D3DXMatrixRotationAxis(&gotmat, &axis, angle);
633 expect_matrix(&expectedmat, &gotmat, 32);
634
635/*____________D3DXMatrixRotationQuaternion______________*/
636 set_matrix(&expectedmat,
637 -129.0f, -162.0f, -74.0f, 0.0f,
638 146.0f, -99.0f, -78.0f, 0.0f,
639 102.0f, -34.0f, -33.0f, 0.0f,
640 0.0f, 0.0f, 0.0f, 1.0f);
642 expect_matrix(&expectedmat, &gotmat, 0);
643
644/*____________D3DXMatrixRotationX______________*/
645 set_matrix(&expectedmat,
646 1.0f, 0.0f, 0.0f, 0.0f,
647 0.0f, 0.5f, sqrt(3.0f)/2.0f, 0.0f,
648 0.0f, -sqrt(3.0f)/2.0f, 0.5f, 0.0f,
649 0.0f, 0.0f, 0.0f, 1.0f);
650 D3DXMatrixRotationX(&gotmat, angle);
651 expect_matrix(&expectedmat, &gotmat, 1);
652
653/*____________D3DXMatrixRotationY______________*/
654 set_matrix(&expectedmat,
655 0.5f, 0.0f, -sqrt(3.0f)/2.0f, 0.0f,
656 0.0f, 1.0f, 0.0f, 0.0f,
657 sqrt(3.0f)/2.0f, 0.0f, 0.5f, 0.0f,
658 0.0f, 0.0f, 0.0f, 1.0f);
659 D3DXMatrixRotationY(&gotmat, angle);
660 expect_matrix(&expectedmat, &gotmat, 1);
661
662/*____________D3DXMatrixRotationYawPitchRoll____*/
663 set_matrix(&expectedmat,
664 0.88877726f, 0.091874748f, -0.44903678f, 0.0f,
665 0.35171318f, 0.49148652f, 0.79670501f, 0.0f,
666 0.29389259f, -0.86602545f, 0.40450847f, 0.0f,
667 0.0f, 0.0f, 0.0f, 1.0f);
668 D3DXMatrixRotationYawPitchRoll(&gotmat, 3.0f * angle / 5.0f, angle, 3.0f * angle / 17.0f);
669 expect_matrix(&expectedmat, &gotmat, 64);
670
671/*____________D3DXMatrixRotationZ______________*/
672 set_matrix(&expectedmat,
673 0.5f, sqrt(3.0f)/2.0f, 0.0f, 0.0f,
674 -sqrt(3.0f)/2.0f, 0.5f, 0.0f, 0.0f,
675 0.0f, 0.0f, 1.0f, 0.0f,
676 0.0f, 0.0f, 0.0f, 1.0f);
677 D3DXMatrixRotationZ(&gotmat, angle);
678 expect_matrix(&expectedmat, &gotmat, 1);
679
680/*____________D3DXMatrixScaling______________*/
681 set_matrix(&expectedmat,
682 0.69f, 0.0f, 0.0f, 0.0f,
683 0.0f, 0.53f, 0.0f, 0.0f,
684 0.0f, 0.0f, 4.11f, 0.0f,
685 0.0f, 0.0f, 0.0f, 1.0f);
686 D3DXMatrixScaling(&gotmat, 0.69f, 0.53f, 4.11f);
687 expect_matrix(&expectedmat, &gotmat, 0);
688
689/*____________D3DXMatrixShadow______________*/
690 set_matrix(&expectedmat,
691 12.786773f, 5.0009613f, 4.3537784f, 3.7065949f,
692 1.8827150f, 8.8056154f, 1.4512594f, 1.2355317f,
693 -7.5308599f, -6.6679487f, 1.3335901f, -4.9421268f,
694 -13.179006f, -11.668910f, -10.158816f, -1.5100943f);
695 D3DXMatrixShadow(&gotmat, &light, &plane);
696 expect_matrix(&expectedmat, &gotmat, 8);
697
698/*____________D3DXMatrixTransformation______________*/
699 set_matrix(&expectedmat,
700 1.0f, 0.0f, 0.0f, 0.0f,
701 0.0f, 1.0f, 0.0f, 0.0f,
702 0.0f, 0.0f, 1.0f, 0.0f,
703 0.0f, 0.0f, 0.0f, 1.0f);
705 expect_matrix(&expectedmat, &gotmat, 0);
706
707 set_matrix(&expectedmat,
708 1.0f, 0.0f, 0.0f, 0.0f,
709 0.0f, 1.0f, 0.0f, 0.0f,
710 0.0f, 0.0f, 1.0f, 0.0f,
711 9.7f, -8.6f, 1.3f, 1.0f);
713 expect_matrix(&expectedmat, &gotmat, 0);
714
715 set_matrix(&expectedmat,
716 -0.2148f, 1.3116f, 0.4752f, 0.0f,
717 0.9504f, -0.8836f, 0.9244f, 0.0f,
718 1.0212f, 0.1936f, -1.3588f, 0.0f,
719 0.0f, 0.0f, 0.0f, 1.0f);
721 expect_matrix(&expectedmat, &gotmat, 8);
722
723 set_matrix(&expectedmat,
724 1.0f, 0.0f, 0.0f, 0.0f,
725 0.0f, 1.0f, 0.0f, 0.0f,
726 0.0f, 0.0f, 1.0f, 0.0f,
727 0.0f, 0.0f, 0.0f, 1.0f);
728 D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, &eye, NULL, NULL);
729 expect_matrix(&expectedmat, &gotmat, 0);
730
731 set_matrix(&expectedmat,
732 1.0f, 0.0f, 0.0f, 0.0f,
733 0.0f, -3.0f, 0.0f, 0.0f,
734 0.0f, 0.0f, 7.0f, 0.0f,
735 0.0f, 0.0f, 0.0f, 1.0f);
736 D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, NULL, NULL, NULL);
737 expect_matrix(&expectedmat, &gotmat, 0);
738
739 set_matrix(&expectedmat,
740 1.0f, 0.0f, 0.0f, 0.0f,
741 0.0f, 1.0f, 0.0f, 0.0f,
742 0.0f, 0.0f, 1.0f, 0.0f,
743 0.0f, 0.0f, 0.0f, 1.0f);
745 expect_matrix(&expectedmat, &gotmat, 0);
746
747 set_matrix(&expectedmat,
748 1.0f, 0.0f, 0.0f, 0.0f,
749 0.0f, 1.0f, 0.0f, 0.0f,
750 0.0f, 0.0f, 1.0f, 0.0f,
751 0.0f, 0.0f, 0.0f, 1.0f);
752 D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, NULL, NULL, NULL);
753 expect_matrix(&expectedmat, &gotmat, 0);
754
755 set_matrix(&expectedmat,
756 -0.2148f, 1.3116f, 0.4752f, 0.0f,
757 0.9504f, -0.8836f, 0.9244f, 0.0f,
758 1.0212f, 0.1936f, -1.3588f, 0.0f,
759 9.7f, -8.6f, 1.3f, 1.0f);
761 expect_matrix(&expectedmat, &gotmat, 8);
762
763 set_matrix(&expectedmat,
764 1.0f, 0.0f, 0.0f, 0.0f,
765 0.0f, 1.0f, 0.0f, 0.0f,
766 0.0f, 0.0f, 1.0f, 0.0f,
767 9.7f, -8.6f, 1.3f, 1.0f);
768 D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, &eye, NULL, &last);
769 expect_matrix(&expectedmat, &gotmat, 0);
770
771 set_matrix(&expectedmat,
772 1.0f, 0.0f, 0.0f, 0.0f,
773 0.0f, -3.0f, 0.0f, 0.0f,
774 0.0f, 0.0f, 7.0f, 0.0f,
775 9.7f, -8.6f, 1.3f, 1.0f);
776 D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, NULL, NULL, &last);
777 expect_matrix(&expectedmat, &gotmat, 0);
778
779 set_matrix(&expectedmat,
780 1.0f, 0.0f, 0.0f, 0.0f,
781 0.0f, 1.0f, 0.0f, 0.0f,
782 0.0f, 0.0f, 1.0f, 0.0f,
783 9.7f, -8.6f, 1.3f, 1.0f);
785 expect_matrix(&expectedmat, &gotmat, 0);
786
787 set_matrix(&expectedmat,
788 1.0f, 0.0f, 0.0f, 0.0f,
789 0.0f, 1.0f, 0.0f, 0.0f,
790 0.0f, 0.0f, 1.0f, 0.0f,
791 9.7f, -8.6f, 1.3f, 1.0f);
792 D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, NULL, NULL, &last);
793 expect_matrix(&expectedmat, &gotmat, 0);
794
795 set_matrix(&expectedmat,
796 -0.2148f, 1.3116f, 0.4752f, 0.0f,
797 0.9504f, -0.8836f, 0.9244f, 0.0f,
798 1.0212f, 0.1936f, -1.3588f, 0.0f,
799 8.5985f, -21.024f, 14.383499, 1.0f);
800 D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, &eye, &r, NULL);
801 expect_matrix(&expectedmat, &gotmat, 8);
802
803 set_matrix(&expectedmat,
804 -0.2148f, 1.3116f, 0.4752f, 0.0f,
805 -2.8512f, 2.6508f, -2.7732f, 0.0f,
806 7.148399f, 1.3552f, -9.5116f, 0.0f,
807 0.0f, 0.0f, 0.0f, 1.0f);
808 D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, NULL, &r, NULL);
809 expect_matrix(&expectedmat, &gotmat, 8);
810
811 set_matrix(&expectedmat,
812 -0.2148f, 1.3116f, 0.4752f, 0.0f,
813 0.9504f, -0.8836f, 0.9244f, 0.0f,
814 1.0212f, 0.1936f, -1.3588f, 0.0f,
815 0.0f, 0.0f, 0.0f, 1.0f);
816 D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, NULL, &r, NULL);
817 expect_matrix(&expectedmat, &gotmat, 8);
818
819 set_matrix(&expectedmat,
820 -0.2148f, 1.3116f, 0.4752f, 0.0f,
821 0.9504f, -0.8836f, 0.9244f, 0.0f,
822 1.0212f, 0.1936f, -1.3588f, 0.0f,
823 0.0f, 0.0f, 0.0f, 1.0f);
824 D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, NULL, &r, NULL);
825 expect_matrix(&expectedmat, &gotmat, 8);
826
827 set_matrix(&expectedmat,
828 1.0f, 0.0f, 0.0f, 0.0f,
829 0.0f, -3.0f, 0.0f, 0.0f,
830 0.0f, 0.0f, 7.0f, 0.0f,
831 0.0f, 0.0f, 0.0f, 1.0f);
832 D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, &eye, NULL, NULL);
833 expect_matrix(&expectedmat, &gotmat, 0);
834
835 set_matrix(&expectedmat,
836 1.0f, 0.0f, 0.0f, 0.0f,
837 0.0f, 1.0f, 0.0f, 0.0f,
838 0.0f, 0.0f, 1.0f, 0.0f,
839 0.0f, 0.0f, 0.0f, 1.0f);
840 D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, &eye, NULL, NULL);
841 expect_matrix(&expectedmat, &gotmat, 0);
842
843 set_matrix(&expectedmat,
844 1.0f, 0.0f, 0.0f, 0.0f,
845 0.0f, 1.0f, 0.0f, 0.0f,
846 0.0f, 0.0f, 1.0f, 0.0f,
847 0.0f, 0.0f, 0.0f, 1.0f);
848 D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, &eye, NULL, NULL);
849 expect_matrix(&expectedmat, &gotmat, 0);
850
851 set_matrix(&expectedmat,
852 25521.0f, 39984.0f, 20148.0f, 0.0f,
853 39984.0f, 4933.0f, -3324.0f, 0.0f,
854 20148.0f, -3324.0f, -5153.0f, 0.0f,
855 0.0f, 0.0f, 0.0f, 1.0f);
856 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
857 expect_matrix(&expectedmat, &gotmat, 0);
858
859 set_matrix(&expectedmat,
860 1.0f, 0.0f, 0.0f, 0.0f,
861 0.0f, -3.0f, 0.0f, 0.0f,
862 0.0f, 0.0f, 7.0f, 0.0f,
863 0.0f, 52.0f, 54.0f, 1.0f);
864 D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, NULL, NULL, NULL);
865 expect_matrix(&expectedmat, &gotmat, 0);
866
867 set_matrix(&expectedmat,
868 1.0f, 0.0f, 0.0f, 0.0f,
869 0.0f, 1.0f, 0.0f, 0.0f,
870 0.0f, 0.0f, 1.0f, 0.0f,
871 0.0f, 0.0f, 0.0f, 1.0f);
872 D3DXMatrixTransformation(&gotmat, &at, &q, NULL, NULL, NULL, NULL);
873 expect_matrix(&expectedmat, &gotmat, 0);
874
875 set_matrix(&expectedmat,
876 -0.2148f, 1.3116f, 0.4752f, 0.0f,
877 0.9504f, -0.8836f, 0.9244f, 0.0f,
878 1.0212f, 0.1936f, -1.3588f, 0.0f,
879 18.2985f, -29.624001f, 15.683499f, 1.0f);
880 D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, &eye, &r, &last);
881 expect_matrix(&expectedmat, &gotmat, 8);
882
883 set_matrix(&expectedmat,
884 -0.2148f, 1.3116f, 0.4752f, 0.0f,
885 -2.8512f, 2.6508f, -2.7732f, 0.0f,
886 7.148399f, 1.3552f, -9.5116f, 0.0f,
887 9.7f, -8.6f, 1.3f, 1.0f);
888 D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, NULL, &r, &last);
889 expect_matrix(&expectedmat, &gotmat, 8);
890
891 set_matrix(&expectedmat,
892 -0.2148f, 1.3116f, 0.4752f, 0.0f,
893 0.9504f, -0.8836f, 0.9244f, 0.0f,
894 1.0212f, 0.1936f, -1.3588f, 0.0f,
895 9.7f, -8.6f, 1.3f, 1.0f);
896 D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, NULL, &r, &last);
897 expect_matrix(&expectedmat, &gotmat, 8);
898
899 set_matrix(&expectedmat,
900 -0.2148f, 1.3116f, 0.4752f, 0.0f,
901 0.9504f, -0.8836f, 0.9244f, 0.0f,
902 1.0212f, 0.1936f, -1.3588f, 0.0f,
903 9.7f, -8.6f, 1.3f, 1.0f);
904 D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, NULL, &r, &last);
905 expect_matrix(&expectedmat, &gotmat, 8);
906
907 set_matrix(&expectedmat,
908 1.0f, 0.0f, 0.0f, 0.0f,
909 0.0f, -3.0f, 0.0f, 0.0f,
910 0.0f, 0.0f, 7.0f, 0.0f,
911 9.7f, -8.6f, 1.3f, 1.0f);
912 D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, &eye, NULL, &last);
913 expect_matrix(&expectedmat, &gotmat, 0);
914
915 set_matrix(&expectedmat,
916 1.0f, 0.0f, 0.0f, 0.0f,
917 0.0f, 1.0f, 0.0f, 0.0f,
918 0.0f, 0.0f, 1.0f, 0.0f,
919 9.7f, -8.6f, 1.3f, 1.0f);
920 D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, &eye, NULL, &last);
921 expect_matrix(&expectedmat, &gotmat, 0);
922
923 set_matrix(&expectedmat,
924 1.0f, 0.0f, 0.0f, 0.0f,
925 0.0f, 1.0f, 0.0f, 0.0f,
926 0.0f, 0.0f, 1.0f, 0.0f,
927 9.7f, -8.6f, 1.3f, 1.0f);
928 D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, &eye, NULL, &last);
929 expect_matrix(&expectedmat, &gotmat, 0);
930
931 set_matrix(&expectedmat,
932 25521.0f, 39984.0f, 20148.0f, 0.0f,
933 39984.0f, 4933.0f, -3324.0f, 0.0f,
934 20148.0f, -3324.0f, -5153.0f, 0.0f,
935 9.7f, -8.6f, 1.3f, 1.0f);
936 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, &last);
937 expect_matrix(&expectedmat, &gotmat, 0);
938
939 set_matrix(&expectedmat,
940 1.0f, 0.0f, 0.0f, 0.0f,
941 0.0f, -3.0f, 0.0f, 0.0f,
942 0.0f, 0.0f, 7.0f, 0.0f,
943 9.7f, 43.400002f, 55.299999f, 1.0f);
944 D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, NULL, NULL, &last);
945 expect_matrix(&expectedmat, &gotmat, 0);
946
947 set_matrix(&expectedmat,
948 1.0f, 0.0f, 0.0f, 0.0f,
949 0.0f, 1.0f, 0.0f, 0.0f,
950 0.0f, 0.0f, 1.0f, 0.0f,
951 9.7f, -8.6f, 1.3f, 1.0f);
952 D3DXMatrixTransformation(&gotmat, &at, &q, NULL, NULL, NULL, &last);
953 expect_matrix(&expectedmat, &gotmat, 0);
954
955 set_matrix(&expectedmat,
956 -0.2148f, 1.3116f, 0.4752f, 0.0f,
957 -2.8512f, 2.6508f, -2.7732f, 0.0f,
958 7.148399f, 1.3552f, -9.5116f, 0.0f,
959 8.5985f, -21.024f, 14.383499, 1.0f);
960 D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, &eye, &r, NULL);
961 expect_matrix(&expectedmat, &gotmat, 8);
962
963 set_matrix(&expectedmat,
964 -0.2148f, 1.3116f, 0.4752f, 0.0f,
965 0.9504f, -0.8836f, 0.9244f, 0.0f,
966 1.0212f, 0.1936f, -1.3588f, 0.0f,
967 8.5985f, -21.024f, 14.383499, 1.0f);
968 D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, &eye, &r, NULL);
969 expect_matrix(&expectedmat, &gotmat, 8);
970
971 set_matrix(&expectedmat,
972 -0.2148f, 1.3116f, 0.4752f, 0.0f,
973 0.9504f, -0.8836f, 0.9244f, 0.0f,
974 1.0212f, 0.1936f, -1.3588f, 0.0f,
975 8.5985f, -21.024f, 14.383499, 1.0f);
976 D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, &eye, &r, NULL);
977 expect_matrix(&expectedmat, &gotmat, 8);
978
979 set_matrix(&expectedmat,
980 53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
981 -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
982 -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
983 0.0f, 0.0f, 0.0f, 1.0f);
984 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, &r, NULL);
985 expect_matrix(&expectedmat, &gotmat, 32);
986
987 set_matrix(&expectedmat,
988 -0.2148f, 1.3116f, 0.4752f, 0.0f,
989 -2.8512f, 2.6508f, -2.7732f, 0.0f,
990 7.148399f, 1.3552f, -9.5116f, 0.0f,
991 104.565598f, -35.492798f, -25.306400f, 1.0f);
992 D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, NULL, &r, NULL);
993 expect_matrix(&expectedmat, &gotmat, 8);
994
995 set_matrix(&expectedmat,
996 -0.2148f, 1.3116f, 0.4752f, 0.0f,
997 0.9504f, -0.8836f, 0.9244f, 0.0f,
998 1.0212f, 0.1936f, -1.3588f, 0.0f,
999 0.0f, 0.0f, 0.0f, 1.0f);
1000 D3DXMatrixTransformation(&gotmat, &at, &q, NULL, NULL, &r, NULL);
1001 expect_matrix(&expectedmat, &gotmat, 8);
1002
1003 set_matrix(&expectedmat,
1004 25521.0f, 39984.0f, 20148.0f, 0.0f,
1005 39984.0f, 4933.0f, -3324.0f, 0.0f,
1006 20148.0f, -3324.0f, -5153.0f, 0.0f,
1007 0.0f, 0.0f, 0.0f, 1.0f);
1008 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, &eye, NULL, NULL);
1009 expect_matrix(&expectedmat, &gotmat, 0);
1010
1011 set_matrix(&expectedmat,
1012 1.0f, 0.0f, 0.0f, 0.0f,
1013 0.0f, -3.0f, 0.0f, 0.0f,
1014 0.0f, 0.0f, 7.0f, 0.0f,
1015 0.0f, 52.0f, 54.0f, 1.0f);
1016 D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, &eye, NULL, NULL);
1017 expect_matrix(&expectedmat, &gotmat, 0);
1018
1019 set_matrix(&expectedmat,
1020 1.0f, 0.0f, 0.0f, 0.0f,
1021 0.0f, 1.0f, 0.0f, 0.0f,
1022 0.0f, 0.0f, 1.0f, 0.0f,
1023 0.0f, 0.0f, 0.0f, 1.0f);
1024 D3DXMatrixTransformation(&gotmat, &at, &q, NULL, &eye, NULL, NULL);
1025 expect_matrix(&expectedmat, &gotmat, 0);
1026
1027 set_matrix(&expectedmat,
1028 25521.0f, 39984.0f, 20148.0f, 0.0f,
1029 39984.0f, 4933.0f, -3324.0f, 0.0f,
1030 20148.0f, -3324.0f, -5153.0f, 0.0f,
1031 -287420.0f, -14064.0f, 37122.0f, 1.0f);
1032 D3DXMatrixTransformation(&gotmat, &at, &q, &axis, NULL, NULL, NULL);
1033 expect_matrix(&expectedmat, &gotmat, 0);
1034
1035 set_matrix(&expectedmat,
1036 -0.2148f, 1.3116f, 0.4752f, 0.0f,
1037 -2.8512f, 2.6508f, -2.7732f, 0.0f,
1038 7.148399f, 1.3552f, -9.5116f, 0.0f,
1039 18.2985f, -29.624001f, 15.683499f, 1.0f);
1040 D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, &eye, &r, &last);
1041 expect_matrix(&expectedmat, &gotmat, 8);
1042
1043 set_matrix(&expectedmat,
1044 -0.2148f, 1.3116f, 0.4752f, 0.0f,
1045 0.9504f, -0.8836f, 0.9244f, 0.0f,
1046 1.0212f, 0.1936f, -1.3588f, 0.0f,
1047 18.2985f, -29.624001f, 15.683499f, 1.0f);
1048 D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, &eye, &r, &last);
1049 expect_matrix(&expectedmat, &gotmat, 8);
1050
1051 set_matrix(&expectedmat,
1052 -0.2148f, 1.3116f, 0.4752f, 0.0f,
1053 0.9504f, -0.8836f, 0.9244f, 0.0f,
1054 1.0212f, 0.1936f, -1.3588f, 0.0f,
1055 18.2985f, -29.624001f, 15.683499f, 1.0f);
1056 D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, &eye, &r, &last);
1057 expect_matrix(&expectedmat, &gotmat, 8);
1058
1059 set_matrix(&expectedmat,
1060 53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1061 -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1062 -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1063 9.7f, -8.6f, 1.3f, 1.0f);
1064 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, &r, &last);
1065 expect_matrix(&expectedmat, &gotmat, 32);
1066
1067 set_matrix(&expectedmat,
1068 -0.2148f, 1.3116f, 0.4752f, 0.0f,
1069 -2.8512f, 2.6508f, -2.7732f, 0.0f,
1070 7.148399f, 1.3552f, -9.5116f, 0.0f,
1071 114.265594f, -44.092796f, -24.006401f, 1.0f);
1072 D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, NULL, &r, &last);
1073 expect_matrix(&expectedmat, &gotmat, 8);
1074
1075 set_matrix(&expectedmat,
1076 -0.2148f, 1.3116f, 0.4752f, 0.0f,
1077 0.9504f, -0.8836f, 0.9244f, 0.0f,
1078 1.0212f, 0.1936f, -1.3588f, 0.0f,
1079 9.7f, -8.6f, 1.3f, 1.0f);
1080 D3DXMatrixTransformation(&gotmat, &at, &q, NULL, NULL, &r, &last);
1081 expect_matrix(&expectedmat, &gotmat, 8);
1082
1083 set_matrix(&expectedmat,
1084 25521.0f, 39984.0f, 20148.0f, 0.0f,
1085 39984.0f, 4933.0f, -3324.0f, 0.0f,
1086 20148.0f, -3324.0f, -5153.0f, 0.0f,
1087 9.7f, -8.6f, 1.3f, 1.0f);
1088 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, &eye, NULL, &last);
1089 expect_matrix(&expectedmat, &gotmat, 0);
1090
1091 set_matrix(&expectedmat,
1092 1.0f, 0.0f, 0.0f, 0.0f,
1093 0.0f, -3.0f, 0.0f, 0.0f,
1094 0.0f, 0.0f, 7.0f, 0.0f,
1095 9.7f, 43.400002f, 55.299999f, 1.0f);
1096 D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, &eye, NULL, &last);
1097 expect_matrix(&expectedmat, &gotmat, 0);
1098
1099 set_matrix(&expectedmat,
1100 1.0f, 0.0f, 0.0f, 0.0f,
1101 0.0f, 1.0f, 0.0f, 0.0f,
1102 0.0f, 0.0f, 1.0f, 0.0f,
1103 9.7f, -8.6f, 1.3f, 1.0f);
1104 D3DXMatrixTransformation(&gotmat, &at, &q, NULL, &eye, NULL, &last);
1105 expect_matrix(&expectedmat, &gotmat, 0);
1106
1107 set_matrix(&expectedmat,
1108 25521.0f, 39984.0f, 20148.0f, 0.0f,
1109 39984.0f, 4933.0f, -3324.0f, 0.0f,
1110 20148.0f, -3324.0f, -5153.0f, 0.0f,
1111 -287410.3125f, -14072.599609f, 37123.300781f, 1.0f);
1112 D3DXMatrixTransformation(&gotmat, &at, &q, &axis, NULL, NULL, &last);
1113 expect_matrix(&expectedmat, &gotmat, 0);
1114
1115 set_matrix(&expectedmat,
1116 53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1117 -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1118 -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1119 8.598499f, -21.024f, 14.383499f, 1.0f);
1120 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, &eye, &r, NULL);
1121 expect_matrix(&expectedmat, &gotmat, 32);
1122
1123 set_matrix(&expectedmat,
1124 -0.2148f, 1.3116f, 0.4752f, 0.0f,
1125 -2.8512f, 2.6508f, -2.7732f, 0.0f,
1126 7.148399f, 1.3552f, -9.5116f, 0.0f,
1127 113.164093f, -56.5168f, -10.922897f, 1.0f);
1128 D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, &eye, &r, NULL);
1129 expect_matrix(&expectedmat, &gotmat, 8);
1130
1131 set_matrix(&expectedmat,
1132 -0.2148f, 1.3116f, 0.4752f, 0.0f,
1133 0.9504f, -0.8836f, 0.9244f, 0.0f,
1134 1.0212f, 0.1936f, -1.3588f, 0.0f,
1135 8.5985f, -21.024f, 14.383499, 1.0f);
1136 D3DXMatrixTransformation(&gotmat, &at, &q, NULL, &eye, &r, NULL);
1137 expect_matrix(&expectedmat, &gotmat, 8);
1138
1139 set_matrix(&expectedmat,
1140 53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1141 -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1142 -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1143 86280.34375f, -357366.3125f, -200024.125f, 1.0f);
1144 D3DXMatrixTransformation(&gotmat, &at, &q, &axis, NULL, &r, NULL);
1145 expect_matrix(&expectedmat, &gotmat, 32);
1146
1147 set_matrix(&expectedmat,
1148 25521.0f, 39984.0f, 20148.0f, 0.0f,
1149 39984.0f, 4933.0f, -3324.0f, 0.0f,
1150 20148.0f, -3324.0f, -5153.0f, 0.0f,
1151 -287410.3125f, -14064.0f, 37122.0f, 1.0f);
1152 D3DXMatrixTransformation(&gotmat, &at, &q, &axis, &eye, NULL, NULL);
1153 expect_matrix(&expectedmat, &gotmat, 512);
1154
1155 set_matrix(&expectedmat,
1156 53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1157 -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1158 -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1159 86280.34375f, -357366.3125f, -200009.75f, 1.0f);
1160 D3DXMatrixTransformation(&gotmat, &at, &q, &axis, &eye, &r, NULL);
1161 expect_matrix(&expectedmat, &gotmat, 2048);
1162
1163 set_matrix(&expectedmat,
1164 25521.0f, 39984.0f, 20148.0f, 0.0f,
1165 39984.0f, 4933.0f, -3324.0f, 0.0f,
1166 20148.0f, -3324.0f, -5153.0f, 0.0f,
1167 -287410.3125f, -14072.599609f, 37123.300781f, 1.0f);
1168 D3DXMatrixTransformation(&gotmat, &at, &q, &axis, &eye, NULL, &last);
1169 expect_matrix(&expectedmat, &gotmat, 0);
1170
1171 set_matrix(&expectedmat,
1172 53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1173 -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1174 -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1175 86290.046875f, -357374.90625f, -200022.828125f, 1.0f);
1176 D3DXMatrixTransformation(&gotmat, &at, &q, &axis, NULL, &r, &last);
1177 expect_matrix(&expectedmat, &gotmat, 32);
1178
1179 set_matrix(&expectedmat,
1180 -0.21480007f, 1.3116000f, 0.47520003f, 0.0f,
1181 0.95040143f, -0.88360137f, 0.92439979f, 0.0f,
1182 1.0212044f, 0.19359307f, -1.3588026f, 0.0f,
1183 18.298532f, -29.624001f, 15.683499f, 1.0f);
1184 D3DXMatrixTransformation(&gotmat, &at, &q, NULL, &eye, &r, &last);
1185 expect_matrix(&expectedmat, &gotmat, 512);
1186
1187 set_matrix(&expectedmat,
1188 -0.2148f, 1.3116f, 0.4752f, 0.0f,
1189 -2.8512f, 2.6508f, -2.7732f, 0.0f,
1190 7.148399f, 1.3552f, -9.5116f, 0.0f,
1191 122.86409f, -65.116798f, -9.622897f, 1.0f);
1192 D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, &eye, &r, &last);
1193 expect_matrix(&expectedmat, &gotmat, 8);
1194
1195 set_matrix(&expectedmat,
1196 53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1197 -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1198 -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1199 18.2985f, -29.624001f, 15.683499f, 1.0f);
1200 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, &eye, &r, &last);
1201 expect_matrix(&expectedmat, &gotmat, 32);
1202
1203 q.x = 1.0f; q.y = 1.0f; q.z = 1.0f; q.w = 1.0f;
1204 axis.x = 1.0f; axis.y = 1.0f; axis.z = 2.0f;
1205
1206 set_matrix(&expectedmat,
1207 41.0f, -12.0f, -24.0f, 0.0f,
1208 -12.0f, 25.0f, -12.0f, 0.0f,
1209 -24.0f, -12.0f, 34.0f, 0.0f,
1210 0.0f, 0.0f, 0.0f, 1.0f);
1211 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1212 expect_matrix(&expectedmat, &gotmat, 0);
1213
1214 q.x = 1.0f; q.y = 1.0f; q.z = 1.0f; q.w = 1.0f;
1215 axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1216
1217 set_matrix(&expectedmat,
1218 57.0f, -12.0f, -36.0f, 0.0f,
1219 -12.0f, 25.0f, -12.0f, 0.0f,
1220 -36.0f, -12.0f, 43.0f, 0.0f,
1221 0.0f, 0.0f, 0.0f, 1.0f);
1222 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1223 expect_matrix(&expectedmat, &gotmat, 0);
1224
1225 q.x = 1.0f; q.y = 1.0f; q.z = 1.0f; q.w = 0.0f;
1226 axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1227
1228 set_matrix(&expectedmat,
1229 25.0f, 0.0f, -20.0f, 0.0f,
1230 0.0f, 25.0f, -20.0f, 0.0f,
1231 -20.0f, -20.0f, 35.0f, 0.0f,
1232 0.0f, 0.0f, 0.0f, 1.0f);
1233 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1234 expect_matrix(&expectedmat, &gotmat, 0);
1235
1236 q.x = 1.0f; q.y = 1.0f; q.z = 0.0f; q.w = 0.0f;
1237 axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1238
1239 set_matrix(&expectedmat,
1240 5.0f, -4.0f, 0.0f, 0.0f,
1241 -4.0f, 5.0f, 0.0f, 0.0f,
1242 0.0f, 0.0f, 27.0f, 0.0f,
1243 0.0f, 0.0f, 0.0f, 1.0f);
1244 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1245 expect_matrix(&expectedmat, &gotmat, 0);
1246
1247 q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 0.0f;
1248 axis.x = 5.0f; axis.y = 2.0f; axis.z = 1.0f;
1249
1250 set_matrix(&expectedmat,
1251 5.0f, 0.0f, 0.0f, 0.0f,
1252 0.0f, 2.0f, 0.0f, 0.0f,
1253 0.0f, 0.0f, 1.0f, 0.0f,
1254 0.0f, 0.0f, 0.0f, 1.0f);
1255 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1256 expect_matrix(&expectedmat, &gotmat, 0);
1257
1258 q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 0.0f;
1259 axis.x = 1.0f; axis.y = 4.0f; axis.z = 1.0f;
1260
1261 set_matrix(&expectedmat,
1262 1.0f, 0.0f, 0.0f, 0.0f,
1263 0.0f, 4.0f, 0.0f, 0.0f,
1264 0.0f, 0.0f, 1.0f, 0.0f,
1265 0.0f, 0.0f, 0.0f, 1.0f);
1266 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1267 expect_matrix(&expectedmat, &gotmat, 0);
1268
1269 q.x = 0.0f; q.y = 1.0f; q.z = 0.0f; q.w = 0.0f;
1270 axis.x = 1.0f; axis.y = 4.0f; axis.z = 1.0f;
1271
1272 set_matrix(&expectedmat,
1273 1.0f, 0.0f, 0.0f, 0.0f,
1274 0.0f, 4.0f, 0.0f, 0.0f,
1275 0.0f, 0.0f, 1.0f, 0.0f,
1276 0.0f, 0.0f, 0.0f, 1.0f);
1277 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1278 expect_matrix(&expectedmat, &gotmat, 0);
1279
1280 q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 1.0f;
1281 axis.x = 1.0f; axis.y = 4.0f; axis.z = 1.0f;
1282
1283 set_matrix(&expectedmat,
1284 1.0f, 0.0f, 0.0f, 0.0f,
1285 0.0f, 8.0f, -6.0f, 0.0f,
1286 0.0f, -6.0f, 17.0f, 0.0f,
1287 0.0f, 0.0f, 0.0f, 1.0f);
1288 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1289 expect_matrix(&expectedmat, &gotmat, 0);
1290
1291 q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 1.0f;
1292 axis.x = 0.0f; axis.y = 4.0f; axis.z = 0.0f;
1293
1294 set_matrix(&expectedmat,
1295 0.0f, 0.0f, 0.0f, 0.0f,
1296 0.0f, 4.0f, -8.0f, 0.0f,
1297 0.0f, -8.0f, 16.0f, 0.0f,
1298 0.0f, 0.0f, 0.0f, 1.0f);
1299 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1300 expect_matrix(&expectedmat, &gotmat, 0);
1301
1302 q.x = 0.0f; q.y = 1.0f; q.z = 0.0f; q.w = 1.0f;
1303 axis.x = 1.0f; axis.y = 4.0f; axis.z = 1.0f;
1304
1305 set_matrix(&expectedmat,
1306 5.0f, 0.0f, 0.0f, 0.0f,
1307 0.0f, 4.0f, 0.0f, 0.0f,
1308 0.0f, 0.0f, 5.0f, 0.0f,
1309 0.0f, 0.0f, 0.0f, 1.0f);
1310 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1311 expect_matrix(&expectedmat, &gotmat, 0);
1312
1313 q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 0.0f;
1314 axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1315
1316 set_matrix(&expectedmat,
1317 1.0f, 0.0f, 0.0f, 0.0f,
1318 0.0f, 1.0f, 0.0f, 0.0f,
1319 0.0f, 0.0f, 3.0f, 0.0f,
1320 0.0f, 0.0f, 0.0f, 1.0f);
1321 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1322 expect_matrix(&expectedmat, &gotmat, 0);
1323
1324 q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1325 axis.x = 3.0f; axis.y = 3.0f; axis.z = 3.0f;
1326
1327 set_matrix(&expectedmat,
1328 3796587.0f, -1377948.0f, -1589940.0f, 0.0f,
1329 -1377948.0f, 3334059.0f, -1879020.0f, 0.0f,
1330 -1589940.0f, -1879020.0f, 2794443.0f, 0.0f,
1331 0.0f, 0.0f, 0.0f, 1.0f);
1332 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1333 expect_matrix(&expectedmat, &gotmat, 0);
1334
1335 q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1336 axis.x = 1.0f; axis.y = 1.0f; axis.z = 1.0f;
1337
1338 set_matrix(&expectedmat,
1339 1265529.0f, -459316.0f, -529980.0f, 0.0f,
1340 -459316.0f, 1111353.0f, -626340.0f, 0.0f,
1341 -529980.0f, -626340.0f, 931481.0f, 0.0f,
1342 0.0f, 0.0f, 0.0f, 1.0f);
1343 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1344 expect_matrix(&expectedmat, &gotmat, 0);
1345
1346 q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1347 axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1348
1349 set_matrix(&expectedmat,
1350 2457497.0f, -434612.0f, -1423956.0f, 0.0f,
1351 -434612.0f, 1111865.0f, -644868.0f, 0.0f,
1352 -1423956.0f, -644868.0f, 1601963.0f, 0.0f,
1353 0.0f, 0.0f, 0.0f, 1.0f);
1354 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1355 expect_matrix(&expectedmat, &gotmat, 0);
1356
1357 q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1358 axis.x = 0.0f; axis.y = 0.0f; axis.z = 3.0f;
1359
1360 set_matrix(&expectedmat,
1361 1787952.0f, 37056.0f, -1340964.0f, 0.0f,
1362 37056.0f, 768.0f, -27792.0f, 0.0f,
1363 -1340964.0f, -27792.0f, 1005723.0f, 0.0f,
1364 0.0f, 0.0f, 0.0f, 1.0f);
1365 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1366 expect_matrix(&expectedmat, &gotmat, 0);
1367
1368 q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1369 axis.x = 0.0f; axis.y = 0.0f; axis.z = 1.0f;
1370
1371 set_matrix(&expectedmat,
1372 595984.0f, 12352.0f, -446988.0f, 0.0f,
1373 12352.0f, 256.0f, -9264.0f, 0.0f,
1374 -446988.0f, -9264.0f, 335241.0f, 0.0f,
1375 0.0f, 0.0f, 0.0f, 1.0f);
1376 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1377 expect_matrix(&expectedmat, &gotmat, 0);
1378
1379 q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1380 axis.x = 0.0f; axis.y = 3.0f; axis.z = 0.0f;
1381
1382 set_matrix(&expectedmat,
1383 150528.0f, 464352.0f, -513408.0f, 0.0f,
1384 464352.0f, 1432443.0f, -1583772.0f, 0.0f,
1385 -513408.0f, -1583772.0f, 1751088.0f, 0.0f,
1386 0.0f, 0.0f, 0.0f, 1.0f);
1387 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1388 expect_matrix(&expectedmat, &gotmat, 0);
1389
1390 q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1391 axis.x = 0.0f; axis.y = 1.0f; axis.z = 0.0f;
1392
1393 set_matrix(&expectedmat,
1394 50176.0f, 154784.0f, -171136.0f, 0.0f,
1395 154784.0f, 477481.0f, -527924.0f, 0.0f,
1396 -171136.0f, -527924.0f, 583696.0f, 0.0f,
1397 0.0f, 0.0f, 0.0f, 1.0f);
1398 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1399 expect_matrix(&expectedmat, &gotmat, 0);
1400
1401 q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1402 axis.x = 1.0f; axis.y = 0.0f; axis.z = 0.0f;
1403
1404 set_matrix(&expectedmat,
1405 619369.0f, -626452.0f, 88144.0f, 0.0f,
1406 -626452.0f, 633616.0f, -89152.0f, 0.0f,
1407 88144.0f, -89152, 12544.0f, 0.0f,
1408 0.0f, 0.0f, 0.0f, 1.0f);
1409 D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1410 expect_matrix(&expectedmat, &gotmat, 0);
1411
1412/*____________D3DXMatrixTranslation______________*/
1413 set_matrix(&expectedmat,
1414 1.0f, 0.0f, 0.0f, 0.0f,
1415 0.0f, 1.0f, 0.0f, 0.0f,
1416 0.0f, 0.0f, 1.0f, 0.0f,
1417 0.69f, 0.53f, 4.11f, 1.0f);
1418 D3DXMatrixTranslation(&gotmat, 0.69f, 0.53f, 4.11f);
1419 expect_matrix(&expectedmat, &gotmat, 0);
1420
1421/*____________D3DXMatrixTranspose______________*/
1422 set_matrix(&expectedmat,
1423 10.0f, 11.0f, 19.0f, 2.0f,
1424 5.0f, 20.0f, -21.0f, 3.0f,
1425 7.0f, 16.0f, 30.f, -4.0f,
1426 8.0f, 33.0f, 43.0f, -40.0f);
1427 D3DXMatrixTranspose(&gotmat, &mat);
1428 expect_matrix(&expectedmat, &gotmat, 0);
1429}
#define broken(x)
Definition: atltest.h:178
D3DXMATRIX *WINAPI D3DXMatrixLookAtRH(D3DXMATRIX *out, const D3DXVECTOR3 *eye, const D3DXVECTOR3 *at, const D3DXVECTOR3 *up)
Definition: math.c:360
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
Definition: math.c:507
D3DXMATRIX *WINAPI D3DXMatrixMultiplyTranspose(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
Definition: math.c:412
D3DXMATRIX *WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:439
D3DXMATRIX *WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *out, FLOAT yaw, FLOAT pitch, FLOAT roll)
Definition: math.c:663
D3DXMATRIX *WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle)
Definition: math.c:651
D3DXMATRIX *WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle)
Definition: math.c:696
D3DXMATRIX *WINAPI D3DXMatrixReflect(D3DXMATRIX *pout, const D3DXPLANE *pplane)
Definition: math.c:567
D3DXMATRIX *WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
Definition: math.c:393
FLOAT WINAPI D3DXMatrixDeterminant(const D3DXMATRIX *pm)
Definition: math.c:232
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:537
D3DXMATRIX *WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, const D3DXMATRIX *pm)
Definition: math.c:254
D3DXMATRIX *WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *out, const D3DXVECTOR3 *v, FLOAT angle)
Definition: math.c:590
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:521
D3DXMATRIX *WINAPI D3DXMatrixTranspose(D3DXMATRIX *out, const D3DXMATRIX *in)
Definition: math.c:873
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
D3DXMATRIX *WINAPI D3DXMatrixLookAtLH(D3DXMATRIX *out, const D3DXVECTOR3 *eye, const D3DXVECTOR3 *at, const D3DXVECTOR3 *up)
Definition: math.c:327
D3DXMATRIX *WINAPI D3DXMatrixOrthoRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
Definition: math.c:467
D3DXMATRIX *WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, const D3DXQUATERNION *pq)
Definition: math.c:622
D3DXMATRIX *WINAPI D3DXMatrixShadow(D3DXMATRIX *pout, const D3DXVECTOR4 *plight, const D3DXPLANE *pplane)
Definition: math.c:719
D3DXMATRIX *WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z)
Definition: math.c:862
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf)
Definition: math.c:493
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf)
Definition: math.c:479
D3DXMATRIX *WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
Definition: math.c:427
D3DXMATRIX *WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle)
Definition: math.c:639
D3DXMATRIX *WINAPI D3DXMatrixOrthoOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:453
D3DXMATRIX *WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *out, FLOAT scaling, const D3DXVECTOR3 *rotationcenter, const D3DXQUATERNION *rotation, const D3DXVECTOR3 *translation)
Definition: math.c:90
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
Definition: math.c:553
D3DXMATRIX *WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz)
Definition: math.c:708
_ACRTIMP double __cdecl sqrt(double)
Definition: sqrt.c:5
return ret
Definition: mutex.c:147
#define D3DX_PI
Definition: d3dx9math.h:27
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat angle
Definition: glext.h:10853
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
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 light
Definition: glfuncs.h:170
#define expect_matrix(expected, matrix, ulps)
Definition: math.c:164
static void set_matrix(D3DXMATRIX *mat, float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
Definition: math.c:202
static const MAT2 mat
Definition: font.c:51
static const LARGE_INTEGER *static const HANDLE const LARGE_INTEGER *static PSLIST_ENTRY PSLIST_ENTRY last
Definition: sync.c:64
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ D3DXPlaneTest()

static void D3DXPlaneTest ( void  )
static

Definition at line 1431 of file math.c.

1432{
1434 D3DXPLANE expectedplane, gotplane, nulplane, plane;
1435 D3DXVECTOR3 expectedvec, gotvec, vec1, vec2, vec3;
1436 LPD3DXVECTOR3 funcpointer;
1438 FLOAT expected, got;
1439
1440 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1441 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1442 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1443 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1444 mat.m[0][0] = 10.0f; mat.m[1][1] = 20.0f; mat.m[2][2] = 30.0f;
1445 mat.m[3][3] = -40.0f;
1446
1447 plane.a = -3.0f; plane.b = -1.0f; plane.c = 4.0f; plane.d = 7.0f;
1448
1449 vec.x = 2.0f; vec.y = 5.0f; vec.z = -6.0f; vec.w = 11.0f;
1450
1451/*_______________D3DXPlaneDot________________*/
1452 expected = 42.0f;
1453 got = D3DXPlaneDot(&plane, &vec);
1454 ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1455 expected = 0.0f;
1456 got = D3DXPlaneDot(NULL, &vec);
1457 ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1458 expected = 0.0f;
1459 got = D3DXPlaneDot(NULL, NULL);
1460 ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1461
1462/*_______________D3DXPlaneDotCoord________________*/
1463 expected = -28.0f;
1464 got = D3DXPlaneDotCoord(&plane, &vec);
1465 ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1466 expected = 0.0f;
1467 got = D3DXPlaneDotCoord(NULL, &vec);
1468 ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1469 expected = 0.0f;
1470 got = D3DXPlaneDotCoord(NULL, NULL);
1471 ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1472
1473/*_______________D3DXPlaneDotNormal______________*/
1474 expected = -35.0f;
1475 got = D3DXPlaneDotNormal(&plane, &vec);
1476 ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1477 expected = 0.0f;
1478 got = D3DXPlaneDotNormal(NULL, &vec);
1479 ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1480 expected = 0.0f;
1481 got = D3DXPlaneDotNormal(NULL, NULL);
1482 ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1483
1484/*_______________D3DXPlaneFromPointNormal_______*/
1485 vec1.x = 11.0f; vec1.y = 13.0f; vec1.z = 15.0f;
1486 vec2.x = 17.0f; vec2.y = 31.0f; vec2.z = 24.0f;
1487 expectedplane.a = 17.0f; expectedplane.b = 31.0f; expectedplane.c = 24.0f; expectedplane.d = -950.0f;
1488 D3DXPlaneFromPointNormal(&gotplane, &vec1, &vec2);
1489 expect_plane(&expectedplane, &gotplane, 0);
1490 gotplane.a = vec2.x; gotplane.b = vec2.y; gotplane.c = vec2.z;
1491 D3DXPlaneFromPointNormal(&gotplane, &vec1, (D3DXVECTOR3 *)&gotplane);
1492 expect_plane(&expectedplane, &gotplane, 0);
1493 gotplane.a = vec1.x; gotplane.b = vec1.y; gotplane.c = vec1.z;
1494 expectedplane.d = -1826.0f;
1495 D3DXPlaneFromPointNormal(&gotplane, (D3DXVECTOR3 *)&gotplane, &vec2);
1496 expect_plane(&expectedplane, &gotplane, 0);
1497
1498/*_______________D3DXPlaneFromPoints_______*/
1499 vec1.x = 1.0f; vec1.y = 2.0f; vec1.z = 3.0f;
1500 vec2.x = 1.0f; vec2.y = -6.0f; vec2.z = -5.0f;
1501 vec3.x = 83.0f; vec3.y = 74.0f; vec3.z = 65.0f;
1502 expectedplane.a = 0.085914f; expectedplane.b = -0.704492f; expectedplane.c = 0.704492f; expectedplane.d = -0.790406f;
1503 D3DXPlaneFromPoints(&gotplane,&vec1,&vec2,&vec3);
1504 expect_plane(&expectedplane, &gotplane, 64);
1505
1506/*_______________D3DXPlaneIntersectLine___________*/
1507 vec1.x = 9.0f; vec1.y = 6.0f; vec1.z = 3.0f;
1508 vec2.x = 2.0f; vec2.y = 5.0f; vec2.z = 8.0f;
1509 expectedvec.x = 20.0f/3.0f; expectedvec.y = 17.0f/3.0f; expectedvec.z = 14.0f/3.0f;
1510 D3DXPlaneIntersectLine(&gotvec,&plane,&vec1,&vec2);
1511 expect_vec3(&expectedvec, &gotvec, 1);
1512 /* Test a parallel line */
1513 vec1.x = 11.0f; vec1.y = 13.0f; vec1.z = 15.0f;
1514 vec2.x = 17.0f; vec2.y = 31.0f; vec2.z = 24.0f;
1515 expectedvec.x = 20.0f/3.0f; expectedvec.y = 17.0f/3.0f; expectedvec.z = 14.0f/3.0f;
1516 funcpointer = D3DXPlaneIntersectLine(&gotvec,&plane,&vec1,&vec2);
1517 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1518
1519/*_______________D3DXPlaneNormalize______________*/
1520 expectedplane.a = -3.0f/sqrt(26.0f); expectedplane.b = -1.0f/sqrt(26.0f); expectedplane.c = 4.0f/sqrt(26.0f); expectedplane.d = 7.0/sqrt(26.0f);
1521 D3DXPlaneNormalize(&gotplane, &plane);
1522 expect_plane(&expectedplane, &gotplane, 2);
1523 nulplane.a = 0.0; nulplane.b = 0.0f; nulplane.c = 0.0f; nulplane.d = 0.0f;
1524 expectedplane.a = 0.0f; expectedplane.b = 0.0f; expectedplane.c = 0.0f; expectedplane.d = 0.0f;
1525 D3DXPlaneNormalize(&gotplane, &nulplane);
1526 expect_plane(&expectedplane, &gotplane, 0);
1527
1528/*_______________D3DXPlaneTransform____________*/
1529 expectedplane.a = 49.0f; expectedplane.b = -98.0f; expectedplane.c = 55.0f; expectedplane.d = -165.0f;
1530 D3DXPlaneTransform(&gotplane,&plane,&mat);
1531 expect_plane(&expectedplane, &gotplane, 0);
1532}
D3DXPLANE *WINAPI D3DXPlaneTransform(D3DXPLANE *pout, const D3DXPLANE *pplane, const D3DXMATRIX *pm)
Definition: math.c:1278
D3DXPLANE *WINAPI D3DXPlaneFromPoints(D3DXPLANE *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3)
Definition: math.c:1215
D3DXPLANE *WINAPI D3DXPlaneNormalize(D3DXPLANE *out, const D3DXPLANE *p)
Definition: math.c:1253
D3DXVECTOR3 *WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, const D3DXPLANE *pp, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2)
Definition: math.c:1231
D3DXPLANE *WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, const D3DXVECTOR3 *pvpoint, const D3DXVECTOR3 *pvnormal)
Definition: math.c:1204
FT_Vector * vec
Definition: ftbbox.c:469
#define expect_vec3(expected, vector, ulps)
Definition: math.c:117
#define expect_plane(expected, plane, ulps)
Definition: math.c:144
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78
float x
Definition: hlsl_d3d11.c:34
float y
Definition: hlsl_d3d11.c:34
Definition: shader.c:383
float x
Definition: shader.c:384
float y
Definition: shader.c:384
float z
Definition: shader.c:384

Referenced by START_TEST().

◆ D3DXQuaternionTest()

static void D3DXQuaternionTest ( void  )
static

Definition at line 1534 of file math.c.

1535{
1537 D3DXQUATERNION expectedquat, gotquat, Nq, Nq1, nul, smallq, smallr, q, r, s, t, u;
1538 BOOL expectedbool, gotbool, equal;
1539 float angle, got, scale, scale2;
1540 LPD3DXQUATERNION funcpointer;
1541 D3DXVECTOR3 axis, expectedvec;
1542
1543 nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f; nul.w = 0.0f;
1544 q.x = 1.0f; q.y = 2.0f; q.z = 4.0f; q.w = 10.0f;
1545 r.x = -3.0f; r.y = 4.0f; r.z = -5.0f; r.w = 7.0;
1546 t.x = -1111.0f; t.y = 111.0f; t.z = -11.0f; t.w = 1.0f;
1547 u.x = 91.0f; u.y = - 82.0f; u.z = 7.3f; u.w = -6.4f;
1548 smallq.x = 0.1f; smallq.y = 0.2f; smallq.z= 0.3f; smallq.w = 0.4f;
1549 smallr.x = 0.5f; smallr.y = 0.6f; smallr.z= 0.7f; smallr.w = 0.8f;
1550
1551 scale = 0.3f;
1552 scale2 = 0.78f;
1553
1554/*_______________D3DXQuaternionBaryCentric________________________*/
1555 expectedquat.x = -867.444458; expectedquat.y = 87.851111f; expectedquat.z = -9.937778f; expectedquat.w = 3.235555f;
1556 D3DXQuaternionBaryCentric(&gotquat,&q,&r,&t,scale,scale2);
1557 expect_quaternion(&expectedquat, &gotquat, 1);
1558
1559/*_______________D3DXQuaternionConjugate________________*/
1560 expectedquat.x = -1.0f; expectedquat.y = -2.0f; expectedquat.z = -4.0f; expectedquat.w = 10.0f;
1561 D3DXQuaternionConjugate(&gotquat,&q);
1562 expect_quaternion(&expectedquat, &gotquat, 0);
1563 /* Test the NULL case */
1564 funcpointer = D3DXQuaternionConjugate(&gotquat,NULL);
1565 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1566 funcpointer = D3DXQuaternionConjugate(NULL,NULL);
1567 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1568
1569/*_______________D3DXQuaternionDot______________________*/
1570 got = D3DXQuaternionDot(&q,&r);
1571 equal = compare_float(got, 55.0f, 0);
1572 ok(equal, "Got unexpected dot %.8e.\n", got);
1573 /* Tests the case NULL */
1574 got = D3DXQuaternionDot(NULL,&r);
1575 equal = compare_float(got, 0.0f, 0);
1576 ok(equal, "Got unexpected dot %.8e.\n", got);
1577 got = D3DXQuaternionDot(NULL,NULL);
1578 equal = compare_float(got, 0.0f, 0);
1579 ok(equal, "Got unexpected dot %.8e.\n", got);
1580
1581/*_______________D3DXQuaternionExp______________________________*/
1582 expectedquat.x = -0.216382f; expectedquat.y = -0.432764f; expectedquat.z = -0.8655270f; expectedquat.w = -0.129449f;
1583 D3DXQuaternionExp(&gotquat,&q);
1584 expect_quaternion(&expectedquat, &gotquat, 16);
1585 /* Test the null quaternion */
1586 expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f;
1587 D3DXQuaternionExp(&gotquat,&nul);
1588 expect_quaternion(&expectedquat, &gotquat, 0);
1589 /* Test the case where the norm of the quaternion is <1 */
1590 Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w= 0.9f;
1591 expectedquat.x = 0.195366; expectedquat.y = 0.097683f; expectedquat.z = 0.293049f; expectedquat.w = 0.930813f;
1592 D3DXQuaternionExp(&gotquat,&Nq1);
1593 expect_quaternion(&expectedquat, &gotquat, 8);
1594
1595/*_______________D3DXQuaternionIdentity________________*/
1596 expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f;
1597 D3DXQuaternionIdentity(&gotquat);
1598 expect_quaternion(&expectedquat, &gotquat, 0);
1599 /* Test the NULL case */
1600 funcpointer = D3DXQuaternionIdentity(NULL);
1601 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1602
1603/*_______________D3DXQuaternionInverse________________________*/
1604 expectedquat.x = -1.0f/121.0f; expectedquat.y = -2.0f/121.0f; expectedquat.z = -4.0f/121.0f; expectedquat.w = 10.0f/121.0f;
1605 D3DXQuaternionInverse(&gotquat,&q);
1606 expect_quaternion(&expectedquat, &gotquat, 0);
1607
1608 expectedquat.x = 1.0f; expectedquat.y = 2.0f; expectedquat.z = 4.0f; expectedquat.w = 10.0f;
1609 D3DXQuaternionInverse(&gotquat,&gotquat);
1610 expect_quaternion(&expectedquat, &gotquat, 1);
1611
1612
1613/*_______________D3DXQuaternionIsIdentity________________*/
1614 s.x = 0.0f; s.y = 0.0f; s.z = 0.0f; s.w = 1.0f;
1615 expectedbool = TRUE;
1616 gotbool = D3DXQuaternionIsIdentity(&s);
1617 ok( expectedbool == gotbool, "Expected boolean : %d, Got bool : %d\n", expectedbool, gotbool);
1618 s.x = 2.3f; s.y = -4.2f; s.z = 1.2f; s.w=0.2f;
1619 expectedbool = FALSE;
1620 gotbool = D3DXQuaternionIsIdentity(&q);
1621 ok( expectedbool == gotbool, "Expected boolean : %d, Got bool : %d\n", expectedbool, gotbool);
1622 /* Test the NULL case */
1623 gotbool = D3DXQuaternionIsIdentity(NULL);
1624 ok(gotbool == FALSE, "Expected boolean: %d, Got boolean: %d\n", FALSE, gotbool);
1625
1626/*_______________D3DXQuaternionLength__________________________*/
1627 got = D3DXQuaternionLength(&q);
1628 equal = compare_float(got, 11.0f, 0);
1629 ok(equal, "Got unexpected length %.8e.\n", got);
1630 /* Tests the case NULL. */
1631 got = D3DXQuaternionLength(NULL);
1632 equal = compare_float(got, 0.0f, 0);
1633 ok(equal, "Got unexpected length %.8e.\n", got);
1634
1635/*_______________D3DXQuaternionLengthSq________________________*/
1636 got = D3DXQuaternionLengthSq(&q);
1637 equal = compare_float(got, 121.0f, 0);
1638 ok(equal, "Got unexpected length %.8e.\n", got);
1639 /* Tests the case NULL */
1640 got = D3DXQuaternionLengthSq(NULL);
1641 equal = compare_float(got, 0.0f, 0);
1642 ok(equal, "Got unexpected length %.8e.\n", got);
1643
1644/*_______________D3DXQuaternionLn______________________________*/
1645 expectedquat.x = 1.0f; expectedquat.y = 2.0f; expectedquat.z = 4.0f; expectedquat.w = 0.0f;
1646 D3DXQuaternionLn(&gotquat,&q);
1647 expect_quaternion(&expectedquat, &gotquat, 0);
1648 expectedquat.x = -3.0f; expectedquat.y = 4.0f; expectedquat.z = -5.0f; expectedquat.w = 0.0f;
1649 D3DXQuaternionLn(&gotquat,&r);
1650 expect_quaternion(&expectedquat, &gotquat, 0);
1651 Nq.x = 1.0f/11.0f; Nq.y = 2.0f/11.0f; Nq.z = 4.0f/11.0f; Nq.w=10.0f/11.0f;
1652 expectedquat.x = 0.093768f; expectedquat.y = 0.187536f; expectedquat.z = 0.375073f; expectedquat.w = 0.0f;
1653 D3DXQuaternionLn(&gotquat,&Nq);
1654 expect_quaternion(&expectedquat, &gotquat, 32);
1655 Nq.x = 0.0f; Nq.y = 0.0f; Nq.z = 0.0f; Nq.w = 1.0f;
1656 expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
1657 D3DXQuaternionLn(&gotquat,&Nq);
1658 expect_quaternion(&expectedquat, &gotquat, 0);
1659 Nq.x = 5.4f; Nq.y = 1.2f; Nq.z = -0.3f; Nq.w = -0.3f;
1660 expectedquat.x = 10.616652f; expectedquat.y = 2.359256f; expectedquat.z = -0.589814f; expectedquat.w = 0.0f;
1661 D3DXQuaternionLn(&gotquat,&Nq);
1662 expect_quaternion(&expectedquat, &gotquat, 1);
1663 /* Test the case where the norm of the quaternion is <1 */
1664 Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w = 0.9f;
1665 expectedquat.x = 0.206945f; expectedquat.y = 0.103473f; expectedquat.z = 0.310418f; expectedquat.w = 0.0f;
1666 D3DXQuaternionLn(&gotquat,&Nq1);
1667 expect_quaternion(&expectedquat, &gotquat, 64);
1668 /* Test the case where the real part of the quaternion is -1.0f */
1669 Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w = -1.0f;
1670 expectedquat.x = 0.2f; expectedquat.y = 0.1f; expectedquat.z = 0.3f; expectedquat.w = 0.0f;
1671 D3DXQuaternionLn(&gotquat,&Nq1);
1672 expect_quaternion(&expectedquat, &gotquat, 0);
1673
1674/*_______________D3DXQuaternionMultiply________________________*/
1675 expectedquat.x = 3.0f; expectedquat.y = 61.0f; expectedquat.z = -32.0f; expectedquat.w = 85.0f;
1676 D3DXQuaternionMultiply(&gotquat,&q,&r);
1677 expect_quaternion(&expectedquat, &gotquat, 0);
1678
1679/*_______________D3DXQuaternionNormalize________________________*/
1680 expectedquat.x = 1.0f/11.0f; expectedquat.y = 2.0f/11.0f; expectedquat.z = 4.0f/11.0f; expectedquat.w = 10.0f/11.0f;
1681 D3DXQuaternionNormalize(&gotquat,&q);
1682 expect_quaternion(&expectedquat, &gotquat, 1);
1683
1684/*_______________D3DXQuaternionRotationAxis___________________*/
1685 axis.x = 2.0f; axis.y = 7.0; axis.z = 13.0f;
1686 angle = D3DX_PI/3.0f;
1687 expectedquat.x = 0.067116; expectedquat.y = 0.234905f; expectedquat.z = 0.436251f; expectedquat.w = 0.866025f;
1688 D3DXQuaternionRotationAxis(&gotquat,&axis,angle);
1689 expect_quaternion(&expectedquat, &gotquat, 64);
1690 /* Test the nul quaternion */
1691 axis.x = 0.0f; axis.y = 0.0; axis.z = 0.0f;
1692 expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.866025f;
1693 D3DXQuaternionRotationAxis(&gotquat,&axis,angle);
1694 expect_quaternion(&expectedquat, &gotquat, 8);
1695
1696/*_______________D3DXQuaternionRotationMatrix___________________*/
1697 /* test when the trace is >0 */
1698 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1699 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1700 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1701 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1702 mat.m[0][0] = 10.0f; mat.m[1][1] = 20.0f; mat.m[2][2] = 30.0f;
1703 mat.m[3][3] = 48.0f;
1704 expectedquat.x = 2.368682f; expectedquat.y = 0.768221f; expectedquat.z = -0.384111f; expectedquat.w = 3.905125f;
1706 expect_quaternion(&expectedquat, &gotquat, 16);
1707 /* test the case when the greater element is (2,2) */
1708 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1709 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1710 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1711 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1712 mat.m[0][0] = -10.0f; mat.m[1][1] = -60.0f; mat.m[2][2] = 40.0f;
1713 mat.m[3][3] = 48.0f;
1714 expectedquat.x = 1.233905f; expectedquat.y = -0.237290f; expectedquat.z = 5.267827f; expectedquat.w = -0.284747f;
1716 expect_quaternion(&expectedquat, &gotquat, 64);
1717 /* test the case when the greater element is (1,1) */
1718 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1719 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1720 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1721 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1722 mat.m[0][0] = -10.0f; mat.m[1][1] = 60.0f; mat.m[2][2] = -80.0f;
1723 mat.m[3][3] = 48.0f;
1724 expectedquat.x = 0.651031f; expectedquat.y = 6.144103f; expectedquat.z = -0.203447f; expectedquat.w = 0.488273f;
1726 expect_quaternion(&expectedquat, &gotquat, 8);
1727 /* test the case when the trace is near 0 in a matrix which is not a rotation */
1728 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1729 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1730 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1731 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1732 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = -0.9f;
1733 mat.m[3][3] = 48.0f;
1734 expectedquat.x = 1.709495f; expectedquat.y = 2.339872f; expectedquat.z = -0.534217f; expectedquat.w = 1.282122f;
1736 expect_quaternion(&expectedquat, &gotquat, 8);
1737 /* test the case when the trace is 0.49 in a matrix which is not a rotation */
1738 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1739 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1740 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1741 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1742 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = -0.51f;
1743 mat.m[3][3] = 48.0f;
1744 expectedquat.x = 1.724923f; expectedquat.y = 2.318944f; expectedquat.z = -0.539039f; expectedquat.w = 1.293692f;
1746 expect_quaternion(&expectedquat, &gotquat, 8);
1747 /* test the case when the trace is 0.51 in a matrix which is not a rotation */
1748 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1749 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1750 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1751 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1752 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = -0.49f;
1753 mat.m[3][3] = 48.0f;
1754 expectedquat.x = 1.725726f; expectedquat.y = 2.317865f; expectedquat.z = -0.539289f; expectedquat.w = 1.294294f;
1756 expect_quaternion(&expectedquat, &gotquat, 8);
1757 /* test the case when the trace is 0.99 in a matrix which is not a rotation */
1758 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1759 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1760 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1761 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1762 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = -0.01f;
1763 mat.m[3][3] = 48.0f;
1764 expectedquat.x = 1.745328f; expectedquat.y = 2.291833f; expectedquat.z = -0.545415f; expectedquat.w = 1.308996f;
1766 expect_quaternion(&expectedquat, &gotquat, 4);
1767 /* test the case when the trace is 1.0 in a matrix which is not a rotation */
1768 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1769 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1770 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1771 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1772 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = 0.0f;
1773 mat.m[3][3] = 48.0f;
1774 expectedquat.x = 1.745743f; expectedquat.y = 2.291288f; expectedquat.z = -0.545545f; expectedquat.w = 1.309307f;
1776 expect_quaternion(&expectedquat, &gotquat, 8);
1777 /* test the case when the trace is 1.01 in a matrix which is not a rotation */
1778 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1779 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1780 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1781 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1782 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = 0.01f;
1783 mat.m[3][3] = 48.0f;
1784 expectedquat.x = 18.408188f; expectedquat.y = 5.970223f; expectedquat.z = -2.985111f; expectedquat.w = 0.502494f;
1786 expect_quaternion(&expectedquat, &gotquat, 4);
1787 /* test the case when the trace is 1.5 in a matrix which is not a rotation */
1788 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1789 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1790 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1791 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1792 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = 0.5f;
1793 mat.m[3][3] = 48.0f;
1794 expectedquat.x = 15.105186f; expectedquat.y = 4.898980f; expectedquat.z = -2.449490f; expectedquat.w = 0.612372f;
1796 expect_quaternion(&expectedquat, &gotquat, 8);
1797 /* test the case when the trace is 1.7 in a matrix which is not a rotation */
1798 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1799 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1800 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1801 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1802 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = 0.70f;
1803 mat.m[3][3] = 48.0f;
1804 expectedquat.x = 14.188852f; expectedquat.y = 4.601790f; expectedquat.z = -2.300895f; expectedquat.w = 0.651920f;
1806 expect_quaternion(&expectedquat, &gotquat, 4);
1807 /* test the case when the trace is 1.99 in a matrix which is not a rotation */
1808 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1809 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1810 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1811 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1812 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = 0.99f;
1813 mat.m[3][3] = 48.0f;
1814 expectedquat.x = 13.114303f; expectedquat.y = 4.253287f; expectedquat.z = -2.126644f; expectedquat.w = 0.705337f;
1816 expect_quaternion(&expectedquat, &gotquat, 4);
1817 /* test the case when the trace is 2.0 in a matrix which is not a rotation */
1818 mat.m[0][1] = 5.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
1819 mat.m[1][0] = 11.0f; mat.m[1][2] = 16.0f; mat.m[1][3] = 33.0f;
1820 mat.m[2][0] = 19.0f; mat.m[2][1] = -21.0f; mat.m[2][3] = 43.0f;
1821 mat.m[3][0] = 2.0f; mat.m[3][1] = 3.0f; mat.m[3][2] = -4.0f;
1822 mat.m[0][0] = -10.0f; mat.m[1][1] = 10.0f; mat.m[2][2] = 2.0f;
1823 mat.m[3][3] = 48.0f;
1824 expectedquat.x = 10.680980f; expectedquat.y = 3.464102f; expectedquat.z = -1.732051f; expectedquat.w = 0.866025f;
1826 expect_quaternion(&expectedquat, &gotquat, 8);
1827
1828/*_______________D3DXQuaternionRotationYawPitchRoll__________*/
1829 expectedquat.x = 0.303261f; expectedquat.y = 0.262299f; expectedquat.z = 0.410073f; expectedquat.w = 0.819190f;
1831 expect_quaternion(&expectedquat, &gotquat, 16);
1832
1833/*_______________D3DXQuaternionSlerp________________________*/
1834 expectedquat.x = -0.2f; expectedquat.y = 2.6f; expectedquat.z = 1.3f; expectedquat.w = 9.1f;
1835 D3DXQuaternionSlerp(&gotquat,&q,&r,scale);
1836 expect_quaternion(&expectedquat, &gotquat, 4);
1837 expectedquat.x = 334.0f; expectedquat.y = -31.9f; expectedquat.z = 6.1f; expectedquat.w = 6.7f;
1838 D3DXQuaternionSlerp(&gotquat,&q,&t,scale);
1839 expect_quaternion(&expectedquat, &gotquat, 2);
1840 expectedquat.x = 0.239485f; expectedquat.y = 0.346580f; expectedquat.z = 0.453676f; expectedquat.w = 0.560772f;
1841 D3DXQuaternionSlerp(&gotquat,&smallq,&smallr,scale);
1842 expect_quaternion(&expectedquat, &gotquat, 32);
1843
1844/*_______________D3DXQuaternionSquad________________________*/
1845 expectedquat.x = -156.296f; expectedquat.y = 30.242f; expectedquat.z = -2.5022f; expectedquat.w = 7.3576f;
1846 D3DXQuaternionSquad(&gotquat,&q,&r,&t,&u,scale);
1847 expect_quaternion(&expectedquat, &gotquat, 2);
1848
1849/*_______________D3DXQuaternionSquadSetup___________________*/
1850 r.x = 1.0f; r.y = 2.0f; r.z = 4.0f; r.w = 10.0f;
1851 s.x = -3.0f; s.y = 4.0f; s.z = -5.0f; s.w = 7.0;
1852 t.x = -1111.0f; t.y = 111.0f; t.z = -11.0f; t.w = 1.0f;
1853 u.x = 91.0f; u.y = - 82.0f; u.z = 7.3f; u.w = -6.4f;
1854 D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &t, &u);
1855 expectedquat.x = 7.121285f; expectedquat.y = 2.159964f; expectedquat.z = -3.855094f; expectedquat.w = 5.362844f;
1856 expect_quaternion(&expectedquat, &gotquat, 16);
1857 expectedquat.x = -1113.492920f; expectedquat.y = 82.679260f; expectedquat.z = -6.696645f; expectedquat.w = -4.090050f;
1858 expect_quaternion(&expectedquat, &Nq, 4);
1859 expectedquat.x = -1111.0f; expectedquat.y = 111.0f; expectedquat.z = -11.0f; expectedquat.w = 1.0f;
1860 expect_quaternion(&expectedquat, &Nq1, 0);
1861 gotquat = s;
1862 D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &gotquat, &t, &u);
1863 expectedquat.x = -1113.492920f; expectedquat.y = 82.679260f; expectedquat.z = -6.696645f; expectedquat.w = -4.090050f;
1864 expect_quaternion(&expectedquat, &Nq, 4);
1865 Nq1 = u;
1866 D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &t, &Nq1);
1867 expect_quaternion(&expectedquat, &Nq, 4);
1868 r.x = 0.2f; r.y = 0.3f; r.z = 1.3f; r.w = -0.6f;
1869 s.x = -3.0f; s.y =-2.0f; s.z = 4.0f; s.w = 0.2f;
1870 t.x = 0.4f; t.y = 8.3f; t.z = -3.1f; t.w = -2.7f;
1871 u.x = 1.1f; u.y = -0.7f; u.z = 9.2f; u.w = 0.0f;
1872 D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &u, &t);
1873 expectedquat.x = -4.139569f; expectedquat.y = -2.469115f; expectedquat.z = 2.364477f; expectedquat.w = 0.465494f;
1874 expect_quaternion(&expectedquat, &gotquat, 16);
1875 expectedquat.x = 2.342533f; expectedquat.y = 2.365127f; expectedquat.z = 8.628538f; expectedquat.w = -0.898356f;
1876 expect_quaternion(&expectedquat, &Nq, 16);
1877 expectedquat.x = 1.1f; expectedquat.y = -0.7f; expectedquat.z = 9.2f; expectedquat.w = 0.0f;
1878 expect_quaternion(&expectedquat, &Nq1, 0);
1879 D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &t, &u);
1880 expectedquat.x = -3.754567f; expectedquat.y = -0.586085f; expectedquat.z = 3.815818f; expectedquat.w = -0.198150f;
1881 expect_quaternion(&expectedquat, &gotquat, 32);
1882 expectedquat.x = 0.140773f; expectedquat.y = -8.737090f; expectedquat.z = -0.516593f; expectedquat.w = 3.053942f;
1883 expect_quaternion(&expectedquat, &Nq, 16);
1884 expectedquat.x = -0.4f; expectedquat.y = -8.3f; expectedquat.z = 3.1f; expectedquat.w = 2.7f;
1885 expect_quaternion(&expectedquat, &Nq1, 0);
1886 r.x = -1.0f; r.y = 0.0f; r.z = 0.0f; r.w = 0.0f;
1887 s.x = 1.0f; s.y =0.0f; s.z = 0.0f; s.w = 0.0f;
1888 t.x = 1.0f; t.y = 0.0f; t.z = 0.0f; t.w = 0.0f;
1889 u.x = -1.0f; u.y = 0.0f; u.z = 0.0f; u.w = 0.0f;
1890 D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &t, &u);
1891 expectedquat.x = 1.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
1892 expect_quaternion(&expectedquat, &gotquat, 0);
1893 expectedquat.x = 1.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
1894 expect_quaternion(&expectedquat, &Nq, 0);
1895 expectedquat.x = 1.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
1896 expect_quaternion(&expectedquat, &Nq1, 0);
1897
1898/*_______________D3DXQuaternionToAxisAngle__________________*/
1899 Nq.x = 1.0f/22.0f; Nq.y = 2.0f/22.0f; Nq.z = 4.0f/22.0f; Nq.w = 10.0f/22.0f;
1900 expectedvec.x = 1.0f/22.0f; expectedvec.y = 2.0f/22.0f; expectedvec.z = 4.0f/22.0f;
1901 D3DXQuaternionToAxisAngle(&Nq,&axis,&angle);
1902 expect_vec3(&expectedvec, &axis, 0);
1903 equal = compare_float(angle, 2.197869f, 1);
1904 ok(equal, "Got unexpected angle %.8e.\n", angle);
1905 /* Test if |w|>1.0f */
1906 expectedvec.x = 1.0f; expectedvec.y = 2.0f; expectedvec.z = 4.0f;
1908 expect_vec3(&expectedvec, &axis, 0);
1909 /* Test the null quaternion */
1910 expectedvec.x = 0.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f;
1911 D3DXQuaternionToAxisAngle(&nul, &axis, &angle);
1912 expect_vec3(&expectedvec, &axis, 0);
1913 equal = compare_float(angle, 3.14159274e+00f, 0);
1914 ok(equal, "Got unexpected angle %.8e.\n", angle);
1915
1916 D3DXQuaternionToAxisAngle(&nul, &axis, NULL);
1918 expect_vec3(&expectedvec, &axis, 0);
1919 equal = compare_float(angle, 3.14159274e+00f, 0);
1920 ok(equal, "Got unexpected angle %.8e.\n", angle);
1921}
D3DXQUATERNION *WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2)
Definition: math.c:1377
D3DXQUATERNION *WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3, FLOAT f, FLOAT g)
Definition: math.c:1308
D3DXQUATERNION *WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3, const D3DXQUATERNION *pq4, FLOAT t)
Definition: math.c:1531
D3DXQUATERNION *WINAPI D3DXQuaternionExp(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1318
D3DXQUATERNION *WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *out, const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, FLOAT t)
Definition: math.c:1500
D3DXQUATERNION *WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1391
D3DXQUATERNION *WINAPI D3DXQuaternionLn(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1358
void WINAPI D3DXQuaternionSquadSetup(D3DXQUATERNION *paout, D3DXQUATERNION *pbout, D3DXQUATERNION *pcout, const D3DXQUATERNION *pq0, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3)
Definition: math.c:1553
D3DXQUATERNION *WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, const D3DXQUATERNION *pq)
Definition: math.c:1343
D3DXQUATERNION *WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *out, FLOAT yaw, FLOAT pitch, FLOAT roll)
Definition: math.c:1479
void WINAPI D3DXQuaternionToAxisAngle(const D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle)
Definition: math.c:1609
D3DXQUATERNION *WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *out, const D3DXMATRIX *m)
Definition: math.c:1423
D3DXQUATERNION *WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *out, const D3DXVECTOR3 *v, FLOAT angle)
Definition: math.c:1407
GLdouble s
Definition: gl.h:2039
GLdouble GLdouble t
Definition: gl.h:2047
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define expect_quaternion(expected, quaternion, ulps)
Definition: math.c:153

Referenced by START_TEST().

◆ D3DXVector2Test()

static void D3DXVector2Test ( void  )
static

Definition at line 1923 of file math.c.

1924{
1925 D3DXVECTOR2 expectedvec, gotvec, nul, u, v, w, x;
1926 LPD3DXVECTOR2 funcpointer;
1927 D3DXVECTOR4 expectedtrans, gottrans;
1928 float coeff1, coeff2, got, scale;
1930 BOOL equal;
1931
1932 nul.x = 0.0f; nul.y = 0.0f;
1933 u.x = 3.0f; u.y = 4.0f;
1934 v.x = -7.0f; v.y = 9.0f;
1935 w.x = 4.0f; w.y = -3.0f;
1936 x.x = 2.0f; x.y = -11.0f;
1937
1938 set_matrix(&mat,
1939 1.0f, 2.0f, 3.0f, 4.0f,
1940 5.0f, 6.0f, 7.0f, 8.0f,
1941 9.0f, 10.0f, 11.0f, 12.0f,
1942 13.0f, 14.0f, 15.0f, 16.0f);
1943
1944 coeff1 = 2.0f; coeff2 = 5.0f;
1945 scale = -6.5f;
1946
1947/*_______________D3DXVec2Add__________________________*/
1948 expectedvec.x = -4.0f; expectedvec.y = 13.0f;
1949 D3DXVec2Add(&gotvec,&u,&v);
1950 expect_vec2(&expectedvec, &gotvec, 0);
1951 /* Tests the case NULL */
1952 funcpointer = D3DXVec2Add(&gotvec,NULL,&v);
1953 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1954 funcpointer = D3DXVec2Add(NULL,NULL,NULL);
1955 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1956
1957/*_______________D3DXVec2BaryCentric___________________*/
1958 expectedvec.x = -12.0f; expectedvec.y = -21.0f;
1959 D3DXVec2BaryCentric(&gotvec,&u,&v,&w,coeff1,coeff2);
1960 expect_vec2(&expectedvec, &gotvec, 0);
1961
1962/*_______________D3DXVec2CatmullRom____________________*/
1963 expectedvec.x = 5820.25f; expectedvec.y = -3654.5625f;
1964 D3DXVec2CatmullRom(&gotvec,&u,&v,&w,&x,scale);
1965 expect_vec2(&expectedvec, &gotvec, 0);
1966
1967/*_______________D3DXVec2CCW__________________________*/
1968 got = D3DXVec2CCW(&u, &v);
1969 equal = compare_float(got, 55.0f, 0);
1970 ok(equal, "Got unexpected ccw %.8e.\n", got);
1971 /* Tests the case NULL. */
1972 got = D3DXVec2CCW(NULL, &v);
1973 equal = compare_float(got, 0.0f, 0);
1974 ok(equal, "Got unexpected ccw %.8e.\n", got);
1975 got = D3DXVec2CCW(NULL, NULL);
1976 equal = compare_float(got, 0.0f, 0);
1977 ok(equal, "Got unexpected ccw %.8e.\n", got);
1978
1979/*_______________D3DXVec2Dot__________________________*/
1980 got = D3DXVec2Dot(&u, &v);
1981 equal = compare_float(got, 15.0f, 0);
1982 ok(equal, "Got unexpected dot %.8e.\n", got);
1983 /* Tests the case NULL */
1984 got = D3DXVec2Dot(NULL, &v);
1985 equal = compare_float(got, 0.0f, 0);
1986 ok(equal, "Got unexpected dot %.8e.\n", got);
1987 got = D3DXVec2Dot(NULL, NULL);
1988 equal = compare_float(got, 0.0f, 0);
1989 ok(equal, "Got unexpected dot %.8e.\n", got);
1990
1991/*_______________D3DXVec2Hermite__________________________*/
1992 expectedvec.x = 2604.625f; expectedvec.y = -4533.0f;
1993 D3DXVec2Hermite(&gotvec,&u,&v,&w,&x,scale);
1994 expect_vec2(&expectedvec, &gotvec, 0);
1995
1996/*_______________D3DXVec2Length__________________________*/
1997 got = D3DXVec2Length(&u);
1998 equal = compare_float(got, 5.0f, 0);
1999 ok(equal, "Got unexpected length %.8e.\n", got);
2000 /* Tests the case NULL. */
2001 got = D3DXVec2Length(NULL);
2002 equal = compare_float(got, 0.0f, 0);
2003 ok(equal, "Got unexpected length %.8e.\n", got);
2004
2005/*_______________D3DXVec2LengthSq________________________*/
2006 got = D3DXVec2LengthSq(&u);
2007 equal = compare_float(got, 25.0f, 0);
2008 ok(equal, "Got unexpected length %.8e.\n", got);
2009 /* Tests the case NULL. */
2010 got = D3DXVec2LengthSq(NULL);
2011 equal = compare_float(got, 0.0f, 0);
2012 ok(equal, "Got unexpected length %.8e.\n", got);
2013
2014/*_______________D3DXVec2Lerp__________________________*/
2015 expectedvec.x = 68.0f; expectedvec.y = -28.5f;
2016 D3DXVec2Lerp(&gotvec, &u, &v, scale);
2017 expect_vec2(&expectedvec, &gotvec, 0);
2018 /* Tests the case NULL. */
2019 funcpointer = D3DXVec2Lerp(&gotvec,NULL,&v,scale);
2020 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2021 funcpointer = D3DXVec2Lerp(NULL,NULL,NULL,scale);
2022 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2023
2024/*_______________D3DXVec2Maximize__________________________*/
2025 expectedvec.x = 3.0f; expectedvec.y = 9.0f;
2026 D3DXVec2Maximize(&gotvec, &u, &v);
2027 expect_vec2(&expectedvec, &gotvec, 0);
2028 /* Tests the case NULL. */
2029 funcpointer = D3DXVec2Maximize(&gotvec,NULL,&v);
2030 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2031 funcpointer = D3DXVec2Maximize(NULL,NULL,NULL);
2032 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2033
2034/*_______________D3DXVec2Minimize__________________________*/
2035 expectedvec.x = -7.0f; expectedvec.y = 4.0f;
2036 D3DXVec2Minimize(&gotvec,&u,&v);
2037 expect_vec2(&expectedvec, &gotvec, 0);
2038 /* Tests the case NULL */
2039 funcpointer = D3DXVec2Minimize(&gotvec,NULL,&v);
2040 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2041 funcpointer = D3DXVec2Minimize(NULL,NULL,NULL);
2042 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2043
2044/*_______________D3DXVec2Normalize_________________________*/
2045 expectedvec.x = 0.6f; expectedvec.y = 0.8f;
2046 D3DXVec2Normalize(&gotvec,&u);
2047 expect_vec2(&expectedvec, &gotvec, 0);
2048 /* Test the nul vector */
2049 expectedvec.x = 0.0f; expectedvec.y = 0.0f;
2050 D3DXVec2Normalize(&gotvec,&nul);
2051 expect_vec2(&expectedvec, &gotvec, 0);
2052
2053/*_______________D3DXVec2Scale____________________________*/
2054 expectedvec.x = -19.5f; expectedvec.y = -26.0f;
2055 D3DXVec2Scale(&gotvec,&u,scale);
2056 expect_vec2(&expectedvec, &gotvec, 0);
2057 /* Tests the case NULL */
2058 funcpointer = D3DXVec2Scale(&gotvec,NULL,scale);
2059 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2060 funcpointer = D3DXVec2Scale(NULL,NULL,scale);
2061 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2062
2063/*_______________D3DXVec2Subtract__________________________*/
2064 expectedvec.x = 10.0f; expectedvec.y = -5.0f;
2065 D3DXVec2Subtract(&gotvec, &u, &v);
2066 expect_vec2(&expectedvec, &gotvec, 0);
2067 /* Tests the case NULL. */
2068 funcpointer = D3DXVec2Subtract(&gotvec,NULL,&v);
2069 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2070 funcpointer = D3DXVec2Subtract(NULL,NULL,NULL);
2071 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2072
2073/*_______________D3DXVec2Transform_______________________*/
2074 expectedtrans.x = 36.0f; expectedtrans.y = 44.0f; expectedtrans.z = 52.0f; expectedtrans.w = 60.0f;
2075 D3DXVec2Transform(&gottrans, &u, &mat);
2076 expect_vec4(&expectedtrans, &gottrans, 0);
2077 gottrans.x = u.x; gottrans.y = u.y;
2078 D3DXVec2Transform(&gottrans, (D3DXVECTOR2 *)&gottrans, &mat);
2079 expect_vec4(&expectedtrans, &gottrans, 0);
2080
2081/*_______________D3DXVec2TransformCoord_______________________*/
2082 expectedvec.x = 0.6f; expectedvec.y = 11.0f/15.0f;
2083 D3DXVec2TransformCoord(&gotvec, &u, &mat);
2084 expect_vec2(&expectedvec, &gotvec, 1);
2085 gotvec.x = u.x; gotvec.y = u.y;
2086 D3DXVec2TransformCoord(&gotvec, &gotvec, &mat);
2087 expect_vec2(&expectedvec, &gotvec, 1);
2088
2089 /*_______________D3DXVec2TransformNormal______________________*/
2090 expectedvec.x = 23.0f; expectedvec.y = 30.0f;
2091 D3DXVec2TransformNormal(&gotvec,&u,&mat);
2092 expect_vec2(&expectedvec, &gotvec, 0);
2093}
D3DXVECTOR2 *WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
Definition: math.c:1740
D3DXVECTOR2 *WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pv3, FLOAT f, FLOAT g)
Definition: math.c:1625
D3DXVECTOR2 *WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pt1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pt2, FLOAT s)
Definition: math.c:1643
D3DXVECTOR4 *WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
Definition: math.c:1680
D3DXVECTOR2 *WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv0, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pv3, FLOAT s)
Definition: math.c:1634
D3DXVECTOR2 *WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
Definition: math.c:1709
D3DXVECTOR2 *WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv)
Definition: math.c:1659
const GLdouble * v
Definition: gl.h:2040
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define expect_vec2(expected, vector, ulps)
Definition: math.c:108
#define expect_vec4(expected, vector, ulps)
Definition: math.c:126
FLOAT x
Definition: d3dx9math.h:64
FLOAT y
Definition: d3dx9math.h:64

Referenced by START_TEST().

◆ D3DXVector3Test()

static void D3DXVector3Test ( void  )
static

Definition at line 2095 of file math.c.

2096{
2097 D3DVIEWPORT9 viewport;
2098 D3DXVECTOR3 expectedvec, gotvec, nul, u, v, w, x;
2099 LPD3DXVECTOR3 funcpointer;
2100 D3DXVECTOR4 expectedtrans, gottrans;
2101 D3DXMATRIX mat, projection, view, world;
2102 float coeff1, coeff2, got, scale;
2103 BOOL equal;
2104
2105 nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f;
2106 u.x = 9.0f; u.y = 6.0f; u.z = 2.0f;
2107 v.x = 2.0f; v.y = -3.0f; v.z = -4.0;
2108 w.x = 3.0f; w.y = -5.0f; w.z = 7.0f;
2109 x.x = 4.0f; x.y = 1.0f; x.z = 11.0f;
2110
2111 viewport.Width = 800; viewport.MinZ = 0.2f; viewport.X = 10;
2112 viewport.Height = 680; viewport.MaxZ = 0.9f; viewport.Y = 5;
2113
2114 set_matrix(&mat,
2115 1.0f, 2.0f, 3.0f, 4.0f,
2116 5.0f, 6.0f, 7.0f, 8.0f,
2117 9.0f, 10.0f, 11.0f, 12.0f,
2118 13.0f, 14.0f, 15.0f, 16.0f);
2119
2120 view.m[0][1] = 5.0f; view.m[0][2] = 7.0f; view.m[0][3] = 8.0f;
2121 view.m[1][0] = 11.0f; view.m[1][2] = 16.0f; view.m[1][3] = 33.0f;
2122 view.m[2][0] = 19.0f; view.m[2][1] = -21.0f; view.m[2][3] = 43.0f;
2123 view.m[3][0] = 2.0f; view.m[3][1] = 3.0f; view.m[3][2] = -4.0f;
2124 view.m[0][0] = 10.0f; view.m[1][1] = 20.0f; view.m[2][2] = 30.0f;
2125 view.m[3][3] = -40.0f;
2126
2127 set_matrix(&world,
2128 21.0f, 2.0f, 3.0f, 4.0f,
2129 5.0f, 23.0f, 7.0f, 8.0f,
2130 -8.0f, -7.0f, 25.0f, -5.0f,
2131 -4.0f, -3.0f, -2.0f, 27.0f);
2132
2133 coeff1 = 2.0f; coeff2 = 5.0f;
2134 scale = -6.5f;
2135
2136/*_______________D3DXVec3Add__________________________*/
2137 expectedvec.x = 11.0f; expectedvec.y = 3.0f; expectedvec.z = -2.0f;
2138 D3DXVec3Add(&gotvec,&u,&v);
2139 expect_vec3(&expectedvec, &gotvec, 0);
2140 /* Tests the case NULL */
2141 funcpointer = D3DXVec3Add(&gotvec,NULL,&v);
2142 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2143 funcpointer = D3DXVec3Add(NULL,NULL,NULL);
2144 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2145
2146/*_______________D3DXVec3BaryCentric___________________*/
2147 expectedvec.x = -35.0f; expectedvec.y = -67.0; expectedvec.z = 15.0f;
2148 D3DXVec3BaryCentric(&gotvec,&u,&v,&w,coeff1,coeff2);
2149 expect_vec3(&expectedvec, &gotvec, 0);
2150
2151/*_______________D3DXVec3CatmullRom____________________*/
2152 expectedvec.x = 1458.0f; expectedvec.y = 22.1875f; expectedvec.z = 4141.375f;
2153 D3DXVec3CatmullRom(&gotvec,&u,&v,&w,&x,scale);
2154 expect_vec3(&expectedvec, &gotvec, 0);
2155
2156/*_______________D3DXVec3Cross________________________*/
2157 expectedvec.x = -18.0f; expectedvec.y = 40.0f; expectedvec.z = -39.0f;
2158 D3DXVec3Cross(&gotvec,&u,&v);
2159 expect_vec3(&expectedvec, &gotvec, 0);
2160 expectedvec.x = -277.0f; expectedvec.y = -150.0f; expectedvec.z = -26.0f;
2161 D3DXVec3Cross(&gotvec,&gotvec,&v);
2162 expect_vec3(&expectedvec, &gotvec, 0);
2163 /* Tests the case NULL */
2164 funcpointer = D3DXVec3Cross(&gotvec,NULL,&v);
2165 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2166 funcpointer = D3DXVec3Cross(NULL,NULL,NULL);
2167 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2168
2169/*_______________D3DXVec3Dot__________________________*/
2170 got = D3DXVec3Dot(&u, &v);
2171 equal = compare_float(got, -8.0f, 0);
2172 ok(equal, "Got unexpected dot %.8e.\n", got);
2173 /* Tests the case NULL */
2174 got = D3DXVec3Dot(NULL, &v);
2175 equal = compare_float(got, 0.0f, 0);
2176 ok(equal, "Got unexpected dot %.8e.\n", got);
2177 got = D3DXVec3Dot(NULL, NULL);
2178 equal = compare_float(got, 0.0f, 0);
2179 ok(equal, "Got unexpected dot %.8e.\n", got);
2180
2181/*_______________D3DXVec3Hermite__________________________*/
2182 expectedvec.x = -6045.75f; expectedvec.y = -6650.0f; expectedvec.z = 1358.875f;
2183 D3DXVec3Hermite(&gotvec,&u,&v,&w,&x,scale);
2184 expect_vec3(&expectedvec, &gotvec, 0);
2185
2186/*_______________D3DXVec3Length__________________________*/
2187 got = D3DXVec3Length(&u);
2188 equal = compare_float(got, 11.0f, 0);
2189 ok(equal, "Got unexpected length %.8e.\n", got);
2190 /* Tests the case NULL. */
2191 got = D3DXVec3Length(NULL);
2192 equal = compare_float(got, 0.0f, 0);
2193 ok(equal, "Got unexpected length %.8e.\n", got);
2194
2195/*_______________D3DXVec3LengthSq________________________*/
2196 got = D3DXVec3LengthSq(&u);
2197 equal = compare_float(got, 121.0f, 0);
2198 ok(equal, "Got unexpected length %.8e.\n", got);
2199 /* Tests the case NULL. */
2200 got = D3DXVec3LengthSq(NULL);
2201 equal = compare_float(got, 0.0f, 0);
2202 ok(equal, "Got unexpected length %.8e.\n", got);
2203
2204/*_______________D3DXVec3Lerp__________________________*/
2205 expectedvec.x = 54.5f; expectedvec.y = 64.5f; expectedvec.z = 41.0f ;
2206 D3DXVec3Lerp(&gotvec,&u,&v,scale);
2207 expect_vec3(&expectedvec, &gotvec, 0);
2208 /* Tests the case NULL */
2209 funcpointer = D3DXVec3Lerp(&gotvec,NULL,&v,scale);
2210 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2211 funcpointer = D3DXVec3Lerp(NULL,NULL,NULL,scale);
2212 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2213
2214/*_______________D3DXVec3Maximize__________________________*/
2215 expectedvec.x = 9.0f; expectedvec.y = 6.0f; expectedvec.z = 2.0f;
2216 D3DXVec3Maximize(&gotvec,&u,&v);
2217 expect_vec3(&expectedvec, &gotvec, 0);
2218 /* Tests the case NULL */
2219 funcpointer = D3DXVec3Maximize(&gotvec,NULL,&v);
2220 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2221 funcpointer = D3DXVec3Maximize(NULL,NULL,NULL);
2222 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2223
2224/*_______________D3DXVec3Minimize__________________________*/
2225 expectedvec.x = 2.0f; expectedvec.y = -3.0f; expectedvec.z = -4.0f;
2226 D3DXVec3Minimize(&gotvec,&u,&v);
2227 expect_vec3(&expectedvec, &gotvec, 0);
2228 /* Tests the case NULL */
2229 funcpointer = D3DXVec3Minimize(&gotvec,NULL,&v);
2230 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2231 funcpointer = D3DXVec3Minimize(NULL,NULL,NULL);
2232 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2233
2234/*_______________D3DXVec3Normalize_________________________*/
2235 expectedvec.x = 9.0f/11.0f; expectedvec.y = 6.0f/11.0f; expectedvec.z = 2.0f/11.0f;
2236 D3DXVec3Normalize(&gotvec,&u);
2237 expect_vec3(&expectedvec, &gotvec, 1);
2238 /* Test the nul vector */
2239 expectedvec.x = 0.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f;
2240 D3DXVec3Normalize(&gotvec,&nul);
2241 expect_vec3(&expectedvec, &gotvec, 0);
2242
2243/*_______________D3DXVec3Scale____________________________*/
2244 expectedvec.x = -58.5f; expectedvec.y = -39.0f; expectedvec.z = -13.0f;
2245 D3DXVec3Scale(&gotvec,&u,scale);
2246 expect_vec3(&expectedvec, &gotvec, 0);
2247 /* Tests the case NULL */
2248 funcpointer = D3DXVec3Scale(&gotvec,NULL,scale);
2249 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2250 funcpointer = D3DXVec3Scale(NULL,NULL,scale);
2251 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2252
2253/*_______________D3DXVec3Subtract_______________________*/
2254 expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f;
2255 D3DXVec3Subtract(&gotvec,&u,&v);
2256 expect_vec3(&expectedvec, &gotvec, 0);
2257 /* Tests the case NULL */
2258 funcpointer = D3DXVec3Subtract(&gotvec,NULL,&v);
2259 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2260 funcpointer = D3DXVec3Subtract(NULL,NULL,NULL);
2261 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2262
2263/*_______________D3DXVec3Transform_______________________*/
2264 expectedtrans.x = 70.0f; expectedtrans.y = 88.0f; expectedtrans.z = 106.0f; expectedtrans.w = 124.0f;
2265 D3DXVec3Transform(&gottrans, &u, &mat);
2266 expect_vec4(&expectedtrans, &gottrans, 0);
2267
2268 gottrans.x = u.x; gottrans.y = u.y; gottrans.z = u.z;
2269 D3DXVec3Transform(&gottrans, (D3DXVECTOR3 *)&gottrans, &mat);
2270 expect_vec4(&expectedtrans, &gottrans, 0);
2271
2272/*_______________D3DXVec3TransformCoord_______________________*/
2273 expectedvec.x = 70.0f/124.0f; expectedvec.y = 88.0f/124.0f; expectedvec.z = 106.0f/124.0f;
2274 D3DXVec3TransformCoord(&gotvec,&u,&mat);
2275 expect_vec3(&expectedvec, &gotvec, 1);
2276
2277/*_______________D3DXVec3TransformNormal______________________*/
2278 expectedvec.x = 57.0f; expectedvec.y = 74.0f; expectedvec.z = 91.0f;
2279 D3DXVec3TransformNormal(&gotvec,&u,&mat);
2280 expect_vec3(&expectedvec, &gotvec, 0);
2281
2282/*_______________D3DXVec3Project_________________________*/
2283 expectedvec.x = 1135.721924f; expectedvec.y = 147.086914f; expectedvec.z = 0.153412f;
2284 D3DXMatrixPerspectiveFovLH(&projection,D3DX_PI/4.0f,20.0f/17.0f,1.0f,1000.0f);
2285 D3DXVec3Project(&gotvec,&u,&viewport,&projection,&view,&world);
2286 expect_vec3(&expectedvec, &gotvec, 32);
2287 /* World matrix can be omitted */
2288 D3DXMatrixMultiply(&mat,&world,&view);
2289 D3DXVec3Project(&gotvec,&u,&viewport,&projection,&mat,NULL);
2290 expect_vec3(&expectedvec, &gotvec, 32);
2291 /* Projection matrix can be omitted */
2292 D3DXMatrixMultiply(&mat,&view,&projection);
2293 D3DXVec3Project(&gotvec,&u,&viewport,NULL,&mat,&world);
2294 expect_vec3(&expectedvec, &gotvec, 32);
2295 /* View matrix can be omitted */
2296 D3DXMatrixMultiply(&mat,&world,&view);
2297 D3DXVec3Project(&gotvec,&u,&viewport,&projection,NULL,&mat);
2298 expect_vec3(&expectedvec, &gotvec, 32);
2299 /* All matrices can be omitted */
2300 expectedvec.x = 4010.000000f; expectedvec.y = -1695.000000f; expectedvec.z = 1.600000f;
2301 D3DXVec3Project(&gotvec,&u,&viewport,NULL,NULL,NULL);
2302 expect_vec3(&expectedvec, &gotvec, 2);
2303 /* Viewport can be omitted */
2304 expectedvec.x = 1.814305f; expectedvec.y = 0.582097f; expectedvec.z = -0.066555f;
2305 D3DXVec3Project(&gotvec,&u,NULL,&projection,&view,&world);
2306 expect_vec3(&expectedvec, &gotvec, 64);
2307
2308/*_______________D3DXVec3Unproject_________________________*/
2309 expectedvec.x = -2.913411f; expectedvec.y = 1.593215f; expectedvec.z = 0.380724f;
2310 D3DXMatrixPerspectiveFovLH(&projection,D3DX_PI/4.0f,20.0f/17.0f,1.0f,1000.0f);
2311 D3DXVec3Unproject(&gotvec,&u,&viewport,&projection,&view,&world);
2312 expect_vec3(&expectedvec, &gotvec, 16);
2313 /* World matrix can be omitted */
2314 D3DXMatrixMultiply(&mat,&world,&view);
2315 D3DXVec3Unproject(&gotvec,&u,&viewport,&projection,&mat,NULL);
2316 expect_vec3(&expectedvec, &gotvec, 16);
2317 /* Projection matrix can be omitted */
2318 D3DXMatrixMultiply(&mat,&view,&projection);
2319 D3DXVec3Unproject(&gotvec,&u,&viewport,NULL,&mat,&world);
2320 expect_vec3(&expectedvec, &gotvec, 32);
2321 /* View matrix can be omitted */
2322 D3DXMatrixMultiply(&mat,&world,&view);
2323 D3DXVec3Unproject(&gotvec,&u,&viewport,&projection,NULL,&mat);
2324 expect_vec3(&expectedvec, &gotvec, 16);
2325 /* All matrices can be omitted */
2326 expectedvec.x = -1.002500f; expectedvec.y = 0.997059f; expectedvec.z = 2.571429f;
2327 D3DXVec3Unproject(&gotvec,&u,&viewport,NULL,NULL,NULL);
2328 expect_vec3(&expectedvec, &gotvec, 4);
2329 /* Viewport can be omitted */
2330 expectedvec.x = -11.018396f; expectedvec.y = 3.218991f; expectedvec.z = 1.380329f;
2331 D3DXVec3Unproject(&gotvec,&u,NULL,&projection,&view,&world);
2332 expect_vec3(&expectedvec, &gotvec, 8);
2333}
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1895
D3DXVECTOR3 *WINAPI D3DXVec3Project(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld)
Definition: math.c:1828
D3DXVECTOR3 *WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1928
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1805
D3DXVECTOR3 *WINAPI D3DXVec3Unproject(D3DXVECTOR3 *out, const D3DXVECTOR3 *v, const D3DVIEWPORT9 *viewport, const D3DXMATRIX *projection, const D3DXMATRIX *view, const D3DXMATRIX *world)
Definition: math.c:1956
D3DXVECTOR3 *WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3, FLOAT f, FLOAT g)
Definition: math.c:1768
D3DXVECTOR4 *WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1866
D3DXVECTOR3 *WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pt1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pt2, FLOAT s)
Definition: math.c:1788
D3DXVECTOR3 *WINAPI D3DXVec3CatmullRom(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv0, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3, FLOAT s)
Definition: math.c:1778

Referenced by START_TEST().

◆ D3DXVector4Test()

static void D3DXVector4Test ( void  )
static

Definition at line 2335 of file math.c.

2336{
2337 D3DXVECTOR4 expectedvec, gotvec, u, v, w, x;
2338 LPD3DXVECTOR4 funcpointer;
2339 D3DXVECTOR4 expectedtrans, gottrans;
2340 float coeff1, coeff2, got, scale;
2342 BOOL equal;
2343
2344 u.x = 1.0f; u.y = 2.0f; u.z = 4.0f; u.w = 10.0;
2345 v.x = -3.0f; v.y = 4.0f; v.z = -5.0f; v.w = 7.0;
2346 w.x = 4.0f; w.y =6.0f; w.z = -2.0f; w.w = 1.0f;
2347 x.x = 6.0f; x.y = -7.0f; x.z =8.0f; x.w = -9.0f;
2348
2349 set_matrix(&mat,
2350 1.0f, 2.0f, 3.0f, 4.0f,
2351 5.0f, 6.0f, 7.0f, 8.0f,
2352 9.0f, 10.0f, 11.0f, 12.0f,
2353 13.0f, 14.0f, 15.0f, 16.0f);
2354
2355 coeff1 = 2.0f; coeff2 = 5.0;
2356 scale = -6.5f;
2357
2358/*_______________D3DXVec4Add__________________________*/
2359 expectedvec.x = -2.0f; expectedvec.y = 6.0f; expectedvec.z = -1.0f; expectedvec.w = 17.0f;
2360 D3DXVec4Add(&gotvec,&u,&v);
2361 expect_vec4(&expectedvec, &gotvec, 0);
2362 /* Tests the case NULL */
2363 funcpointer = D3DXVec4Add(&gotvec,NULL,&v);
2364 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2365 funcpointer = D3DXVec4Add(NULL,NULL,NULL);
2366 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2367
2368/*_______________D3DXVec4BaryCentric____________________*/
2369 expectedvec.x = 8.0f; expectedvec.y = 26.0; expectedvec.z = -44.0f; expectedvec.w = -41.0f;
2370 D3DXVec4BaryCentric(&gotvec,&u,&v,&w,coeff1,coeff2);
2371 expect_vec4(&expectedvec, &gotvec, 0);
2372
2373/*_______________D3DXVec4CatmullRom____________________*/
2374 expectedvec.x = 2754.625f; expectedvec.y = 2367.5625f; expectedvec.z = 1060.1875f; expectedvec.w = 131.3125f;
2375 D3DXVec4CatmullRom(&gotvec,&u,&v,&w,&x,scale);
2376 expect_vec4(&expectedvec, &gotvec, 0);
2377
2378/*_______________D3DXVec4Cross_________________________*/
2379 expectedvec.x = 390.0f; expectedvec.y = -393.0f; expectedvec.z = -316.0f; expectedvec.w = 166.0f;
2380 D3DXVec4Cross(&gotvec,&u,&v,&w);
2381 expect_vec4(&expectedvec, &gotvec, 0);
2382
2383/*_______________D3DXVec4Dot__________________________*/
2384 got = D3DXVec4Dot(&u, &v);
2385 equal = compare_float(got, 55.0f, 0);
2386 ok(equal, "Got unexpected dot %.8e.\n", got);
2387 /* Tests the case NULL. */
2388 got = D3DXVec4Dot(NULL, &v);
2389 equal = compare_float(got, 0.0f, 0);
2390 ok(equal, "Got unexpected dot %.8e.\n", got);
2391 got = D3DXVec4Dot(NULL, NULL);
2392 equal = compare_float(got, 0.0f, 0);
2393 ok(equal, "Got unexpected dot %.8e.\n", got);
2394
2395/*_______________D3DXVec4Hermite_________________________*/
2396 expectedvec.x = 1224.625f; expectedvec.y = 3461.625f; expectedvec.z = -4758.875f; expectedvec.w = -5781.5f;
2397 D3DXVec4Hermite(&gotvec,&u,&v,&w,&x,scale);
2398 expect_vec4(&expectedvec, &gotvec, 0);
2399
2400/*_______________D3DXVec4Length__________________________*/
2401 got = D3DXVec4Length(&u);
2402 equal = compare_float(got, 11.0f, 0);
2403 ok(equal, "Got unexpected length %.8e.\n", got);
2404 /* Tests the case NULL. */
2405 got = D3DXVec4Length(NULL);
2406 equal = compare_float(got, 0.0f, 0);
2407 ok(equal, "Got unexpected length %.8e.\n", got);
2408
2409/*_______________D3DXVec4LengthSq________________________*/
2410 got = D3DXVec4LengthSq(&u);
2411 equal = compare_float(got, 121.0f, 0);
2412 ok(equal, "Got unexpected length %.8e.\n", got);
2413 /* Tests the case NULL. */
2414 got = D3DXVec4LengthSq(NULL);
2415 equal = compare_float(got, 0.0f, 0);
2416 ok(equal, "Got unexpected length %.8e.\n", got);
2417
2418/*_______________D3DXVec4Lerp__________________________*/
2419 expectedvec.x = 27.0f; expectedvec.y = -11.0f; expectedvec.z = 62.5; expectedvec.w = 29.5;
2420 D3DXVec4Lerp(&gotvec,&u,&v,scale);
2421 expect_vec4(&expectedvec, &gotvec, 0);
2422 /* Tests the case NULL */
2423 funcpointer = D3DXVec4Lerp(&gotvec,NULL,&v,scale);
2424 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2425 funcpointer = D3DXVec4Lerp(NULL,NULL,NULL,scale);
2426 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2427
2428/*_______________D3DXVec4Maximize__________________________*/
2429 expectedvec.x = 1.0f; expectedvec.y = 4.0f; expectedvec.z = 4.0f; expectedvec.w = 10.0;
2430 D3DXVec4Maximize(&gotvec,&u,&v);
2431 expect_vec4(&expectedvec, &gotvec, 0);
2432 /* Tests the case NULL */
2433 funcpointer = D3DXVec4Maximize(&gotvec,NULL,&v);
2434 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2435 funcpointer = D3DXVec4Maximize(NULL,NULL,NULL);
2436 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2437
2438/*_______________D3DXVec4Minimize__________________________*/
2439 expectedvec.x = -3.0f; expectedvec.y = 2.0f; expectedvec.z = -5.0f; expectedvec.w = 7.0;
2440 D3DXVec4Minimize(&gotvec,&u,&v);
2441 expect_vec4(&expectedvec, &gotvec, 0);
2442 /* Tests the case NULL */
2443 funcpointer = D3DXVec4Minimize(&gotvec,NULL,&v);
2444 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2445 funcpointer = D3DXVec4Minimize(NULL,NULL,NULL);
2446 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2447
2448/*_______________D3DXVec4Normalize_________________________*/
2449 expectedvec.x = 1.0f/11.0f; expectedvec.y = 2.0f/11.0f; expectedvec.z = 4.0f/11.0f; expectedvec.w = 10.0f/11.0f;
2450 D3DXVec4Normalize(&gotvec,&u);
2451 expect_vec4(&expectedvec, &gotvec, 1);
2452
2453/*_______________D3DXVec4Scale____________________________*/
2454 expectedvec.x = -6.5f; expectedvec.y = -13.0f; expectedvec.z = -26.0f; expectedvec.w = -65.0f;
2455 D3DXVec4Scale(&gotvec,&u,scale);
2456 expect_vec4(&expectedvec, &gotvec, 0);
2457 /* Tests the case NULL */
2458 funcpointer = D3DXVec4Scale(&gotvec,NULL,scale);
2459 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2460 funcpointer = D3DXVec4Scale(NULL,NULL,scale);
2461 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2462
2463/*_______________D3DXVec4Subtract__________________________*/
2464 expectedvec.x = 4.0f; expectedvec.y = -2.0f; expectedvec.z = 9.0f; expectedvec.w = 3.0f;
2465 D3DXVec4Subtract(&gotvec,&u,&v);
2466 expect_vec4(&expectedvec, &gotvec, 0);
2467 /* Tests the case NULL */
2468 funcpointer = D3DXVec4Subtract(&gotvec,NULL,&v);
2469 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2470 funcpointer = D3DXVec4Subtract(NULL,NULL,NULL);
2471 ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2472
2473/*_______________D3DXVec4Transform_______________________*/
2474 expectedtrans.x = 177.0f; expectedtrans.y = 194.0f; expectedtrans.z = 211.0f; expectedtrans.w = 228.0f;
2475 D3DXVec4Transform(&gottrans,&u,&mat);
2476 expect_vec4(&expectedtrans, &gottrans, 0);
2477}
D3DXVECTOR4 *WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv)
Definition: math.c:2057
D3DXVECTOR4 *WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv, const D3DXMATRIX *pm)
Definition: math.c:2073
D3DXVECTOR4 *WINAPI D3DXVec4Cross(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pv3)
Definition: math.c:2025
D3DXVECTOR4 *WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pv3, FLOAT f, FLOAT g)
Definition: math.c:2003
D3DXVECTOR4 *WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pt1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pt2, FLOAT s)
Definition: math.c:2039
D3DXVECTOR4 *WINAPI D3DXVec4CatmullRom(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv0, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pv3, FLOAT s)
Definition: math.c:2014

Referenced by START_TEST().

◆ expect_color_()

static void expect_color_ ( unsigned int  line,
const D3DXCOLOR *  expected,
const D3DXCOLOR *  color,
unsigned int  ulps 
)
static

Definition at line 136 of file math.c.

137{
139 ok_(__FILE__, line)(equal,
140 "Got unexpected color {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
141 color->r, color->g, color->b, color->a, expected->r, expected->g, expected->b, expected->a);
142}
#define ok_(x1, x2)
Definition: atltest.h:61
static BOOL compare_color(const D3DXCOLOR *c1, const D3DXCOLOR *c2, unsigned int ulps)
Definition: math.c:68
Definition: parser.c:49

◆ expect_matrix_()

static void expect_matrix_ ( unsigned int  line,
const D3DXMATRIX *  expected,
const D3DXMATRIX *  matrix,
unsigned int  ulps 
)
static

Definition at line 165 of file math.c.

166{
168 ok_(__FILE__, line)(equal,
169 "Got unexpected matrix {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e, %.8e, %.8e, "
170 "%.8e, %.8e, %.8e, %.8e, %.8e, %.8e, %.8e, %.8e}, "
171 "expected {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e, %.8e, %.8e, "
172 "%.8e, %.8e, %.8e, %.8e, %.8e, %.8e, %.8e, %.8e}.\n",
173 matrix->m[0][0], matrix->m[0][1], matrix->m[0][2], matrix->m[0][3],
174 matrix->m[1][0], matrix->m[1][1], matrix->m[1][2], matrix->m[1][3],
175 matrix->m[2][0], matrix->m[2][1], matrix->m[2][2], matrix->m[2][3],
176 matrix->m[3][0], matrix->m[3][1], matrix->m[3][2], matrix->m[3][3],
177 expected->m[0][0], expected->m[0][1], expected->m[0][2], expected->m[0][3],
178 expected->m[1][0], expected->m[1][1], expected->m[1][2], expected->m[1][3],
179 expected->m[2][0], expected->m[2][1], expected->m[2][2], expected->m[2][3],
180 expected->m[3][0], expected->m[3][1], expected->m[3][2], expected->m[3][3]);
181}
GLuint GLenum matrix
Definition: glext.h:9407
static BOOL compare_matrix(const D3DXMATRIX *m1, const D3DXMATRIX *m2, unsigned int ulps)
Definition: math.c:92

◆ expect_plane_()

static void expect_plane_ ( unsigned int  line,
const D3DXPLANE *  expected,
const D3DXPLANE *  plane,
unsigned int  ulps 
)
static

Definition at line 145 of file math.c.

146{
148 ok_(__FILE__, line)(equal,
149 "Got unexpected plane {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
150 plane->a, plane->b, plane->c, plane->d, expected->a, expected->b, expected->c, expected->d);
151}
static BOOL compare_plane(const D3DXPLANE *p1, const D3DXPLANE *p2, unsigned int ulps)
Definition: math.c:76

◆ expect_quaternion_()

static void expect_quaternion_ ( unsigned int  line,
const D3DXQUATERNION *  expected,
const D3DXQUATERNION *  quaternion,
unsigned int  ulps 
)
static

Definition at line 154 of file math.c.

156{
157 BOOL equal = compare_quaternion(expected, quaternion, ulps);
158 ok_(__FILE__, line)(equal,
159 "Got unexpected quaternion {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
160 quaternion->x, quaternion->y, quaternion->z, quaternion->w,
161 expected->x, expected->y, expected->z, expected->w);
162}
static BOOL compare_quaternion(const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, unsigned int ulps)
Definition: math.c:84

◆ expect_vec2_()

static void expect_vec2_ ( unsigned int  line,
const D3DXVECTOR2 *  expected,
const D3DXVECTOR2 *  vector,
unsigned int  ulps 
)
static

Definition at line 109 of file math.c.

110{
112 ok_(__FILE__, line)(equal,
113 "Got unexpected vector {%.8e, %.8e}, expected {%.8e, %.8e}.\n",
114 vector->x, vector->y, expected->x, expected->y);
115}
static BOOL compare_vec2(const D3DXVECTOR2 *v1, const D3DXVECTOR2 *v2, unsigned int ulps)
Definition: math.c:48

◆ expect_vec3_()

static void expect_vec3_ ( unsigned int  line,
const D3DXVECTOR3 *  expected,
const D3DXVECTOR3 *  vector,
unsigned int  ulps 
)
static

Definition at line 118 of file math.c.

119{
121 ok_(__FILE__, line)(equal,
122 "Got unexpected vector {%.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e}.\n",
123 vector->x, vector->y, vector->z, expected->x, expected->y, expected->z);
124}
static BOOL compare_vec3(const D3DXVECTOR3 *v1, const D3DXVECTOR3 *v2, unsigned int ulps)
Definition: math.c:53

◆ expect_vec4_()

static void expect_vec4_ ( unsigned int  line,
const D3DXVECTOR4 *  expected,
const D3DXVECTOR4 *  vector,
unsigned int  ulps 
)
static

Definition at line 127 of file math.c.

128{
130 ok_(__FILE__, line)(equal,
131 "Got unexpected vector {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
132 vector->x, vector->y, vector->z, vector->w, expected->x, expected->y, expected->z, expected->w);
133}
static BOOL compare_vec4(const D3DXVECTOR4 *v1, const D3DXVECTOR4 *v2, unsigned int ulps)
Definition: math.c:60

◆ expect_vec4_array_()

static void expect_vec4_array_ ( unsigned int  line,
unsigned int  count,
const D3DXVECTOR4 *  expected,
const D3DXVECTOR4 *  vector,
unsigned int  ulps 
)
static

Definition at line 184 of file math.c.

186{
187 BOOL equal;
188 unsigned int i;
189
190 for (i = 0; i < count; ++i)
191 {
193 ok_(__FILE__, line)(equal,
194 "Got unexpected vector {%.8e, %.8e, %.8e, %.8e} at index %u, expected {%.8e, %.8e, %.8e, %.8e}.\n",
195 vector[i].x, vector[i].y, vector[i].z, vector[i].w, i,
196 expected[i].x, expected[i].y, expected[i].z, expected[i].w);
197 if (!equal)
198 break;
199 }
200}
GLuint GLuint GLsizei count
Definition: gl.h:1545

◆ set_matrix()

static void set_matrix ( D3DXMATRIX *  mat,
float  m00,
float  m01,
float  m02,
float  m03,
float  m10,
float  m11,
float  m12,
float  m13,
float  m20,
float  m21,
float  m22,
float  m23,
float  m30,
float  m31,
float  m32,
float  m33 
)
static

Definition at line 202 of file math.c.

207{
208 mat->m[0][0] = m00; mat->m[0][1] = m01; mat->m[0][2] = m02; mat->m[0][3] = m03;
209 mat->m[1][0] = m10; mat->m[1][1] = m11; mat->m[1][2] = m12; mat->m[1][3] = m13;
210 mat->m[2][0] = m20; mat->m[2][1] = m21; mat->m[2][2] = m22; mat->m[2][3] = m23;
211 mat->m[3][0] = m30; mat->m[3][1] = m31; mat->m[3][2] = m32; mat->m[3][3] = m33;
212}
#define m32
#define m33
#define m31
#define m22
#define m11
#define m13
#define m23
#define m12
#define m21

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

◆ START_TEST()

START_TEST ( math  )

Definition at line 4585 of file math.c.

4586{
4587 D3DXColorTest();
4590 D3DXPlaneTest();
4615}
static void D3DXQuaternionTest(void)
Definition: math.c:1534
static void D3DXVector3Test(void)
Definition: math.c:2095
static void test_matrix_stack(void)
Definition: math.c:2479
static void test_D3DXSHEvalConeLight(void)
Definition: math.c:3417
static void test_D3DXSHMultiply2(void)
Definition: math.c:4034
static void test_D3DXSHMultiply3(void)
Definition: math.c:4063
static void test_D3DXSHMultiply4(void)
Definition: math.c:4108
static void test_D3DXFloat_Array(void)
Definition: math.c:3256
static void test_D3DXSHAdd(void)
Definition: math.c:3344
static void test_D3DXSHScale(void)
Definition: math.c:4391
static void test_Matrix_AffineTransformation2D(void)
Definition: math.c:2556
static void D3DXMatrixTest(void)
Definition: math.c:372
static void test_D3DXSHDot(void)
Definition: math.c:3394
static void test_Matrix_Transformation2D(void)
Definition: math.c:3008
static void test_D3DXSHEvalDirection(void)
Definition: math.c:3586
static void test_D3DXVec_Array(void)
Definition: math.c:3105
static void D3DXColorTest(void)
Definition: math.c:261
static void test_D3DXSHEvalDirectionalLight(void)
Definition: math.c:3630
static void test_Matrix_Decompose(void)
Definition: math.c:2677
static void test_D3DXSHRotate(void)
Definition: math.c:4172
static void test_D3DXSHEvalSphericalLight(void)
Definition: math.c:3874
static void test_D3DXSHRotateZ(void)
Definition: math.c:4271
static void D3DXVector4Test(void)
Definition: math.c:2335
static void D3DXFresnelTest(void)
Definition: math.c:362
static void test_D3DXSHProjectCubeMap(void)
Definition: math.c:4421
static void D3DXVector2Test(void)
Definition: math.c:1923
static void D3DXPlaneTest(void)
Definition: math.c:1431
static void test_D3DXSHEvalHemisphereLight(void)
Definition: math.c:3777

◆ test_D3DXFloat_Array()

static void test_D3DXFloat_Array ( void  )
static

Definition at line 3256 of file math.c.

3257{
3258 unsigned int i;
3259 void *out = NULL;
3260 D3DXFLOAT16 half;
3261 BOOL equal;
3262
3263 /* Input floats through bit patterns because compilers do not generate reliable INF and NaN values. */
3264 union convert
3265 {
3266 DWORD d;
3267 float f;
3268 } single;
3269
3270 struct
3271 {
3272 union convert single_in;
3273
3274 /* half_ver2 occurs on WXPPROSP3 (32 bit math), WVISTAADM (32/64 bit math), W7PRO (32 bit math) */
3275 WORD half_ver1, half_ver2;
3276
3277 /* single_out_ver2 confirms that half -> single conversion is consistent across platforms */
3278 union convert single_out_ver1, single_out_ver2;
3279 }
3280 testdata[] =
3281 {
3282 { { 0x479c4000 }, 0x7c00, 0x7ce2, { 0x47800000 }, { 0x479c4000 } }, /* 80000.0f */
3283 { { 0x477fdf00 }, 0x7bff, 0x7bff, { 0x477fe000 }, { 0x477fe000 } }, /* 65503.0f */
3284 { { 0x477fe000 }, 0x7bff, 0x7bff, { 0x477fe000 }, { 0x477fe000 } }, /* 65504.0f */
3285 { { 0x477ff000 }, 0x7bff, 0x7c00, { 0x477fe000 }, { 0x47800000 } }, /* 65520.0f */
3286 { { 0x477ff100 }, 0x7c00, 0x7c00, { 0x47800000 }, { 0x47800000 } }, /* 65521.0f */
3287
3288 { { 0x477ffe00 }, 0x7c00, 0x7c00, { 0x47800000 }, { 0x47800000 } }, /* 65534.0f */
3289 { { 0x477fff00 }, 0x7c00, 0x7c00, { 0x47800000 }, { 0x47800000 } }, /* 65535.0f */
3290 { { 0x47800000 }, 0x7c00, 0x7c00, { 0x47800000 }, { 0x47800000 } }, /* 65536.0f */
3291 { { 0xc79c4000 }, 0xfc00, 0xfce2, { 0xc7800000 }, { 0xc79c4000 } }, /* -80000.0f */
3292 { { 0xc77fdf00 }, 0xfbff, 0xfbff, { 0xc77fe000 }, { 0xc77fe000 } }, /* -65503.0f */
3293
3294 { { 0xc77fe000 }, 0xfbff, 0xfbff, { 0xc77fe000 }, { 0xc77fe000 } }, /* -65504.0f */
3295 { { 0xc77ff000 }, 0xfbff, 0xfc00, { 0xc77fe000 }, { 0xc7800000 } }, /* -65520.0f */
3296 { { 0xc77ff100 }, 0xfc00, 0xfc00, { 0xc7800000 }, { 0xc7800000 } }, /* -65521.0f */
3297 { { 0xc77ffe00 }, 0xfc00, 0xfc00, { 0xc7800000 }, { 0xc7800000 } }, /* -65534.0f */
3298 { { 0xc77fff00 }, 0xfc00, 0xfc00, { 0xc7800000 }, { 0xc7800000 } }, /* -65535.0f */
3299
3300 { { 0xc7800000 }, 0xfc00, 0xfc00, { 0xc7800000 }, { 0xc7800000 } }, /* -65536.0f */
3301 { { 0x7f800000 }, 0x7c00, 0x7fff, { 0x47800000 }, { 0x47ffe000 } }, /* INF */
3302 { { 0xff800000 }, 0xffff, 0xffff, { 0xc7ffe000 }, { 0xc7ffe000 } }, /* -INF */
3303 { { 0x7fc00000 }, 0x7fff, 0xffff, { 0x47ffe000 }, { 0xc7ffe000 } }, /* NaN */
3304 { { 0xffc00000 }, 0xffff, 0xffff, { 0xc7ffe000 }, { 0xc7ffe000 } }, /* -NaN */
3305
3306 { { 0x00000000 }, 0x0000, 0x0000, { 0x00000000 }, { 0x00000000 } }, /* 0.0f */
3307 { { 0x80000000 }, 0x8000, 0x8000, { 0x80000000 }, { 0x80000000 } }, /* -0.0f */
3308 { { 0x330007ff }, 0x0000, 0x0000, { 0x00000000 }, { 0x00000000 } }, /* 2.9809595e-08f */
3309 { { 0xb30007ff }, 0x8000, 0x8000, { 0x80000000 }, { 0x80000000 } }, /* -2.9809595e-08f */
3310 { { 0x33000800 }, 0x0001, 0x0000, { 0x33800000 }, { 0x00000000 } }, /* 2.9809598e-08f */
3311
3312 { { 0xb3000800 }, 0x8001, 0x8000, { 0xb3800000 }, { 0x80000000 } }, /* -2.9809598e-08f */
3313 { { 0x33c00000 }, 0x0002, 0x0001, { 0x34000000 }, { 0x33800000 } }, /* 8.9406967e-08f */
3314 };
3315
3316 /* exception on NULL out or in parameter */
3317 single.f = 0.0f;
3318 out = D3DXFloat32To16Array(&half, &single.f, 0);
3319 ok(out == &half, "Got %p, expected %p.\n", out, &half);
3320
3321 out = D3DXFloat16To32Array(&single.f, &half, 0);
3322 ok(out == &single.f, "Got %p, expected %p.\n", out, &single.f);
3323
3324 for (i = 0; i < ARRAY_SIZE(testdata); ++i)
3325 {
3326 out = D3DXFloat32To16Array(&half, &testdata[i].single_in.f, 1);
3327 ok(out == &half, "Got %p, expected %p.\n", out, &half);
3328 ok(half.value == testdata[i].half_ver1 || half.value == testdata[i].half_ver2,
3329 "Got %x, expected %x or %x for index %d.\n", half.value, testdata[i].half_ver1,
3330 testdata[i].half_ver2, i);
3331
3332 out = D3DXFloat16To32Array(&single.f, (D3DXFLOAT16 *)&testdata[i].half_ver1, 1);
3333 ok(out == &single.f, "Got %p, expected %p.\n", out, &single.f);
3334 equal = compare_float(single.f, testdata[i].single_out_ver1.f, 0);
3335 ok(equal, "Got %#lx, expected %#lx at index %u.\n", single.d, testdata[i].single_out_ver1.d, i);
3336
3337 out = D3DXFloat16To32Array(&single.f, (D3DXFLOAT16 *)&testdata[i].half_ver2, 1);
3338 ok(out == &single.f, "Got %p, expected %p.\n", out, &single.f);
3339 equal = compare_float(single.f, testdata[i].single_out_ver2.f, 0);
3340 ok(equal, "Got %#lx, expected %#lx at index %u.\n", single.d, testdata[i].single_out_ver2.d, i);
3341 }
3342}
#define ARRAY_SIZE(A)
Definition: main.h:20
FLOAT *WINAPI D3DXFloat16To32Array(FLOAT *pout, const D3DXFLOAT16 *pin, UINT n)
Definition: math.c:2221
D3DXFLOAT16 *WINAPI D3DXFloat32To16Array(D3DXFLOAT16 *pout, const FLOAT *pin, UINT n)
Definition: math.c:2187
unsigned short WORD
Definition: ntddk_ex.h:93
#define d
Definition: ke_i.h:81
#define f
Definition: ke_i.h:83
int convert
Definition: msacm.c:1374
float single
Definition: msinkaut.idl:29
WORD value
Definition: d3dx9math.h:277
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by START_TEST().

◆ test_D3DXSHAdd()

static void test_D3DXSHAdd ( void  )
static

Definition at line 3344 of file math.c.

3345{
3346 float out[50] = {0.0f};
3347 unsigned int i, k;
3348 float *ret;
3349 BOOL equal;
3350
3351 static const float in1[50] =
3352 {
3353 1.11f, 1.12f, 1.13f, 1.14f, 1.15f, 1.16f, 1.17f, 1.18f,
3354 1.19f, 1.20f, 1.21f, 1.22f, 1.23f, 1.24f, 1.25f, 1.26f,
3355 1.27f, 1.28f, 1.29f, 1.30f, 1.31f, 1.32f, 1.33f, 1.34f,
3356 1.35f, 1.36f, 1.37f, 1.38f, 1.39f, 1.40f, 1.41f, 1.42f,
3357 1.43f, 1.44f, 1.45f, 1.46f, 1.47f, 1.48f, 1.49f, 1.50f,
3358 1.51f, 1.52f, 1.53f, 1.54f, 1.55f, 1.56f, 1.57f, 1.58f,
3359 1.59f, 1.60f,
3360 };
3361 static const float in2[50] =
3362 {
3363 2.11f, 2.12f, 2.13f, 2.14f, 2.15f, 2.16f, 2.17f, 2.18f,
3364 2.19f, 2.20f, 2.21f, 2.22f, 2.23f, 2.24f, 2.25f, 2.26f,
3365 2.27f, 2.28f, 2.29f, 2.30f, 2.31f, 2.32f, 2.33f, 2.34f,
3366 2.35f, 2.36f, 2.37f, 2.38f, 2.39f, 2.40f, 2.41f, 2.42f,
3367 2.43f, 2.44f, 2.45f, 2.46f, 2.47f, 2.48f, 2.49f, 2.50f,
3368 2.51f, 2.52f, 2.53f, 2.54f, 2.55f, 2.56f, 2.57f, 2.58f,
3369 2.59f, 2.60f,
3370 };
3371
3372 /*
3373 * Order is not limited by D3DXSH_MINORDER and D3DXSH_MAXORDER!
3374 * All values will work, test from 0-7 [D3DXSH_MINORDER = 2, D3DXSH_MAXORDER = 6]
3375 * Exceptions will show up when out, in1 or in2 is NULL
3376 */
3377 for (k = 0; k <= D3DXSH_MAXORDER + 1; k++)
3378 {
3379 UINT count = k * k;
3380
3381 ret = D3DXSHAdd(&out[0], k, &in1[0], &in2[0]);
3382 ok(ret == out, "%u: D3DXSHAdd() failed, got %p, expected %p\n", k, out, ret);
3383
3384 for (i = 0; i < count; ++i)
3385 {
3386 equal = compare_float(in1[i] + in2[i], out[i], 0);
3387 ok(equal, "%u-%u: Got %.8e, expected %.8e.\n", k, i, out[i], in1[i] + in2[i]);
3388 }
3389 equal = compare_float(out[count], 0.0f, 0);
3390 ok(equal, "%u-%u: Got %.8e, expected 0.0.\n", k, k * k, out[count]);
3391 }
3392}
FLOAT *WINAPI D3DXSHAdd(FLOAT *out, UINT order, const FLOAT *a, const FLOAT *b)
Definition: math.c:2237
#define D3DXSH_MAXORDER
Definition: d3dx9math.h:31
unsigned int UINT
Definition: sysinfo.c:13
int k
Definition: mpi.c:3369

Referenced by START_TEST().

◆ test_D3DXSHDot()

static void test_D3DXSHDot ( void  )
static

Definition at line 3394 of file math.c.

3395{
3396 float a[49], b[49], got;
3397 unsigned int i;
3398 BOOL equal;
3399
3400 static const float expected[] = {0.5f, 0.5f, 25.0f, 262.5f, 1428.0f, 5362.5f, 15873.0f, 39812.5f};
3401
3402 for (i = 0; i < ARRAY_SIZE(a); ++i)
3403 {
3404 a[i] = i + 1.0f;
3405 b[i] = i + 0.5f;
3406 }
3407
3408 /* D3DXSHDot computes by using order * order elements */
3409 for (i = 0; i <= D3DXSH_MAXORDER + 1; i++)
3410 {
3411 got = D3DXSHDot(i, a, b);
3412 equal = compare_float(got, expected[i], 0);
3413 ok(equal, "order %u: Got %.8e, expected %.8e.\n", i, got, expected[i]);
3414 }
3415}
FLOAT WINAPI D3DXSHDot(UINT order, const FLOAT *a, const FLOAT *b)
Definition: math.c:2249
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by START_TEST().

◆ test_D3DXSHEvalConeLight()

static void test_D3DXSHEvalConeLight ( void  )
static

Definition at line 3417 of file math.c.

3418{
3419 float bout[49], expected, gout[49], rout[49];
3420 unsigned int j, l, order;
3422 HRESULT hr;
3423 BOOL equal;
3424
3425 static const float table[] =
3426 {
3427 /* Red colour */
3428 1.604815f, -3.131381f, 7.202175f, -2.870432f, 6.759296f, -16.959688f,
3429 32.303082f, -15.546381f, -0.588878f, -5.902123f, 40.084042f, -77.423569f,
3430 137.556320f, -70.971603f, -3.492171f, 7.683092f, -2.129311f, -35.971344f,
3431 183.086548f, -312.414948f, 535.091064f, -286.380371f, -15.950727f, 46.825714f,
3432 -12.127637f, 11.289261f, -12.417809f, -155.039566f, 681.182556f, -1079.733643f,
3433 1807.650513f, -989.755798f, -59.345467f, 201.822815f, -70.726486f, 7.206529f,
3434
3435 3.101155f, -3.128710f, 7.196033f, -2.867984f, -0.224708f, 0.563814f,
3436 -1.073895f, 0.516829f, 0.019577f, 2.059788f, -13.988971f, 27.020128f,
3437 -48.005917f, 24.768450f, 1.218736f, -2.681329f, -0.088639f, -1.497410f,
3438 7.621501f, -13.005165f, 22.274696f, -11.921401f, -0.663995f, 1.949254f,
3439 -0.504848f, 4.168484f, -4.585193f, -57.247314f, 251.522095f, -398.684387f,
3440 667.462891f, -365.460693f, -21.912912f, 74.521721f, -26.115280f, 2.660963f,
3441 /* Green colour */
3442 2.454422f, -4.789170f, 11.015091f, -4.390072f, 10.337747f, -25.938347f,
3443 49.404713f, -23.776817f, -0.900637f, -9.026776f, 61.305000f, -118.412514f,
3444 210.380249f, -108.544792f, -5.340967f, 11.750610f, -3.256593f, -55.014996f,
3445 280.014709f, -477.811066f, 818.374512f, -437.993469f, -24.395227f, 71.615799f,
3446 -18.548151f, 17.265928f, -18.991943f, -237.119324f, 1041.808594f, -1651.357300f,
3447 2764.642090f, -1513.744141f, -90.763657f, 308.670197f, -108.169922f, 11.021750f,
3448
3449 4.742942f, -4.785086f, 11.005697f, -4.386329f, -0.343672f, 0.862303f,
3450 -1.642427f, 0.790444f, 0.029941f, 3.150264f, -21.394896f, 41.324898f,
3451 -73.420807f, 37.881153f, 1.863950f, -4.100857f, -0.135565f, -2.290156f,
3452 11.656413f, -19.890251f, 34.067181f, -18.232729f, -1.015521f, 2.981212f,
3453 -0.772120f, 6.375328f, -7.012648f, -87.554710f, 384.680817f, -609.752563f,
3454 1020.825500f, -558.939819f, -33.513863f, 113.974388f, -39.941013f, 4.069707f,
3455 /* Blue colour */
3456 3.304030f, -6.446959f, 14.828006f, -5.909713f, 13.916198f, -34.917004f,
3457 66.506340f, -32.007256f, -1.212396f, -12.151429f, 82.525963f, -159.401459f,
3458 283.204193f, -146.117996f, -7.189764f, 15.818130f, -4.383876f, -74.058655f,
3459 376.942871f, -643.207214f, 1101.658081f, -589.606628f, -32.839729f, 96.405884f,
3460 -24.968664f, 23.242596f, -25.566080f, -319.199097f, 1402.434692f, -2222.980957f,
3461 3721.633545f, -2037.732544f, -122.181847f, 415.517578f, -145.613358f, 14.836972f,
3462
3463 6.384730f, -6.441462f, 14.815362f, -5.904673f, -0.462635f, 1.160793f,
3464 -2.210959f, 1.064060f, 0.040305f, 4.240739f, -28.800821f, 55.629673f,
3465 -98.835709f, 50.993862f, 2.509163f, -5.520384f, -0.182491f, -3.082903f,
3466 15.691326f, -26.775339f, 45.859665f, -24.544060f, -1.367048f, 4.013170f,
3467 -1.039392f, 8.582172f, -9.440103f, -117.862114f, 517.839600f, -820.820740f,
3468 1374.188232f, -752.419067f, -45.114819f, 153.427063f, -53.766754f, 5.478452f, };
3469 const struct
3470 {
3471 float *red_received, *green_received, *blue_received;
3472 const float *red_expected, *green_expected, *blue_expected;
3473 float radius, roffset, goffset, boffset;
3474 }
3475 test[] =
3476 {
3477 { rout, gout, bout, table, &table[72], &table[144], 0.5f, 1.01f, 1.02f, 1.03f, },
3478 { rout, gout, bout, &table[36], &table[108], &table[180], 1.6f, 1.01f, 1.02f, 1.03f, },
3479 { rout, rout, rout, &table[144], &table[144], &table[144], 0.5f, 1.03f, 1.03f, 1.03f, },
3480 { rout, rout, bout, &table[72], &table[72], &table[144], 0.5, 1.02f, 1.02f, 1.03f, },
3481 { rout, gout, gout, table, &table[144], &table[144], 0.5f, 1.01f, 1.03f, 1.03f, },
3482 { rout, gout, rout, &table[144], &table[72], &table[144], 0.5f, 1.03f, 1.02f, 1.03f, },
3483 /* D3DXSHEvalConeLight accepts NULL green or blue colour. */
3484 { rout, NULL, bout, table, NULL, &table[144], 0.5f, 1.01f, 0.0f, 1.03f, },
3485 { rout, gout, NULL, table, &table[72], NULL, 0.5f, 1.01f, 1.02f, 0.0f, },
3486 { rout, NULL, NULL, table, NULL, NULL, 0.5f, 1.01f, 0.0f, 0.0f, },
3487 };
3488
3489 dir.x = 1.1f; dir.y = 1.2f; dir.z = 2.76f;
3490
3491 for (l = 0; l < ARRAY_SIZE(test); ++l)
3492 {
3494 {
3495 for (j = 0; j < 49; j++)
3496 {
3497 test[l].red_received[j] = 1.01f + j;
3498 if (test[l].green_received)
3499 test[l].green_received[j] = 1.02f + j;
3500 if (test[l].blue_received)
3501 test[l].blue_received[j] = 1.03f + j;
3502 }
3503
3504 hr = D3DXSHEvalConeLight(order, &dir, test[l].radius, 1.7f, 2.6f, 3.5f, test[l].red_received, test[l].green_received, test[l].blue_received);
3505 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3506
3507 for (j = 0; j < 49; j++)
3508 {
3509 if (j >= order * order)
3510 expected = j + test[l].roffset;
3511 else
3512 expected = test[l].red_expected[j];
3513 equal = compare_float(test[l].red_received[j], expected, 128);
3514 ok(equal, "Red: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3515 l, order, j, expected, test[l].red_received[j]);
3516
3517 if (test[l].green_received)
3518 {
3519 if (j >= order * order)
3520 expected = j + test[l].goffset;
3521 else
3522 expected = test[l].green_expected[j];
3523 equal = compare_float(test[l].green_received[j], expected, 64);
3524 ok(equal, "Green: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3525 l, order, j, expected, test[l].green_received[j]);
3526 }
3527
3528 if (test[l].blue_received)
3529 {
3530 if (j >= order * order)
3531 expected = j + test[l].boffset;
3532 else
3533 expected = test[l].blue_expected[j];
3534 equal = compare_float(test[l].blue_received[j], expected, 128);
3535 ok(equal, "Blue: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3536 l, order, j, expected, test[l].blue_received[j]);
3537 }
3538 }
3539 }
3540 }
3541
3542 /* Cone light with radius <= 0.0f behaves as a directional light */
3544 {
3545 FLOAT blue[49], green[49], red[49];
3546
3547 for (j = 0; j < 49; j++)
3548 {
3549 rout[j] = 1.01f + j;
3550 gout[j] = 1.02f + j;
3551 bout[j] = 1.03f + j;
3552 red[j] = 1.01f + j;
3553 green[j] = 1.02f + j;
3554 blue[j] = 1.03f + j;
3555 }
3556
3557 hr = D3DXSHEvalConeLight(order, &dir, -0.1f, 1.7f, 2.6f, 3.5f, rout, gout, bout);
3558 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3559 D3DXSHEvalDirectionalLight(order, &dir, 1.7f, 2.6f, 3.5f, red, green, blue);
3560
3561 for (j = 0; j < 49; j++)
3562 {
3563 equal = compare_float(red[j], rout[j], 0);
3564 ok(equal, "Red: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3565 l, order, j, red[j], rout[j]);
3566
3567 equal = compare_float(green[j], gout[j], 0);
3568 ok(equal, "Green: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3569 l, order, j, green[j], gout[j]);
3570
3571 equal = compare_float(blue[j], bout[j], 0);
3572 ok(equal, "Blue: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3573 l, order, j, blue[j], bout[j]);
3574 }
3575 }
3576
3577 /* D3DXSHEvalConeLight accepts order < D3DXSH_MINORDER or order > D3DXSH_MAXORDER. But tests in native windows show that the colour outputs are not set */
3578 hr = D3DXSHEvalConeLight(7, &dir, 0.5f, 1.0f, 2.0f, 3.0f, rout, gout, bout);
3579 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3580 hr = D3DXSHEvalConeLight(0, &dir, 0.5f, 1.0f, 2.0f, 3.0f, rout, gout, bout);
3581 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3582 hr = D3DXSHEvalConeLight(1, &dir, 0.5f, 1.0f, 2.0f, 3.0f, rout, gout, bout);
3583 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3584}
unsigned int dir
Definition: maze.c:112
r l[0]
Definition: byte_order.h:168
#define D3D_OK
Definition: d3d.h:106
HRESULT hr
Definition: delayimp.cpp:582
HRESULT WINAPI D3DXSHEvalConeLight(UINT order, const D3DXVECTOR3 *dir, FLOAT radius, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *rout, FLOAT *gout, FLOAT *bout)
Definition: math.c:2292
HRESULT WINAPI D3DXSHEvalDirectionalLight(UINT order, const D3DXVECTOR3 *dir, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *Rout, FLOAT *Gout, FLOAT *Bout)
Definition: math.c:2406
#define D3DXSH_MINORDER
Definition: d3dx9math.h:30
GLclampf green
Definition: gl.h:1740
GLclampf GLclampf blue
Definition: gl.h:1740
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
#define red
Definition: linetest.c:67
#define test
Definition: rosglue.h:37

Referenced by START_TEST().

◆ test_D3DXSHEvalDirection()

static void test_D3DXSHEvalDirection ( void  )
static

Definition at line 3586 of file math.c.

3587{
3588 float a[49], expected, *received_ptr;
3589 unsigned int i, order;
3590 D3DXVECTOR3 d;
3591 BOOL equal;
3592
3593 static const float table[36] =
3594 {
3595 2.82094806e-01f, -9.77205038e-01f, 1.46580756e+00f, -4.88602519e-01f, 2.18509698e+00f, -6.55529118e+00f,
3596 8.20018101e+00f, -3.27764559e-00f, -1.63882279e+00f, 1.18008721e+00f, 1.73436680e+01f, -4.02200317e+01f,
3597 4.70202179e+01f, -2.01100159e+01f, -1.30077515e+01f, 6.49047947e+00f, -1.50200577e+01f, 1.06207848e+01f,
3598 1.17325661e+02f, -2.40856750e+02f, 2.71657288e+02f, -1.20428375e+02f, -8.79942474e+01f, 5.84143143e+01f,
3599 -4.38084984e+00f, 2.49425201e+01f, -1.49447693e+02f, 7.82781296e+01f, 7.47791748e+02f, -1.42768787e+03f,
3600 1.57461914e+03f, -7.13843933e+02f, -5.60843811e+02f, 4.30529724e+02f, -4.35889091e+01f, -2.69116650e+01f,
3601 };
3602
3603 d.x = 1.0; d.y = 2.0f; d.z = 3.0f;
3604
3605 for (order = 0; order <= D3DXSH_MAXORDER + 1; order++)
3606 {
3607 for (i = 0; i < ARRAY_SIZE(a); ++i)
3608 a[i] = 1.5f + i;
3609
3610 received_ptr = D3DXSHEvalDirection(a, order, &d);
3611 ok(received_ptr == a, "Expected %p, received %p\n", a, received_ptr);
3612
3613 for (i = 0; i < ARRAY_SIZE(a); ++i)
3614 {
3615 /* if the order is < D3DXSH_MINORDER or order > D3DXSH_MAXORDER or
3616 * the index of the element is greater than order * order - 1,
3617 * D3DXSHEvalDirection() does not modify the output. */
3618 if ((order < D3DXSH_MINORDER) || (order > D3DXSH_MAXORDER) || (i >= order * order))
3619 expected = 1.5f + i;
3620 else
3621 expected = table[i];
3622
3623 equal = compare_float(a[i], expected, 2);
3624 ok(equal, "order %u, index %u: Got unexpected result %.8e, expected %.8e.\n",
3625 order, i, a[i], expected);
3626 }
3627 }
3628}
FLOAT *WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir)
Definition: math.c:2336

Referenced by START_TEST().

◆ test_D3DXSHEvalDirectionalLight()

static void test_D3DXSHEvalDirectionalLight ( void  )
static

Definition at line 3630 of file math.c.

3631{
3632 float *blue_out, bout[49], expected, gout[49], *green_out, *red_out, rout[49];
3633 unsigned int j, l, order, startindex;
3635 HRESULT hr;
3636 BOOL equal;
3637
3638 static const float table[] =
3639 {
3640 /* Red colour */
3641 2.008781f, -4.175174f, 9.602900f, -3.827243f, 1.417963f, -2.947181f,
3642 6.778517f, -2.701583f, 7.249108f, -18.188671f, 34.643921f, -16.672949f,
3643 -0.631551f, 1.417963f, -2.947181f, 6.778517f, -2.701583f, 7.249108f,
3644 -18.188671f, 34.643921f, -16.672949f, -0.631551f, -7.794341f, 52.934967f,
3645 -102.245529f, 181.656815f, -93.725060f, -4.611760f, 10.146287f, 1.555186f,
3646 -3.232392f, 7.434503f, -2.963026f, 7.950634f, -19.948866f, 37.996559f,
3647 -18.286459f, -0.692669f, -8.548632f, 58.057705f, -112.140251f, 199.236496f,
3648 -102.795227f, -5.058059f, 11.128186f, -4.189955f, -70.782669f, 360.268829f,
3649 -614.755005f, 1052.926270f, -563.525391f, -31.387066f, 92.141365f, -23.864176f,
3650 1.555186f, -3.232392f, 7.434503f, -2.963026f, 7.950634f, -19.948866f,
3651 37.996559f, -18.286459f, -0.692669f, -8.548632f, 58.057705f, -112.140251f,
3652 199.236496f, -102.795227f, -5.058059f, 11.128186f, -4.189955f, -70.782669f,
3653 360.268829f, -614.755005f, 1052.926270f, -563.525391f, -31.387066f, 92.141365f,
3654 -23.864176f, 34.868664f, -38.354366f, -478.864166f, 2103.939941f, -3334.927734f,
3655 5583.213867f, -3057.017090f, -183.297836f, 623.361633f, -218.449921f, 22.258503f,
3656 /* Green colour */
3657 3.072254f, -6.385560f, 14.686787f, -5.853429f, 2.168650f, -4.507453f,
3658 10.367143f, -4.131832f, 11.086870f, -27.817965f, 52.984818f, -25.499800f,
3659 -0.965902f, 2.168650f, -4.507453f, 10.367143f, -4.131832f, 11.086870f,
3660 -27.817965f, 52.984818f, -25.499800f, -0.965902f, -11.920755f, 80.959351f,
3661 -156.375488f, 277.828033f, -143.344193f, -7.053278f, 15.517849f, 2.378519f,
3662 -4.943659f, 11.370415f, -4.531687f, 12.159794f, -30.510029f, 58.112385f,
3663 -27.967525f, -1.059376f, -13.074378f, 88.794136f, -171.508621f, 304.714630f,
3664 -157.216217f, -7.735855f, 17.019577f, -6.408166f, -108.255844f, 550.999390f,
3665 -940.213501f, 1610.357788f, -861.862305f, -48.003746f, 140.922089f, -36.498150f,
3666 2.378519f, -4.943659f, 11.370415f, -4.531687f, 12.159794f, -30.510029f,
3667 58.112385f, -27.967525f, -1.059376f, -13.074378f, 88.794136f, -171.508621f,
3668 304.714630f, -157.216217f, -7.735855f, 17.019577f, -6.408166f, -108.255844f,
3669 550.999390f, -940.213501f, 1610.357788f, -861.862305f, -48.003746f, 140.922089f,
3670 -36.498150f, 53.328545f, -58.659618f, -732.380493f, 3217.790283f, -5100.477539f,
3671 8539.033203f, -4675.437500f, -280.337860f, 953.376587f, -334.099884f, 34.042416f,
3672 /* Blue colour */
3673 4.135726f, -8.595945f, 19.770674f, -7.879617f, 2.919336f, -6.067726f,
3674 13.955770f, -5.562082f, 14.924634f, -37.447262f, 71.325722f, -34.326656f,
3675 -1.300252f, 2.919336f, -6.067726f, 13.955770f, -5.562082f, 14.924634f,
3676 -37.447262f, 71.325722f, -34.326656f, -1.300252f, -16.047173f, 108.983749f,
3677 -210.505493f, 373.999298f, -192.963348f, -9.494799f, 20.889414f, 3.201853f,
3678 -6.654925f, 15.306328f, -6.100348f, 16.368954f, -41.071194f, 78.228210f,
3679 -37.648590f, -1.426083f, -17.600124f, 119.530563f, -230.876984f, 410.192780f,
3680 -211.637222f, -10.413651f, 22.910971f, -8.626378f, -145.729019f, 741.729919f,
3681 -1265.671997f, 2167.789307f, -1160.199219f, -64.620430f, 189.702820f, -49.132126f,
3682 3.201853f, -6.654925f, 15.306328f, -6.100348f, 16.368954f, -41.071194f,
3683 78.228210f, -37.648590f, -1.426083f, -17.600124f, 119.530563f, -230.876984f,
3684 410.192780f, -211.637222f, -10.413651f, 22.910971f, -8.626378f, -145.729019f,
3685 741.729919f, -1265.671997f, 2167.789307f, -1160.199219f, -64.620430f, 189.702820f,
3686 -49.132126f, 71.788422f, -78.964867f, -985.896790f, 4331.640625f, -6866.027344f,
3687 11494.852539f, -6293.858398f, -377.377899f, 1283.391479f, -449.749817f, 45.826328f, };
3688 const struct
3689 {
3690 float *red_in, *green_in, *blue_in;
3691 const float *red_out, *green_out, *blue_out;
3692 float roffset, goffset, boffset;
3693 }
3694 test[] =
3695 {
3696 { rout, gout, bout, table, &table[90], &table[180], 1.01f, 1.02f, 1.03f, },
3697 { rout, rout, rout, &table[180], &table[180], &table[180], 1.03f, 1.03f, 1.03f, },
3698 { rout, rout, bout, &table[90], &table[90], &table[180], 1.02f, 1.02f, 1.03f, },
3699 { rout, gout, gout, table, &table[180], &table[180], 1.01f, 1.03f, 1.03f, },
3700 { rout, gout, rout, &table[180], &table[90], &table[180], 1.03f, 1.02f, 1.03f, },
3701 /* D3DXSHEvalDirectionaLight accepts NULL green or blue colour. */
3702 { rout, NULL, bout, table, NULL, &table[180], 1.01f, 0.0f, 1.03f, },
3703 { rout, gout, NULL, table, &table[90], NULL, 1.01f, 1.02f, 0.0f, },
3704 { rout, NULL, NULL, table, NULL, NULL, 1.01f, 0.0f, 0.0f, },
3705 };
3706
3707 dir.x = 1.1f; dir.y= 1.2f; dir.z = 2.76f;
3708
3709 for (l = 0; l < ARRAY_SIZE(test); ++l)
3710 {
3711 startindex = 0;
3712
3714 {
3715 red_out = test[l].red_in;
3716 green_out = test[l].green_in;
3717 blue_out = test[l].blue_in;
3718
3719 for (j = 0; j < ARRAY_SIZE(rout); ++j)
3720 {
3721 red_out[j] = 1.01f + j;
3722 if ( green_out )
3723 green_out[j] = 1.02f + j;
3724 if ( blue_out )
3725 blue_out[j] = 1.03f + j;
3726 }
3727
3728 hr = D3DXSHEvalDirectionalLight(order, &dir, 1.7f, 2.6f, 3.5f, red_out, green_out, blue_out);
3729 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3730
3731 for (j = 0; j < ARRAY_SIZE(rout); ++j)
3732 {
3733 if ( j >= order * order )
3734 expected = j + test[l].roffset;
3735 else
3736 expected = test[l].red_out[startindex + j];
3737 equal = compare_float(expected, red_out[j], 8);
3738 ok(equal, "Red: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3739 l, order, j, expected, red_out[j]);
3740
3741 if ( green_out )
3742 {
3743 if ( j >= order * order )
3744 expected = j + test[l].goffset;
3745 else
3746 expected = test[l].green_out[startindex + j];
3747 equal = compare_float(expected, green_out[j], 8);
3748 ok(equal, "Green: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3749 l, order, j, expected, green_out[j]);
3750 }
3751
3752 if ( blue_out )
3753 {
3754 if ( j >= order * order )
3755 expected = j + test[l].boffset;
3756 else
3757 expected = test[l].blue_out[startindex + j];
3758 equal = compare_float(expected, blue_out[j], 4);
3759 ok(equal, "Blue: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3760 l, order, j, expected, blue_out[j]);
3761 }
3762 }
3763
3764 startindex += order * order;
3765 }
3766 }
3767
3768 /* D3DXSHEvalDirectionalLight accepts order < D3DXSH_MINORDER or order > D3DXSH_MAXORDER. But tests in native windows show that the colour outputs are not set*/
3769 hr = D3DXSHEvalDirectionalLight(7, &dir, 1.0f, 2.0f, 3.0f, rout, gout, bout);
3770 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3771 hr = D3DXSHEvalDirectionalLight(0, &dir, 1.0f, 2.0f, 3.0f, rout, gout, bout);
3772 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3773 hr = D3DXSHEvalDirectionalLight(1, &dir, 1.0f, 2.0f, 3.0f, rout, gout, bout);
3774 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3775}

Referenced by START_TEST().

◆ test_D3DXSHEvalHemisphereLight()

static void test_D3DXSHEvalHemisphereLight ( void  )
static

Definition at line 3777 of file math.c.

3778{
3779 float bout[49], expected, gout[49], rout[49];
3780 unsigned int j, l, order;
3783 HRESULT hr;
3784 BOOL equal;
3785
3786 static const float table[] =
3787 {
3788 /* Red colour. */
3789 23.422981f, 15.859521f, -36.476898f, 14.537894f,
3790 /* Green colour. */
3791 19.966694f, 6.096982f, -14.023058f, 5.588900f,
3792 /* Blue colour. */
3793 24.566214f, 8.546826f, -19.657701f, 7.834591f,
3794 };
3795 const struct
3796 {
3797 float *red_received, *green_received, *blue_received;
3798 const float *red_expected, *green_expected, *blue_expected;
3799 const float roffset, goffset, boffset;
3800 }
3801 test[] =
3802 {
3803 { rout, gout, bout, table, &table[4], &table[8], 1.01f, 1.02f, 1.03f, },
3804 { rout, rout, rout, &table[8], &table[8], &table[8], 1.03f, 1.03f, 1.03f, },
3805 { rout, rout, bout, &table[4], &table[4], &table[8], 1.02f, 1.02f, 1.03f, },
3806 { rout, gout, gout, table, &table[8], &table[8], 1.01f, 1.03f, 1.03f, },
3807 { rout, gout, rout, &table[8], &table[4], &table[8], 1.03f, 1.02f, 1.03f, },
3808 /* D3DXSHEvalHemisphereLight accepts NULL green or blue colour. */
3809 { rout, NULL, bout, table, NULL, &table[8], 1.01f, 1.02f, 1.03f, },
3810 { rout, gout, NULL, table, &table[4], NULL, 1.01f, 1.02f, 1.03f, },
3811 { rout, NULL, NULL, table, NULL, NULL, 1.01f, 1.02f, 1.03f, },
3812 };
3813
3814 dir.x = 1.1f; dir.y = 1.2f; dir.z = 2.76f;
3815 top.r = 0.1f; top.g = 2.1f; top.b = 2.3f; top.a = 4.3f;
3816 bottom.r = 8.71f; bottom.g = 5.41f; bottom.b = 6.94f; bottom.a = 8.43f;
3817
3818 for (l = 0; l < ARRAY_SIZE(test); ++l)
3820 {
3821 for (j = 0; j < 49; j++)
3822 {
3823 test[l].red_received[j] = 1.01f + j;
3824 if (test[l].green_received)
3825 test[l].green_received[j] = 1.02f + j;
3826 if (test[l].blue_received)
3827 test[l].blue_received[j] = 1.03f + j;
3828 }
3829
3830 hr = D3DXSHEvalHemisphereLight(order, &dir, top, bottom, test[l].red_received, test[l].green_received, test[l].blue_received);
3831 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3832
3833 for (j = 0; j < 49; j++)
3834 {
3835 if (j < 4)
3836 expected = test[l].red_expected[j];
3837 else if (j < order * order)
3838 expected = 0.0f;
3839 else
3840 expected = test[l].roffset + j;
3841 equal = compare_float(test[l].red_received[j], expected, 4);
3842 ok(equal, "Red: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3843 l, order, j, expected, test[l].red_received[j]);
3844
3845 if (test[l].green_received)
3846 {
3847 if (j < 4)
3848 expected = test[l].green_expected[j];
3849 else if (j < order * order)
3850 expected = 0.0f;
3851 else
3852 expected = test[l].goffset + j;
3853 equal = compare_float(expected, test[l].green_received[j], 4);
3854 ok(equal, "Green: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3855 l, order, j, expected, test[l].green_received[j]);
3856 }
3857
3858 if (test[l].blue_received)
3859 {
3860 if (j < 4)
3861 expected = test[l].blue_expected[j];
3862 else if (j < order * order)
3863 expected = 0.0f;
3864 else
3865 expected = test[l].boffset + j;
3866 equal = compare_float(expected, test[l].blue_received[j], 4);
3867 ok(equal, "Blue: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3868 l, order, j, expected, test[l].blue_received[j]);
3869 }
3870 }
3871 }
3872}
HRESULT WINAPI D3DXSHEvalHemisphereLight(UINT order, const D3DXVECTOR3 *dir, D3DXCOLOR top, D3DXCOLOR bottom, FLOAT *rout, FLOAT *gout, FLOAT *bout)
Definition: math.c:2435
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint GLint bottom
Definition: glext.h:7726

Referenced by START_TEST().

◆ test_D3DXSHEvalSphericalLight()

static void test_D3DXSHEvalSphericalLight ( void  )
static

Definition at line 3874 of file math.c.

3875{
3876 float bout[49], expected, gout[49], rout[49];
3877 unsigned int j, l, order;
3879 HRESULT hr;
3880 BOOL equal;
3881
3882 static const float table[] =
3883 {
3884 /* Red colour. */
3885 3.01317163e+00f, -9.77240128e-01f, 2.24765220e+00f, -8.95803434e-01f, 3.25255224e-35f, -8.16094904e-35f,
3886 8.95199460e-35f, -7.48086982e-35f, -2.83366352e-36f, 6.29281376e-02f, -4.27374053e-01f, 6.19212543e-01f,
3887 -3.04508915e-01f, 5.67611487e-01f, 3.72333533e-02f, -8.19167317e-02f, 1.25205729e-36f, 2.11515287e-35f,
3888 -8.85884025e-35f, 8.22100105e-35f, -1.41290744e-37f, 7.53591749e-35f, 7.71793061e-36f, -2.75340121e-35f,
3889 7.13117824e-36f, 1.24992691e-02f, -1.37487792e-02f, -1.48109290e-01f, 4.34345843e-01f, -2.45986100e-01f,
3890 -1.51757946e-01f, -2.25487254e-01f, -3.78407442e-02f, 1.92801335e-01f, -7.83071154e-02f, 7.97894137e-03f,
3891
3892 4.02519645e-01f, -2.43653315e-01f, 5.60402600e-01f, -2.23348868e-01f, 1.62046875e-01f, -4.06590330e-01f,
3893 4.46001368e-01f, -3.72707796e-01f, -1.41177231e-02f, -4.31995198e-02f, 2.93387896e-01f, -4.25083048e-01f,
3894 2.09042241e-01f, -3.89659453e-01f, -2.55603144e-02f, 5.62349945e-02f, -4.68822967e-03f, -7.92002290e-02f,
3895 3.31712278e-01f, -3.07828893e-01f, 5.29052032e-04f, -2.82176480e-01f, -2.88991817e-02f, 1.03098934e-01f,
3896 -2.67021338e-02f, 7.24339502e-03f, -7.96749298e-03f, -8.58301461e-02f, 2.51705799e-01f, -1.42550295e-01f,
3897 -8.79445626e-02f, -1.30671101e-01f, -2.19289189e-02f, 1.11729432e-01f, -4.53794030e-02f, 4.62384030e-03f,
3898
3899 1.95445306e+00f, -8.56593659e-01f, 1.97016533e+00f, -7.85210840e-01f, 2.31033385e-01f, -5.79683751e-01f,
3900 6.35872835e-01f, -5.31376762e-01f, -2.01279127e-02f, 2.11104646e-02f, -1.43370917e-01f, 2.07726860e-01f,
3901 -1.02153423e-01f, 1.90416285e-01f, 1.24906507e-02f, -2.74805568e-02f, 6.33162467e-03f, 1.06962790e-01f,
3902 -4.47989495e-01f, 4.15734115e-01f, -7.14504011e-04f, 3.81089599e-01f, 3.90293960e-02f, -1.39238860e-01f,
3903 3.60622028e-02f, -4.47359268e-03f, 4.92080277e-03f, 5.30095505e-02f, -1.55456001e-01f, 8.80404774e-02f,
3904 5.43154350e-02f, 8.07037695e-02f, 1.35435180e-02f, -6.90052063e-02f, 2.80267699e-02f, -2.85572968e-03f,
3905 /* Green colour. */
3906 4.60837984e+00f, -1.49460245e+00f, 3.43758549e+00f, -1.37005222e+00f, 4.97449134e-35f, -1.24814507e-34f,
3907 1.36912850e-34f, -1.14413296e-34f, -4.33383805e-36f, 9.62430278e-02f, -6.53630863e-01f, 9.47030887e-01f,
3908 -4.65719486e-01f, 8.68111630e-01f, 5.69451249e-02f, -1.25284405e-01f, 1.91491103e-36f, 3.23493947e-35f,
3909 -1.35488136e-34f, 1.25732949e-34f, -2.16091711e-37f, 1.15255201e-34f, 1.18038931e-35f, -4.21108392e-35f,
3910 1.09065072e-35f, 1.91165280e-02f, -2.10275433e-02f, -2.26520076e-01f, 6.64293599e-01f, -3.76214011e-01f,
3911 -2.32100374e-01f, -3.44862837e-01f, -5.78740756e-02f, 2.94872611e-01f, -1.19763816e-01f, 1.22030860e-02f,
3912
3913 6.15618240e-01f, -3.72646222e-01f, 8.57086273e-01f, -3.41592364e-01f, 2.47836381e-01f, -6.21843994e-01f,
3914 6.82119695e-01f, -5.70023651e-01f, -2.15918104e-02f, -6.60698496e-02f, 4.48710870e-01f, -6.50126972e-01f,
3915 3.19711642e-01f, -5.95949713e-01f, -3.90922430e-02f, 8.60064566e-02f, -7.17023314e-03f, -1.21129754e-01f,
3916 5.07324627e-01f, -4.70797100e-01f, 8.09138350e-04f, -4.31564000e-01f, -4.41987457e-02f, 1.57680712e-01f,
3917 -4.08385549e-02f, 1.10781328e-02f, -1.21855767e-02f, -1.31269627e-01f, 3.84961785e-01f, -2.18018084e-01f,
3918 -1.34503440e-01f, -1.99849906e-01f, -3.35383443e-02f, 1.70880296e-01f, -6.94037884e-02f, 7.07175529e-03f,
3919
3920 2.98916331e+00f, -1.31008433e+00f, 3.01319384e+00f, -1.20091062e+00f, 3.53345154e-01f, -8.86575090e-01f,
3921 9.72511332e-01f, -8.12693818e-01f, -3.07838645e-02f, 3.22865908e-02f, -2.19273153e-01f, 3.17699883e-01f,
3922 -1.56234637e-01f, 2.91224888e-01f, 1.91033469e-02f, -4.20290842e-02f, 9.68366064e-03f, 1.63590138e-01f,
3923 -6.85160360e-01f, 6.35828606e-01f, -1.09277077e-03f, 5.82842878e-01f, 5.96920135e-02f, -2.12953537e-01f,
3924 5.51539537e-02f, -6.84196484e-03f, 7.52593316e-03f, 8.10734249e-02f, -2.37756221e-01f, 1.34650133e-01f,
3925 8.30706600e-02f, 1.23429287e-01f, 2.07136145e-02f, -1.05537368e-01f, 4.28644688e-02f, -4.36758628e-03f,
3926 /* Blue colour. */
3927 6.20358848e+00f, -2.01196491e+00f, 4.62751910e+00f, -1.84430114e+00f, 6.69643089e-35f, -1.68019534e-34f,
3928 1.84305766e-34f, -1.54017904e-34f, -5.83401297e-36f, 1.29557927e-01f, -8.79887732e-01f, 1.27484932e+00f,
3929 -6.26930101e-01f, 1.16861185e+00f, 7.66569017e-02f, -1.68652090e-01f, 2.57776494e-36f, 4.35472637e-35f,
3930 -1.82387882e-34f, 1.69255899e-34f, -2.90892699e-37f, 1.55151238e-34f, 1.58898567e-35f, -5.66876703e-35f,
3931 1.46818371e-35f, 2.57337886e-02f, -2.83063093e-02f, -3.04930882e-01f, 8.94241416e-01f, -5.06441957e-01f,
3932 -3.12442822e-01f, -4.64238452e-01f, -7.79074123e-02f, 3.96943914e-01f, -1.61220527e-01f, 1.64272318e-02f,
3933
3934 8.28716892e-01f, -5.01639163e-01f, 1.15377003e+00f, -4.59835891e-01f, 3.33625909e-01f, -8.37097715e-01f,
3935 9.18238085e-01f, -7.67339558e-01f, -2.90658997e-02f, -8.89401854e-02f, 6.04033886e-01f, -8.75170956e-01f,
3936 4.30381072e-01f, -8.02240028e-01f, -5.26241753e-02f, 1.15777927e-01f, -9.65223728e-03f, -1.63059290e-01f,
3937 6.82937023e-01f, -6.33765350e-01f, 1.08922474e-03f, -5.80951560e-01f, -5.94983136e-02f, 2.12262505e-01f,
3938 -5.49749798e-02f, 1.49128717e-02f, -1.64036616e-02f, -1.76709119e-01f, 5.18217807e-01f, -2.93485893e-01f,
3939 -1.81062330e-01f, -2.69028730e-01f, -4.51477729e-02f, 2.30031176e-01f, -9.34281801e-02f, 9.51967094e-03f,
3940
3941 4.02387383e+00f, -1.76357513e+00f, 4.05622263e+00f, -1.61661051e+00f, 4.75656955e-01f, -1.19346651e+00f,
3942 1.30914992e+00f, -1.09401095e+00f, -4.14398191e-02f, 4.34627200e-02f, -2.95175409e-01f, 4.27672935e-01f,
3943 -2.10315865e-01f, 3.92033517e-01f, 2.57160448e-02f, -5.65776154e-02f, 1.30356975e-02f, 2.20217502e-01f,
3944 -9.22331288e-01f, 8.55923154e-01f, -1.47103763e-03f, 7.84596211e-01f, 8.03546365e-02f, -2.86668233e-01f,
3945 7.42457096e-02f, -9.21033762e-03f, 1.01310642e-02f, 1.09137307e-01f, -3.20056463e-01f, 1.81259801e-01f,
3946 1.11825893e-01f, 1.66154815e-01f, 2.78837128e-02f, -1.42069538e-01f, 5.77021717e-02f, -5.87944329e-03f,
3947 };
3948 const struct
3949 {
3950 float *red_received, *green_received, *blue_received;
3951 const float *red_expected, *green_expected, *blue_expected;
3952 float radius, roffset, goffset, boffset;
3953 }
3954 test[] =
3955 {
3956 { rout, gout, bout, table, &table[108], &table[216], 17.4f, 1.01f, 1.02f, 1.03f, },
3957 { rout, gout, bout, &table[36], &table[144], &table[252], 1.6f, 1.01f, 1.02f, 1.03f, },
3958 { rout, gout, bout, &table[72], &table[180], &table[288], -3.0f, 1.01f, 1.02f, 1.03f, },
3959 { rout, rout, rout, &table[216], &table[216], &table[216], 17.4f, 1.03f, 1.03f, 1.03f, },
3960 { rout, rout, bout, &table[108], &table[108], &table[216], 17.4, 1.02f, 1.02f, 1.03f, },
3961 { rout, gout, gout, table, &table[216], &table[216], 17.4f, 1.01f, 1.03f, 1.03f, },
3962 { rout, gout, rout, &table[216], &table[108], &table[216], 17.4f, 1.03f, 1.02f, 1.03f, },
3963 /* D3DXSHEvalSphericalLight accepts NULL green or blue colour. */
3964 { rout, NULL, bout, table, NULL, &table[216], 17.4f, 1.01f, 0.0f, 1.03f, },
3965 { rout, gout, NULL, table, &table[108], NULL, 17.4f, 1.01f, 1.02f, 0.0f, },
3966 { rout, NULL, NULL, table, NULL, NULL, 17.4f, 1.01f, 0.0f, 0.0f, },
3967 };
3968
3969 dir.x = 1.1f; dir.y = 1.2f; dir.z = 2.76f;
3970
3971 for (l = 0; l < ARRAY_SIZE(test); ++l)
3972 {
3974 {
3975 for (j = 0; j < 49; j++)
3976 {
3977 test[l].red_received[j] = 1.01f + j;
3978 if (test[l].green_received)
3979 test[l].green_received[j] = 1.02f + j;
3980 if (test[l].blue_received)
3981 test[l].blue_received[j] = 1.03f + j;
3982 }
3983
3984 hr = D3DXSHEvalSphericalLight(order, &dir, test[l].radius, 1.7f, 2.6f, 3.5f, test[l].red_received, test[l].green_received, test[l].blue_received);
3985 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
3986
3987 for (j = 0; j < 49; j++)
3988 {
3989 if (j >= order * order)
3990 expected = j + test[l].roffset;
3991 else
3992 expected = test[l].red_expected[j];
3993 equal = compare_float(expected, test[l].red_received[j], 4096);
3994 ok(equal || (fabs(expected) < 1.0e-6f && fabs(test[l].red_received[j]) < 1.0e-6f),
3995 "Red: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
3996 l, order, j, expected, test[l].red_received[j]);
3997
3998 if (test[l].green_received)
3999 {
4000 if (j >= order * order)
4001 expected = j + test[l].goffset;
4002 else
4003 expected = test[l].green_expected[j];
4004 equal = compare_float(expected, test[l].green_received[j], 4096);
4005 ok(equal || (fabs(expected) < 1.0e-6f && fabs(test[l].green_received[j]) < 1.0e-6f),
4006 "Green: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
4007 l, order, j, expected, test[l].green_received[j]);
4008 }
4009
4010 if (test[l].blue_received)
4011 {
4012 if (j >= order * order)
4013 expected = j + test[l].boffset;
4014 else
4015 expected = test[l].blue_expected[j];
4016 equal = compare_float(expected, test[l].blue_received[j], 4096);
4017 ok(equal || (fabs(expected) < 1.0e-6f && fabs(test[l].blue_received[j]) < 1.0e-6f),
4018 "Blue: case %u, order %u: expected[%u] = %.8e, received %.8e.\n",
4019 l, order, j, expected, test[l].blue_received[j]);
4020 }
4021 }
4022 }
4023 }
4024
4025 /* D3DXSHEvalSphericalLight accepts order < D3DXSH_MINORDER or order > D3DXSH_MAXORDER. But tests in native windows show that the colour outputs are not set */
4026 hr = D3DXSHEvalSphericalLight(7, &dir, 17.4f, 1.0f, 2.0f, 3.0f, rout, gout, bout);
4027 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
4028 hr = D3DXSHEvalSphericalLight(0, &dir, 17.4f, 1.0f, 2.0f, 3.0f, rout, gout, bout);
4029 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
4030 hr = D3DXSHEvalSphericalLight(1, &dir, 17.4f, 1.0f, 2.0f, 3.0f, rout, gout, bout);
4031 ok(hr == D3D_OK, "Expected %#lx, got %#lx\n", D3D_OK, hr);
4032}
HRESULT WINAPI D3DXSHEvalSphericalLight(UINT order, const D3DXVECTOR3 *dir, FLOAT radius, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *rout, FLOAT *gout, FLOAT *bout)
Definition: math.c:2481
_ACRTIMP double __cdecl fabs(double)

Referenced by START_TEST().

◆ test_D3DXSHMultiply2()

static void test_D3DXSHMultiply2 ( void  )
static

Definition at line 4034 of file math.c.

4035{
4036 float a[20], b[20], c[20];
4037 unsigned int i;
4038 BOOL equal;
4039
4040 /* D3DXSHMultiply2() only modifies the first 4 elements of the array. */
4041 static const float expected[20] =
4042 {
4043 3.41859412f, 1.69821072f, 1.70385253f, 1.70949447f, 4.0f, 5.0f, 6.0f,
4044 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f,
4045 14.0f, 15.0f, 16.0f, 17.0f, 18.0f, 19.0f,
4046 };
4047
4048 for (i = 0; i < ARRAY_SIZE(a); ++i)
4049 {
4050 a[i] = 1.0f + i / 100.0f;
4051 b[i] = 3.0f - i / 100.0f;
4052 c[i] = i;
4053 }
4054
4055 D3DXSHMultiply2(c, a, b);
4056 for (i = 0; i < ARRAY_SIZE(expected); ++i)
4057 {
4058 equal = compare_float(c[i], expected[i], 2);
4059 ok(equal, "Expected[%u] = %.8e, received = %.8e.\n", i, expected[i], c[i]);
4060 }
4061}
FLOAT *WINAPI D3DXSHMultiply2(FLOAT *out, const FLOAT *a, const FLOAT *b)
Definition: math.c:2523
const GLubyte * c
Definition: glext.h:8905

Referenced by START_TEST().

◆ test_D3DXSHMultiply3()

static void test_D3DXSHMultiply3 ( void  )
static

Definition at line 4063 of file math.c.

4064{
4065 float a[20], b[20], c[20];
4066 unsigned int i;
4067 BOOL equal;
4068
4069 /* D3DXSHMultiply3() only modifies the first 9 elements of the array. */
4070 static const float expected[20] =
4071 {
4072 7.81391382e+00f, 2.25605774e+00f, 5.94839954e+00f, 4.97089481e+00f, 2.89985824e+00f, 3.59894633e+00f,
4073 1.72657156e+00f, 5.57353783e+00f, 6.22063160e-01f, 9.00000000e+00f, 1.00000000e+01f, 1.10000000e+01f,
4074 1.20000000e+01f, 1.30000000e+01f, 1.40000000e+01f, 1.50000000e+01f, 1.60000000e+01f, 1.70000000e+01f,
4075 1.80000000e+01f, 1.90000000e+01f,
4076 };
4077 static const float expected_aliased[20] =
4078 {
4079 4.54092499e+02f, 2.12640405e+00f, 5.57040071e+00f, 1.53303785e+01f, 2.27960873e+01f, 4.36041260e+01f,
4080 4.27384138e+00f, 1.75772034e+02f, 2.37672729e+02f, 1.09000003e+00f, 1.10000002e+00f, 1.11000001e+00f,
4081 1.12000000e+00f, 1.13000000e+00f, 1.13999999e+00f, 1.14999998e+00f, 1.15999997e+00f, 1.16999996e+00f,
4082 1.17999995e+00f, 1.19000006e+00f,
4083 };
4084
4085 for (i = 0; i < ARRAY_SIZE(a); ++i)
4086 {
4087 a[i] = 1.0f + i / 100.0f;
4088 b[i] = 3.0f - i / 100.0f;
4089 c[i] = i;
4090 }
4091
4092 D3DXSHMultiply3(c, a, b);
4093 for (i = 0; i < ARRAY_SIZE(expected); ++i)
4094 {
4095 equal = compare_float(c[i], expected[i], 4);
4096 ok(equal, "Expected[%u] = %.8e, received = %.8e.\n", i, expected[i], c[i]);
4097 }
4098
4099 memcpy(c, a, sizeof(c));
4100 D3DXSHMultiply3(c, c, b);
4101 for (i = 0; i < ARRAY_SIZE(expected_aliased); ++i)
4102 {
4103 equal = compare_float(c[i], expected_aliased[i], 64);
4104 ok(equal, "Expected[%u] = %.8e, received = %.8e.\n", i, expected_aliased[i], c[i]);
4105 }
4106}
FLOAT *WINAPI D3DXSHMultiply3(FLOAT *out, const FLOAT *a, const FLOAT *b)
Definition: math.c:2540
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by START_TEST().

◆ test_D3DXSHMultiply4()

static void test_D3DXSHMultiply4 ( void  )
static

Definition at line 4108 of file math.c.

4109{
4110 float a[20], b[20], c[20];
4111 unsigned int i;
4112 BOOL equal;
4113
4114 /* D3DXSHMultiply4() only modifies the first 16 elements of the array. */
4115 static const float expected[] =
4116 {
4117 /* c, a, b */
4118 1.41825991e+01f, 2.61570334e+00f, 1.28286009e+01f, 9.82059574e+00f, 3.03969646e+00f, 4.53044176e+00f,
4119 5.82058382e+00f, 1.22498465e+01f, 2.19434643e+00f, 3.90015244e+00f, 5.41660881e+00f, 5.60181284e+00f,
4120 9.59981740e-01f, 7.03754997e+00f, 3.62523031e+00f, 4.63601470e-01f, 1.60000000e+01f, 1.70000000e+01f,
4121 1.80000000e+01f, 1.90000000e+01f,
4122 /* c, c, b */
4123 -2.11441266e+05f, -2.52915771e+03f, -1.00233936e+04f, -4.41277191e+02f, -1.63994385e+02f, -5.26305115e+02f,
4124 2.96361875e+04f, -3.93183081e+03f, -1.35771113e+04f, -3.97897388e+03f, -1.03303418e+04f, -1.37797871e+04f,
4125 -1.66851094e+04f, -4.49813750e+04f, -7.32697422e+04f, -9.52373359e+04f, 1.60000000e+01f, 1.70000000e+01f,
4126 1.80000000e+01f, 1.90000000e+01f,
4127 /* c, c, c */
4128 2.36682415e-01f, -7.17648506e-01f, -1.80499524e-01f, -7.71235973e-02f, 1.44830629e-01f, 5.73285699e-01f,
4129 -3.37959230e-01f, 5.56938872e-02f, -4.42100227e-01f, 1.47701755e-01f, -5.51566519e-02f, 8.43374059e-02f,
4130 1.79876596e-01f, 9.09878965e-03f, 2.32199892e-01f, 7.41420984e-02f, 1.60000002e+00f, 1.70000005e+00f,
4131 1.80000007e+00f, 1.89999998e+00f,
4132 };
4133
4134 for (i = 0; i < ARRAY_SIZE(a); ++i)
4135 {
4136 a[i] = 1.0f + i / 100.0f;
4137 b[i] = 3.0f - i / 100.0f;
4138 c[i] = i;
4139 }
4140
4141 D3DXSHMultiply4(c, a, b);
4142 for (i = 0; i < ARRAY_SIZE(c); ++i)
4143 {
4144 equal = compare_float(c[i], expected[i], 16);
4145 ok(equal, "Expected[%u] = %.8e, received = %.8e.\n", i, expected[i], c[i]);
4146 }
4147
4148 for (i = 0; i < ARRAY_SIZE(b); ++i)
4149 {
4150 b[i] = 3.0f - i / 100.0f;
4151 c[i] = i;
4152 }
4153
4154 D3DXSHMultiply4(c, c, b);
4155 for (i = 0; i < ARRAY_SIZE(c); ++i)
4156 {
4157 equal = compare_float(c[i], expected[20 + i], 32);
4158 ok(equal, "Expected[%u] = %.8e, received = %.8e.\n", i, expected[20 + i], c[i]);
4159 }
4160
4161 for (i = 0; i < ARRAY_SIZE(c); ++i)
4162 c[i] = 0.1f * i;
4163
4164 D3DXSHMultiply4(c, c, c);
4165 for (i = 0; i < ARRAY_SIZE(c); ++i)
4166 {
4167 equal = compare_float(c[i], expected[40 + i], 8);
4168 ok(equal, "Expected[%u] = %.8e, received = %.8e.\n", i, expected[40 + i], c[i]);
4169 }
4170}
FLOAT *WINAPI D3DXSHMultiply4(FLOAT *out, const FLOAT *a, const FLOAT *b)
Definition: math.c:2639

Referenced by START_TEST().

◆ test_D3DXSHProjectCubeMap()

static void test_D3DXSHProjectCubeMap ( void  )
static

Definition at line 4421 of file math.c.

4422{
4423 unsigned int i, j, level, face, x, y;
4424 float red[4], green[4], blue[4];
4425 IDirect3DCubeTexture9 *texture;
4427 D3DLOCKED_RECT map_desc;
4428 IDirect3D9 *d3d;
4429 ULONG refcount;
4430 HWND window;
4431 HRESULT hr;
4432
4433 static const struct
4434 {
4436 float red[4];
4437 float green[4];
4438 float blue[4];
4439 }
4440 tests[] =
4441 {
4443 {1.77656245f, -1.11197047e-2f, 2.08763797e-2f, -2.10229922e-2f},
4444 {1.75811982f, -4.82511893e-2f, 1.67397819e-2f, -1.71497762e-2f},
4445 {1.75515056f, -4.07523997e-2f, 1.05397226e-2f, -2.46812664e-2f}},
4447 {1.77656245f, -1.11197047e-2f, 2.08763797e-2f, -2.10229922e-2f},
4448 {1.75811982f, -4.82511893e-2f, 1.67397819e-2f, -1.71497762e-2f},
4449 {1.75515056f, -4.07523997e-2f, 1.05397226e-2f, -2.46812664e-2f}},
4451 {1.75515056f, -4.07523997e-2f, 1.05397226e-2f, -2.46812664e-2f},
4452 {1.75811982f, -4.82511893e-2f, 1.67397819e-2f, -1.71497762e-2f},
4453 {1.77656245f, -1.11197047e-2f, 2.08763797e-2f, -2.10229922e-2f}},
4455 {1.77099848f, -3.88867334e-2f, 6.73775524e-2f, -1.26888147e-2f},
4456 {1.77244151f, -5.64723741e-4f, -2.77878426e-4f, -9.10691451e-3f},
4457 {1.78902030f, 2.79005636e-2f, 1.62461456e-2f, 2.21668324e-3f}},
4459 {1.78022826f, 1.46923587e-2f, 3.58058624e-2f, 2.51076911e-2f},
4460 {1.77233493f, -7.58088892e-4f, -2.03727093e-3f, -1.34809706e-2f},
4461 {1.78902030f, 2.79005636e-2f, 1.62461456e-2f, 2.21668324e-3f}},
4463 {1.78022826f, 1.46923587e-2f, 3.58058624e-2f, 2.51076911e-2f},
4464 {1.77233493f, -7.58088892e-4f, -2.03727093e-3f, -1.34809706e-2f},
4465 {1.78902030f, 2.79005636e-2f, 1.62461456e-2f, 2.21668324e-3f}},
4467 {1.79359019f, -7.74506712e-4f, 8.65613017e-3f, 5.75336441e-3f},
4468 {1.77067971f, 6.42523961e-3f, 1.35379164e-2f, 2.24088971e-3f},
4469 {1.76601243f, -4.94002625e-2f, 1.28124524e-2f, -7.69229094e-3f}},
4471 {1.76601243f, -4.94002625e-2f, 1.28124524e-2f, -7.69229094e-3f},
4472 {1.77067971f, 6.42523961e-3f, 1.35379164e-2f, 2.24088971e-3f},
4473 {1.79359019f, -7.74506712e-4f, 8.65613017e-3f, 5.75336441e-3f}},
4475 {1.75979614f, 1.44450525e-2f, -3.25212209e-3f, 2.98178056e-3f},
4476 {1.78080165f, -2.63770130e-2f, 6.31967233e-3f, 3.66022950e-3f},
4477 {1.77588308f, -1.93727610e-3f, -3.22831096e-3f, -6.18841546e-3f}},
4479 { 5.17193642e+1f, -3.41681671e+2f, -8.82221741e+2f, 7.77049316e+2f},
4480 {-2.08198950e+3f, 5.24323584e+3f, -3.42663379e+3f, 3.80999243e+3f},
4481 {-1.10743945e+3f, -9.43649292e+2f, 5.48424316e+2f, 1.65352710e+3f}},
4482 };
4483
4485 if (!d3d)
4486 {
4487 skip("Failed to create a D3D object.\n");
4488 return;
4489 }
4490
4492 if (!(device = create_device(d3d, window)))
4493 {
4494 skip("Failed to create a D3D device, skipping tests.\n");
4495 IDirect3D9_Release(d3d);
4497 return;
4498 }
4499
4500 for (i = 0; i < ARRAY_SIZE(tests); ++i)
4501 {
4502 winetest_push_context("Format %#x", tests[i].format);
4503
4506 if (FAILED(hr))
4507 {
4508 skip("Failed to create cube texture.\n");
4510 continue;
4511 }
4512 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
4513
4514 for (face = 0; face < 6; ++face)
4515 {
4516 hr = IDirect3DCubeTexture9_LockRect(texture, face, 0, &map_desc, NULL, 0);
4517 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
4518
4519 for (y = 0; y < 8; ++y)
4520 {
4521 uint8_t *row = (uint8_t *)map_desc.pBits + y * map_desc.Pitch;
4522
4523 for (x = 0; x < map_desc.Pitch; ++x)
4524 row[x] = face * 111 + y * 39 + x * 7;
4525 }
4526
4528 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
4529
4530 for (level = 1; level < 4; ++level)
4531 {
4533 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
4534 memset(map_desc.pBits, 0xcc, (8 >> level) * map_desc.Pitch);
4536 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
4537 }
4538 }
4539
4541 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
4542
4544 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
4545
4547 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
4548
4549 memset(red, 0, sizeof(red));
4550 memset(green, 0, sizeof(green));
4551 memset(blue, 0, sizeof(blue));
4553 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
4554
4555 for (j = 0; j < 4; ++j)
4556 {
4557 ok(compare_float(red[j], tests[i].red[j], 1024),
4558 "Got unexpected value %.8e for red coefficient %u.\n", red[j], j);
4559 ok(compare_float(green[j], tests[i].green[j], 1024),
4560 "Got unexpected value %.8e for green coefficient %u.\n", green[j], j);
4561 ok(compare_float(blue[j], tests[i].blue[j], 1024),
4562 "Got unexpected value %.8e for blue coefficient %u.\n", blue[j], j);
4563 }
4564
4566 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
4567
4569 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
4570
4572 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
4573
4575
4577 }
4578
4579 refcount = IDirect3DDevice9_Release(device);
4580 ok(!refcount, "Device has %lu references left.\n", refcount);
4581 IDirect3D9_Release(d3d);
4583}
#define skip(...)
Definition: atltest.h:64
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
@ D3DFMT_A1R5G5B5
Definition: d3d8types.h:608
@ D3DFMT_X1R5G5B5
Definition: d3d8types.h:607
@ D3DFMT_A2B10G10R10
Definition: d3d8types.h:614
@ D3DFMT_R5G6B5
Definition: d3d8types.h:606
@ D3DFMT_X8R8G8B8
Definition: d3d8types.h:605
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
@ D3DPOOL_DEFAULT
Definition: d3d8types.h:709
enum _D3DFORMAT D3DFORMAT
IDirect3D9 *WINAPI Direct3DCreate9(UINT SDKVersion)
Definition: d3d9.c:57
#define IDirect3DCubeTexture9_UnlockRect(p, a, b)
Definition: d3d9.h:768
#define IDirect3DCubeTexture9_Release(p)
Definition: d3d9.h:747
#define IDirect3DCubeTexture9_LockRect(p, a, b, c, d, e)
Definition: d3d9.h:767
#define IDirect3DDevice9_CreateCubeTexture(p, a, b, c, d, e, f, g)
Definition: d3d9.h:1360
#define IDirect3D9_Release(p)
Definition: d3d9.h:209
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1336
@ D3DFMT_A16B16G16R16F
Definition: d3d9types.h:856
@ D3DFMT_A2R10G10B10
Definition: d3d9types.h:805
@ D3DFMT_A8B8G8R8
Definition: d3d9types.h:802
@ D3DFMT_A16B16G16R16
Definition: d3d9types.h:806
HRESULT WINAPI D3DXSHProjectCubeMap(unsigned int order, IDirect3DCubeTexture9 *texture, float *red, float *green, float *blue)
Definition: math.c:2991
WORD face[3]
Definition: mesh.c:4854
unsigned char uint8_t
Definition: stdint.h:33
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
GLint level
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
static ID3D11Device * create_device(void)
Definition: hlsl_d3d11.c:102
#define FAILED(hr)
Definition: intsafe.h:51
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:539
static struct test_info tests[]
static HWND create_window(void)
Definition: math.c:214
static IHTMLWindow2 * window
Definition: events.c:77
BOOL WINAPI DestroyWindow(_In_ HWND)
for(i=0;i< sizeof(testsuite)/sizeof(testsuite[0]);++i) ok(call_test(testsuite[i].func)
#define D3D_SDK_VERSION
Definition: d3d8.h:52
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_D3DXSHRotate()

static void test_D3DXSHRotate ( void  )
static

Definition at line 4172 of file math.c.

4173{
4174 float expected, in[49], out[49], *out_temp, *received_ptr;
4175 unsigned int i, j, l, order;
4176 D3DXMATRIX m[4];
4177 BOOL equal;
4178
4179 static const float table[]=
4180 {
4181 /* Rotation around the x-axis, π/2. */
4182 1.00999999e+00f, -3.00999999e+00f, 2.00999975e+00f, 4.01000023e+00f, -8.01000023e+00f, -6.00999928e+00f,
4183 -1.13078899e+01f, 5.00999975e+00f, -1.56583869e+00f, 1.09359801e+00f, -1.10099983e+01f, 1.98334141e+01f,
4184 -1.52681913e+01f, -1.90041180e+01f, -3.36488891e+00f, -9.56262684e+00f, 1.20996542e+01f, -2.72131383e-01f,
4185 3.02410126e+01f, 2.69199905e+01f, 3.92368774e+01f, -2.26324463e+01f, 6.70738792e+00f, -1.17682819e+01f,
4186 3.44367194e+00f, -6.07445812e+00f, 1.16183939e+01f, 1.52756083e+00f, 3.78963356e+01f, -5.69012184e+01f,
4187 4.74228935e+01f, 5.03915329e+01f, 1.06181908e+01f, 2.55010109e+01f, 4.92456071e-02f, 1.69833069e+01f,
4188
4189 1.00999999e+00f, -3.00999999e+00f, -3.01000023e+00f, 4.01000023e+00f, -8.01000023e+00f, -6.00999928e+00f,
4190 -1.13078890e+01f, -8.01000023e+00f, 1.42979193e+01f,
4191 /* Rotation around the x-axis, -Ï€/2. */
4192 1.00999999e+00f, 3.00999999e+00f, -2.01000023e+00f, 4.01000023e+00f, 8.01000023e+00f, -6.01000118e+00f,
4193 -1.13078880e+01f, -5.01000071e+00f, -1.56583774e+00f, -1.09359753e+00f, -1.10100021e+01f, -1.98334103e+01f,
4194 1.52681961e+01f, -1.90041142e+01f, 3.36489248e+00f, -9.56262398e+00f, -1.20996523e+01f, -2.72129118e-01f,
4195 -3.02410049e+01f, 2.69200020e+01f, 3.92368736e+01f, 2.26324520e+01f, 6.70738268e+00f, 1.17682877e+01f,
4196 3.44367099e+00f, 6.07445717e+00f, 1.16183996e+01f, -1.52756333e+00f, 3.78963509e+01f, 5.69011993e+01f,
4197 -4.74229126e+01f, 5.03915253e+01f, -1.06182041e+01f, 2.55009995e+01f, -4.92481887e-02f, 1.69833050e+01f,
4198
4199 1.00999999e+00f, 3.00999999e+00f, -3.01000023e+00f, 4.01000023e+00f, 8.01000023e+00f, -6.01000118e+00f,
4200 -1.13078899e+01f, -8.01000023e+00f, 1.42979193e+01f,
4201 /* Yaw π/3, pitch π/4, roll π/5. */
4202 1.00999999e+00f, 4.94489908e+00f, 1.44230127e+00f, 1.62728095e+00f, 2.19220325e-01f, 1.05408239e+01f,
4203 -9.13690281e+00f, 2.76374960e+00f, -7.30904531e+00f, -5.87572050e+00f, 5.30312395e+00f, -8.68215370e+00f,
4204 -2.56833839e+01f, 1.68027866e+00f, -1.88083878e+01f, 7.65365601e+00f, 1.69391327e+01f, -1.73280182e+01f,
4205 1.46297951e+01f, -5.44671021e+01f, -1.22310352e+01f, -4.08985710e+00f, -9.44422245e+00f, 3.05603528e+00f,
4206 1.79257303e-01f, -1.00418749e+01f, 2.30900917e+01f, -2.31887093e+01f, 1.17270985e+01f, -6.51830902e+01f,
4207 4.86715775e+01f, -1.50732088e+01f, 3.87931709e+01f, -2.60395355e+01f, 6.19276857e+00f, -1.76722469e+01f,
4208
4209 1.00999999e+00f, 4.94489908e+00f, -8.91142070e-01f, 4.60769463e+00f, 2.19218358e-01f, 1.07733250e+01f,
4210 -8.20476913e+00f, 1.35638294e+01f, -1.20077667e+01f,
4211 /* Rotation around the z-axis, π/6. */
4212 1.00999999e+00f, 3.74571109e+00f, 3.00999999e+00f, 2.46776199e+00f, 1.03078890e+01f, 9.20981312e+00f,
4213 7.01000023e+00f, 3.93186355e+00f, 1.66212186e-01f, 1.60099983e+01f, 1.85040417e+01f, 1.74059658e+01f,
4214 1.30100002e+01f, 6.12801647e+00f, -2.02994061e+00f, -1.00100012e+01f, 1.31542921e+01f, 2.40099964e+01f,
4215 2.94322453e+01f, 2.83341675e+01f, 2.10100021e+01f, 9.05622101e+00f, -4.95814323e+00f, -1.80100002e+01f,
4216 -2.72360935e+01f, -4.52033186e+00f, 1.68145428e+01f, 3.40099945e+01f, 4.30924950e+01f, 4.19944229e+01f,
4217 3.10100002e+01f, 1.27164707e+01f, -8.61839962e+00f, -2.80100021e+01f, -4.08963470e+01f, -4.41905708e+01f,
4218
4219 1.00999999e+00f, 3.74571109e+00f, 3.00999999e+00f, 1.59990644e+00f, 1.03078890e+01f, 9.20981312e+00f,
4220 7.01000023e+00f, 2.33195710e+00f, -4.42189360e+00f,
4221 };
4222
4223 D3DXMatrixRotationX(&m[0], -D3DX_PI / 2.0f);
4224 D3DXMatrixRotationX(&m[1], D3DX_PI / 2.0f);
4225 D3DXMatrixRotationYawPitchRoll(&m[2], D3DX_PI / 3.0f, D3DX_PI / 4.0f, D3DX_PI / 5.0f);
4226 D3DXMatrixRotationZ(&m[3], D3DX_PI / 6.0f);
4227
4228 for (l = 0; l < 2; l++)
4229 {
4230 if (l == 0)
4231 out_temp = out;
4232 else
4233 out_temp = in;
4234
4235 for (j = 0; j < ARRAY_SIZE(m); ++j)
4236 {
4237 for (order = 0; order <= D3DXSH_MAXORDER; order++)
4238 {
4239 for (i = 0; i < ARRAY_SIZE(out); ++i)
4240 {
4241 out[i] = ( i + 1.0f ) * ( i + 1.0f );
4242 in[i] = i + 1.01f;
4243 }
4244
4245 received_ptr = D3DXSHRotate(out_temp, order, &m[j], in);
4246 ok(received_ptr == out_temp, "Order %u, expected %p, received %p.\n",
4247 order, out, received_ptr);
4248
4249 for (i = 0; i < ARRAY_SIZE(out); ++i)
4250 {
4251 if ((i > 0) && ((i >= order * order) || (order > D3DXSH_MAXORDER)))
4252 {
4253 if (l == 0)
4254 expected = ( i + 1.0f ) * ( i + 1.0f );
4255 else
4256 expected = i + 1.01f;
4257 }
4258 else if ((l == 0) || (order > 3))
4259 expected = table[45 * j + i];
4260 else
4261 expected = table[45 * j + 36 +i];
4262 equal = compare_float(out_temp[i], expected, 4096);
4263 ok(equal, "Order %u index %u, expected %.8e, received %.8e.\n",
4264 order, i, expected, out_temp[i]);
4265 }
4266 }
4267 }
4268 }
4269}
FLOAT *WINAPI D3DXSHRotate(FLOAT *out, UINT order, const D3DXMATRIX *matrix, const FLOAT *in)
Definition: math.c:3123
GLuint in
Definition: glext.h:9616
const GLfloat * m
Definition: glext.h:10848

Referenced by START_TEST().

◆ test_D3DXSHRotateZ()

static void test_D3DXSHRotateZ ( void  )
static

Definition at line 4271 of file math.c.

4272{
4273 float expected, in[49], out[49], *out_temp, *received_ptr;
4274 unsigned int end, i, j, l, order, square;
4275 BOOL equal;
4276
4277 static const float angle[] = {D3DX_PI / 3.0f, -D3DX_PI / 3.0f, 4.0f * D3DX_PI / 3.0f};
4278 static const float table[] =
4279 {
4280 /* Angle π/3. */
4281 1.00999999e+00f, 4.47776222e+00f, 3.00999999e+00f, 2.64288902e-01f, 5.29788828e+00f, 9.94186401e+00f,
4282 7.01000023e+00f, -1.19981313e+00f, -8.84378910e+00f, -1.00100021e+01f, 7.49403954e+00f, 1.81380157e+01f,
4283 1.30100002e+01f, -3.39596605e+00f, -1.70399418e+01f, -1.60099983e+01f, -3.01642971e+01f, -1.80100040e+01f,
4284 1.04222422e+01f, 2.90662193e+01f, 2.10100002e+01f, -6.32417059e+00f, -2.79681454e+01f, -2.40099983e+01f,
4285 2.22609901e+00f, -1.81805649e+01f, -4.38245506e+01f, -2.80100040e+01f, 1.40824928e+01f, 4.27264709e+01f,
4286 3.10100002e+01f, -9.98442554e+00f, -4.16283989e+01f, -3.40099945e+01f, 5.88635778e+00f, 4.05303307e+01f,
4287
4288 1.00999999e+00f, 4.47776222e+00f, 0.00000000e+00f, -5.81678391e+00f, 5.29788828e+00f, 6.93686390e+00f,
4289 0.00000000e+00f, -9.01125050e+00f, -2.29405236e+00f, -1.00100021e+01f, 1.29990416e+01f, 1.21330166e+01f,
4290 0.00000000e+00f, -1.57612505e+01f, -5.62874842e+00f, 0.00000000e+00f, -3.01642971e+01f, -3.29017075e-06f,
4291 1.99272442e+01f, 1.90612202e+01f, 0.00000000e+00f, -2.47612514e+01f, -8.62874794e+00f, 0.00000000e+00f,
4292 -1.30615301e+01f, -1.81805649e+01f, -3.03195534e+01f, -4.66050415e-06f, 2.85874958e+01f, 2.77214737e+01f,
4293 0.00000000e+00f, -3.60112534e+01f, -1.23787460e+01f, 0.00000000e+00f, -1.31287584e+01f, -2.36172504e+01f,
4294
4295 1.00999999e+00f, 3.97776222e+00f, 3.97776222e+00f, 1.11419535e+00f, 7.24579096e+00f, 1.05597591e+01f,
4296 1.05597591e+01f, -9.95159924e-01f, -4.67341393e-01f, 4.67339337e-01f, 1.27653713e+01f, 1.85157013e+01f,
4297 1.85157013e+01f, -1.79728663e+00f, 4.93915796e-01f, -4.93915856e-01f, -2.14123421e+01f, 2.14123383e+01f,
4298 9.22107220e+00f, 2.36717567e+01f, 2.36717567e+01f, 3.85019469e+00f, -2.04687271e+01f, 2.04687233e+01f,
4299 -1.06621027e+01f, -3.65166283e+01f, -1.20612450e+01f, 1.20612402e+01f, 2.25568752e+01f, 3.89999084e+01f,
4300 3.89999084e+01f, -3.48751247e-02f, -1.04279022e+01f, 1.04279003e+01f, -3.68382835e+01f, -2.76528034e+01f,
4301 /* Angle -Ï€/3. */
4302 1.00999999e+00f, -2.46776247e+00f, 3.00999999e+00f, 3.74571109e+00f, -1.03078899e+01f, -3.93186426e+00f,
4303 7.01000023e+00f, 9.20981312e+00f, -1.66213632e-01f, -1.00099983e+01f, -1.85040436e+01f, -6.12801695e+00f,
4304 1.30100002e+01f, 1.74059658e+01f, 2.02993774e+00f, -1.60100021e+01f, 1.31543026e+01f, -1.80099964e+01f,
4305 -2.94322472e+01f, -9.05622101e+00f, 2.10100002e+01f, 2.83341694e+01f, 4.95813942e+00f, -2.40100021e+01f,
4306 -2.72360916e+01f, 4.41905823e+01f, 1.68145580e+01f, -2.80099964e+01f, -4.30924988e+01f, -1.27164736e+01f,
4307 3.10100002e+01f, 4.19944229e+01f, 8.61839294e+00f, -3.40100021e+01f, -4.08963470e+01f, -4.52030993e+00f,
4308
4309 1.00999999e+00f, -2.46776247e+00f, 0.00000000e+00f, -3.20571756e+00f, -1.03078899e+01f, -6.93686390e+00f,
4310 0.00000000e+00f, -9.01125050e+00f, -4.46344614e+00f, -1.00099983e+01f, -1.29990416e+01f, -1.21330166e+01f,
4311 0.00000000e+00f, -1.57612505e+01f, -5.62874842e+00f, 0.00000000e+00f, 1.31543026e+01f, 3.29017075e-06f,
4312 -1.99272442e+01f, -1.90612202e+01f, 0.00000000e+00f, -2.47612514e+01f, -8.62874794e+00f, 0.00000000e+00f,
4313 -5.69598293e+00f, 4.41905823e+01f, 3.03195534e+01f, 4.66050415e-06f, -2.85874958e+01f, -2.77214737e+01f,
4314 0.00000000e+00f, -3.60112534e+01f, -1.23787460e+01f, 0.00000000e+00f, -1.31287584e+01f, -5.74052582e+01f,
4315
4316 1.00999999e+00f, -2.96776223e+00f, -2.96776223e+00f, -6.09195352e-01f, -7.49829102e+00f, -1.06860094e+01f,
4317 -1.06860094e+01f, -1.18367157e+01f, 5.39078045e+00f, -5.39077854e+00f, -1.03036509e+01f, -1.72848415e+01f,
4318 -1.72848415e+01f, -1.75656433e+01f, 4.11427259e+00f, -4.11427307e+00f, 2.37164364e+01f, -2.37164326e+01f,
4319 -8.06902504e+00f, -2.30957317e+01f, -2.30957317e+01f, -1.85358467e+01f, -1.12711067e+01f, 1.12711039e+01f,
4320 -2.07248449e+00f, 3.01493301e+01f, 1.52448931e+01f, -1.52448883e+01f, -2.09650497e+01f, -3.82039986e+01f,
4321 -3.82039986e+01f, -3.72582664e+01f, 5.42667723e+00f, -5.42667913e+00f, -2.33967514e+01f, -9.90355873e+00f,
4322 /* Angle 4Ï€/3. */
4323 1.00999999e+00f, -4.47776222e+00f, 3.00999999e+00f, -2.64288664e-01f, 5.29788685e+00f, -9.94186401e+00f,
4324 7.01000023e+00f, 1.19981360e+00f, -8.84378815e+00f, 1.00100040e+01f, 7.49403811e+00f, -1.81380157e+01f,
4325 1.30100002e+01f, 3.39596677e+00f, -1.70399399e+01f, 1.60099964e+01f, -3.01642933e+01f, 1.80100060e+01f,
4326 1.04222393e+01f, -2.90662193e+01f, 2.10100002e+01f, 6.32417202e+00f, -2.79681435e+01f, 2.40099926e+01f,
4327 2.22610497e+00f, 1.81805515e+01f, -4.38245430e+01f, 2.80100079e+01f, 1.40824890e+01f, -4.27264709e+01f,
4328 3.10100002e+01f, 9.98442745e+00f, -4.16283989e+01f, 3.40099869e+01f, 5.88636589e+00f, -4.05303268e+01f,
4329
4330 1.00999999e+00f, -4.47776222e+00f, 0.00000000e+00f, -1.93892837e+00f, 5.29788685e+00f, -6.93686390e+00f,
4331 0.00000000e+00f, -3.00375080e+00f, -2.29405141e+00f, 1.00100040e+01f, 1.29990396e+01f, -1.21330166e+01f,
4332 0.00000000e+00f, -5.25375128e+00f, -5.62874699e+00f, -5.68378528e-06f, -3.01642933e+01f, 7.00829787e-06f,
4333 1.99272423e+01f, -1.90612202e+01f, 0.00000000e+00f, -8.25375271e+00f, -8.62874603e+00f, -4.09131496e-12f,
4334 -1.30615349e+01f, 1.81805515e+01f, -3.03195534e+01f, 9.92720470e-06f, 2.85874920e+01f, -2.77214737e+01f,
4335 0.00000000e+00f, -1.20037527e+01f, -1.23787422e+01f, -5.79531909e-12f, -1.31287651e+01f, -7.87240028e+00f,
4336
4337 1.00999999e+00f, -3.97776222e+00f, -3.97776222e+00f, 2.86356640e+00f, 6.37110424e+00f, -1.01224155e+01f,
4338 -1.01224155e+01f, 1.05787458e+01f, -7.76929522e+00f, -7.76928997e+00f, 1.68836861e+01f, -2.05748577e+01f,
4339 -2.05748577e+01f, 2.49091301e+01f, -5.72616625e+00f, -5.72616386e+00f, -1.87962208e+01f, -1.87962112e+01f,
4340 2.93253498e+01f, -3.37238922e+01f, -3.37238922e+01f, 4.22584419e+01f, -4.85123205e+00f, -4.85122633e+00f,
4341 -2.53339314e+00f, 3.24522591e+01f, -4.65456696e+01f, -4.65456543e+01f, 5.18603249e+01f, -5.36516304e+01f,
4342 -5.36516304e+01f, 7.17381744e+01f, 4.44061565e+00f, 4.44062901e+00f, 2.58841743e+01f, -1.07481155e+01f,
4343 };
4344
4345 for (l = 0; l < 3; l++)
4346 {
4347 if (l == 0)
4348 out_temp = out;
4349 else
4350 out_temp = &in[l - 1];
4351
4352 if (l < 2)
4353 end = 49;
4354 else
4355 end = 48;
4356
4357 for (j = 0; j < ARRAY_SIZE(angle); ++j)
4358 {
4359 for (order = 0; order <= D3DXSH_MAXORDER + 1; order++)
4360 {
4361 for (i = 0; i < ARRAY_SIZE(out); ++i)
4362 {
4363 out[i] = ( i + 1.0f ) * ( i + 1.0f );
4364 in[i] = i + 1.01f;
4365 }
4366
4367 received_ptr = D3DXSHRotateZ(out_temp, order, angle[j], in);
4368 ok(received_ptr == out_temp, "angle %f, order %u, expected %p, received %p\n", angle[j], order, out_temp, received_ptr);
4369
4370 for (i = 0; i < end; i++)
4371 {
4372 /* order = 0 or order = 1 behaves like order = D3DXSH_MINORDER */
4374 if (i >= square || ((order >= D3DXSH_MAXORDER) && (i >= D3DXSH_MAXORDER * D3DXSH_MAXORDER)))
4375 if (l > 0)
4376 expected = i + l + 0.01f;
4377 else
4378 expected = ( i + 1.0f ) * ( i + 1.0f );
4379 else
4380 expected = table[36 * (l + 3 * j) + i];
4381 equal = compare_float(expected, out_temp[i], 512);
4382 ok(equal || (fabs(expected) < 2.0e-5f && fabs(out_temp[i]) < 2.0e-5f),
4383 "angle %.8e, order %u index %u, expected %.8e, received %.8e.\n",
4384 angle[j], order, i, expected, out_temp[i]);
4385 }
4386 }
4387 }
4388 }
4389}
FLOAT *WINAPI D3DXSHRotateZ(FLOAT *out, UINT order, FLOAT angle, const FLOAT *in)
Definition: math.c:3210
GLuint GLuint end
Definition: gl.h:1545

Referenced by START_TEST().

◆ test_D3DXSHScale()

static void test_D3DXSHScale ( void  )
static

Definition at line 4391 of file math.c.

4392{
4393 float a[49], b[49], expected, *received_array;
4394 unsigned int i, order;
4395 BOOL equal;
4396
4397 for (i = 0; i < ARRAY_SIZE(a); ++i)
4398 {
4399 a[i] = i;
4400 b[i] = i;
4401 }
4402
4403 for (order = 0; order <= D3DXSH_MAXORDER + 1; order++)
4404 {
4405 received_array = D3DXSHScale(b, order, a, 5.0f);
4406 ok(received_array == b, "Expected %p, received %p\n", b, received_array);
4407
4408 for (i = 0; i < ARRAY_SIZE(b); ++i)
4409 {
4410 if (i < order * order)
4411 expected = 5.0f * a[i];
4412 /* D3DXSHScale does not modify the elements of the array after the order * order-th element */
4413 else
4414 expected = a[i];
4415 equal = compare_float(b[i], expected, 0);
4416 ok(equal, "order %u, element %u, expected %.8e, received %.8e.\n", order, i, expected, b[i]);
4417 }
4418 }
4419}
FLOAT *WINAPI D3DXSHScale(FLOAT *out, UINT order, const FLOAT *a, const FLOAT scale)
Definition: math.c:3256

Referenced by START_TEST().

◆ test_D3DXVec_Array()

static void test_D3DXVec_Array ( void  )
static

Definition at line 3105 of file math.c.

3106{
3107 D3DXPLANE inp_plane[5], out_plane[7], exp_plane[7];
3108 D3DXVECTOR4 inp_vec[5], out_vec[7], exp_vec[7];
3109 D3DXMATRIX mat, projection, view, world;
3110 D3DVIEWPORT9 viewport;
3111 unsigned int i;
3112
3113 viewport.Width = 800; viewport.MinZ = 0.2f; viewport.X = 10;
3114 viewport.Height = 680; viewport.MaxZ = 0.9f; viewport.Y = 5;
3115
3116 memset(out_vec, 0, sizeof(out_vec));
3117 memset(exp_vec, 0, sizeof(exp_vec));
3118 memset(out_plane, 0, sizeof(out_plane));
3119 memset(exp_plane, 0, sizeof(exp_plane));
3120
3121 for (i = 0; i < ARRAY_SIZE(inp_vec); ++i)
3122 {
3123 inp_plane[i].a = inp_plane[i].c = inp_vec[i].x = inp_vec[i].z = i;
3124 inp_plane[i].b = inp_plane[i].d = inp_vec[i].y = inp_vec[i].w = ARRAY_SIZE(inp_vec) - i;
3125 }
3126
3127 set_matrix(&mat,
3128 1.0f, 2.0f, 3.0f, 4.0f,
3129 5.0f, 6.0f, 7.0f, 8.0f,
3130 9.0f, 10.0f, 11.0f, 12.0f,
3131 13.0f, 14.0f, 15.0f, 16.0f);
3132
3133 D3DXMatrixPerspectiveFovLH(&projection, D3DX_PI / 4.0f, 20.0f / 17.0f, 1.0f, 1000.0f);
3134
3135 view.m[0][1] = 5.0f; view.m[0][2] = 7.0f; view.m[0][3] = 8.0f;
3136 view.m[1][0] = 11.0f; view.m[1][2] = 16.0f; view.m[1][3] = 33.0f;
3137 view.m[2][0] = 19.0f; view.m[2][1] = -21.0f; view.m[2][3] = 43.0f;
3138 view.m[3][0] = 2.0f; view.m[3][1] = 3.0f; view.m[3][2] = -4.0f;
3139 view.m[0][0] = 10.0f; view.m[1][1] = 20.0f; view.m[2][2] = 30.0f;
3140 view.m[3][3] = -40.0f;
3141
3142 set_matrix(&world,
3143 21.0f, 2.0f, 3.0f, 4.0f,
3144 5.0f, 23.0f, 7.0f, 8.0f,
3145 -8.0f, -7.0f, 25.0f, -5.0f,
3146 -4.0f, -3.0f, -2.0f, 27.0f);
3147
3148 /* D3DXVec2TransformCoordArray */
3149 exp_vec[1].x = 6.78571403e-01f; exp_vec[1].y = 7.85714269e-01f;
3150 exp_vec[2].x = 6.53846204e-01f; exp_vec[2].y = 7.69230783e-01f;
3151 exp_vec[3].x = 6.25000000e-01f; exp_vec[3].y = 7.50000000e-01f;
3152 exp_vec[4].x = 5.90909123e-01f; exp_vec[4].y = 7.27272749e-01f;
3153 exp_vec[5].x = 5.49999952e-01f; exp_vec[5].y = 6.99999928e-01f;
3154 D3DXVec2TransformCoordArray((D3DXVECTOR2 *)&out_vec[1], sizeof(*out_vec),
3155 (D3DXVECTOR2 *)inp_vec, sizeof(*inp_vec), &mat, ARRAY_SIZE(inp_vec));
3156 expect_vec4_array(ARRAY_SIZE(exp_vec), exp_vec, out_vec, 1);
3157
3158 /* D3DXVec2TransformNormalArray */
3159 exp_vec[1].x = 25.0f; exp_vec[1].y = 30.0f;
3160 exp_vec[2].x = 21.0f; exp_vec[2].y = 26.0f;
3161 exp_vec[3].x = 17.0f; exp_vec[3].y = 22.0f;
3162 exp_vec[4].x = 13.0f; exp_vec[4].y = 18.0f;
3163 exp_vec[5].x = 9.0f; exp_vec[5].y = 14.0f;
3164 D3DXVec2TransformNormalArray((D3DXVECTOR2 *)&out_vec[1], sizeof(*out_vec),
3165 (D3DXVECTOR2 *)inp_vec, sizeof(*inp_vec), &mat, ARRAY_SIZE(inp_vec));
3166 expect_vec4_array(ARRAY_SIZE(exp_vec), exp_vec, out_vec, 0);
3167
3168 /* D3DXVec3TransformCoordArray */
3169 exp_vec[1].x = 6.78571403e-01f; exp_vec[1].y = 7.85714269e-01f; exp_vec[1].z = 8.92857075e-01f;
3170 exp_vec[2].x = 6.71874940e-01f; exp_vec[2].y = 7.81249940e-01f; exp_vec[2].z = 8.90624940e-01f;
3171 exp_vec[3].x = 6.66666627e-01f; exp_vec[3].y = 7.77777731e-01f; exp_vec[3].z = 8.88888836e-01f;
3172 exp_vec[4].x = 6.62499964e-01f; exp_vec[4].y = 7.74999976e-01f; exp_vec[4].z = 8.87499928e-01f;
3173 exp_vec[5].x = 6.59090877e-01f; exp_vec[5].y = 7.72727251e-01f; exp_vec[5].z = 8.86363566e-01f;
3174 D3DXVec3TransformCoordArray((D3DXVECTOR3 *)&out_vec[1], sizeof(*out_vec),
3175 (D3DXVECTOR3 *)inp_vec, sizeof(*inp_vec), &mat, ARRAY_SIZE(inp_vec));
3176 expect_vec4_array(ARRAY_SIZE(exp_vec), exp_vec, out_vec, 1);
3177
3178 /* D3DXVec3TransformNormalArray */
3179 exp_vec[1].x = 25.0f; exp_vec[1].y = 30.0f; exp_vec[1].z = 35.0f;
3180 exp_vec[2].x = 30.0f; exp_vec[2].y = 36.0f; exp_vec[2].z = 42.0f;
3181 exp_vec[3].x = 35.0f; exp_vec[3].y = 42.0f; exp_vec[3].z = 49.0f;
3182 exp_vec[4].x = 40.0f; exp_vec[4].y = 48.0f; exp_vec[4].z = 56.0f;
3183 exp_vec[5].x = 45.0f; exp_vec[5].y = 54.0f; exp_vec[5].z = 63.0f;
3184 D3DXVec3TransformNormalArray((D3DXVECTOR3 *)&out_vec[1], sizeof(*out_vec),
3185 (D3DXVECTOR3 *)inp_vec, sizeof(*inp_vec), &mat, ARRAY_SIZE(inp_vec));
3186 expect_vec4_array(ARRAY_SIZE(exp_vec), exp_vec, out_vec, 0);
3187
3188 /* D3DXVec3ProjectArray */
3189 exp_vec[1].x = 1.08955420e+03f; exp_vec[1].y = -2.26590622e+02f; exp_vec[1].z = 2.15272754e-01f;
3190 exp_vec[2].x = 1.06890344e+03f; exp_vec[2].y = 1.03085144e+02f; exp_vec[2].z = 1.83049560e-01f;
3191 exp_vec[3].x = 1.05177905e+03f; exp_vec[3].y = 3.76462280e+02f; exp_vec[3].z = 1.56329080e-01f;
3192 exp_vec[4].x = 1.03734888e+03f; exp_vec[4].y = 6.06827393e+02f; exp_vec[4].z = 1.33812696e-01f;
3193 exp_vec[5].x = 1.02502356e+03f; exp_vec[5].y = 8.03591248e+02f; exp_vec[5].z = 1.14580572e-01f;
3194 D3DXVec3ProjectArray((D3DXVECTOR3 *)&out_vec[1], sizeof(*out_vec), (D3DXVECTOR3 *)inp_vec,
3195 sizeof(*inp_vec), &viewport, &projection, &view, &world, ARRAY_SIZE(inp_vec));
3196 expect_vec4_array(ARRAY_SIZE(exp_vec), exp_vec, out_vec, 8);
3197
3198 /* D3DXVec3UnprojectArray */
3199 exp_vec[1].x = -6.12403107e+00f; exp_vec[1].y = 3.22536016e+00f; exp_vec[1].z = 6.20571136e-01f;
3200 exp_vec[2].x = -3.80710936e+00f; exp_vec[2].y = 2.04657936e+00f; exp_vec[2].z = 4.46894377e-01f;
3201 exp_vec[3].x = -2.92283988e+00f; exp_vec[3].y = 1.59668946e+00f; exp_vec[3].z = 3.80609393e-01f;
3202 exp_vec[4].x = -2.45622563e+00f; exp_vec[4].y = 1.35928988e+00f; exp_vec[4].z = 3.45631927e-01f;
3203 exp_vec[5].x = -2.16789746e+00f; exp_vec[5].y = 1.21259713e+00f; exp_vec[5].z = 3.24018806e-01f;
3204 D3DXVec3UnprojectArray((D3DXVECTOR3 *)&out_vec[1], sizeof(*out_vec), (D3DXVECTOR3 *)inp_vec,
3205 sizeof(*inp_vec), &viewport, &projection, &view, &world, ARRAY_SIZE(inp_vec));
3206 expect_vec4_array(ARRAY_SIZE(exp_vec), exp_vec, out_vec, 4);
3207
3208 /* D3DXVec2TransformArray */
3209 exp_vec[1].x = 38.0f; exp_vec[1].y = 44.0f; exp_vec[1].z = 50.0f; exp_vec[1].w = 56.0f;
3210 exp_vec[2].x = 34.0f; exp_vec[2].y = 40.0f; exp_vec[2].z = 46.0f; exp_vec[2].w = 52.0f;
3211 exp_vec[3].x = 30.0f; exp_vec[3].y = 36.0f; exp_vec[3].z = 42.0f; exp_vec[3].w = 48.0f;
3212 exp_vec[4].x = 26.0f; exp_vec[4].y = 32.0f; exp_vec[4].z = 38.0f; exp_vec[4].w = 44.0f;
3213 exp_vec[5].x = 22.0f; exp_vec[5].y = 28.0f; exp_vec[5].z = 34.0f; exp_vec[5].w = 40.0f;
3214 D3DXVec2TransformArray(&out_vec[1], sizeof(*out_vec), (D3DXVECTOR2 *)inp_vec,
3215 sizeof(*inp_vec), &mat, ARRAY_SIZE(inp_vec));
3216 expect_vec4_array(ARRAY_SIZE(exp_vec), exp_vec, out_vec, 0);
3217
3218 /* D3DXVec3TransformArray */
3219 exp_vec[1].x = 38.0f; exp_vec[1].y = 44.0f; exp_vec[1].z = 50.0f; exp_vec[1].w = 56.0f;
3220 exp_vec[2].x = 43.0f; exp_vec[2].y = 50.0f; exp_vec[2].z = 57.0f; exp_vec[2].w = 64.0f;
3221 exp_vec[3].x = 48.0f; exp_vec[3].y = 56.0f; exp_vec[3].z = 64.0f; exp_vec[3].w = 72.0f;
3222 exp_vec[4].x = 53.0f; exp_vec[4].y = 62.0f; exp_vec[4].z = 71.0f; exp_vec[4].w = 80.0f;
3223 exp_vec[5].x = 58.0f; exp_vec[5].y = 68.0f; exp_vec[5].z = 78.0f; exp_vec[5].w = 88.0f;
3224 D3DXVec3TransformArray(&out_vec[1], sizeof(*out_vec), (D3DXVECTOR3 *)inp_vec,
3225 sizeof(*inp_vec), &mat, ARRAY_SIZE(inp_vec));
3226 expect_vec4_array(ARRAY_SIZE(exp_vec), exp_vec, out_vec, 0);
3227
3228 /* D3DXVec4TransformArray */
3229 exp_vec[1].x = 90.0f; exp_vec[1].y = 100.0f; exp_vec[1].z = 110.0f; exp_vec[1].w = 120.0f;
3230 exp_vec[2].x = 82.0f; exp_vec[2].y = 92.0f; exp_vec[2].z = 102.0f; exp_vec[2].w = 112.0f;
3231 exp_vec[3].x = 74.0f; exp_vec[3].y = 84.0f; exp_vec[3].z = 94.0f; exp_vec[3].w = 104.0f;
3232 exp_vec[4].x = 66.0f; exp_vec[4].y = 76.0f; exp_vec[4].z = 86.0f; exp_vec[4].w = 96.0f;
3233 exp_vec[5].x = 58.0f; exp_vec[5].y = 68.0f; exp_vec[5].z = 78.0f; exp_vec[5].w = 88.0f;
3234 D3DXVec4TransformArray(&out_vec[1], sizeof(*out_vec), inp_vec, sizeof(*inp_vec), &mat, ARRAY_SIZE(inp_vec));
3235 expect_vec4_array(ARRAY_SIZE(exp_vec), exp_vec, out_vec, 0);
3236
3237 /* D3DXPlaneTransformArray */
3238 exp_plane[1].a = 90.0f; exp_plane[1].b = 100.0f; exp_plane[1].c = 110.0f; exp_plane[1].d = 120.0f;
3239 exp_plane[2].a = 82.0f; exp_plane[2].b = 92.0f; exp_plane[2].c = 102.0f; exp_plane[2].d = 112.0f;
3240 exp_plane[3].a = 74.0f; exp_plane[3].b = 84.0f; exp_plane[3].c = 94.0f; exp_plane[3].d = 104.0f;
3241 exp_plane[4].a = 66.0f; exp_plane[4].b = 76.0f; exp_plane[4].c = 86.0f; exp_plane[4].d = 96.0f;
3242 exp_plane[5].a = 58.0f; exp_plane[5].b = 68.0f; exp_plane[5].c = 78.0f; exp_plane[5].d = 88.0f;
3243 D3DXPlaneTransformArray(&out_plane[1], sizeof(*out_plane), inp_plane,
3244 sizeof(*inp_plane), &mat, ARRAY_SIZE(inp_plane));
3245 for (i = 0; i < ARRAY_SIZE(exp_plane); ++i)
3246 {
3247 BOOL equal = compare_plane(&exp_plane[i], &out_plane[i], 0);
3248 ok(equal, "Got unexpected plane {%.8e, %.8e, %.8e, %.8e} at index %u, expected {%.8e, %.8e, %.8e, %.8e}.\n",
3249 out_plane[i].a, out_plane[i].b, out_plane[i].c, out_plane[i].d, i,
3250 exp_plane[i].a, exp_plane[i].b, exp_plane[i].c, exp_plane[i].d);
3251 if (!equal)
3252 break;
3253 }
3254}
D3DXVECTOR2 *WINAPI D3DXVec2TransformCoordArray(D3DXVECTOR2 *out, UINT outstride, const D3DXVECTOR2 *in, UINT instride, const D3DXMATRIX *matrix, UINT elements)
Definition: math.c:1725
D3DXVECTOR3 *WINAPI D3DXVec3UnprojectArray(D3DXVECTOR3 *out, UINT outstride, const D3DXVECTOR3 *in, UINT instride, const D3DVIEWPORT9 *viewport, const D3DXMATRIX *projection, const D3DXMATRIX *view, const D3DXMATRIX *world, UINT elements)
Definition: math.c:1985
D3DXVECTOR4 *WINAPI D3DXVec2TransformArray(D3DXVECTOR4 *out, UINT outstride, const D3DXVECTOR2 *in, UINT instride, const D3DXMATRIX *matrix, UINT elements)
Definition: math.c:1694
D3DXVECTOR2 *WINAPI D3DXVec2TransformNormalArray(D3DXVECTOR2 *out, UINT outstride, const D3DXVECTOR2 *in, UINT instride, const D3DXMATRIX *matrix, UINT elements)
Definition: math.c:1751
D3DXVECTOR3 *WINAPI D3DXVec3ProjectArray(D3DXVECTOR3 *out, UINT outstride, const D3DXVECTOR3 *in, UINT instride, const D3DVIEWPORT9 *viewport, const D3DXMATRIX *projection, const D3DXMATRIX *view, const D3DXMATRIX *world, UINT elements)
Definition: math.c:1850
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoordArray(D3DXVECTOR3 *out, UINT outstride, const D3DXVECTOR3 *in, UINT instride, const D3DXMATRIX *matrix, UINT elements)
Definition: math.c:1913
D3DXVECTOR4 *WINAPI D3DXVec3TransformArray(D3DXVECTOR4 *out, UINT outstride, const D3DXVECTOR3 *in, UINT instride, const D3DXMATRIX *matrix, UINT elements)
Definition: math.c:1880
D3DXPLANE *WINAPI D3DXPlaneTransformArray(D3DXPLANE *out, UINT outstride, const D3DXPLANE *in, UINT instride, const D3DXMATRIX *matrix, UINT elements)
Definition: math.c:1291
D3DXVECTOR4 *WINAPI D3DXVec4TransformArray(D3DXVECTOR4 *out, UINT outstride, const D3DXVECTOR4 *in, UINT instride, const D3DXMATRIX *matrix, UINT elements)
Definition: math.c:2087
D3DXVECTOR3 *WINAPI D3DXVec3TransformNormalArray(D3DXVECTOR3 *out, UINT outstride, const D3DXVECTOR3 *in, UINT instride, const D3DXMATRIX *matrix, UINT elements)
Definition: math.c:1941
#define expect_vec4_array(count, expected, vector, ulps)
Definition: math.c:183

Referenced by START_TEST().

◆ test_Matrix_AffineTransformation2D()

static void test_Matrix_AffineTransformation2D ( void  )
static

Definition at line 2556 of file math.c.

2557{
2558 D3DXMATRIX exp_mat, got_mat;
2559 D3DXVECTOR2 center, position;
2560 FLOAT angle, scale;
2561
2562 center.x = 3.0f;
2563 center.y = 4.0f;
2564
2565 position.x = -6.0f;
2566 position.y = 7.0f;
2567
2568 angle = D3DX_PI/3.0f;
2569
2570 scale = 20.0f;
2571
2572 exp_mat.m[0][0] = 10.0f;
2573 exp_mat.m[1][0] = -17.320507f;
2574 exp_mat.m[2][0] = 0.0f;
2575 exp_mat.m[3][0] = -1.035898f;
2576 exp_mat.m[0][1] = 17.320507f;
2577 exp_mat.m[1][1] = 10.0f;
2578 exp_mat.m[2][1] = 0.0f;
2579 exp_mat.m[3][1] = 6.401924f;
2580 exp_mat.m[0][2] = 0.0f;
2581 exp_mat.m[1][2] = 0.0f;
2582 exp_mat.m[2][2] = 1.0f;
2583 exp_mat.m[3][2] = 0.0f;
2584 exp_mat.m[0][3] = 0.0f;
2585 exp_mat.m[1][3] = 0.0f;
2586 exp_mat.m[2][3] = 0.0f;
2587 exp_mat.m[3][3] = 1.0f;
2588
2589 D3DXMatrixAffineTransformation2D(&got_mat, scale, &center, angle, &position);
2590 expect_matrix(&exp_mat, &got_mat, 2);
2591
2592/*______________*/
2593
2594 center.x = 3.0f;
2595 center.y = 4.0f;
2596
2597 angle = D3DX_PI/3.0f;
2598
2599 scale = 20.0f;
2600
2601 exp_mat.m[0][0] = 10.0f;
2602 exp_mat.m[1][0] = -17.320507f;
2603 exp_mat.m[2][0] = 0.0f;
2604 exp_mat.m[3][0] = 4.964102f;
2605 exp_mat.m[0][1] = 17.320507f;
2606 exp_mat.m[1][1] = 10.0f;
2607 exp_mat.m[2][1] = 0.0f;
2608 exp_mat.m[3][1] = -0.598076f;
2609 exp_mat.m[0][2] = 0.0f;
2610 exp_mat.m[1][2] = 0.0f;
2611 exp_mat.m[2][2] = 1.0f;
2612 exp_mat.m[3][2] = 0.0f;
2613 exp_mat.m[0][3] = 0.0f;
2614 exp_mat.m[1][3] = 0.0f;
2615 exp_mat.m[2][3] = 0.0f;
2616 exp_mat.m[3][3] = 1.0f;
2617
2618 D3DXMatrixAffineTransformation2D(&got_mat, scale, &center, angle, NULL);
2619 expect_matrix(&exp_mat, &got_mat, 8);
2620
2621/*______________*/
2622
2623 position.x = -6.0f;
2624 position.y = 7.0f;
2625
2626 angle = D3DX_PI/3.0f;
2627
2628 scale = 20.0f;
2629
2630 exp_mat.m[0][0] = 10.0f;
2631 exp_mat.m[1][0] = -17.320507f;
2632 exp_mat.m[2][0] = 0.0f;
2633 exp_mat.m[3][0] = -6.0f;
2634 exp_mat.m[0][1] = 17.320507f;
2635 exp_mat.m[1][1] = 10.0f;
2636 exp_mat.m[2][1] = 0.0f;
2637 exp_mat.m[3][1] = 7.0f;
2638 exp_mat.m[0][2] = 0.0f;
2639 exp_mat.m[1][2] = 0.0f;
2640 exp_mat.m[2][2] = 1.0f;
2641 exp_mat.m[3][2] = 0.0f;
2642 exp_mat.m[0][3] = 0.0f;
2643 exp_mat.m[1][3] = 0.0f;
2644 exp_mat.m[2][3] = 0.0f;
2645 exp_mat.m[3][3] = 1.0f;
2646
2647 D3DXMatrixAffineTransformation2D(&got_mat, scale, NULL, angle, &position);
2648 expect_matrix(&exp_mat, &got_mat, 1);
2649
2650/*______________*/
2651
2652 angle = 5.0f * D3DX_PI/4.0f;
2653
2654 scale = -20.0f;
2655
2656 exp_mat.m[0][0] = 14.142133f;
2657 exp_mat.m[1][0] = -14.142133f;
2658 exp_mat.m[2][0] = 0.0f;
2659 exp_mat.m[3][0] = 0.0f;
2660 exp_mat.m[0][1] = 14.142133;
2661 exp_mat.m[1][1] = 14.142133f;
2662 exp_mat.m[2][1] = 0.0f;
2663 exp_mat.m[3][1] = 0.0f;
2664 exp_mat.m[0][2] = 0.0f;
2665 exp_mat.m[1][2] = 0.0f;
2666 exp_mat.m[2][2] = 1.0f;
2667 exp_mat.m[3][2] = 0.0f;
2668 exp_mat.m[0][3] = 0.0f;
2669 exp_mat.m[1][3] = 0.0f;
2670 exp_mat.m[2][3] = 0.0f;
2671 exp_mat.m[3][3] = 1.0f;
2672
2674 expect_matrix(&exp_mat, &got_mat, 8);
2675}
D3DXMATRIX *WINAPI D3DXMatrixAffineTransformation2D(D3DXMATRIX *out, FLOAT scaling, const D3DXVECTOR2 *rotationcenter, FLOAT rotation, const D3DXVECTOR2 *translation)
Definition: math.c:149

Referenced by START_TEST().

◆ test_Matrix_Decompose()

static void test_Matrix_Decompose ( void  )
static

Definition at line 2677 of file math.c.

2678{
2679 D3DXMATRIX pm;
2680 D3DXQUATERNION exp_rotation, got_rotation;
2681 D3DXVECTOR3 exp_scale, got_scale, exp_translation, got_translation;
2682 HRESULT hr;
2683 BOOL equal;
2684
2685/*___________*/
2686
2687 pm.m[0][0] = -9.23879206e-01f;
2688 pm.m[1][0] = -2.70598412e-01f;
2689 pm.m[2][0] = 2.70598441e-01f;
2690 pm.m[3][0] = -5.00000000e+00f;
2691 pm.m[0][1] = 2.70598471e-01f;
2692 pm.m[1][1] = 3.80604863e-02f;
2693 pm.m[2][1] = 9.61939573e-01f;
2694 pm.m[3][1] = 0.00000000e+00f;
2695 pm.m[0][2] = -2.70598441e-01f;
2696 pm.m[1][2] = 9.61939573e-01f;
2697 pm.m[2][2] = 3.80603075e-02f;
2698 pm.m[3][2] = 1.00000000e+01f;
2699 pm.m[0][3] = 0.00000000e+00f;
2700 pm.m[1][3] = 0.00000000e+00f;
2701 pm.m[2][3] = 0.00000000e+00f;
2702 pm.m[3][3] = 1.00000000e+00f;
2703
2704 exp_scale.x = 9.99999881e-01f;
2705 exp_scale.y = 9.99999881e-01f;
2706 exp_scale.z = 9.99999881e-01f;
2707
2708 exp_rotation.x = 2.14862776e-08f;
2709 exp_rotation.y = 6.93519890e-01f;
2710 exp_rotation.z = 6.93519890e-01f;
2711 exp_rotation.w = 1.95090637e-01f;
2712
2713 exp_translation.x = -5.0f;
2714 exp_translation.y = 0.0f;
2715 exp_translation.z = 10.0f;
2716
2717 D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
2718 expect_vec3(&exp_scale, &got_scale, 1);
2719 expect_quaternion(&exp_rotation, &got_rotation, 1);
2720 expect_vec3(&exp_translation, &got_translation, 0);
2721
2722/*_________*/
2723
2724 pm.m[0][0] = -2.255813f;
2725 pm.m[1][0] = 1.302324f;
2726 pm.m[2][0] = 1.488373f;
2727 pm.m[3][0] = 1.0f;
2728 pm.m[0][1] = 1.302327f;
2729 pm.m[1][1] = -0.7209296f;
2730 pm.m[2][1] = 2.60465f;
2731 pm.m[3][1] = 2.0f;
2732 pm.m[0][2] = 1.488371f;
2733 pm.m[1][2] = 2.604651f;
2734 pm.m[2][2] = -0.02325551f;
2735 pm.m[3][2] = 3.0f;
2736 pm.m[0][3] = 0.0f;
2737 pm.m[1][3] = 0.0f;
2738 pm.m[2][3] = 0.0f;
2739 pm.m[3][3] = 1.0f;
2740
2741 exp_scale.x = 2.99999928e+00f;
2742 exp_scale.y = 2.99999905e+00f;
2743 exp_scale.z = 2.99999952e+00f;
2744
2745 exp_rotation.x = 3.52180451e-01f;
2746 exp_rotation.y = 6.16315663e-01f;
2747 exp_rotation.z = 7.04360664e-01f;
2748 exp_rotation.w = 3.38489343e-07f;
2749
2750 exp_translation.x = 1.0f;
2751 exp_translation.y = 2.0f;
2752 exp_translation.z = 3.0f;
2753
2754 D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
2755 expect_vec3(&exp_scale, &got_scale, 0);
2756 expect_quaternion(&exp_rotation, &got_rotation, 2);
2757 expect_vec3(&exp_translation, &got_translation, 0);
2758
2759/*_____________*/
2760
2761 pm.m[0][0] = 2.427051f;
2762 pm.m[1][0] = 0.0f;
2763 pm.m[2][0] = 1.763355f;
2764 pm.m[3][0] = 5.0f;
2765 pm.m[0][1] = 0.0f;
2766 pm.m[1][1] = 3.0f;
2767 pm.m[2][1] = 0.0f;
2768 pm.m[3][1] = 5.0f;
2769 pm.m[0][2] = -1.763355f;
2770 pm.m[1][2] = 0.0f;
2771 pm.m[2][2] = 2.427051f;
2772 pm.m[3][2] = 5.0f;
2773 pm.m[0][3] = 0.0f;
2774 pm.m[1][3] = 0.0f;
2775 pm.m[2][3] = 0.0f;
2776 pm.m[3][3] = 1.0f;
2777
2778 exp_scale.x = 2.99999976e+00f;
2779 exp_scale.y = 3.00000000e+00f;
2780 exp_scale.z = 2.99999976e+00f;
2781
2782 exp_rotation.x = 0.00000000e+00f;
2783 exp_rotation.y = 3.09016883e-01f;
2784 exp_rotation.z = 0.00000000e+00f;
2785 exp_rotation.w = 9.51056540e-01f;
2786
2787 exp_translation.x = 5.0f;
2788 exp_translation.y = 5.0f;
2789 exp_translation.z = 5.0f;
2790
2791 D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
2792 expect_vec3(&exp_scale, &got_scale, 1);
2793 expect_quaternion(&exp_rotation, &got_rotation, 1);
2794 expect_vec3(&exp_translation, &got_translation, 0);
2795
2796/*_____________*/
2797
2798 pm.m[0][0] = -9.23879206e-01f;
2799 pm.m[1][0] = -2.70598412e-01f;
2800 pm.m[2][0] = 2.70598441e-01f;
2801 pm.m[3][0] = -5.00000000e+00f;
2802 pm.m[0][1] = 2.70598471e-01f;
2803 pm.m[1][1] = 3.80604863e-02f;
2804 pm.m[2][1] = 9.61939573e-01f;
2805 pm.m[3][1] = 0.00000000e+00f;
2806 pm.m[0][2] = -2.70598441e-01f;
2807 pm.m[1][2] = 9.61939573e-01f;
2808 pm.m[2][2] = 3.80603075e-02f;
2809 pm.m[3][2] = 1.00000000e+01f;
2810 pm.m[0][3] = 0.00000000e+00f;
2811 pm.m[1][3] = 0.00000000e+00f;
2812 pm.m[2][3] = 0.00000000e+00f;
2813 pm.m[3][3] = 1.00000000e+00f;
2814
2815 exp_scale.x = 9.99999881e-01f;
2816 exp_scale.y = 9.99999881e-01f;
2817 exp_scale.z = 9.99999881e-01f;
2818
2819 exp_rotation.x = 2.14862776e-08f;
2820 exp_rotation.y = 6.93519890e-01f;
2821 exp_rotation.z = 6.93519890e-01f;
2822 exp_rotation.w = 1.95090637e-01f;
2823
2824 exp_translation.x = -5.0f;
2825 exp_translation.y = 0.0f;
2826 exp_translation.z = 10.0f;
2827
2828 D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
2829 expect_vec3(&exp_scale, &got_scale, 1);
2830 expect_quaternion(&exp_rotation, &got_rotation, 1);
2831 expect_vec3(&exp_translation, &got_translation, 0);
2832
2833/*__________*/
2834
2835 pm.m[0][0] = -9.23878908e-01f;
2836 pm.m[1][0] = -5.41196704e-01f;
2837 pm.m[2][0] = 8.11795175e-01f;
2838 pm.m[3][0] = -5.00000000e+00f;
2839 pm.m[0][1] = 2.70598322e-01f;
2840 pm.m[1][1] = 7.61209577e-02f;
2841 pm.m[2][1] = 2.88581824e+00f;
2842 pm.m[3][1] = 0.00000000e+00f;
2843 pm.m[0][2] = -2.70598352e-01f;
2844 pm.m[1][2] = 1.92387879e+00f;
2845 pm.m[2][2] = 1.14180908e-01f;
2846 pm.m[3][2] = 1.00000000e+01f;
2847 pm.m[0][3] = 0.00000000e+00f;
2848 pm.m[1][3] = 0.00000000e+00f;
2849 pm.m[2][3] = 0.00000000e+00f;
2850 pm.m[3][3] = 1.00000000e+00f;
2851
2852 exp_scale.x = 9.99999583e-01f;
2853 exp_scale.y = 1.99999940e+00f;
2854 exp_scale.z = 2.99999928e+00f;
2855
2856 exp_rotation.x = 1.07431388e-08f;
2857 exp_rotation.y = 6.93519890e-01f;
2858 exp_rotation.z = 6.93519831e-01f;
2859 exp_rotation.w = 1.95090622e-01f;
2860
2861 exp_translation.x = -5.0f;
2862 exp_translation.y = 0.0f;
2863 exp_translation.z = 10.0f;
2864
2865 D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
2866 expect_vec3(&exp_scale, &got_scale, 1);
2867 equal = compare_quaternion(&exp_rotation, &got_rotation, 1);
2868 exp_rotation.x = 0.0f;
2869 equal |= compare_quaternion(&exp_rotation, &got_rotation, 2);
2870 ok(equal, "Got unexpected quaternion {%.8e, %.8e, %.8e, %.8e}.\n",
2871 got_rotation.x, got_rotation.y, got_rotation.z, got_rotation.w);
2872 expect_vec3(&exp_translation, &got_translation, 0);
2873
2874/*__________*/
2875
2876 pm.m[0][0] = 0.7156004f;
2877 pm.m[1][0] = -0.5098283f;
2878 pm.m[2][0] = -0.4774843f;
2879 pm.m[3][0] = -5.0f;
2880 pm.m[0][1] = -0.6612288f;
2881 pm.m[1][1] = -0.7147621f;
2882 pm.m[2][1] = -0.2277977f;
2883 pm.m[3][1] = 0.0f;
2884 pm.m[0][2] = -0.2251499f;
2885 pm.m[1][2] = 0.4787385f;
2886 pm.m[2][2] = -0.8485972f;
2887 pm.m[3][2] = 10.0f;
2888 pm.m[0][3] = 0.0f;
2889 pm.m[1][3] = 0.0f;
2890 pm.m[2][3] = 0.0f;
2891 pm.m[3][3] = 1.0f;
2892
2893 exp_scale.x = 9.99999940e-01f;
2894 exp_scale.y = 1.00000012e+00f;
2895 exp_scale.z = 1.00000012e+00f;
2896
2897 exp_rotation.x = 9.05394852e-01f;
2898 exp_rotation.y = -3.23355347e-01f;
2899 exp_rotation.z = -1.94013178e-01f;
2900 exp_rotation.w = 1.95090592e-01f;
2901
2902 exp_translation.x = -5.0f;
2903 exp_translation.y = 0.0f;
2904 exp_translation.z = 10.0f;
2905
2906 D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
2907 expect_vec3(&exp_scale, &got_scale, 0);
2908 expect_quaternion(&exp_rotation, &got_rotation, 1);
2909 expect_vec3(&exp_translation, &got_translation, 0);
2910
2911/*_____________*/
2912
2913 pm.m[0][0] = 0.06554436f;
2914 pm.m[1][0] = -0.6873012f;
2915 pm.m[2][0] = 0.7234092f;
2916 pm.m[3][0] = -5.0f;
2917 pm.m[0][1] = -0.9617381f;
2918 pm.m[1][1] = -0.2367795f;
2919 pm.m[2][1] = -0.1378230f;
2920 pm.m[3][1] = 0.0f;
2921 pm.m[0][2] = 0.2660144f;
2922 pm.m[1][2] = -0.6866967f;
2923 pm.m[2][2] = -0.6765233f;
2924 pm.m[3][2] = 10.0f;
2925 pm.m[0][3] = 0.0f;
2926 pm.m[1][3] = 0.0f;
2927 pm.m[2][3] = 0.0f;
2928 pm.m[3][3] = 1.0f;
2929
2930 exp_scale.x = 9.99999940e-01f;
2931 exp_scale.y = 9.99999940e-01f;
2932 exp_scale.z = 9.99999881e-01f;
2933
2934 exp_rotation.x = 7.03357518e-01f;
2935 exp_rotation.y = -5.86131275e-01f;
2936 exp_rotation.z = 3.51678789e-01f;
2937 exp_rotation.w = -1.95090577e-01f;
2938
2939 exp_translation.x = -5.0f;
2940 exp_translation.y = 0.0f;
2941 exp_translation.z = 10.0f;
2942
2943 D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
2944 expect_vec3(&exp_scale, &got_scale, 1);
2945 expect_quaternion(&exp_rotation, &got_rotation, 2);
2946 expect_vec3(&exp_translation, &got_translation, 0);
2947
2948/*_________*/
2949
2950 pm.m[0][0] = 7.12104797e+00f;
2951 pm.m[1][0] = -5.88348627e+00f;
2952 pm.m[2][0] = 1.18184204e+01f;
2953 pm.m[3][0] = -5.00000000e+00f;
2954 pm.m[0][1] = 5.88348627e+00f;
2955 pm.m[1][1] = -1.06065865e+01f;
2956 pm.m[2][1] = -8.82523251e+00f;
2957 pm.m[3][1] = 0.00000000e+00f;
2958 pm.m[0][2] = 1.18184204e+01f;
2959 pm.m[1][2] = 8.82523155e+00f;
2960 pm.m[2][2] = -2.72764111e+00f;
2961 pm.m[3][2] = 2.00000000e+00f;
2962 pm.m[0][3] = 0.00000000e+00f;
2963 pm.m[1][3] = 0.00000000e+00f;
2964 pm.m[2][3] = 0.00000000e+00f;
2965 pm.m[3][3] = 1.00000000e+00f;
2966
2967 exp_scale.x = 1.49999933e+01f;
2968 exp_scale.y = 1.49999933e+01f;
2969 exp_scale.z = 1.49999943e+01f;
2970
2971 exp_rotation.x = 7.68714130e-01f;
2972 exp_rotation.y = 0.00000000e+00f;
2973 exp_rotation.z = 5.12475967e-01f;
2974 exp_rotation.w = 3.82683903e-01f;
2975
2976 exp_translation.x = -5.0f;
2977 exp_translation.y = 0.0f;
2978 exp_translation.z = 2.0f;
2979
2980 D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
2981 expect_vec3(&exp_scale, &got_scale, 0);
2982 expect_quaternion(&exp_rotation, &got_rotation, 1);
2983 expect_vec3(&exp_translation, &got_translation, 0);
2984
2985/*__________*/
2986
2987 pm.m[0][0] = 0.0f;
2988 pm.m[1][0] = 4.0f;
2989 pm.m[2][0] = 5.0f;
2990 pm.m[3][0] = -5.0f;
2991 pm.m[0][1] = 0.0f;
2992 pm.m[1][1] = -10.60660f;
2993 pm.m[2][1] = -8.825232f;
2994 pm.m[3][1] = 6.0f;
2995 pm.m[0][2] = 0.0f;
2996 pm.m[1][2] = 8.8252320f;
2997 pm.m[2][2] = 2.727645;
2998 pm.m[3][2] = 3.0f;
2999 pm.m[0][3] = 0.0f;
3000 pm.m[1][3] = 0.0f;
3001 pm.m[2][3] = 0.0f;
3002 pm.m[3][3] = 1.0f;
3003
3004 hr = D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
3005 ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %lx\n", hr);
3006}
HRESULT WINAPI D3DXMatrixDecompose(D3DXVECTOR3 *poutscale, D3DXQUATERNION *poutrotation, D3DXVECTOR3 *pouttranslation, const D3DXMATRIX *pm)
Definition: math.c:187
static LPMONITOREX pm
Definition: localmon.c:45

Referenced by START_TEST().

◆ test_matrix_stack()

static void test_matrix_stack ( void  )
static

Definition at line 2479 of file math.c.

2480{
2481 ID3DXMatrixStack *stack;
2482 ULONG refcount;
2483 HRESULT hr;
2484
2485 const D3DXMATRIX mat1 = {{{
2486 1.0f, 2.0f, 3.0f, 4.0f,
2487 5.0f, 6.0f, 7.0f, 8.0f,
2488 9.0f, 10.0f, 11.0f, 12.0f,
2489 13.0f, 14.0f, 15.0f, 16.0f
2490 }}};
2491
2492 const D3DXMATRIX mat2 = {{{
2493 17.0f, 18.0f, 19.0f, 20.0f,
2494 21.0f, 22.0f, 23.0f, 24.0f,
2495 25.0f, 26.0f, 27.0f, 28.0f,
2496 29.0f, 30.0f, 31.0f, 32.0f
2497 }}};
2498
2500 ok(SUCCEEDED(hr), "Failed to create a matrix stack, hr %#lx\n", hr);
2501 if (FAILED(hr)) return;
2502
2503 ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)),
2504 "The top of an empty matrix stack should be an identity matrix\n");
2505
2507 ok(SUCCEEDED(hr), "Pop failed, hr %#lx\n", hr);
2508
2510 ok(SUCCEEDED(hr), "Push failed, hr %#lx\n", hr);
2511 ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
2512
2514 ok(SUCCEEDED(hr), "Push failed, hr %#lx\n", hr);
2515
2517 ok(SUCCEEDED(hr), "LoadMatrix failed, hr %#lx\n", hr);
2519
2521 ok(SUCCEEDED(hr), "Push failed, hr %#lx\n", hr);
2523
2525 ok(SUCCEEDED(hr), "LoadMatrix failed, hr %#lx\n", hr);
2527
2529 ok(SUCCEEDED(hr), "Push failed, hr %#lx\n", hr);
2531
2533 ok(SUCCEEDED(hr), "LoadIdentity failed, hr %#lx\n", hr);
2534 ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
2535
2537 ok(SUCCEEDED(hr), "Pop failed, hr %#lx\n", hr);
2539
2541 ok(SUCCEEDED(hr), "Pop failed, hr %#lx\n", hr);
2543
2545 ok(SUCCEEDED(hr), "Pop failed, hr %#lx\n", hr);
2546 ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
2547
2549 ok(SUCCEEDED(hr), "Pop failed, hr %#lx\n", hr);
2550 ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
2551
2552 refcount = ID3DXMatrixStack_Release(stack);
2553 ok(!refcount, "Matrix stack has %lu references left.\n", refcount);
2554}
HRESULT WINAPI D3DXCreateMatrixStack(DWORD flags, ID3DXMatrixStack **stack)
Definition: math.c:1171
#define ID3DXMatrixStack_Push(p)
Definition: d3dx9math.h:446
#define ID3DXMatrixStack_LoadMatrix(p, a)
Definition: d3dx9math.h:448
#define ID3DXMatrixStack_GetTop(p)
Definition: d3dx9math.h:459
#define ID3DXMatrixStack_LoadIdentity(p)
Definition: d3dx9math.h:447
#define ID3DXMatrixStack_Release(p)
Definition: d3dx9math.h:444
#define ID3DXMatrixStack_Pop(p)
Definition: d3dx9math.h:445
Definition: format.c:80

Referenced by START_TEST().

◆ test_Matrix_Transformation2D()

static void test_Matrix_Transformation2D ( void  )
static

Definition at line 3008 of file math.c.

3009{
3010 D3DXMATRIX exp_mat, got_mat;
3011 D3DXVECTOR2 rot_center, sca, sca_center, trans;
3012 FLOAT rot, sca_rot;
3013
3014 rot_center.x = 3.0f;
3015 rot_center.y = 4.0f;
3016
3017 sca.x = 12.0f;
3018 sca.y = -3.0f;
3019
3020 sca_center.x = 9.0f;
3021 sca_center.y = -5.0f;
3022
3023 trans.x = -6.0f;
3024 trans.y = 7.0f;
3025
3026 rot = D3DX_PI/3.0f;
3027
3028 sca_rot = 5.0f*D3DX_PI/4.0f;
3029
3030 exp_mat.m[0][0] = -4.245192f;
3031 exp_mat.m[1][0] = -0.147116f;
3032 exp_mat.m[2][0] = 0.0f;
3033 exp_mat.m[3][0] = 45.265373f;
3034 exp_mat.m[0][1] = 7.647113f;
3035 exp_mat.m[1][1] = 8.745192f;
3036 exp_mat.m[2][1] = 0.0f;
3037 exp_mat.m[3][1] = -13.401899f;
3038 exp_mat.m[0][2] = 0.0f;
3039 exp_mat.m[1][2] = 0.0f;
3040 exp_mat.m[2][2] = 1.0f;
3041 exp_mat.m[3][2] = 0.0f;
3042 exp_mat.m[0][3] = 0.0f;
3043 exp_mat.m[1][3] = 0.0f;
3044 exp_mat.m[2][3] = 0.0f;
3045 exp_mat.m[3][3] = 1.0f;
3046
3047 D3DXMatrixTransformation2D(&got_mat, &sca_center, sca_rot, &sca, &rot_center, rot, &trans);
3048 expect_matrix(&exp_mat, &got_mat, 64);
3049
3050/*_________*/
3051
3052 sca_center.x = 9.0f;
3053 sca_center.y = -5.0f;
3054
3055 trans.x = -6.0f;
3056 trans.y = 7.0f;
3057
3058 rot = D3DX_PI/3.0f;
3059
3060 sca_rot = 5.0f*D3DX_PI/4.0f;
3061
3062 exp_mat.m[0][0] = 0.50f;
3063 exp_mat.m[1][0] = -0.866025f;
3064 exp_mat.m[2][0] = 0.0f;
3065 exp_mat.m[3][0] = -6.0f;
3066 exp_mat.m[0][1] = 0.866025f;
3067 exp_mat.m[1][1] = 0.50f;
3068 exp_mat.m[2][1] = 0.0f;
3069 exp_mat.m[3][1] = 7.0f;
3070 exp_mat.m[0][2] = 0.0f;
3071 exp_mat.m[1][2] = 0.0f;
3072 exp_mat.m[2][2] = 1.0f;
3073 exp_mat.m[3][2] = 0.0f;
3074 exp_mat.m[0][3] = 0.0f;
3075 exp_mat.m[1][3] = 0.0f;
3076 exp_mat.m[2][3] = 0.0f;
3077 exp_mat.m[3][3] = 1.0f;
3078
3079 D3DXMatrixTransformation2D(&got_mat, &sca_center, sca_rot, NULL, NULL, rot, &trans);
3080 expect_matrix(&exp_mat, &got_mat, 8);
3081
3082/*_________*/
3083
3084 exp_mat.m[0][0] = 0.50f;
3085 exp_mat.m[1][0] = -0.866025f;
3086 exp_mat.m[2][0] = 0.0f;
3087 exp_mat.m[3][0] = 0.0f;
3088 exp_mat.m[0][1] = 0.866025f;
3089 exp_mat.m[1][1] = 0.50f;
3090 exp_mat.m[2][1] = 0.0f;
3091 exp_mat.m[3][1] = 0.0f;
3092 exp_mat.m[0][2] = 0.0f;
3093 exp_mat.m[1][2] = 0.0f;
3094 exp_mat.m[2][2] = 1.0f;
3095 exp_mat.m[3][2] = 0.0f;
3096 exp_mat.m[0][3] = 0.0f;
3097 exp_mat.m[1][3] = 0.0f;
3098 exp_mat.m[2][3] = 0.0f;
3099 exp_mat.m[3][3] = 1.0f;
3100
3101 D3DXMatrixTransformation2D(&got_mat, NULL, sca_rot, NULL, NULL, rot, NULL);
3102 expect_matrix(&exp_mat, &got_mat, 8);
3103}
static GLfloat rot
Definition: 3dtext.c:37
D3DXMATRIX *WINAPI D3DXMatrixTransformation2D(D3DXMATRIX *out, const D3DXVECTOR2 *scaling_center, float scaling_rotation, const D3DXVECTOR2 *scaling, const D3DXVECTOR2 *rotation_center, float rotation, const D3DXVECTOR2 *translation)
Definition: math.c:823

Referenced by START_TEST().