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

Revision 2575, 2.4 KB checked in by bittner, 17 years ago (diff)

big merge: preparation for havran ray caster, check if everything works

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