00001 #ifndef XDKWRL_SFVEC3F_H
00002 #define XDKWRL_SFVEC3F_H
00003
00004 #include <xdkwrl/fieldtypes.h>
00005 #include <iostream>
00006
00007 namespace wrl
00008 {
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 class SFVec3f
00019 {
00020 public:
00021 inline SFVec3f();
00022 inline SFVec3f(const float* c);
00023 inline SFVec3f(const float x,const float y,const float z);
00024 inline operator const float*() const;
00025 inline operator float*();
00026 inline float x() const;
00027 inline float y() const;
00028 inline float z() const;
00029 inline void setXYZ(const float x,const float y,const float z);
00030 inline void setX(const float);
00031 inline void setY(const float);
00032 inline void setZ(const float);
00033 static inline const char* typeName();
00034 static inline FieldTypeId typeId();
00035 inline bool operator==(const SFVec3f& c) const;
00036 friend std::ostream& operator<<(std::ostream& s,const SFVec3f& f);
00037 protected:
00038 private:
00039 float x_;
00040 float y_;
00041 float z_;
00042 };
00043
00044
00045
00046 inline
00047 SFVec3f::SFVec3f()
00048 : x_(0.0f),y_(0.0f),z_(0.0f)
00049 {
00050 }
00051 inline
00052 SFVec3f::SFVec3f(const float* c)
00053 : x_(c[0]),y_(c[1]),z_(c[2])
00054 {
00055 }
00056 inline
00057 SFVec3f::SFVec3f(const float x,const float y,const float z)
00058 : x_(x),y_(y),z_(z)
00059 {
00060 }
00061 inline
00062 SFVec3f::operator const float*() const
00063 {
00064 return &x_;
00065 }
00066 inline
00067 SFVec3f::operator float*()
00068 {
00069 return &x_;
00070 }
00071 inline float
00072 SFVec3f::x() const
00073 {
00074 return x_;
00075 }
00076 inline float
00077 SFVec3f::y() const
00078 {
00079 return y_;
00080 }
00081 inline float
00082 SFVec3f::z() const
00083 {
00084 return z_;
00085 }
00086 inline void
00087 SFVec3f::setX(const float x)
00088 {
00089 x_ = x;
00090 }
00091 inline void
00092 SFVec3f::setY(const float y)
00093 {
00094 y_ = y;
00095 }
00096 inline void
00097 SFVec3f::setZ(const float z)
00098 {
00099 z_ = z;
00100 }
00101 inline void
00102 SFVec3f::setXYZ(const float x,const float y,const float z)
00103 {
00104 x_ = x;
00105 y_ = y;
00106 z_ = z;
00107 }
00108 inline bool
00109 SFVec3f::operator==(const SFVec3f& c) const
00110 {
00111 return x_ == c.x_ && y_ == c.y_ && z_ == c.z_;
00112 }
00113 inline const char*
00114 SFVec3f::typeName()
00115 {
00116 return "SFVec3f";
00117 }
00118 inline FieldTypeId
00119 SFVec3f::typeId()
00120 {
00121 return sfVec3f;
00122 }
00123 inline std::ostream& operator<<(std::ostream& s,const SFVec3f& f)
00124 {
00125 return s<<f.x_<<' '<<f.y_<<' '<<f.z_;
00126 }
00127 };
00128
00129 #endif // XDKWRL_SFVEC3F_H