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

RevLine 
[2066]1#include "Intersectable.h"
[2575]2#include "SimpleRay.h"
[2066]3
[2176]4using namespace std;
[2066]5
[2575]6#if _WIN32
7#define ALIGN16 __declspec(align(16))
8#else
[2582]9#ifdef USE_HAVRAN_RAYCASTER
10#include "ktbconf.h"
11#define ALIGN16 GALIGN16
12#else
13#define ALIGN16
[2575]14#endif
[2582]15#endif
[2176]16
[2066]17namespace GtpVisibilityPreprocessor {
18
19
[2575]20// This is the result of computing intersection
21// static data member
22  ALIGN16  IntersectionStr
23  SimpleRay::IntersectionRes[32];
24
[2066]25Intersectable::Intersectable():
26mMailbox(0),
27mBvhLeaf(0),
[2543]28mVssRays(NULL),
29mRenderedFrame(0)
[2198]30#if STORE_VIEWCELLS_WITH_BVH
31, mViewCells(NULL)
32#endif
[2066]33{}
34
35
[2575]36
[2066]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:
[2538]48                return "mesh instance";
[2066]49        case TRANSFORMED_MESH_INSTANCE:
[2538]50                return "transformed mesh instance";
[2066]51        case SPHERE:
[2538]52                return "sphere";
[2066]53        case VIEW_CELL:
[2538]54                return "view cell";
[2066]55        case OGRE_MESH_INSTANCE:
[2538]56                return "ogre_mesh_instance";
[2066]57        case KD_INTERSECTABLE:
[2538]58                return "kd";
59        case TRIANGLE_INTERSECTABLE:
60                return "triangle";
61        case BVH_INTERSECTABLE:
62                return "bvh";
[2066]63        default:
[2538]64                return "unknown";
[2066]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
[2198]83#if STORE_VIEWCELLS_WITH_BVH
[2066]84
[2198]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
[2066]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{
[2231]122        cerr << "GetRandomSurfacePoint(u,v...) not yet implemented for type " << Type() << endl;
[2066]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{
[2206]136        cerr << "GetArea not implemented yet for this type" << endl;
[2066]137        return 0;
138}
139
140
141}
Note: See TracBrowser for help on using the repository browser.