File: NopVolumeTest.h

package info (click to toggle)
darkradiant 3.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,080 kB
  • sloc: cpp: 264,743; ansic: 10,659; python: 1,852; xml: 1,650; sh: 92; makefile: 21
file content (107 lines) | stat: -rw-r--r-- 1,783 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#pragma once

#include "ivolumetest.h"
#include "math/Matrix4.h"

namespace render
{

/**
 * greebo: This is a minimal VolumeTest implementation which
 * returns true in all test cases. All matrices are identity
 * unless they're set to something different.
 */
class NopVolumeTest :
	public VolumeTest
{
private:
	Matrix4 _viewPort;
	Matrix4 _projection;
	Matrix4 _modelView;
	Matrix4 _viewProjection;

public:
	NopVolumeTest() :
		_viewPort(Matrix4::getIdentity()),
		_projection(Matrix4::getIdentity()),
		_modelView(Matrix4::getIdentity()),
		_viewProjection(Matrix4::getIdentity())
	{}

	bool TestPoint(const Vector3& point) const
	{ 
		return true; 
	}

	bool TestLine(const Segment& segment) const
	{ 
		return true;
	}

	bool TestPlane(const Plane3& plane) const
	{ 
		return true;
	}

	bool TestPlane(const Plane3& plane, const Matrix4& localToWorld) const 
	{ 
		return true;
	}

	VolumeIntersectionValue TestAABB(const AABB& aabb) const
	{ 
		return VOLUME_INSIDE; 
	}

	VolumeIntersectionValue TestAABB(const AABB& aabb, const Matrix4& localToWorld) const
	{
		return VOLUME_INSIDE;
	}

	virtual bool fill() const
	{ 
		return true;
	}

	virtual const Matrix4& GetViewProjection() const
	{
		return _viewProjection;
	}

	virtual const Matrix4& GetViewport() const
	{
		return _viewPort;
	}

	virtual const Matrix4& GetProjection() const
	{
		return _projection;
	}

	virtual const Matrix4& GetModelview() const
	{
		return _modelView;
	}

	void setViewPort(const Matrix4& matrix)
	{
		_viewPort = matrix;
	}

	void setProjection(const Matrix4& matrix)
	{
		_projection = matrix;
	}

	void setModelView(const Matrix4& matrix)
	{
		_modelView = matrix;
	}

    void setViewProjection(const Matrix4& matrix)
	{
        _viewProjection = matrix;
	}
};

} // namespace render