-
Notifications
You must be signed in to change notification settings - Fork 0
/
testdot.cpp
54 lines (44 loc) · 902 Bytes
/
testdot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "DXUT.h"
#include <xmmintrin.h>
#include <emmintrin.h>
#include <math.h>
extern void DBugVec(WCHAR *str, float* p);
#define XNAMATH
#ifdef XNAMATH
#include "_xnamath_.h"
XMVECTOR TestDotXNA(XMVECTOR n, XMVECTOR i)
{
XMVECTOR r;
r = XMVector4Dot(XMVector4Reflect(i, n), XMVector4Reflect(n, i));
r = XMVector4Dot(r, XMVector4Dot(n, i));
return(r);
}
void TestDot(void)
{
XMVECTOR n = {1.f, 2.f, 1.f, 3.f};
XMVECTOR i = {0.1f, -3.f, 2.f, -2.f};
XMVECTOR r;
r = TestDotXNA(n, i);
float* f = (float*)&r;
DBugVec(L"XNAMath", f);
}
#else
#include "vmath.h"
using namespace VMATH;
Vec4 TestDotVMath(Vec4 n, Vec4 i)
{
Vec4 r;
r = Dot(Reflect(i, n), Reflect(n, i));
r = Dot(r, Dot(n, i));
return(r);
}
void TestDot(void)
{
Vec4 n = {1.f, 2.f, 1.f, 3.f};
Vec4 i = {0.1f, -3.f, 2.f, -2.f};
Vec4 r;
r = TestDotVMath(n, i);
float* f = (float*)&r;
DBugVec(L"VMath", f);
}
#endif