00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef VRS_INTERSECTIONINFO_H
00021 #define VRS_INTERSECTIONINFO_H
00022
00023 #include <vrs/matrix.h>
00024 #include <vrs/ray.h>
00025 #include <vrs/shape.h>
00026
00027 namespace VRS {
00028
00034 class VRS_CORE_API IntersectionInfo :
00035 public SharedObj
00036 {
00037 public:
00038 VRS_TYPEINFO(IntersectionInfo, SharedObj);
00039 VRS_SERIALIZABLE(IntersectionInfo);
00040
00041 public:
00042 IntersectionInfo(
00043 SO<Shape> shape,
00044 const Vector& point,
00045 const Vector& normal,
00046 const Ray& ray,
00047 const Matrix& modelview,
00048 const Matrix& orientation,
00049 const Matrix& projection,
00050 int hint = 0,
00051 unsigned int instanceInfo = 0,
00052 UINT32 id = 0
00053 );
00054
00055 void setShape(SO<Shape> hitShape);
00056 SO<Shape> getShape() const;
00058
00059 void setPoint(const Vector&);
00060 Vector getPoint() const;
00062
00063 void setNormal(const Vector&);
00064 Vector getNormal() const;
00066
00067 void setRay(const Ray& ray);
00068 Ray getRay() const;
00070
00071 void setInstanceInfo(unsigned int instanceInfo);
00072 unsigned int instanceInfo() const;
00074
00075 void setID(UINT32 id);
00076 UINT32 getID() const;
00078
00079 void setModelviewMatrix(const Matrix&);
00080 Matrix getModelviewMatrix() const;
00081 Matrix getInverseModelviewMatrix() const;
00083
00084 void setOrientationMatrix(const Matrix&);
00085 Matrix getOrientationMatrix() const;
00086 Matrix getInverseOrientationMatrix() const;
00088
00089 void setProjectionMatrix(const Matrix&);
00090 Matrix getProjectionMatrix() const;
00091 Matrix getInverseProjectionMatrix() const;
00093
00094 void setHint(int hint);
00095 int getHint() const;
00097
00098 protected:
00099 IntersectionInfo();
00100
00101 private:
00102 SO<Shape> shape_;
00103 Vector point_;
00104 Vector normal_;
00105 Ray ray_;
00106 Matrix modelview_;
00107 Matrix orientation_;
00108 Matrix projection_;
00109 int hint_;
00110 unsigned int m_instanceInfo;
00111 UINT32 m_id;
00112 };
00113
00114 inline void IntersectionInfo::setShape(SO<Shape> s) {
00115 shape_ = s; modified();
00116 }
00117
00118 inline SO<Shape> IntersectionInfo::getShape() const {
00119 return shape_;
00120 }
00121
00122 inline void IntersectionInfo::setPoint(const Vector& p) {
00123 point_ = p; modified();
00124 }
00125
00126 inline Vector IntersectionInfo::getPoint() const {
00127 return point_;
00128 }
00129
00130 inline void IntersectionInfo::setNormal(const Vector& n) {
00131 normal_ = n; modified();
00132 }
00133
00134 inline Vector IntersectionInfo::getNormal() const {
00135 return normal_;
00136 }
00137
00138 inline void IntersectionInfo::setRay(const Ray& ray) {
00139 ray_ = ray; modified();
00140 }
00141
00142 inline Ray IntersectionInfo::getRay() const {
00143 return ray_;
00144 }
00145
00146 inline void IntersectionInfo::setInstanceInfo(unsigned int instanceInfo) {
00147 m_instanceInfo = instanceInfo;
00148 }
00149
00150 inline unsigned int IntersectionInfo::instanceInfo() const {
00151 return m_instanceInfo;
00152 }
00153
00154 inline void IntersectionInfo::setModelviewMatrix(const Matrix& m) {
00155 modelview_ = m; modified();
00156 }
00157
00158 inline Matrix IntersectionInfo::getModelviewMatrix() const {
00159 return modelview_;
00160 }
00161
00162 inline void IntersectionInfo::setOrientationMatrix(const Matrix& m) {
00163 orientation_ = m; modified();
00164 }
00165
00166 inline Matrix IntersectionInfo::getOrientationMatrix() const {
00167 return orientation_;
00168 }
00169
00170 inline void IntersectionInfo::setProjectionMatrix(const Matrix& m) {
00171 projection_ = m; modified();
00172 }
00173
00174 inline Matrix IntersectionInfo::getProjectionMatrix() const {
00175 return projection_;
00176 }
00177
00178 inline void IntersectionInfo::setHint(int hint) {
00179 hint_ = hint; modified();
00180 }
00181
00182 inline int IntersectionInfo::getHint() const {
00183 return hint_;
00184 }
00185
00186 inline void IntersectionInfo::setID(UINT32 id) {
00187 m_id = id; modified();
00188 }
00189
00190 inline UINT32 IntersectionInfo::getID() const {
00191 return m_id;
00192 }
00193
00194 }
00195
00196 #endif // VRS_INTERSECTIONINFO_H