[145] | 1 | #include "VisibilityInfo.h"
|
---|
| 2 | #include <OgreLogManager.h>
|
---|
| 3 |
|
---|
| 4 | namespace GtpVisibility {
|
---|
| 5 | /****************************************************/
|
---|
| 6 | /* VisibilityInfo implementation */
|
---|
| 7 | /****************************************************/
|
---|
| 8 | VisibilityInfo::VisibilityInfo(const int visiblePixels, const int projectedPixels): |
---|
| 9 | mProjectedPixels(projectedPixels), mVisiblePixels(visiblePixels) |
---|
| 10 | {
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | //-----------------------------------------------------------------------
|
---|
| 14 | int VisibilityInfo::GetVisiblePixels() const |
---|
| 15 | { |
---|
| 16 | return mVisiblePixels; |
---|
| 17 | } |
---|
| 18 | //----------------------------------------------------------------------- |
---|
| 19 | int VisibilityInfo::GetProjectedPixels() const |
---|
| 20 | { |
---|
| 21 | return mProjectedPixels; |
---|
| 22 | } |
---|
| 23 | //----------------------------------------------------------------------- |
---|
| 24 | void VisibilityInfo::SetVisiblePixels(int vis) |
---|
| 25 | { |
---|
| 26 | mVisiblePixels = vis; |
---|
| 27 | } |
---|
| 28 | //----------------------------------------------------------------------- |
---|
| 29 | void VisibilityInfo::SetProjectedPixels(int vis) |
---|
| 30 | { |
---|
| 31 | mProjectedPixels = vis; |
---|
| 32 | } |
---|
| 33 | //----------------------------------------------------------------------- |
---|
| 34 | float VisibilityInfo::ComputeRelativeVisibility() |
---|
| 35 | { |
---|
| 36 | if (!mProjectedPixels) |
---|
| 37 | return 0; |
---|
| 38 | |
---|
| 39 | return (float)mVisiblePixels / (float)mProjectedPixels; |
---|
| 40 | } |
---|
| 41 | //----------------------------------------------------------------------- |
---|
| 42 | void VisibilityInfo::AddVisibility(const VisibilityInfo &info) |
---|
| 43 | { |
---|
| 44 | mVisiblePixels += info.GetVisiblePixels(); |
---|
| 45 | mProjectedPixels += info.GetProjectedPixels(); |
---|
| 46 | } |
---|
[150] | 47 | //----------------------------------------------------------------------- |
---|
| 48 | void VisibilityInfo::AddVisibility(const int visiblePixels, const int projectedPixels) |
---|
| 49 | { |
---|
| 50 | mVisiblePixels +=visiblePixels; |
---|
[153] | 51 | mProjectedPixels += projectedPixels; |
---|
[150] | 52 | } |
---|
| 53 |
|
---|
[145] | 54 | /****************************************************/
|
---|
| 55 | /* NodeInfo implementation */
|
---|
| 56 | /****************************************************/ |
---|
[150] | 57 | |
---|
| 58 | |
---|
[145] | 59 | //-----------------------------------------------------------------------
|
---|
| 60 | NodeInfo::NodeInfo(HierarchyNode *node, const int visiblePixels, const int projectedPixels): |
---|
| 61 | VisibilityInfo(visiblePixels, projectedPixels), mNode(node) |
---|
| 62 | {} |
---|
| 63 | //----------------------------------------------------------------------- |
---|
| 64 | void NodeInfo::SetNode(HierarchyNode *node) |
---|
| 65 | { |
---|
| 66 | mNode = node; |
---|
| 67 | } |
---|
| 68 | //----------------------------------------------------------------------- |
---|
| 69 | HierarchyNode *NodeInfo::GetNode() const |
---|
| 70 | { |
---|
| 71 | return mNode; |
---|
| 72 | } |
---|
| 73 | /****************************************************/
|
---|
| 74 | /* MeshInfo implementation */
|
---|
| 75 | /****************************************************/ |
---|
| 76 | //----------------------------------------------------------------------- |
---|
| 77 | MeshInfo::MeshInfo(Mesh *mesh, const int visiblePixels, const int projectedPixels): |
---|
| 78 | VisibilityInfo(visiblePixels, projectedPixels), mMesh(mesh) |
---|
| 79 | {}
|
---|
| 80 | //----------------------------------------------------------------------- |
---|
| 81 | void MeshInfo::SetMesh(Mesh *mesh) |
---|
| 82 | { |
---|
| 83 | mMesh = mesh; |
---|
| 84 | } |
---|
| 85 | //----------------------------------------------------------------------- |
---|
| 86 | Mesh *MeshInfo::GetMesh() const |
---|
| 87 | { |
---|
| 88 | return mMesh; |
---|
| 89 | } |
---|
[159] | 90 | |
---|
| 91 | /****************************************************/
|
---|
| 92 | /* PatchInfo implementation */
|
---|
| 93 | /****************************************************/ |
---|
| 94 | //----------------------------------------------------------------------- |
---|
| 95 | PatchInfo::PatchInfo(Patch *patch, const int visiblePixels, const int projectedPixels): |
---|
| 96 | VisibilityInfo(visiblePixels, projectedPixels), mPatch(patch) |
---|
| 97 | {}
|
---|
| 98 | //----------------------------------------------------------------------- |
---|
| 99 | void PatchInfo::SetPatch(Patch *patch) |
---|
| 100 | { |
---|
| 101 | mPatch = patch; |
---|
| 102 | } |
---|
| 103 | //----------------------------------------------------------------------- |
---|
| 104 | Patch *PatchInfo::GetPatch() const |
---|
| 105 | { |
---|
| 106 | return mPatch; |
---|
| 107 | } |
---|
[145] | 108 | }// namespace GtpVisibility |
---|