FindResourceExA/W should search for the specified language resource only.
[wine] / include / d3dvec.inl
1 #ifndef __WINE_D3DVEC_INL
2 #define __WINE_D3DVEC_INL
3
4 /*** constructors ***/
5
6 inline _D3DVECTOR::_D3DVECTOR(D3DVALUE f)
7 {
8   x = y = z = f;
9 }
10
11 inline _D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z)
12 {
13   x = _x; y = _y; z = _z;
14 }
15
16 /*** assignment operators ***/
17
18 inline _D3DVECTOR& _D3DVECTOR::operator += (const _D3DVECTOR& v)
19 {
20   x += v.x; y += v.y; z += v.z;
21   return *this;
22 }
23
24 inline _D3DVECTOR& _D3DVECTOR::operator -= (const _D3DVECTOR& v)
25 {
26   x -= v.x; y -= v.y; z -= v.z;
27   return *this;
28 }
29
30 inline _D3DVECTOR& _D3DVECTOR::operator *= (const _D3DVECTOR& v)
31 {
32   x *= v.x; y *= v.y; z *= v.z;
33   return *this;
34 }
35
36 inline _D3DVECTOR& _D3DVECTOR::operator /= (const _D3DVECTOR& v)
37 {
38   x /= v.x; y /= v.y; z /= v.z;
39   return *this;
40 }
41
42 inline _D3DVECTOR& _D3DVECTOR::operator *= (D3DVALUE s)
43 {
44   x *= s; y *= s; z *= s;
45   return *this;
46 }
47
48 inline _D3DVECTOR& _D3DVECTOR::operator /= (D3DVALUE s)
49 {
50   x /= s; y /= s; z /= s;
51   return *this;
52 }
53
54 /*** binary operators ***/
55
56 inline _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
57 {
58   return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
59 }
60
61 inline _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
62 {
63   return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
64 }
65
66 inline _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s)
67 {
68   return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
69 }
70
71 inline _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v)
72 {
73   return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
74 }
75
76 inline _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s)
77 {
78   return _D3DVECTOR(v.x/s, v.y/s, v.z/s);
79 }
80
81 inline D3DVALUE SquareMagnitude(const _D3DVECTOR& v)
82 {
83   return v.x*v.x + v.y*v.y + v.z*v.z; /* DotProduct(v, v) */
84 }
85
86 inline D3DVALUE Magnitude(const _D3DVECTOR& v)
87 {
88   return sqrt(SquareMagnitude(v));
89 }
90
91 inline _D3DVECTOR Normalize(const _D3DVECTOR& v)
92 {
93   return v / Magnitude(v);
94 }
95
96 inline D3DVALUE DotProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
97 {
98   return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
99 }
100
101 inline _D3DVECTOR CrossProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
102 {
103   _D3DVECTOR res;
104   /* this is a left-handed cross product, right? */
105   res.x = v1.y * v2.z - v1.z * v2.y;
106   res.y = v1.z * v2.x - v1.x * v2.z;
107   res.z = v1.x * v2.y - v1.y * v2.x;
108   return res;
109 }
110
111 #endif