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