Improve async i/o compatability. lpOverlapped->Internal should hold
[wine/wine-kai.git] / include / d3dvec.inl
blob03dc5f59a210cc686814b5ae5a6226db4afbeaaf
1 #ifndef __WINE_D3DVEC_INL
2 #define __WINE_D3DVEC_INL
4 /*** constructors ***/
6 inline _D3DVECTOR::_D3DVECTOR(D3DVALUE f)
8   x = y = z = f;
11 inline _D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z)
13   x = _x; y = _y; z = _z;
16 /*** assignment operators ***/
18 inline _D3DVECTOR& _D3DVECTOR::operator += (const _D3DVECTOR& v)
20   x += v.x; y += v.y; z += v.z;
21   return *this;
24 inline _D3DVECTOR& _D3DVECTOR::operator -= (const _D3DVECTOR& v)
26   x -= v.x; y -= v.y; z -= v.z;
27   return *this;
30 inline _D3DVECTOR& _D3DVECTOR::operator *= (const _D3DVECTOR& v)
32   x *= v.x; y *= v.y; z *= v.z;
33   return *this;
36 inline _D3DVECTOR& _D3DVECTOR::operator /= (const _D3DVECTOR& v)
38   x /= v.x; y /= v.y; z /= v.z;
39   return *this;
42 inline _D3DVECTOR& _D3DVECTOR::operator *= (D3DVALUE s)
44   x *= s; y *= s; z *= s;
45   return *this;
48 inline _D3DVECTOR& _D3DVECTOR::operator /= (D3DVALUE s)
50   x /= s; y /= s; z /= s;
51   return *this;
54 /*** binary operators ***/
56 inline _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
58   return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
61 inline _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
63   return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
66 inline _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s)
68   return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
71 inline _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v)
73   return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
76 inline _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s)
78   return _D3DVECTOR(v.x/s, v.y/s, v.z/s);
81 inline D3DVALUE SquareMagnitude(const _D3DVECTOR& v)
83   return v.x*v.x + v.y*v.y + v.z*v.z; /* DotProduct(v, v) */
86 inline D3DVALUE Magnitude(const _D3DVECTOR& v)
88   return sqrt(SquareMagnitude(v));
91 inline _D3DVECTOR Normalize(const _D3DVECTOR& v)
93   return v / Magnitude(v);
96 inline D3DVALUE DotProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
98   return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
101 inline _D3DVECTOR CrossProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
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;
111 #endif