Line data Source code
1 :
2 : /* Copyright (c) 2008-2013, 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 : #include "frustum.h"
19 :
20 : #include "config.h"
21 : #include "frustumData.h"
22 :
23 : #include <co/dataIStream.h>
24 : #include <co/dataOStream.h>
25 :
26 : namespace eq
27 : {
28 : namespace server
29 : {
30 4212 : Frustum::Frustum(FrustumData& data)
31 4212 : : _data(data)
32 : {
33 4212 : updateFrustum();
34 4212 : }
35 :
36 0 : Frustum::Frustum(const Frustum& from, FrustumData& data)
37 : : fabric::Frustum(from)
38 0 : , _data(data)
39 : {
40 0 : updateFrustum();
41 0 : }
42 :
43 4282 : void Frustum::updateFrustum()
44 : {
45 4282 : switch (getCurrentType())
46 : {
47 : case TYPE_WALL:
48 70 : _data.applyWall(getWall());
49 70 : break;
50 : case TYPE_PROJECTION:
51 0 : _data.applyProjection(getProjection());
52 0 : break;
53 :
54 : case TYPE_NONE:
55 4212 : _data.invalidate();
56 4212 : break;
57 : default:
58 0 : LBUNREACHABLE;
59 : }
60 4282 : }
61 : }
62 60 : }
|