Tony Wasserka : d3dx8: Implement the C++ stuff of the D3DXPLANE structure.

Alexandre Julliard julliard at winehq.org
Mon Nov 12 06:27:37 CST 2007


Module: wine
Branch: master
Commit: 94ccd3f0145ef9a9a9293514074fdda8b56cdc22
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=94ccd3f0145ef9a9a9293514074fdda8b56cdc22

Author: Tony Wasserka <tony.wasserka at freenet.de>
Date:   Sat Nov 10 15:03:28 2007 +0100

d3dx8: Implement the C++ stuff of the D3DXPLANE structure.

---

 include/d3dx8math.h   |   14 +++++++++++++
 include/d3dx8math.inl |   51 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/include/d3dx8math.h b/include/d3dx8math.h
index f35bed8..0c60b66 100644
--- a/include/d3dx8math.h
+++ b/include/d3dx8math.h
@@ -201,6 +201,20 @@ typedef struct D3DXQUATERNION
 
 typedef struct D3DXPLANE
 {
+#ifdef __cplusplus
+    D3DXPLANE();
+    D3DXPLANE(CONST FLOAT *pf);
+    D3DXPLANE(FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd);
+
+    operator FLOAT* ();
+    operator CONST FLOAT* () const;
+
+    D3DXPLANE operator + () const;
+    D3DXPLANE operator - () const;
+
+    BOOL operator == (CONST D3DXPLANE&) const;
+    BOOL operator != (CONST D3DXPLANE&) const;
+#endif /* __cplusplus */
     FLOAT a, b, c, d;
 } D3DXPLANE, *LPD3DXPLANE;
 
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index bce6070..c04c9d1 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -639,6 +639,57 @@ inline BOOL D3DXQUATERNION::operator != (CONST D3DXQUATERNION& quat) const
     return x != quat.x || y != quat.y || z != quat.z || w != quat.w;
 }
 
+inline D3DXPLANE::D3DXPLANE()
+{
+}
+
+inline D3DXPLANE::D3DXPLANE(CONST FLOAT *pf)
+{
+    if(!pf) return;
+    a = pf[0];
+    b = pf[1];
+    c = pf[2];
+    d = pf[3];
+}
+
+inline D3DXPLANE::D3DXPLANE(FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd)
+{
+    a = fa;
+    b = fb;
+    c = fc;
+    d = fd;
+}
+
+inline D3DXPLANE::operator FLOAT* ()
+{
+    return (FLOAT*)&a;
+}
+
+inline D3DXPLANE::operator CONST FLOAT* () const
+{
+    return (CONST FLOAT*)&a;
+}
+
+inline D3DXPLANE D3DXPLANE::operator + () const
+{
+    return *this;
+}
+
+inline D3DXPLANE D3DXPLANE::operator - () const
+{
+    return D3DXPLANE(-a, -b, -c, -d);
+}
+
+inline BOOL D3DXPLANE::operator == (CONST D3DXPLANE& pl) const
+{
+    return a == pl.a && b == pl.b && c == pl.c && d == pl.d;
+}
+
+inline BOOL D3DXPLANE::operator != (CONST D3DXPLANE& pl) const
+{
+    return a != pl.a || b != pl.b || c != pl.c || d != pl.d;
+}
+
 #endif /* __cplusplus */
 
 /*_______________D3DXCOLOR_____________________*/




More information about the wine-cvs mailing list