00001 #ifndef MERCURYVERTEX_H
00002 #define MERCURYVERTEX_H
00003
00004 #include "MercuryTypes.h"
00005 #include "MercuryVector.h"
00006
00007 class MercuryPoly;
00008
00010 typedef MercuryPoint MercuryNormal;
00011
00012 class MercuryVertex
00013 {
00014 public:
00015 MercuryVertex();
00016 MercuryVertex( const float ix, const float iy, const float iz, const float iu, const float iv );
00017
00018
00019 inline const float GetX() const { return x; }
00020 inline const float GetY() const { return y; }
00021 inline const float GetZ() const { return z; }
00022 inline void SetX(const float ix) { x = ix; }
00023 inline void SetY(const float iy) { y = iy; }
00024 inline void SetZ(const float iz) { z = iz; }
00025 inline void ConvertToVector3( MercuryPoint & out ) const { out[0] = x; out[1] = y; out[2] = z; }
00026 inline void ConvertFromVector3( const MercuryPoint & in ) { x = in[0]; y = in[1]; z = in[2]; }
00027 inline MercuryPoint& GetPointHandle() { return *(MercuryPoint*)&x; }
00028
00029 inline MercuryVertex& operator += ( const MercuryVertex& other ) { x+=other.x; y+=other.y; z+=other.z; return *this; }
00030 inline MercuryVertex& operator -= ( const MercuryVertex& other ) { x-=other.x; y-=other.y; z-=other.z; return *this; }
00031 inline MercuryVertex& operator *= ( float f ) { x*=f; y*=f; z*=f; return *this; }
00032 inline MercuryVertex& operator /= ( float f ) { x/=f; y/=f; z/=f; return *this; }
00033
00034 inline MercuryVertex operator + ( const MercuryVertex& other ) const { return MercuryVertex( x+other.x, y+other.y, z+other.z, m_uv[0], m_uv[1] ); }
00035 inline MercuryVertex operator - ( const MercuryVertex& other ) const { return MercuryVertex( x-other.x, y-other.y, z-other.z, m_uv[0], m_uv[1] ); }
00036 inline MercuryVertex operator * ( float f ) const { return MercuryVertex( x*f, y*f, z*f, m_uv[0], m_uv[1] ); }
00037 inline MercuryVertex operator / ( float f ) const { return MercuryVertex( x/f, y/f, z/f, m_uv[0], m_uv[1] ); }
00038
00039 MercuryVertex CrossProduct(const MercuryVertex& second);
00040
00041 inline void GetUV(float* uv) const { uv[0] = m_uv[0]; uv[1] = m_uv[1]; }
00042 inline void SetUV(const float* uv) { m_uv[0] = uv[0]; m_uv[1] = uv[1]; }
00043 inline void SetU(const float u) { m_uv[0] = u; }
00044 inline void SetV(const float v) { m_uv[1] = v; }
00045 inline const MercuryNormal& GetNormal() const { return m_normal; }
00046
00048 inline void GetNormal(MercuryNormal*& normal) { normal = &m_normal; }
00049
00050 void SetNormal(MercuryNormal normal) { m_normal = normal; }
00051
00052
00053
00054
00055
00056 float m_uv[2];
00057 MercuryNormal m_normal;
00058
00059
00060 float x;
00061 float y;
00062 float z;
00063 } M_ALIGN(32);
00064
00065
00066
00067 struct MercuryVertWrapper
00068 {
00069 MDeque<MercuryPoly*> m_sharingPolys;
00070 MDequeIterator<MercuryPoly*> FindSharingPoly(MercuryPoly* p);
00071 MercuryVertex* m_vertex;
00072 };
00073
00074 #endif
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103