Subversion Repositories gelsvn

Rev

Rev 290 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 290 Rev 291
Line 2... Line 2...
2
#include "BoundingINode.h"
2
#include "BoundingINode.h"
3
 
3
 
4
using namespace std;
4
using namespace std;
5
using namespace CGLA;
5
using namespace CGLA;
6
 
6
 
7
template<class BoxType>
7
namespace Geometry
8
void BoundingINode<BoxType>::draw(int l, int lmax) const
-
 
9
{
8
{
10
	if(l==lmax)
-
 
11
		{
-
 
12
			gl_draw(); 
-
 
13
			return;
-
 
14
		}
-
 
15
	left->draw(l+1,lmax);
-
 
16
	right->draw(l+1,lmax);
-
 
17
}
-
 
18
 
9
 
19
template<class BoxType>
10
template<class BoxType>
20
int BoundingINode<BoxType>::intersect_cnt(const CGLA::Vec3f& p , 
11
int BoundingINode<BoxType>::intersect_cnt(const CGLA::Vec3f& p , 
21
																 const CGLA::Vec3f& dir) const
12
																 const CGLA::Vec3f& dir) const
22
{
13
{
Line 33... Line 24...
33
															float& tmin) const 
24
															float& tmin) const 
34
{
25
{
35
	if(!BoxType::intersect(p,dir))
26
	if(!BoxType::intersect(p,dir))
36
		return false;
27
		return false;
37
 
28
 
38
	float tminl=1e33, tminr=1e33;
29
	float tminl=1.0e33f, tminr=1.0e33f;
39
	bool li = left->intersect(p,dir,tminl);
30
	bool li = left->intersect(p,dir,tminl);
40
	bool ri = right->intersect(p,dir,tminr);
31
	bool ri = right->intersect(p,dir,tminr);
41
	if(li||ri)
32
	if(li||ri)
42
		{
33
		{
43
			tmin = min(tminl,tminr);
34
			tmin = min(tminl,tminr);
Line 47... Line 38...
47
}
38
}
48
 
39
 
49
 
40
 
50
 template BoundingINode<AABox>;
41
 template BoundingINode<AABox>;
51
template BoundingINode<OBox>;
42
template BoundingINode<OBox>;
-
 
43
 
-
 
44
}
52
 
45