Line data Source code
1 :
2 : /* Copyright (c) 2006-2011, Stefan Eilemann <eile@equalizergraphics.com>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #ifndef EQSERVER_FRUSTUMDATA_H
19 : #define EQSERVER_FRUSTUMDATA_H
20 :
21 : #include "types.h"
22 : #include <eq/server/api.h>
23 :
24 : #include <eq/fabric/eye.h> // EYE enum
25 : #include <eq/fabric/wall.h> // Wall::Type enum
26 :
27 : namespace eq
28 : {
29 : namespace server
30 : {
31 : /**
32 : * Data derived from fabric::Frustum, in a general, optimized format used
33 : * for frustum calculations during rendering.
34 : */
35 812 : class FrustumData
36 : {
37 : public:
38 : EQSERVER_API FrustumData();
39 :
40 590 : bool isValid() const { return (_width != 0.f && _height != 0.f); }
41 4212 : void invalidate()
42 : {
43 4212 : _width = 0.f;
44 4212 : _height = 0.f;
45 4212 : }
46 :
47 : /** @name Data Update. */
48 : //@{
49 : /** Update the frustum data using the given projection. */
50 : void applyProjection(const fabric::Projection& projection);
51 :
52 : /** Update the frustum data using the given wall. */
53 : EQSERVER_API void applyWall(const fabric::Wall& wall);
54 : //@}
55 :
56 : /** @name Data Access. */
57 : //@{
58 : /** @return the frustum plane transformation */
59 51 : const Matrix4f& getTransform() const { return _xfm; }
60 : /** @return the frustum plane width */
61 35 : float getWidth() const { return _width; }
62 : /** @return the frustum plane height */
63 35 : float getHeight() const { return _height; }
64 : /** @return the projection type. */
65 64 : fabric::Wall::Type getType() const { return _type; }
66 : //@}
67 :
68 : private:
69 : float _width;
70 : float _height;
71 : Matrix4f _xfm;
72 : fabric::Wall::Type _type;
73 : };
74 :
75 : std::ostream& operator<<(std::ostream& os, const FrustumData&);
76 : }
77 : }
78 : #endif // EQ_FRUSTUMDATA_H
|