Commit 4905921f authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard

d2d1: Implement D2D1Vec3Length().

parent 9cf8fab9
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
@ stub D2D1CreateDeviceContext @ stub D2D1CreateDeviceContext
@ stdcall D2D1SinCos(float ptr ptr) @ stdcall D2D1SinCos(float ptr ptr)
@ stdcall D2D1Tan(float) @ stdcall D2D1Tan(float)
@ stub D2D1Vec3Length @ stdcall D2D1Vec3Length(float float float)
...@@ -728,6 +728,13 @@ float WINAPI D2D1Tan(float angle) ...@@ -728,6 +728,13 @@ float WINAPI D2D1Tan(float angle)
return tanf(angle); return tanf(angle);
} }
float WINAPI D2D1Vec3Length(float x, float y, float z)
{
TRACE("x %.8e, y %.8e, z %.8e.\n", x, y, z);
return sqrtf(x * x + y * y + z * z);
}
static BOOL get_config_key_dword(HKEY default_key, HKEY application_key, const char *name, DWORD *value) static BOOL get_config_key_dword(HKEY default_key, HKEY application_key, const char *name, DWORD *value)
{ {
DWORD type, data, size; DWORD type, data, size;
......
...@@ -9427,8 +9427,8 @@ static void test_wic_bitmap_format(void) ...@@ -9427,8 +9427,8 @@ static void test_wic_bitmap_format(void)
static void test_math(void) static void test_math(void)
{ {
float s, c, t, l;
unsigned int i; unsigned int i;
float s, c, t;
static const struct static const struct
{ {
...@@ -9459,6 +9459,24 @@ static void test_math(void) ...@@ -9459,6 +9459,24 @@ static void test_math(void)
{M_PI, 8.74227766e-008f}, {M_PI, 8.74227766e-008f},
}; };
static const struct
{
float x;
float y;
float z;
float l;
}
l_data[] =
{
{0.0f, 0.0f, 0.0f, 0.0f},
{1.0f, 0.0f, 0.0f, 1.0f},
{0.0f, 1.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 1.0f, 1.0f},
{1.0f, 1.0f, 1.0f, 1.73205078f},
{1.0f, 2.0f, 2.0f, 3.0f},
{1.0f, 2.0f, 3.0f, 3.74165750f},
};
for (i = 0; i < ARRAY_SIZE(sc_data); ++i) for (i = 0; i < ARRAY_SIZE(sc_data); ++i)
{ {
D2D1SinCos(sc_data[i].x, &s, &c); D2D1SinCos(sc_data[i].x, &s, &c);
...@@ -9474,6 +9492,13 @@ static void test_math(void) ...@@ -9474,6 +9492,13 @@ static void test_math(void)
ok(compare_float(t, t_data[i].t, 1), ok(compare_float(t, t_data[i].t, 1),
"Test %u: Got unexpected tan %.8e, expected %.8e.\n", i, t, t_data[i].t); "Test %u: Got unexpected tan %.8e, expected %.8e.\n", i, t, t_data[i].t);
} }
for (i = 0; i < ARRAY_SIZE(l_data); ++i)
{
l = D2D1Vec3Length(l_data[i].x, l_data[i].y, l_data[i].z);
ok(compare_float(l, l_data[i].l, 0),
"Test %u: Got unexpected length %.8e, expected %.8e.\n", i, l, l_data[i].l);
}
} }
START_TEST(d2d1) START_TEST(d2d1)
......
...@@ -796,3 +796,4 @@ interface ID2D1Factory1 : ID2D1Factory ...@@ -796,3 +796,4 @@ interface ID2D1Factory1 : ID2D1Factory
const D2D1_CREATION_PROPERTIES *creation_properties, ID2D1Device **device); const D2D1_CREATION_PROPERTIES *creation_properties, ID2D1Device **device);
[local] void __stdcall D2D1SinCos(float angle, float *s, float *c); [local] void __stdcall D2D1SinCos(float angle, float *s, float *c);
[local] float __stdcall D2D1Tan(float angle); [local] float __stdcall D2D1Tan(float angle);
[local] float __stdcall D2D1Vec3Length(float x, float y, float z);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment