|
From: <axl...@us...> - 2009-07-05 21:15:50
|
Revision: 409
http://hgengine.svn.sourceforge.net/hgengine/?rev=409&view=rev
Author: axlecrusher
Date: 2009-07-05 21:15:50 +0000 (Sun, 05 Jul 2009)
Log Message:
-----------
commit what I have done before I mess it up
Modified Paths:
--------------
Mercury2/src/BoundingBox.cpp
Mercury2/src/BoundingBox.h
Mercury2/src/HGMDLModel.cpp
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryNode.h
Modified: Mercury2/src/BoundingBox.cpp
===================================================================
--- Mercury2/src/BoundingBox.cpp 2009-07-05 15:48:11 UTC (rev 408)
+++ Mercury2/src/BoundingBox.cpp 2009-07-05 21:15:50 UTC (rev 409)
@@ -109,13 +109,13 @@
return !inView;
}
-bool BoundingBox::FrustumCull() const
-{
+//bool BoundingBox::FrustumCull() const
+//{
/*feedback in openGL is probably depreciated
and is known to fallback to software
the OcclusionTest provides the same performence
it is probably best to avoid using this function */
-
+/*
static float b[3];
uint32_t samples;
const float* center = GetCenter();
@@ -161,9 +161,18 @@
// return false;
return samples==0;
}
+*/
+bool BoundingBox::DoFrustumTest( const MercuryMatrix& m )
+{
+ BoundingBox bb(*this);
+ bb.Transform( m );
+ return false;
+}
+
void BoundingBox::DoOcclusionTest( OcclusionResult& result )
{
+ return;
const float* center = GetCenter();
const float* extend = GetExtend();
Modified: Mercury2/src/BoundingBox.h
===================================================================
--- Mercury2/src/BoundingBox.h 2009-07-05 15:48:11 UTC (rev 408)
+++ Mercury2/src/BoundingBox.h 2009-07-05 21:15:50 UTC (rev 409)
@@ -42,8 +42,7 @@
virtual bool Clip( const MercuryPlane& p ) = 0;
virtual bool Clip( const Frustum& f ) = 0;
- virtual bool FrustumCull() const = 0; //Do not use
-// virtual bool OcclusionCull() const = 0;
+ virtual bool DoFrustumTest( const MercuryMatrix& m ) = 0;
/** This uses openGL to do an occlusion test in hardware.
The answer is not immediately known, but this can be run on the GPU
@@ -85,8 +84,7 @@
virtual bool Clip( const MercuryPlane& p );
virtual bool Clip( const Frustum& f );
- virtual bool FrustumCull() const; //Do not use
-// virtual bool OcclusionCull() const;
+ virtual bool DoFrustumTest( const MercuryMatrix& m );
virtual void DoOcclusionTest(OcclusionResult& result);
private:
Modified: Mercury2/src/HGMDLModel.cpp
===================================================================
--- Mercury2/src/HGMDLModel.cpp 2009-07-05 15:48:11 UTC (rev 408)
+++ Mercury2/src/HGMDLModel.cpp 2009-07-05 21:15:50 UTC (rev 409)
@@ -71,7 +71,7 @@
{
for(uint16_t i = 0; i < m_meshes.size(); ++i)
{
- if ( !node->GetOcclusionResult().IsOccluded() )
+ if ( !(node->GetOcclusionResult().IsOccluded() || node->IsCulled()) )
m_meshes[i]->Render(node);
}
}
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-07-05 15:48:11 UTC (rev 408)
+++ Mercury2/src/MercuryAsset.cpp 2009-07-05 21:15:50 UTC (rev 409)
@@ -41,7 +41,11 @@
{
MercuryNode* n = const_cast<MercuryNode*>(node);
if ( m_boundingVolume )
- m_boundingVolume->DoOcclusionTest( n->GetOcclusionResult() );
+ {
+// n->SetCulled( m_boundingVolume->DoFrustumTest(matrix) );
+ if ( !n->IsCulled() )
+ m_boundingVolume->DoOcclusionTest( n->GetOcclusionResult() );
+ }
}
void MercuryAsset::DrawAxes()
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-07-05 15:48:11 UTC (rev 408)
+++ Mercury2/src/MercuryNode.cpp 2009-07-05 21:15:50 UTC (rev 409)
@@ -14,7 +14,7 @@
REGISTER_NODE_TYPE(MercuryNode);
MercuryNode::MercuryNode()
- :m_parent(NULL), m_prevSibling(NULL), m_nextSibling(NULL), m_hidden(false), m_useAlphaPath(false)
+ :m_parent(NULL), m_prevSibling(NULL), m_nextSibling(NULL), m_hidden(false), m_useAlphaPath(false), m_culled(false)
{
}
@@ -146,7 +146,7 @@
void MercuryNode::RecursiveRender()
{
- if ( IsHidden() || m_occlusionResult.IsOccluded() ) return;
+ if ( IsHidden() || m_occlusionResult.IsOccluded() || IsCulled() ) return;
MercuryMatrix matrix = FindGlobalMatrix();
MercuryMatrix modelView = ManipulateMatrix( matrix );
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-07-05 15:48:11 UTC (rev 408)
+++ Mercury2/src/MercuryNode.h 2009-07-05 21:15:50 UTC (rev 409)
@@ -91,8 +91,10 @@
const MercuryMatrix& FindGlobalMatrix() const;
virtual bool IsCulled(const MercuryMatrix& matrix);
- bool IsHidden() { return m_hidden; }
+ inline bool IsHidden() { return m_hidden; }
+ inline void SetCulled(bool t) { m_culled = t; }
+ inline bool IsCulled() const { return m_culled; }
virtual MercuryMatrix ManipulateMatrix(const MercuryMatrix& matrix);
inline OcclusionResult& GetOcclusionResult() { return m_occlusionResult; }
@@ -105,8 +107,10 @@
static bool m_rebuildRenderGraph;
MString m_name;
+
bool m_hidden;
bool m_useAlphaPath;
+ bool m_culled;
private:
bool IsInAssetList(MercuryAsset* asset) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|