source: GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.cpp @ 2582

Revision 2582, 2.4 KB checked in by bittner, 16 years ago (diff)

Havran Ray Caster compiles and links, but still does not work

Line 
1#include "Intersectable.h"
2#include "SimpleRay.h"
3
4using namespace std;
5
6#if _WIN32
7#define ALIGN16 __declspec(align(16))
8#else
9#ifdef USE_HAVRAN_RAYCASTER
10#include "ktbconf.h"
11#define ALIGN16 GALIGN16
12#else
13#define ALIGN16
14#endif
15#endif
16
17namespace GtpVisibilityPreprocessor {
18
19
20// This is the result of computing intersection
21// static data member
22  ALIGN16  IntersectionStr
23  SimpleRay::IntersectionRes[32];
24
25Intersectable::Intersectable():
26mMailbox(0),
27mBvhLeaf(0),
28mVssRays(NULL),
29mRenderedFrame(0)
30#if STORE_VIEWCELLS_WITH_BVH
31, mViewCells(NULL)
32#endif
33{}
34
35
36
37Intersectable::~Intersectable()
38{
39        DEL_PTR(mVssRays);
40}
41
42
43string Intersectable::GetTypeName(Intersectable *obj)
44{
45        switch(obj->Type())
46        {
47        case MESH_INSTANCE:
48                return "mesh instance";
49        case TRANSFORMED_MESH_INSTANCE:
50                return "transformed mesh instance";
51        case SPHERE:
52                return "sphere";
53        case VIEW_CELL:
54                return "view cell";
55        case OGRE_MESH_INSTANCE:
56                return "ogre_mesh_instance";
57        case KD_INTERSECTABLE:
58                return "kd";
59        case TRIANGLE_INTERSECTABLE:
60                return "triangle";
61        case BVH_INTERSECTABLE:
62                return "bvh";
63        default:
64                return "unknown";
65        }
66}
67
68 
69Vector3 Intersectable::GetNormal(const int idx) const
70{
71        return Vector3(0, 0, 0);
72}
73
74
75VssRayContainer *Intersectable::GetOrCreateRays()
76{
77        if (!mVssRays)
78                mVssRays = new VssRayContainer();
79
80        return mVssRays;
81}
82
83#if STORE_VIEWCELLS_WITH_BVH
84
85ViewCellContainer *Intersectable::GetOrCreateViewCells()
86{
87        if (!mViewCells)
88                mViewCells = new ViewCellContainer();
89
90        return mViewCells;
91}
92
93
94void Intersectable::DelViewCells()
95{
96        DEL_PTR(mViewCells);
97}
98
99#endif
100
101
102void Intersectable::DelRayRefs()
103{
104        DEL_PTR(mVssRays);
105}
106
107
108int Intersectable::GenerateSilhouetteRays(const int nrays,
109                                                                                  const AxisAlignedBox3 &originBox,
110                                                                                  const AxisAlignedBox3 &directionBox,
111                                                                                  VssRayContainer &rays)
112{
113        return 0;
114}
115
116
117int Intersectable::GetRandomSurfacePoint(const float u,
118                                                                                 const float v,
119                                                                                 Vector3 &point,
120                                                                                 Vector3 &normal)
121{
122        cerr << "GetRandomSurfacePoint(u,v...) not yet implemented for type " << Type() << endl;
123        return 1;
124}
125
126
127bool Intersectable::GreaterCounter(const Intersectable *a,
128                                                                   const Intersectable *b)
129{
130        return a->mCounter > b->mCounter;
131}
132
133
134float Intersectable::GetArea() const
135{
136        cerr << "GetArea not implemented yet for this type" << endl;
137        return 0;
138}
139
140
141}
Note: See TracBrowser for help on using the repository browser.