Revision 240,
1.6 KB
checked in by mattausch, 19 years ago
(diff) |
added dome bsp tree stuff
|
Line | |
---|
1 | #include <iostream>
|
---|
2 | using namespace std;
|
---|
3 | #include "Pvs.h"
|
---|
4 |
|
---|
5 | KdPvsData *
|
---|
6 | KdPvs::Find(KdNode *node)
|
---|
7 | {
|
---|
8 | KdPvsMap::iterator i = mEntries.find(node);
|
---|
9 | if (i != mEntries.end()) {
|
---|
10 | // cout<<node<<" "<<(*i).first<<" "<<(*i).second.mVisibleSamples<<endl;
|
---|
11 | return &(*i).second;
|
---|
12 | } else
|
---|
13 | return NULL;
|
---|
14 | }
|
---|
15 |
|
---|
16 | int
|
---|
17 | KdPvs::AddNodeSample(KdNode *node)
|
---|
18 | {
|
---|
19 | int result;
|
---|
20 |
|
---|
21 | KdPvsData *data = Find(node);
|
---|
22 | if (data) {
|
---|
23 | data->mVisibleSamples++;
|
---|
24 | result = 0;
|
---|
25 | } else {
|
---|
26 | mEntries[node] = KdPvsData(1);
|
---|
27 | result = 1;
|
---|
28 | }
|
---|
29 | return result;
|
---|
30 | }
|
---|
31 |
|
---|
32 |
|
---|
33 | void
|
---|
34 | KdPvs::GetData(const int index,
|
---|
35 | KdNode *&node,
|
---|
36 | KdPvsData &data
|
---|
37 | )
|
---|
38 | {
|
---|
39 | KdPvsMap::iterator i = mEntries.begin();
|
---|
40 | for (int k = 0; k!=index && i != mEntries.end(); i++, k++);
|
---|
41 | node = (*i).first;
|
---|
42 | data = (*i).second;
|
---|
43 | }
|
---|
44 |
|
---|
45 | BspPvsData *BspPvs::Find(BspNode *node)
|
---|
46 | {
|
---|
47 | BspPvsMap::iterator i = mEntries.find(node);
|
---|
48 |
|
---|
49 | if (i != mEntries.end())
|
---|
50 | {
|
---|
51 | // cout<<node<<" "<<(*i).first<<" "<<(*i).second.mVisibleSamples<<endl;
|
---|
52 | return &(*i).second;
|
---|
53 | }
|
---|
54 | else
|
---|
55 | return NULL;
|
---|
56 | }
|
---|
57 |
|
---|
58 | // TODO: Get common ancestor for bsp and kd tree (HierarchyNode)
|
---|
59 | int BspPvs::AddNodeSample(BspNode *node)
|
---|
60 | {
|
---|
61 | int result;
|
---|
62 |
|
---|
63 | BspPvsData *data = Find(node);
|
---|
64 |
|
---|
65 | if (data)
|
---|
66 | {
|
---|
67 | data->mVisibleSamples ++;
|
---|
68 | result = 0;
|
---|
69 | }
|
---|
70 | else
|
---|
71 | {
|
---|
72 | mEntries[node] = BspPvsData(1);
|
---|
73 | result = 1;
|
---|
74 | }
|
---|
75 |
|
---|
76 | return result;
|
---|
77 | }
|
---|
78 |
|
---|
79 |
|
---|
80 | void BspPvs::GetData(const int index, BspNode *&node, BspPvsData &data)
|
---|
81 | {
|
---|
82 | BspPvsMap::iterator i = mEntries.begin();
|
---|
83 |
|
---|
84 | for (int k = 0; k!=index && i != mEntries.end(); i++, k++);
|
---|
85 |
|
---|
86 | node = (*i).first;
|
---|
87 | data = (*i).second;
|
---|
88 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.