author | Radek Brich <radek.brich@devl.cz> |
Sat, 10 May 2008 14:29:37 +0200 | |
branch | pyrit |
changeset 95 | ca7d4c665531 |
parent 94 | 4c8abb8977dc |
child 98 | 64638385798a |
permissions | -rw-r--r-- |
94 | 1 |
/** |
2 |
* @file container.h |
|
3 |
* @brief Spatial container for shapes |
|
44 | 4 |
* |
5 |
* This file is part of Pyrit Ray Tracer. |
|
6 |
* |
|
91 | 7 |
* Copyright 2007, 2008 Radek Brich |
34
28f6e8b9d5d1
quaternion moved to extra header file
Radek Brich <radek.brich@devl.cz>
parents:
24
diff
changeset
|
8 |
* |
44 | 9 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
10 |
* of this software and associated documentation files (the "Software"), to deal |
|
11 |
* in the Software without restriction, including without limitation the rights |
|
12 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
13 |
* copies of the Software, and to permit persons to whom the Software is |
|
14 |
* furnished to do so, subject to the following conditions: |
|
15 |
* |
|
16 |
* The above copyright notice and this permission notice shall be included in |
|
17 |
* all copies or substantial portions of the Software. |
|
18 |
* |
|
19 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
20 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
21 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
22 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
23 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
24 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
25 |
* THE SOFTWARE. |
|
34
28f6e8b9d5d1
quaternion moved to extra header file
Radek Brich <radek.brich@devl.cz>
parents:
24
diff
changeset
|
26 |
*/ |
28f6e8b9d5d1
quaternion moved to extra header file
Radek Brich <radek.brich@devl.cz>
parents:
24
diff
changeset
|
27 |
|
24
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
28 |
#ifndef CONTAINER_H |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
29 |
#define CONTAINER_H |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
30 |
|
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
31 |
#include <vector> |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
32 |
|
78
9569e9f35374
move shapes to extra source file
Radek Brich <radek.brich@devl.cz>
parents:
46
diff
changeset
|
33 |
#include "shapes.h" |
24
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
34 |
|
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
35 |
using namespace std; |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
36 |
|
46 | 37 |
/** |
38 |
* general container |
|
39 |
*/ |
|
24
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
40 |
class Container |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
41 |
{ |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
42 |
protected: |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
43 |
BBox bbox; |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
44 |
public: |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
45 |
ShapeList shapes; |
92
9af5c039b678
add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents:
91
diff
changeset
|
46 |
|
24
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
47 |
Container(): bbox(), shapes() {}; |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
48 |
virtual ~Container() {}; |
92
9af5c039b678
add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents:
91
diff
changeset
|
49 |
|
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
94
diff
changeset
|
50 |
virtual void addShape(const Shape* aShape); |
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
94
diff
changeset
|
51 |
//void addShapeNoExtend(const Shape* aShape) { shapes.push_back(aShape); }; |
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
94
diff
changeset
|
52 |
virtual const Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray, |
24
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
53 |
Float &nearest_distance); |
82
930a2d3ecaed
prepare structures for packet tracing
Radek Brich <radek.brich@devl.cz>
parents:
78
diff
changeset
|
54 |
|
24
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
55 |
virtual void optimize() {}; |
78
9569e9f35374
move shapes to extra source file
Radek Brich <radek.brich@devl.cz>
parents:
46
diff
changeset
|
56 |
|
9569e9f35374
move shapes to extra source file
Radek Brich <radek.brich@devl.cz>
parents:
46
diff
changeset
|
57 |
ShapeList & getShapes() { return shapes; }; |
9569e9f35374
move shapes to extra source file
Radek Brich <radek.brich@devl.cz>
parents:
46
diff
changeset
|
58 |
|
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
94
diff
changeset
|
59 |
virtual ostream & dump(ostream &st) const; |
91 | 60 |
|
92
9af5c039b678
add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents:
91
diff
changeset
|
61 |
#ifndef NO_SIMD |
9af5c039b678
add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents:
91
diff
changeset
|
62 |
virtual void packet_intersection(const Shape* const* origin_shapes, const RayPacket &rays, |
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
94
diff
changeset
|
63 |
Float *nearest_distances, const Shape** nearest_shapes); |
91 | 64 |
#endif |
24
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
65 |
}; |
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
66 |
|
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
67 |
#endif |