source: trunk/VUT/GtpVisibility/src/VisibilityInfo.cpp @ 171

Revision 171, 3.6 KB checked in by mattausch, 19 years ago (diff)

fixed visibilityQueries

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