00001 #ifndef COIN_SBVIEWVOLUME_H
00002 #define COIN_SBVIEWVOLUME_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <stdio.h>
00028
00029 #include <Inventor/SbBasic.h>
00030 #include <Inventor/SbVec3f.h>
00031 #include <Inventor/SbDPViewVolume.h>
00032
00033 class SbBox3f;
00034 class SbLine;
00035 class SbMatrix;
00036 class SbPlane;
00037 class SbRotation;
00038 class SbVec2f;
00039 class SbVec3f;
00040
00041 class COIN_DLL_API SbViewVolume {
00042 public:
00043 enum ProjectionType { ORTHOGRAPHIC = 0, PERSPECTIVE = 1 };
00044
00045 public:
00046 SbViewVolume(void);
00047 ~SbViewVolume(void);
00048 void getMatrices(SbMatrix& affine, SbMatrix& proj) const;
00049 SbMatrix getMatrix(void) const;
00050 SbMatrix getCameraSpaceMatrix(void) const;
00051 void projectPointToLine(const SbVec2f& pt, SbLine& line) const;
00052 void projectPointToLine(const SbVec2f& pt,
00053 SbVec3f& line0, SbVec3f& line1) const;
00054 void projectToScreen(const SbVec3f& src, SbVec3f& dst) const;
00055 SbPlane getPlane(const float distFromEye) const;
00056 SbVec3f getSightPoint(const float distFromEye) const;
00057 SbVec3f getPlanePoint(const float distFromEye,
00058 const SbVec2f& normPoint) const;
00059 SbRotation getAlignRotation(SbBool rightAngleOnly = FALSE) const;
00060 float getWorldToScreenScale(const SbVec3f& worldCenter,
00061 float normRadius) const;
00062 SbVec2f projectBox(const SbBox3f& box) const;
00063 SbViewVolume narrow(float left, float bottom,
00064 float right, float top) const;
00065 SbViewVolume narrow(const SbBox3f& box) const;
00066 void ortho(float left, float right,
00067 float bottom, float top,
00068 float nearval, float farval);
00069 void perspective(float fovy, float aspect,
00070 float nearval, float farval);
00071 void frustum(float left, float right,
00072 float bottom, float top,
00073 float nearval, float farval);
00074 void rotateCamera(const SbRotation& q);
00075 void translateCamera(const SbVec3f& v);
00076 SbVec3f zVector(void) const;
00077 SbViewVolume zNarrow(float nearval, float farval) const;
00078 void scale(float factor);
00079 void scaleWidth(float ratio);
00080 void scaleHeight(float ratio);
00081 ProjectionType getProjectionType(void) const;
00082 const SbVec3f& getProjectionPoint(void) const;
00083 const SbVec3f& getProjectionDirection(void) const;
00084 float getNearDist(void) const;
00085 float getWidth(void) const;
00086 float getHeight(void) const;
00087 float getDepth(void) const;
00088
00089 void print(FILE * fp) const;
00090 void getViewVolumePlanes(SbPlane planes[6]) const;
00091 void transform(const SbMatrix &matrix);
00092 SbVec3f getViewUp(void) const;
00093
00094 public:
00095
00096
00097
00098
00099
00100
00101 ProjectionType type;
00102 SbVec3f projPoint;
00103 SbVec3f projDir;
00104 float nearDist;
00105 float nearToFar;
00106 SbVec3f llf;
00107 SbVec3f lrf;
00108 SbVec3f ulf;
00109
00110 private:
00111
00112 SbDPViewVolume dpvv;
00113 };
00114
00115 #endif // !COIN_SBVIEWVOLUME_H