Corrected declaration and some syntax errors in GetFrustum
This commit is contained in:
parent
b1469351ad
commit
b01f11a93e
|
@ -23,6 +23,9 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
History
|
History
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.18 2005/02/21 18:11:07 ganovelli
|
||||||
|
GetFrustum moved from gl/camera to math/camera.h
|
||||||
|
|
||||||
Revision 1.17 2005/02/15 14:55:52 tommyfranken
|
Revision 1.17 2005/02/15 14:55:52 tommyfranken
|
||||||
added principal point
|
added principal point
|
||||||
|
|
||||||
|
@ -139,7 +142,7 @@ public:
|
||||||
inline void SetFrustum(S dx, S sx, S bt, S tp, S nearend, S farend,vcg::Point2<S> viewport=vcg::Point2<S>(500,-1));
|
inline void SetFrustum(S dx, S sx, S bt, S tp, S nearend, S farend,vcg::Point2<S> viewport=vcg::Point2<S>(500,-1));
|
||||||
|
|
||||||
/// get the camera frustum view
|
/// get the camera frustum view
|
||||||
inline void GetFrustum(const CameraType & camera,S & sx,S & dx,S & bt,S & tp, S & f ,S & fr);
|
inline void GetFrustum(S & sx,S & dx,S & bt,S & tp, S & f ,S & fr);
|
||||||
|
|
||||||
/// project a point from space 3d (in the reference system of the camera) to the camera's plane
|
/// project a point from space 3d (in the reference system of the camera) to the camera's plane
|
||||||
/// the result is in absolute coordinates
|
/// the result is in absolute coordinates
|
||||||
|
@ -188,7 +191,12 @@ vcg::Point2<S> Camera<S>::LocalTo_neg1_1(const vcg::Point2<S> & p){
|
||||||
|
|
||||||
/// set the camera specifying the perspective view
|
/// set the camera specifying the perspective view
|
||||||
template<class S>
|
template<class S>
|
||||||
void Camera<S>::SetPerspective(S angle, S ratio, S near_thr, S far_thr, vcg::Point2<S> vp){
|
void Camera<S>::SetPerspective( S angle,
|
||||||
|
S ratio,
|
||||||
|
S near_thr,
|
||||||
|
S far_thr,
|
||||||
|
vcg::Point2<S> vp)
|
||||||
|
{
|
||||||
S halfsize[2];
|
S halfsize[2];
|
||||||
halfsize[1] = tan(math::ToRad(angle/2)) * near_thr;
|
halfsize[1] = tan(math::ToRad(angle/2)) * near_thr;
|
||||||
halfsize[0] = halfsize[1]*ratio;
|
halfsize[0] = halfsize[1]*ratio;
|
||||||
|
@ -197,7 +205,14 @@ template<class S>
|
||||||
|
|
||||||
/// set the camera specifying the frustum view
|
/// set the camera specifying the frustum view
|
||||||
template<class S>
|
template<class S>
|
||||||
void Camera<S>::SetFrustum(S sx, S dx, S bt, S tp, S near_thr, S far_thr,vcg::Point2<S> vp){
|
void Camera<S>::SetFrustum( S sx,
|
||||||
|
S dx,
|
||||||
|
S bt,
|
||||||
|
S tp,
|
||||||
|
S near_thr,
|
||||||
|
S far_thr,
|
||||||
|
vcg::Point2<S> vp )
|
||||||
|
{
|
||||||
S vpt[2];
|
S vpt[2];
|
||||||
vpt[0] = dx-sx;
|
vpt[0] = dx-sx;
|
||||||
vpt[1] = tp-bt;
|
vpt[1] = tp-bt;
|
||||||
|
@ -216,28 +231,27 @@ template<class S>
|
||||||
|
|
||||||
f =near_thr;
|
f =near_thr;
|
||||||
farend = far_thr;
|
farend = far_thr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class S>
|
template<class S>
|
||||||
void Camera<S>:: GetFrustum(
|
void Camera<S>:: GetFrustum( S & sx,
|
||||||
typename S & sx,
|
S & dx,
|
||||||
typename S & dx,
|
S & bt,
|
||||||
typename S & bt,
|
S & tp,
|
||||||
typename S & tp,
|
S & nr ,
|
||||||
typename S & f ,
|
S & fr )
|
||||||
typename S & fr
|
{
|
||||||
){
|
|
||||||
dx = c.X()*s.X(); //scaled center
|
dx = c.X()*s.X(); //scaled center
|
||||||
sx = -( viewport.X() - c.X() ) * s.X();
|
sx = -( viewport.X() - c.X() ) * s.X();
|
||||||
|
|
||||||
bt = -c.Y()*s.Y();
|
bt = -c.Y()*s.Y();
|
||||||
tp = ( viewport.Y() - c.Y() ) * s.Y();
|
tp = ( viewport.Y() - c.Y() ) * s.Y();
|
||||||
|
|
||||||
f = f;
|
nr = f;
|
||||||
fr = farend;
|
fr = farend;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue