Revision 239,
1.4 KB
checked in by mattausch, 19 years ago
(diff) |
removed debug stuff. viewcell insertion working
|
Rev | Line | |
---|
[235] | 1 | #include "ViewCell.h"
|
---|
| 2 | #include "Mesh.h"
|
---|
| 3 | #include "MeshKdTree.h"
|
---|
| 4 | #include "Triangle3.h"
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | ViewCell::ViewCell(Mesh *mesh): mMesh(mesh), mPvs(NULL) |
---|
| 8 | { |
---|
| 9 | } |
---|
| 10 | |
---|
| 11 | Mesh *ViewCell::GetMesh() |
---|
| 12 | { |
---|
| 13 | return mMesh; |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | BspPvs *ViewCell::GetPVS() |
---|
| 17 | { |
---|
| 18 | return mPvs; |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | AxisAlignedBox3 ViewCell::GetBox()
|
---|
| 22 | {
|
---|
| 23 | return mMesh->mBox;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | int ViewCell::CastRay(Ray &ray)
|
---|
| 27 | {
|
---|
| 28 | return 0;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | bool ViewCell::IsConvex() |
---|
| 32 | { |
---|
| 33 | return mMesh->mIsConvex; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | bool ViewCell::IsWatertight() |
---|
| 37 | { |
---|
| 38 | return mMesh->mIsWatertight; |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | float ViewCell::IntersectionComplexity() |
---|
| 42 | { |
---|
[239] | 43 | return (float)mMesh->mFaces.size(); |
---|
[235] | 44 | } |
---|
| 45 | |
---|
| 46 | int ViewCell::Type() const
|
---|
| 47 | {
|
---|
| 48 | return VIEWCELL;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | void ViewCell::GetRandomSurfacePoint(Vector3 &point, Vector3 &normal)
|
---|
| 52 | {
|
---|
| 53 | point = Vector3(0,0,0);
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | void ViewCell::DeriveViewCells(const ObjectContainer &objects,
|
---|
| 57 | ViewCellContainer &viewCells,
|
---|
[239] | 58 | const int maxViewCells)
|
---|
[235] | 59 | {
|
---|
[237] | 60 | // maximal max viewcells
|
---|
[239] | 61 | int limit = maxViewCells > 0 ? std::min((int)objects.size(), maxViewCells) : (int)objects.size();
|
---|
[237] | 62 |
|
---|
[239] | 63 | for (int i = 0; i < limit; ++i)
|
---|
[235] | 64 | {
|
---|
| 65 | Intersectable *object = objects[i];
|
---|
| 66 |
|
---|
| 67 | // extract the mesh instances
|
---|
| 68 | if (object->Type() == Intersectable::MESH_INSTANCE)
|
---|
| 69 | {
|
---|
| 70 | MeshInstance *inst = dynamic_cast<MeshInstance *>(object);
|
---|
| 71 |
|
---|
| 72 | ViewCell *viewCell = new ViewCell(inst->GetMesh());
|
---|
| 73 | viewCells.push_back(viewCell);
|
---|
| 74 | }
|
---|
[237] | 75 | //TODO: transformed meshes
|
---|
[235] | 76 | }
|
---|
| 77 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.