1 | #include "Intersectable.h"
|
---|
2 |
|
---|
3 |
|
---|
4 | namespace GtpVisibilityPreprocessor {
|
---|
5 |
|
---|
6 |
|
---|
7 | Intersectable::Intersectable():
|
---|
8 | mMailbox(0),
|
---|
9 | mBvhLeaf(0),
|
---|
10 | mVssRays(NULL)
|
---|
11 | {}
|
---|
12 |
|
---|
13 |
|
---|
14 | Intersectable::~Intersectable()
|
---|
15 | {
|
---|
16 | DEL_PTR(mVssRays);
|
---|
17 | }
|
---|
18 |
|
---|
19 |
|
---|
20 | string Intersectable::GetTypeName(Intersectable *obj)
|
---|
21 | {
|
---|
22 | switch(obj->Type())
|
---|
23 | {
|
---|
24 | case MESH_INSTANCE:
|
---|
25 | return "mesh_instance\n";
|
---|
26 |
|
---|
27 | case TRANSFORMED_MESH_INSTANCE:
|
---|
28 | return "transformed_mesh_instance\n";
|
---|
29 |
|
---|
30 | case SPHERE:
|
---|
31 | return "sphere\n";
|
---|
32 |
|
---|
33 | case VIEW_CELL:
|
---|
34 | return "view cell\n";
|
---|
35 |
|
---|
36 | case OGRE_MESH_INSTANCE:
|
---|
37 | return "ogre_mesh_instance\n";
|
---|
38 |
|
---|
39 | case KD_INTERSECTABLE:
|
---|
40 | return "kd_intersectable\n";
|
---|
41 |
|
---|
42 | default:
|
---|
43 | return "unknown\n";
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 |
|
---|
48 | Vector3 Intersectable::GetNormal(const int idx) const
|
---|
49 | {
|
---|
50 | return Vector3(0, 0, 0);
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 | VssRayContainer *Intersectable::GetOrCreateRays()
|
---|
55 | {
|
---|
56 | if (!mVssRays)
|
---|
57 | mVssRays = new VssRayContainer();
|
---|
58 |
|
---|
59 | return mVssRays;
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|
63 | void Intersectable::DelRayRefs()
|
---|
64 | {
|
---|
65 | DEL_PTR(mVssRays);
|
---|
66 | }
|
---|
67 |
|
---|
68 |
|
---|
69 | int Intersectable::GenerateSilhouetteRays(const int nrays,
|
---|
70 | const AxisAlignedBox3 &originBox,
|
---|
71 | const AxisAlignedBox3 &directionBox,
|
---|
72 | VssRayContainer &rays)
|
---|
73 | {
|
---|
74 | return 0;
|
---|
75 | }
|
---|
76 |
|
---|
77 |
|
---|
78 | int Intersectable::GetRandomSurfacePoint(const float u,
|
---|
79 | const float v,
|
---|
80 | Vector3 &point,
|
---|
81 | Vector3 &normal)
|
---|
82 | {
|
---|
83 | cerr << "GetRandomSurfacePoint(u,v...) not yet implemented" << endl;
|
---|
84 | return 1;
|
---|
85 | }
|
---|
86 |
|
---|
87 |
|
---|
88 | bool Intersectable::GreaterCounter(const Intersectable *a,
|
---|
89 | const Intersectable *b)
|
---|
90 | {
|
---|
91 | return a->mCounter > b->mCounter;
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 | float Intersectable::GetArea() const
|
---|
96 | {
|
---|
97 | cerr << "GetArea not implemented yet" << endl;
|
---|
98 | return 0;
|
---|
99 | }
|
---|
100 |
|
---|
101 |
|
---|
102 | }
|
---|