Index: trunk/VUT/GtpVisibility/include/VisibilityInfo.h
===================================================================
--- trunk/VUT/GtpVisibility/include/VisibilityInfo.h	(revision 144)
+++ trunk/VUT/GtpVisibility/include/VisibilityInfo.h	(revision 145)
@@ -9,54 +9,60 @@
 namespace GtpVisibility {
   
-/** Class storing the visibility information of a scene node. 
+/** Class storing visibility information.
 */
-class NodeInfo 
+class VisibilityInfo
 {
 public:
-    NodeInfo(HierarchyNode *node, const int projectedPixels, const int visiblePixels): 
-	mNode(node)//, mProjectedPixels(projectedPixels), mVisiblePixels(visiblePixels) 
-	{}
+	VisibilityInfo(const int visiblePixels, const int projectedPixels);
 
-	int GetVisiblePixels() const {return mVisiblePixels;}
-	int GetProjectedPixels() const {return mProjectedPixels;}
+	int GetVisiblePixels() const;
+	int GetProjectedPixels() const;
 
-	void SetVisiblePixels(int vis) {mVisiblePixels = vis;}
-	void SetProjectedPixels(int vis) {mProjectedPixels = vis;}
+	void SetVisiblePixels(int vis);
+	void SetProjectedPixels(int vis);
+	
+	/** Computes ratio of visible to projected pixels. */
+	float ComputeRelativeVisibility();
 
-	void SetNode(HierarchyNode *node) {mNode = node;}
-	HierarchyNode *GetNode() const {return mNode;}
+	/** Adds visibility to current visibility information.
+	*/
+	void AddVisibility(const VisibilityInfo &info);
 
-	float ComputeRelativeVisibility() { float result = mVisiblePixels; if (mProjectedPixels) result /= (float)mProjectedPixels; return result;}
+
+protected:
+	/** number of visible pixels. */
+    int mVisiblePixels;
+	/** number of projected pixels */
+	int mProjectedPixels;
+};
+/** Class storing the visibility information of a hierarchy node. 
+*/
+class NodeInfo: public VisibilityInfo
+{
+public:
+    NodeInfo(HierarchyNode *node, const int visiblePixels, const int projectedPixels);
+
+	void SetNode(HierarchyNode *node);
+	HierarchyNode *GetNode() const;
 	//bool operator<(const NodeInfo& rhs) const {return mNode < rhs.mNode;}
 
 protected:
 
-    /** pointer to the scene node */
+    /** Pointer to the hierarchy nnode.
+	*/
     HierarchyNode *mNode;
-    
-    int mVisiblePixels;
-	int mProjectedPixels;
 };
   
 /** Class storing the visibility information of a mesh.
 */
-class MeshInfo 
+class MeshInfo: public VisibilityInfo
 {
 public:
-	MeshInfo(Mesh *mesh,  const int projectedPixels, const int visiblePixels): 
-	mMesh(mesh), mProjectedPixels(projectedPixels), mVisiblePixels(visiblePixels) 
-	{}
+	MeshInfo(Mesh *mesh, const int visiblePixels, const int projectedPixels);
 
-	int GetVisiblePixels() const {return mVisiblePixels;}
-	int GetProjectedPixels() const {return mProjectedPixels;}
+	Mesh *GetMesh() const;
+	void SetMesh(Mesh *mesh);
 
-	void SetVisiblePixels(float vis) { mVisiblePixels = vis;}
-	void SetProjectedPixels(float vis) { mProjectedPixels = vis;}
-
-	Mesh *GetMesh() const {return mMesh;}
-	void SetMesh(Mesh *mesh) {mMesh = mesh;}
-
-	bool operator<(const MeshInfo& rhs) const {return mMesh < rhs.mMesh;}
-	//bool operator>(const MeshInfo& rhs) const {return mMesh > rhs.mMesh;}
+	//bool operator<(const MeshInfo& rhs) const {return mMesh < rhs.mMesh;}
 	//bool operator==(const MeshInfo& rhs) const {return mMesh == rhs.mMesh;}
 	
@@ -66,7 +72,4 @@
 	*/
     Mesh *mMesh;
-  
-    int mVisiblePixels;
-	int mProjectedPixels;
 };
   
Index: trunk/VUT/GtpVisibility/src/VisibilityInfo.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/VisibilityInfo.cpp	(revision 145)
+++ trunk/VUT/GtpVisibility/src/VisibilityInfo.cpp	(revision 145)
@@ -0,0 +1,81 @@
+#include "VisibilityInfo.h"
+#include <OgreLogManager.h>
+
+namespace GtpVisibility {
+/****************************************************/
+/*           VisibilityInfo implementation          */
+/****************************************************/
+VisibilityInfo::VisibilityInfo(const int visiblePixels, const int projectedPixels): 
+mProjectedPixels(projectedPixels), mVisiblePixels(visiblePixels) 
+{
+}
+
+//-----------------------------------------------------------------------
+int VisibilityInfo::GetVisiblePixels() const 
+{
+	return mVisiblePixels;
+}
+//-----------------------------------------------------------------------
+int VisibilityInfo::GetProjectedPixels() const 
+{
+	return mProjectedPixels;
+}
+//-----------------------------------------------------------------------
+void VisibilityInfo::SetVisiblePixels(int vis) 
+{
+	mVisiblePixels = vis;
+}
+//-----------------------------------------------------------------------
+void VisibilityInfo::SetProjectedPixels(int vis) 
+{
+	mProjectedPixels = vis;
+}
+//-----------------------------------------------------------------------
+float VisibilityInfo::ComputeRelativeVisibility() 
+{ 
+	if (!mProjectedPixels) 
+		return 0;
+
+	return (float)mVisiblePixels / (float)mProjectedPixels; 
+}
+//-----------------------------------------------------------------------
+void VisibilityInfo::AddVisibility(const VisibilityInfo &info)
+{
+	mVisiblePixels += info.GetVisiblePixels();
+	mProjectedPixels += info.GetProjectedPixels();
+}
+/****************************************************/
+/*              NodeInfo implementation             */
+/****************************************************/
+//-----------------------------------------------------------------------
+NodeInfo::NodeInfo(HierarchyNode *node, const int visiblePixels, const int projectedPixels): 
+VisibilityInfo(visiblePixels, projectedPixels), mNode(node) 
+{}
+//-----------------------------------------------------------------------
+void NodeInfo::SetNode(HierarchyNode *node) 
+{
+	mNode = node;
+}
+//-----------------------------------------------------------------------	
+HierarchyNode *NodeInfo::GetNode() const 
+{
+	return mNode;
+}
+/****************************************************/
+/*              MeshInfo implementation             */
+/****************************************************/
+//-----------------------------------------------------------------------
+MeshInfo::MeshInfo(Mesh *mesh, const int visiblePixels, const int projectedPixels): 
+VisibilityInfo(visiblePixels, projectedPixels), mMesh(mesh) 
+{}
+//-----------------------------------------------------------------------
+void MeshInfo::SetMesh(Mesh *mesh) 
+{
+	mMesh = mesh;
+}
+//-----------------------------------------------------------------------	
+Mesh *MeshInfo::GetMesh() const 
+{
+	return mMesh;
+}
+}// namespace GtpVisibility
