Cleaning up and planes init more stable.
This commit is contained in:
parent
f480f01a3f
commit
37e7cd9ada
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.5 2004/09/28 10:23:28 ponchio
|
||||||
|
Various generic changes.
|
||||||
|
|
||||||
Revision 1.4 2004/05/12 20:55:18 ponchio
|
Revision 1.4 2004/05/12 20:55:18 ponchio
|
||||||
*** empty log message ***
|
*** empty log message ***
|
||||||
|
|
||||||
|
@ -43,6 +46,8 @@ Adding copyright.
|
||||||
#include <vcg/space/plane3.h>
|
#include <vcg/space/plane3.h>
|
||||||
#include <vcg/space/line3.h>
|
#include <vcg/space/line3.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
|
|
||||||
|
@ -93,13 +98,12 @@ template <class T> bool Frustum<T>::IsOutside(Point3<T> &point, T radius) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> T Frustum<T>::Distance(Point3<T> &point, int plane) {
|
template <class T> T Frustum<T>::Distance(Point3<T> &point, int plane) {
|
||||||
return Distance(point, planes[plane]);
|
return vcg::Distance(planes[plane], point);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> void Frustum<T>::GetView() {
|
template <class T> void Frustum<T>::GetView() {
|
||||||
View<T>::GetView();
|
View<T>::GetView();
|
||||||
|
|
||||||
// Point3d NE, SE, SW, NW, ne, se, sw, nw;
|
|
||||||
int t = viewport[1] + viewport[3];
|
int t = viewport[1] + viewport[3];
|
||||||
int b = viewport[1];
|
int b = viewport[1];
|
||||||
int r = viewport[0] + viewport[2];
|
int r = viewport[0] + viewport[2];
|
||||||
|
@ -114,29 +118,18 @@ template <class T> void Frustum<T>::GetView() {
|
||||||
Point3<T> NE = UnProject(Point3<T>(r, b, 1));
|
Point3<T> NE = UnProject(Point3<T>(r, b, 1));
|
||||||
Point3<T> SE = UnProject(Point3<T>(r, t, 1));
|
Point3<T> SE = UnProject(Point3<T>(r, t, 1));
|
||||||
|
|
||||||
/* gluUnProject(l,b,0,model,proj,viewport,&nw[0], &nw[1], &nw[2]);
|
|
||||||
gluUnProject(l,t,0,model,proj,viewport,&sw[0], &sw[1], &sw[2]);
|
|
||||||
gluUnProject(r,b,0,model,proj,viewport,&ne[0], &ne[1], &ne[2]);
|
|
||||||
gluUnProject(r,t,0,model,proj,viewport,&se[0], &se[1], &se[2]);
|
|
||||||
gluUnProject(l,b,1,model,proj,viewport,&NW[0], &NW[1], &NW[2]);
|
|
||||||
gluUnProject(l,t,1,model,proj,viewport,&SW[0], &SW[1], &SW[2]);
|
|
||||||
gluUnProject(r,b,1,model,proj,viewport,&NE[0], &NE[1], &NE[2]);
|
|
||||||
gluUnProject(r,t,1,model,proj,viewport,&SE[0], &SE[1], &SE[2]);*/
|
|
||||||
|
|
||||||
view_point = View<T>::ViewPoint();
|
view_point = View<T>::ViewPoint();
|
||||||
|
|
||||||
planes[0].Init(view_point, nw, ne);
|
planes[0].Init(nw, NW, NE);
|
||||||
planes[1].Init(view_point, ne, se);
|
planes[1].Init(ne, NE, SE);
|
||||||
planes[2].Init(view_point, se, sw);
|
planes[2].Init(se, SE, SW);
|
||||||
planes[3].Init(view_point, sw, nw);
|
planes[3].Init(sw, SW, NW);
|
||||||
planes[4].Init(se, sw, nw);
|
planes[4].Init(se, sw, nw);
|
||||||
planes[5].Init(SW, SE, NE);
|
planes[5].Init(SW, SE, NE);
|
||||||
|
|
||||||
for(int i = 0; i < 6; i++)
|
//compute resolution: sizeo of a pixel unitary distance from view_point
|
||||||
planes[i].Normalize();
|
resolution = ((ne + NE) - (nw + NW)).Norm() /
|
||||||
|
(viewport[2] * ((ne + NE) - view_point).Norm());
|
||||||
//calcoliamo la risoluzione: dimenzione di un pixel a distanza 1 dal view_point
|
|
||||||
resolution = ((ne + NE) - (nw + NW)).Norm() /( viewport[2] * ((ne + NE) - view_point).Norm());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace
|
}//namespace
|
||||||
|
|
Loading…
Reference in New Issue