You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(46) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(185) |
Feb
(242) |
Mar
(237) |
Apr
(180) |
May
(102) |
Jun
(278) |
Jul
(114) |
Aug
(92) |
Sep
(246) |
Oct
(212) |
Nov
(279) |
Dec
(99) |
| 2007 |
Jan
(130) |
Feb
(194) |
Mar
(22) |
Apr
(72) |
May
(40) |
Jun
(111) |
Jul
(114) |
Aug
(154) |
Sep
(114) |
Oct
(2) |
Nov
(1) |
Dec
(5) |
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(51) |
Nov
(34) |
Dec
(130) |
| 2009 |
Jan
(22) |
Feb
(20) |
Mar
(41) |
Apr
(45) |
May
(82) |
Jun
(96) |
Jul
(48) |
Aug
(90) |
Sep
(13) |
Oct
(49) |
Nov
(31) |
Dec
(21) |
| 2010 |
Jan
(25) |
Feb
(9) |
Mar
(7) |
Apr
(28) |
May
(27) |
Jun
(7) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(13) |
Dec
(2) |
| 2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <cn...@us...> - 2009-08-18 22:26:58
|
Revision: 494
http://hgengine.svn.sourceforge.net/hgengine/?rev=494&view=rev
Author: cnlohr
Date: 2009-08-18 22:26:48 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
add the C formatting stuff ( \n => (newline) )
Modified Paths:
--------------
Mercury2/src/MercuryUtil.cpp
Mercury2/src/MercuryUtil.h
Modified: Mercury2/src/MercuryUtil.cpp
===================================================================
--- Mercury2/src/MercuryUtil.cpp 2009-08-18 22:25:48 UTC (rev 493)
+++ Mercury2/src/MercuryUtil.cpp 2009-08-18 22:26:48 UTC (rev 494)
@@ -4,6 +4,85 @@
#include <MercuryVector.h>
#include <MercuryBacktrace.h>
+MString ConvertToCFormat( const MString & ncf )
+{
+ MString ret;
+ const char* nccf = ncf.c_str();
+
+ for ( int i = 0; (unsigned)i < ncf.length(); i++ )
+ {
+ switch ( nccf[i] )
+ {
+ case '\t': ret += "\\t"; break;
+ case '\n': ret += "\\n"; break;
+ case '\r': ret += "\\r"; break;
+ case '\f': ret += "\\f"; break;
+ case '\b': ret += "\\b"; break;
+ case '\\': ret += "\\\\"; break;
+ case '\'': ret += "\\\'"; break;
+ case '\"': ret += "\\\""; break;
+ default:
+ if( nccf[i] < 32 )
+ {
+ ret += "\\";
+ ret += ((unsigned char)nccf[i]/64)%8 + '0';
+ ret += ((unsigned char)nccf[i]/8)%8 + '0';
+ ret += (unsigned char)nccf[i]%8 + '0';
+ } else
+ ret += nccf[i];
+ }
+ }
+ return ret;
+}
+
+MString ConvertToUnformatted( const MString & cf )
+{
+ MString ret;
+ const char* ccf = cf.c_str();
+
+ for ( int i = 0; (unsigned)i < cf.length(); i++ )
+ {
+ switch ( ccf[i] )
+ {
+ case '\\':
+ i++;
+ if ( (unsigned)i >= cf.length() )
+ return ret;
+ switch ( ccf[i] )
+ {
+ case 't': ret += '\t'; break;
+ case 'n': ret += '\n'; break;
+ case 'r': ret += '\r'; break;
+ case 'f': ret += '\f'; break;
+ case 'b': ret += '\b'; break;
+ case '\\': ret += '\\'; break;
+ case '\'': ret += '\''; break;
+ case '\"': ret += '\"'; break;
+ default:
+ if( ccf[i] >= '0' && ccf[i] <= '7' )
+ {
+ char c = ccf[i] - '0';
+ if( ccf[i+1] >= '0' && ccf[i+1] <= '8' )
+ {
+ i++;
+ c = c * 8 + ccf[i] - '0';
+ }
+ if( ccf[i+1] >= '0' && ccf[i+1] <= '8' )
+ {
+ i++;
+ c = c * 8 + ccf[i] - '0';
+ }
+ ret += c;
+ }
+ }
+ break;
+ default:
+ ret += ccf[i];
+ }
+ }
+ return ret;
+}
+
MString ToUpper(const MString& s)
{
MString t = s;
Modified: Mercury2/src/MercuryUtil.h
===================================================================
--- Mercury2/src/MercuryUtil.h 2009-08-18 22:25:48 UTC (rev 493)
+++ Mercury2/src/MercuryUtil.h 2009-08-18 22:26:48 UTC (rev 494)
@@ -124,7 +124,12 @@
///Split given string into other strings using delimiters from termin
void SplitStrings( const MString & in, MVector < MString > & out, const char * termin, const char * whitespace, long termlen, long wslen );
+///Convert string containing binary characters to C-style formatted string.
+MString ConvertToCFormat( const MString & ncf );
+///Convert a C-style formatted string into it's binary string equivalent.
+MString ConvertToUnformatted( const MString & cf );
+
#endif
/* Copyright (c) 2009, Joshua Allen and Charles Lohr
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 22:25:56
|
Revision: 493
http://hgengine.svn.sourceforge.net/hgengine/?rev=493&view=rev
Author: cnlohr
Date: 2009-08-18 22:25:48 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
permit C formatted text
Modified Paths:
--------------
Mercury2/modules/TextNode.cpp
Modified: Mercury2/modules/TextNode.cpp
===================================================================
--- Mercury2/modules/TextNode.cpp 2009-08-18 22:23:26 UTC (rev 492)
+++ Mercury2/modules/TextNode.cpp 2009-08-18 22:25:48 UTC (rev 493)
@@ -336,7 +336,7 @@
void TextNode::SetText( const MString & sText )
{
- m_sText = sText;
+ m_sText = ConvertToUnformatted( sText );
SetDirtyText();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 22:23:35
|
Revision: 492
http://hgengine.svn.sourceforge.net/hgengine/?rev=492&view=rev
Author: cnlohr
Date: 2009-08-18 22:23:26 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
update doxyfile to reflect a more close bit to what we're going
for
Modified Paths:
--------------
Mercury2/docs/Doxyfile
Modified: Mercury2/docs/Doxyfile
===================================================================
--- Mercury2/docs/Doxyfile 2009-08-18 10:41:01 UTC (rev 491)
+++ Mercury2/docs/Doxyfile 2009-08-18 22:23:26 UTC (rev 492)
@@ -105,7 +105,7 @@
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
-FULL_PATH_NAMES = YES
+FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user-defined part of the path. Stripping is
@@ -593,7 +593,7 @@
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
-EXCLUDE =
+EXCLUDE = /home/cnlohr/Mercury2/src/glext.h /home/cnlohr/Mercury2/src/OGLExtensions.cpp /home/cnlohr/Mercury2/src/OGLExtensions.h
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
@@ -997,13 +997,13 @@
# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
-COMPACT_LATEX = NO
+COMPACT_LATEX = YES
# The PAPER_TYPE tag can be used to set the paper type that is used
# by the printer. Possible values are: a4, a4wide, letter, legal and
# executive. If left blank a4wide will be used.
-PAPER_TYPE = a4wide
+PAPER_TYPE = letter
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
@@ -1216,7 +1216,7 @@
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
-EXPAND_ONLY_PREDEF = NO
+EXPAND_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
@@ -1251,7 +1251,7 @@
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED = CLASS_RTTI
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
@@ -1406,7 +1406,7 @@
# documented header file showing the documented files that directly or
# indirectly include this file.
-INCLUDED_BY_GRAPH = YES
+INCLUDED_BY_GRAPH = NO
# If the CALL_GRAPH and HAVE_DOT options are set to YES then
# doxygen will generate a call dependency graph for every global function
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-18 10:41:08
|
Revision: 491
http://hgengine.svn.sourceforge.net/hgengine/?rev=491&view=rev
Author: axlecrusher
Date: 2009-08-18 10:41:01 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
Fix completly broken culling
Modified Paths:
--------------
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryNode.cpp
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-18 05:47:39 UTC (rev 490)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-18 10:41:01 UTC (rev 491)
@@ -6,7 +6,7 @@
extern bool DOOCCLUSIONCULL;
MercuryAsset::MercuryAsset()
- :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE), m_excludeFromCull(true)
+ :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE), m_excludeFromCull(false)
{
}
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-18 05:47:39 UTC (rev 490)
+++ Mercury2/src/MercuryNode.cpp 2009-08-18 10:41:01 UTC (rev 491)
@@ -275,13 +275,16 @@
{
MercuryAssetInstance& mai = *i;
MercuryAsset& a = mai.Asset();
+
if ( !a.ExcludeFromCull() )
- culled = culled && mai.Culled( a.DoCullingTests( mai.GetOcclusionResult(), matrix ) );
- if ( !mai.Culled() )
{
- culled = false;
- a.PreRender(this);
+ mai.Culled( a.DoCullingTests( mai.GetOcclusionResult(), matrix ) );
+ culled = culled && mai.Culled();
}
+
+ if ( a.ExcludeFromCull() ) culled = false; //node must be rendered if something was excluded
+
+ if ( !mai.Culled() ) a.PreRender(this);
}
SetCulled( culled );
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 05:47:46
|
Revision: 490
http://hgengine.svn.sourceforge.net/hgengine/?rev=490&view=rev
Author: cnlohr
Date: 2009-08-18 05:47:39 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
fix memory leak
Modified Paths:
--------------
Mercury2/src/ModuleManager.cpp
Modified: Mercury2/src/ModuleManager.cpp
===================================================================
--- Mercury2/src/ModuleManager.cpp 2009-08-18 05:47:27 UTC (rev 489)
+++ Mercury2/src/ModuleManager.cpp 2009-08-18 05:47:39 UTC (rev 490)
@@ -26,6 +26,7 @@
{
}
+
ModuleManager & ModuleManager::GetInstance()
{
static ModuleManager *instance = NULL;
@@ -53,6 +54,7 @@
MString LoadFunct = child.Attribute( "func" );
LoadModule( ModuleName, LoadFunct );
}
+ delete doc;
}
void ModuleManager::UnloadModule( const MString & ModuleName )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 05:47:34
|
Revision: 489
http://hgengine.svn.sourceforge.net/hgengine/?rev=489&view=rev
Author: cnlohr
Date: 2009-08-18 05:47:27 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
set default for MercuryAsset, to prevent frustration and pulling of hair of future developers, I'm going to make assets by default excluded
from culling
Modified Paths:
--------------
Mercury2/src/MercuryAsset.cpp
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-18 05:39:50 UTC (rev 488)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-18 05:47:27 UTC (rev 489)
@@ -6,7 +6,7 @@
extern bool DOOCCLUSIONCULL;
MercuryAsset::MercuryAsset()
- :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE)
+ :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE), m_excludeFromCull(true)
{
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 05:39:58
|
Revision: 488
http://hgengine.svn.sourceforge.net/hgengine/?rev=488&view=rev
Author: cnlohr
Date: 2009-08-18 05:39:50 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
fix dissappearing textures and assets. The problem is that we're
ignoring if we're actually culled or not, and just letting whatever
happen.
Modified Paths:
--------------
Mercury2/src/MercuryNode.cpp
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-18 05:24:42 UTC (rev 487)
+++ Mercury2/src/MercuryNode.cpp 2009-08-18 05:39:50 UTC (rev 488)
@@ -277,7 +277,11 @@
MercuryAsset& a = mai.Asset();
if ( !a.ExcludeFromCull() )
culled = culled && mai.Culled( a.DoCullingTests( mai.GetOcclusionResult(), matrix ) );
- if ( !mai.Culled() ) a.PreRender(this);
+ if ( !mai.Culled() )
+ {
+ culled = false;
+ a.PreRender(this);
+ }
}
SetCulled( culled );
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 05:24:57
|
Revision: 487
http://hgengine.svn.sourceforge.net/hgengine/?rev=487&view=rev
Author: cnlohr
Date: 2009-08-18 05:24:42 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
add attic
Added Paths:
-----------
Mercury2/attic/
Mercury2/attic/SelfTraversal.txt
Added: Mercury2/attic/SelfTraversal.txt
===================================================================
--- Mercury2/attic/SelfTraversal.txt (rev 0)
+++ Mercury2/attic/SelfTraversal.txt 2009-08-18 05:24:42 UTC (rev 487)
@@ -0,0 +1,135 @@
+(From Charles Lohr)
+
+At one point I was considering stackless traversal of the scene graph for limited sections.
+I chose not to do this in the end due to the limitation of being unable to adaptively change
+it based on which objects are hidden/visible.
+
+This code is below:
+
+void Viewport::GoAll( const float fDtime )
+{
+ MercuryNode * n;
+ int depth = 0;
+
+ if( NeedsRebuild() )
+ {
+ printf( "Xxxx\n" );
+ }
+
+ //Update pass
+ n = this;
+ while( n )
+ {
+ n->Update( fDtime );
+ n = n->TraversalNextNode( this, depth );
+ }
+
+ //Prerender pass
+ n = this;
+ while( n )
+ {
+ //If we're hidden, skip to the next traversable element
+ if( n->IsHidden() )
+ {
+ //Make sure we have a next sibling...
+ while( n && n != this && !n->NextSibling() )
+ {
+ depth--;
+ n = n->Parent();
+ }
+
+ if( !n || n == this )
+ break;
+
+ n = n->NextSibling();
+ }
+
+
+ const MercuryMatrix& matrix = n->FindGlobalMatrix();
+
+ TransformNode * tn = dynamic_cast< TransformNode * >( n );
+ if( tn )
+ tn->HandleMatrixOperations();
+
+ n->PreRender( matrix );
+
+ if( n->Parent() )
+ n->Parent()->SetCulled( n->Parent()->IsCulled() && n->IsCulled() );
+
+ //Traverse next
+/*
+ MercuryNode * ret;
+ if( ret = n->FirstChild() )
+ {
+ depth++;
+ n = ret;
+ }
+ else if( ret = n->NextSibling() )
+ n = ret;
+ else if( ret = n->Parent() )
+ {
+ depth--;
+
+ while( ret && ret != this && !ret->NextSibling() )
+ {
+ depth--;
+ ret = ret->Parent();
+ }
+
+ if( !ret || ret == this )
+ return 0;
+
+ n = ret->m_nextSibling;
+ }
+ else
+ return 0;
+*/
+
+ n = n->TraversalNextNode( this, depth );
+ }
+
+ n = this;
+ while( n )
+ {
+ if( n->IsHidden() || IsCulled() )
+ {
+ //Make sure we have a next sibling...
+ while( n && n != this && !n->NextSibling() )
+ {
+ depth--;
+ n = n->Parent();
+ }
+
+ if( !n || n == this )
+ break;
+
+ n = n->NextSibling();
+ }
+
+ const MercuryMatrix& matrix = n->FindGlobalMatrix();
+ const MercuryMatrix& modelView = n->FindModelViewMatrix(); //get the one computed in the last transform
+
+ glLoadMatrix( modelView );
+
+ ShaderAttribute sa;
+ sa.type = ShaderAttribute::TYPE_MATRIX;
+ sa.value.matrix = matrix.Ptr();
+ Shader::SetAttribute("HG_ModelMatrix", sa);
+
+ if ( n->m_useAlphaPath )
+ CURRENTRENDERGRAPH->AddAlphaNode(n);
+ else
+ n->Render( modelView );
+
+ glLoadMatrix( modelView );
+ Shader::SetAttribute("HG_ModelMatrix", sa);
+
+ if ( !n->m_useAlphaPath )
+ n->PostRender( modelView );
+
+ n = n->TraversalNextNode( this, depth );
+ }
+
+ this->PostRender( FindModelViewMatrix() );
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 05:23:39
|
Revision: 486
http://hgengine.svn.sourceforge.net/hgengine/?rev=486&view=rev
Author: cnlohr
Date: 2009-08-18 05:23:32 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
use Memoized Matrices (Find and remember the location, so we can GetGlobalMatrix instead of FindGlobalMatrix())
Modified Paths:
--------------
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryNode.h
Mercury2/src/RenderGraph.cpp
Mercury2/src/TransformNode.cpp
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-18 05:21:53 UTC (rev 485)
+++ Mercury2/src/MercuryNode.cpp 2009-08-18 05:23:32 UTC (rev 486)
@@ -14,7 +14,9 @@
REGISTER_NODE_TYPE(MercuryNode);
MercuryNode::MercuryNode()
- :m_parent(NULL), m_prevSibling(NULL), m_nextSibling(NULL), m_hidden(false), m_useAlphaPath(false), m_culled(false)
+ :m_parent(NULL), m_prevSibling(NULL),
+ m_nextSibling(NULL), m_hidden(false),
+ m_useAlphaPath(false), m_culled(false)
{
}
@@ -173,7 +175,7 @@
{
if ( IsHidden() ) return;
- const MercuryMatrix& matrix = FindGlobalMatrix();
+ const MercuryMatrix& matrix = GetGlobalMatrix();
PreRender( matrix ); //calls on children assets
@@ -188,8 +190,8 @@
{
if ( IsHidden() || IsCulled() ) return;
- const MercuryMatrix& matrix = FindGlobalMatrix();
- const MercuryMatrix& modelView = FindModelViewMatrix(); //get the one computed in the last transform
+ const MercuryMatrix& matrix = GetGlobalMatrix();
+ const MercuryMatrix& modelView = GetModelViewMatrix(); //get the one computed in the last transform
//A lot of this stuff could be moved into the transform node, BUT
@@ -370,6 +372,8 @@
}
bool MercuryNode::m_rebuildRenderGraph = false;
+__thread int g_iViewportID;
+
/***************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-08-18 05:21:53 UTC (rev 485)
+++ Mercury2/src/MercuryNode.h 2009-08-18 05:23:32 UTC (rev 486)
@@ -27,6 +27,10 @@
while(tn) { if (typeid(x) == typeid(*tn)) return true; tn = *n; } \
return false;}
*/
+
+///The Global Viewport ID for this thread (to enable multi-threaded functioning for Viewports)
+extern __thread int g_iViewportID;
+
class MercuryNode : public MessageHandler
{
public:
@@ -91,18 +95,16 @@
virtual void PreRender(const MercuryMatrix& matrix);
virtual void Render(const MercuryMatrix& matrix);
virtual void PostRender(const MercuryMatrix& matrix);
-
- ///This will get the world space matrix
- const MercuryMatrix& FindGlobalMatrix() const;
- const MercuryMatrix& FindModelViewMatrix() const;
-
+
virtual bool IsCulled(const MercuryMatrix& matrix);
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);
-
+
+ const MercuryMatrix & GetGlobalMatrix() const { return m_pGlobalMatrix[g_iViewportID]; }
+ const MercuryMatrix & GetModelViewMatrix() const { return m_pModelViewMatrix[g_iViewportID]; }
protected:
std::list< MercuryNode* > m_children; //These nodes are unique, not instanced
MercuryNode* m_parent;
@@ -112,13 +114,10 @@
static bool m_rebuildRenderGraph;
MString m_name;
- bool m_hidden;
- public: //XXX: This will become private sooner or later... It is temporarily public for other work.
- bool IsInAssetList(MercuryAsset* asset) const;
+ bool m_hidden;
bool m_useAlphaPath;
-
- private:
bool m_culled;
+ bool IsInAssetList(MercuryAsset* asset) const;
//The asset is actually stored here
std::list< MercuryAssetInstance > m_assets;
@@ -129,6 +128,15 @@
// std::list< MercuryAsset* > m_prerender;
// std::list< MercuryAsset* > m_render;
// std::list< MercuryAsset* > m_postrender;
+
+ ///This will get the world space matrix
+ const MercuryMatrix& FindGlobalMatrix() const;
+ const MercuryMatrix& FindModelViewMatrix() const;
+
+ const MercuryMatrix * m_pGlobalMatrix;
+ const MercuryMatrix * m_pModelViewMatrix;
+
+ friend class RenderGraph;
};
class NodeFactory
Modified: Mercury2/src/RenderGraph.cpp
===================================================================
--- Mercury2/src/RenderGraph.cpp 2009-08-18 05:21:53 UTC (rev 485)
+++ Mercury2/src/RenderGraph.cpp 2009-08-18 05:23:32 UTC (rev 486)
@@ -53,6 +53,10 @@
{
RenderGraphEntry* lastEntry = &entry;
// MercuryNode* rn = MercuryNode::Cast(node);
+
+ //Update the Matrices
+ node->m_pGlobalMatrix = &node->FindGlobalMatrix();
+ node->m_pModelViewMatrix = &node->FindModelViewMatrix();
if ( node )
{
@@ -72,7 +76,7 @@
{
StoreRenderState srs;
srs.Save();
- srs.Matrix = node->FindGlobalMatrix();
+ srs.Matrix = node->GetGlobalMatrix();
srs.Node = node;
MercuryVertex p = srs.Matrix * MercuryVertex(0,0,0,1);
Modified: Mercury2/src/TransformNode.cpp
===================================================================
--- Mercury2/src/TransformNode.cpp 2009-08-18 05:21:53 UTC (rev 485)
+++ Mercury2/src/TransformNode.cpp 2009-08-18 05:23:32 UTC (rev 486)
@@ -20,7 +20,7 @@
{
if ( IsHidden() ) return;
- const MercuryMatrix& matrix = FindGlobalMatrix();
+ const MercuryMatrix& matrix = GetGlobalMatrix();
m_modelView = ManipulateMatrix( matrix );
glLoadMatrix( m_modelView );
@@ -32,7 +32,7 @@
{
if ( IsHidden() ) return;
- const MercuryMatrix& matrix = FindGlobalMatrix();
+ const MercuryMatrix& matrix = GetGlobalMatrix();
m_modelView = ManipulateMatrix( matrix );
glLoadMatrix( m_modelView );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 05:22:13
|
Revision: 485
http://hgengine.svn.sourceforge.net/hgengine/?rev=485&view=rev
Author: cnlohr
Date: 2009-08-18 05:21:53 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
remove recursion method we won't be using
Modified Paths:
--------------
Mercury2/src/Viewport.h
Modified: Mercury2/src/Viewport.h
===================================================================
--- Mercury2/src/Viewport.h 2009-08-18 05:20:25 UTC (rev 484)
+++ Mercury2/src/Viewport.h 2009-08-18 05:21:53 UTC (rev 485)
@@ -12,8 +12,6 @@
public:
Viewport();
- virtual void GoAll( const float fDtime );
-
virtual void PreRender(const MercuryMatrix& matrix);
virtual void Render(const MercuryMatrix& matrix);
virtual void PostRender(const MercuryMatrix& matrix);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 05:20:32
|
Revision: 484
http://hgengine.svn.sourceforge.net/hgengine/?rev=484&view=rev
Author: cnlohr
Date: 2009-08-18 05:20:25 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
remove recursion method we won't be using
Modified Paths:
--------------
Mercury2/src/Mercury2.cpp
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2009-08-18 05:20:06 UTC (rev 483)
+++ Mercury2/src/Mercury2.cpp 2009-08-18 05:20:25 UTC (rev 484)
@@ -77,39 +77,22 @@
timer.Touch();
MESSAGEMAN::GetInstance().PumpMessages( timer.MicrosecondsSinceInit() );
- //If false, use experimental traversal technique.
- if(true)
+ root->RecursiveUpdate( timer.Age() ); //comment to use threads
+
+ CURRENTRENDERGRAPH = &renderGraph;
+ if ( MercuryNode::NeedsRebuild() )
{
- root->RecursiveUpdate( timer.Age() ); //comment to use threads
-
- CURRENTRENDERGRAPH = &renderGraph;
- if ( MercuryNode::NeedsRebuild() )
- {
- renderGraph.Build(root);
- }
-
- w->Clear();
- // renderGraph.Render();
- // RenderableNode::RecursiveRender(root);
- // printf("\n");
- root->RecursivePreRender();
- root->RecursiveRender();
- // renderGraph.RenderAlpha();
- w->SwapBuffers();
+ renderGraph.Build(root);
}
- else
- {
- CURRENTRENDERGRAPH = &renderGraph;
- if ( MercuryNode::NeedsRebuild() )
- {
- renderGraph.Build(root);
- }
- Viewport* vp = (Viewport*)root->FirstChild();
- w->Clear();
- vp->GoAll( timer.Age() );
- w->SwapBuffers();
- }
+ w->Clear();
+// renderGraph.Render();
+// RenderableNode::RecursiveRender(root);
+// printf("\n");
+ root->RecursivePreRender();
+ root->RecursiveRender();
+// renderGraph.RenderAlpha();
+ w->SwapBuffers();
++m_count;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 05:20:15
|
Revision: 483
http://hgengine.svn.sourceforge.net/hgengine/?rev=483&view=rev
Author: cnlohr
Date: 2009-08-18 05:20:06 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
remove the traversal method we're not using
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-08-16 16:44:49 UTC (rev 482)
+++ Mercury2/src/Viewport.cpp 2009-08-18 05:20:06 UTC (rev 483)
@@ -18,135 +18,6 @@
{
}
-void Viewport::GoAll( const float fDtime )
-{
- MercuryNode * n;
- int depth = 0;
-
- if( NeedsRebuild() )
- {
- printf( "Xxxx\n" );
- }
-
- //Update pass
- n = this;
- while( n )
- {
- n->Update( fDtime );
- n = n->TraversalNextNode( this, depth );
- }
-
- //Prerender pass
- n = this;
- while( n )
- {
- //If we're hidden, skip to the next traversable element
- if( n->IsHidden() )
- {
- //Make sure we have a next sibling...
- while( n && n != this && !n->NextSibling() )
- {
- depth--;
- n = n->Parent();
- }
-
- if( !n || n == this )
- break;
-
- n = n->NextSibling();
- }
-
-
- const MercuryMatrix& matrix = n->FindGlobalMatrix();
-
- TransformNode * tn = dynamic_cast< TransformNode * >( n );
- if( tn )
- tn->HandleMatrixOperations();
-
- n->PreRender( matrix );
-
- if( n->Parent() )
- n->Parent()->SetCulled( n->Parent()->IsCulled() && n->IsCulled() );
-
- //Traverse next
-/*
- MercuryNode * ret;
- if( ret = n->FirstChild() )
- {
- depth++;
- n = ret;
- }
- else if( ret = n->NextSibling() )
- n = ret;
- else if( ret = n->Parent() )
- {
- depth--;
-
- while( ret && ret != this && !ret->NextSibling() )
- {
- depth--;
- ret = ret->Parent();
- }
-
- if( !ret || ret == this )
- return 0;
-
- n = ret->m_nextSibling;
- }
- else
- return 0;
-*/
-
- n = n->TraversalNextNode( this, depth );
- }
-
- n = this;
- while( n )
- {
- if( n->IsHidden() || IsCulled() )
- {
- //Make sure we have a next sibling...
- while( n && n != this && !n->NextSibling() )
- {
- depth--;
- n = n->Parent();
- }
-
- if( !n || n == this )
- break;
-
- n = n->NextSibling();
- }
-
- const MercuryMatrix& matrix = n->FindGlobalMatrix();
- const MercuryMatrix& modelView = n->FindModelViewMatrix(); //get the one computed in the last transform
-
- glLoadMatrix( modelView );
-
- ShaderAttribute sa;
- sa.type = ShaderAttribute::TYPE_MATRIX;
- sa.value.matrix = matrix.Ptr();
- Shader::SetAttribute("HG_ModelMatrix", sa);
-
- if ( n->m_useAlphaPath )
- CURRENTRENDERGRAPH->AddAlphaNode(n);
- else
- n->Render( modelView );
-
- glLoadMatrix( modelView );
- Shader::SetAttribute("HG_ModelMatrix", sa);
-
- if ( !n->m_useAlphaPath )
- n->PostRender( modelView );
-
- n = n->TraversalNextNode( this, depth );
- }
-
- this->PostRender( FindModelViewMatrix() );
-
-}
-
-
void Viewport::PreRender(const MercuryMatrix& matrix)
{
FRUSTUM = &m_frustum;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-16 16:44:55
|
Revision: 482
http://hgengine.svn.sourceforge.net/hgengine/?rev=482&view=rev
Author: axlecrusher
Date: 2009-08-16 16:44:49 +0000 (Sun, 16 Aug 2009)
Log Message:
-----------
add texture as asset to fix text texture mapping
Modified Paths:
--------------
Mercury2/modules/TextNode.cpp
Modified: Mercury2/modules/TextNode.cpp
===================================================================
--- Mercury2/modules/TextNode.cpp 2009-08-16 15:34:35 UTC (rev 481)
+++ Mercury2/modules/TextNode.cpp 2009-08-16 16:44:49 UTC (rev 482)
@@ -69,6 +69,7 @@
fprintf( stderr, "Could not create Texture for text.\n" );
return;
}
+ AddAsset( m_kTEX );
}
//Setup FBO and Texture
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-16 15:34:41
|
Revision: 481
http://hgengine.svn.sourceforge.net/hgengine/?rev=481&view=rev
Author: axlecrusher
Date: 2009-08-16 15:34:35 +0000 (Sun, 16 Aug 2009)
Log Message:
-----------
Init was used to add assets to pre and post render. Since that is gone, init does nothing. Init will probably be tranformed into a function to recycle assets.
Modified Paths:
--------------
Mercury2/modules/TextNode.cpp
Modified: Mercury2/modules/TextNode.cpp
===================================================================
--- Mercury2/modules/TextNode.cpp 2009-08-16 15:33:55 UTC (rev 480)
+++ Mercury2/modules/TextNode.cpp 2009-08-16 15:34:35 UTC (rev 481)
@@ -69,7 +69,6 @@
fprintf( stderr, "Could not create Texture for text.\n" );
return;
}
- m_kTEX->Init( this );
}
//Setup FBO and Texture
@@ -306,7 +305,6 @@
}
m_bDirty = false;
- m_kVBO->Init( this );
}
bool TextNode::LoadFont( const MString & sFont )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-16 15:34:04
|
Revision: 480
http://hgengine.svn.sourceforge.net/hgengine/?rev=480&view=rev
Author: axlecrusher
Date: 2009-08-16 15:33:55 +0000 (Sun, 16 Aug 2009)
Log Message:
-----------
Init was used to add assets to pre and post render. Since that is gone, init does nothing. Init will probably be tranformed into a function to recycle assets.
Modified Paths:
--------------
Mercury2/src/Light.cpp
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryNode.cpp
Mercury2/src/RenderBuffer.cpp
Mercury2/src/RenderBuffer.h
Mercury2/src/Shader.cpp
Mercury2/src/Shader.h
Mercury2/src/Texture.cpp
Mercury2/src/Texture.h
Modified: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/Light.cpp 2009-08-16 15:33:55 UTC (rev 480)
@@ -63,7 +63,6 @@
// shader->LoadFromXML( node );
shader->LoadShader(key, 0);
SetShader( shader );
-// shader->Init( this );
}
m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-16 15:33:55 UTC (rev 480)
@@ -15,10 +15,8 @@
SAFE_DELETE(m_boundingVolume);
}
-void MercuryAsset::Init(MercuryNode* node)
+void MercuryAsset::Init()
{
-// if ( node ) node->AddPreRender(this);
-// if ( node ) node->AddRender(this);
}
void MercuryAsset::SetLoadState(LoadState ls)
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/MercuryAsset.h 2009-08-16 15:33:55 UTC (rev 480)
@@ -30,7 +30,7 @@
MercuryAsset();
virtual ~MercuryAsset();
- virtual void Init(MercuryNode* node);
+ virtual void Init();
/** PreRender should be called before any real openGL render commands.
It is used to handles things like frustum culling, and occlusion culling.
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/MercuryNode.cpp 2009-08-16 15:33:55 UTC (rev 480)
@@ -257,7 +257,6 @@
{
asset->LoadFromXML( child );
this->AddAsset( asset );
- asset->Init( this );
}
}
}
Modified: Mercury2/src/RenderBuffer.cpp
===================================================================
--- Mercury2/src/RenderBuffer.cpp 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/RenderBuffer.cpp 2009-08-16 15:33:55 UTC (rev 480)
@@ -17,18 +17,6 @@
if (m_bufferID != 0) glDeleteRenderbuffersEXT(1, &m_bufferID);
}
-void RenderBuffer::Init(MercuryNode* node)
-{
- MercuryAsset::Init( node );
-
- RenderableNode* rn = RenderableNode::Cast( node );
- if ( rn )
- {
-// rn->AddPreRender( this );
- rn->AddPostRender( this );
- }
-}
-
void RenderBuffer::Render(const MercuryNode* node)
{
if ( !m_initiated ) InitRenderBuffer();
Modified: Mercury2/src/RenderBuffer.h
===================================================================
--- Mercury2/src/RenderBuffer.h 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/RenderBuffer.h 2009-08-16 15:33:55 UTC (rev 480)
@@ -18,8 +18,6 @@
RenderBuffer();
virtual ~RenderBuffer();
- virtual void Init(MercuryNode* node);
-
virtual void Render(const MercuryNode* node);
virtual void PostRender(const MercuryNode* node);
virtual void LoadFromXML(const XMLNode& node);
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/Shader.cpp 2009-08-16 15:33:55 UTC (rev 480)
@@ -58,11 +58,6 @@
DestroyShader( );
}
-void Shader::Init(MercuryNode* node)
-{
- MercuryAsset::Init( node );
-}
-
void Shader::Render(const MercuryNode* node)
{
bool bApply = true;
Modified: Mercury2/src/Shader.h
===================================================================
--- Mercury2/src/Shader.h 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/Shader.h 2009-08-16 15:33:55 UTC (rev 480)
@@ -77,7 +77,6 @@
Shader();
virtual ~Shader();
- virtual void Init(MercuryNode* node);
virtual void Render(const MercuryNode* node);
virtual void PostRender(const MercuryNode* node);
static Shader* Generate() { return new Shader; }
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/Texture.cpp 2009-08-16 15:33:55 UTC (rev 480)
@@ -37,11 +37,6 @@
m_textureID = 0;
}
-void Texture::Init(MercuryNode* node)
-{
- MercuryAsset::Init( node );
-}
-
void Texture::LoadFromRaw()
{
if ( !m_raw ) return;
Modified: Mercury2/src/Texture.h
===================================================================
--- Mercury2/src/Texture.h 2009-08-16 13:58:08 UTC (rev 479)
+++ Mercury2/src/Texture.h 2009-08-16 15:33:55 UTC (rev 480)
@@ -12,8 +12,6 @@
void Clean();
- virtual void Init(MercuryNode* node);
-
virtual void Render(const MercuryNode* node);
virtual void PostRender(const MercuryNode* node);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-16 13:58:15
|
Revision: 479
http://hgengine.svn.sourceforge.net/hgengine/?rev=479&view=rev
Author: axlecrusher
Date: 2009-08-16 13:58:08 +0000 (Sun, 16 Aug 2009)
Log Message:
-----------
Change how MercuryNodes handle assets. Asset are still instanced, but instead of MercuryNode storing auto pointers to assets, they store a MercuryAssetInstance. Assets are still instanced, but also allows for per-instance data storage. Perviously no per-instance data was allowed as it would affect all instaces of an asset. This change is useful for culling and occlusion tests.
Also the Prerender, Render, and PostRender lists have been removed. Currently all assets have all 3 render functions executed. This may change in the future.
Modified Paths:
--------------
Mercury2/src/HGMDLMesh.h
Mercury2/src/HGMDLModel.cpp
Mercury2/src/HGMDLModel.h
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryNode.h
Mercury2/src/Shader.cpp
Mercury2/src/Texture.cpp
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/HGMDLMesh.h
===================================================================
--- Mercury2/src/HGMDLMesh.h 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/HGMDLMesh.h 2009-08-16 13:58:08 UTC (rev 479)
@@ -11,6 +11,7 @@
void ReadExtraData(MercuryFile* hgmdl);
void LoadOBB(MercuryFile* hgmdl);
+ OcclusionResult m_occlusionResult;
private:
MString m_name;
bool m_cachable;
Modified: Mercury2/src/HGMDLModel.cpp
===================================================================
--- Mercury2/src/HGMDLModel.cpp 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/HGMDLModel.cpp 2009-08-16 13:58:08 UTC (rev 479)
@@ -60,14 +60,14 @@
}
}
-bool HGMDLModel::DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix)
+bool HGMDLModel::DoCullingTests(OcclusionResult& occlusion, const MercuryMatrix& matrix)
{
bool culled = false;
if ( GetLoadState() != LOADING )
{
culled = true;
for(uint16_t i = 0; i < m_meshes.size(); ++i)
- culled = culled && m_meshes[i]->DoCullingTests(n, matrix);
+ culled = culled && m_meshes[i]->DoCullingTests(m_meshes[i]->m_occlusionResult, matrix);
}
return culled;
}
@@ -85,7 +85,7 @@
{
for(uint16_t i = 0; i < m_meshes.size(); ++i)
{
- if ( !(node->GetOcclusionResult().IsOccluded() || node->IsCulled()) )
+ if ( !(m_meshes[i]->m_occlusionResult.IsOccluded() || node->IsCulled()) )
m_meshes[i]->Render(node);
}
}
Modified: Mercury2/src/HGMDLModel.h
===================================================================
--- Mercury2/src/HGMDLModel.h 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/HGMDLModel.h 2009-08-16 13:58:08 UTC (rev 479)
@@ -19,7 +19,7 @@
static HGMDLModel* Generate();
- virtual bool DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix);
+ virtual bool DoCullingTests(OcclusionResult& occlusion, const MercuryMatrix& matrix);
virtual void PreRender(const MercuryNode* node);
virtual void Render(const MercuryNode* node);
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-16 13:58:08 UTC (rev 479)
@@ -17,9 +17,8 @@
void MercuryAsset::Init(MercuryNode* node)
{
-// RenderableNode* rn;
- if ( node ) node->AddPreRender(this);
- if ( node ) node->AddRender(this);
+// if ( node ) node->AddPreRender(this);
+// if ( node ) node->AddRender(this);
}
void MercuryAsset::SetLoadState(LoadState ls)
@@ -39,14 +38,13 @@
SetLoadState( LOADED );
}
-bool MercuryAsset::DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix)
+bool MercuryAsset::DoCullingTests(OcclusionResult& occlusion, const MercuryMatrix& matrix)
{
bool culled = false;
if ( m_boundingVolume )
{
culled = m_boundingVolume->DoFrustumTest(matrix);
- if ( !culled && DOOCCLUSIONCULL)
- m_boundingVolume->DoOcclusionTest( n->GetOcclusionResult() );
+ if ( !culled && DOOCCLUSIONCULL) m_boundingVolume->DoOcclusionTest( occlusion );
}
return culled;
}
@@ -89,6 +87,11 @@
glEnd();
}
+MercuryAssetInstance::MercuryAssetInstance(MercuryAsset* asset)
+ :m_asset( asset ), m_isCulled( false )
+{
+}
+
AssetFactory& AssetFactory::GetInstance()
{
static AssetFactory* instance = NULL;
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/MercuryAsset.h 2009-08-16 13:58:08 UTC (rev 479)
@@ -52,7 +52,7 @@
inline const MString& Path() const { return m_path; }
///Retuns true if culled, also will initiate occlusion test
- virtual bool DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix);
+ virtual bool DoCullingTests(OcclusionResult& occlusion, const MercuryMatrix& matrix);
void DrawAxes();
inline void SetExcludeFromCull(bool t) { m_excludeFromCull = t; }
@@ -70,6 +70,26 @@
bool m_excludeFromCull;
};
+/** This holds the per-instance data for each asset instance.
+Used in MercuryNode. */
+class MercuryAssetInstance
+{
+ public:
+ MercuryAssetInstance(MercuryAsset* asset);
+ inline MercuryAsset& Asset() { return *m_asset; }
+ inline const MercuryAsset& Asset() const { return *m_asset; }
+ inline const MercuryAsset* AssetPtr() const { return m_asset; }
+
+ inline bool Culled() const { return m_isCulled; }
+ inline bool Culled(bool t) { m_isCulled = t; return m_isCulled; }
+
+ inline OcclusionResult& GetOcclusionResult() { return m_occlusionResult; }
+ private:
+ MAutoPtr< MercuryAsset > m_asset; //actual asset storage
+ OcclusionResult m_occlusionResult;
+ bool m_isCulled;
+};
+
class LoaderThreadData
{
public:
@@ -97,7 +117,7 @@
std::list< std::pair< MString, Callback0R< MAutoPtr<MercuryAsset> > > > m_factoryCallbacks;
- //the actual storage point is in renderable nodes
+ //the actual storage point is in MercuryAssetInstance
static std::map<MString, MercuryAsset*> m_assetInstances;
};
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/MercuryNode.cpp 2009-08-16 13:58:08 UTC (rev 479)
@@ -29,6 +29,11 @@
m_children.clear();
}
+void MercuryNode::AddAsset(MercuryAsset* asset)
+{
+ m_assets.push_back( MercuryAssetInstance(asset) );
+}
+
void MercuryNode::AddChild(MercuryNode* n)
{
// list< MercuryNode* >::iterator last = m_children.end();
@@ -181,7 +186,7 @@
void MercuryNode::RecursiveRender()
{
- if ( IsHidden() || m_occlusionResult.IsOccluded() || IsCulled() ) return;
+ if ( IsHidden() || IsCulled() ) return;
const MercuryMatrix& matrix = FindGlobalMatrix();
const MercuryMatrix& modelView = FindModelViewMatrix(); //get the one computed in the last transform
@@ -263,28 +268,31 @@
{
SetCulled( false );
bool culled = true;
- list< MercuryAsset* >::iterator i;
- for (i = m_prerender.begin(); i != m_prerender.end(); ++i )
+
+ std::list< MercuryAssetInstance >::iterator i;
+ for (i = m_assets.begin(); i != m_assets.end(); ++i )
{
- if ( !(*i)->ExcludeFromCull() )
- culled = culled && (*i)->DoCullingTests( this, matrix );
- (*i)->PreRender(this);
- SetCulled( culled );
+ MercuryAssetInstance& mai = *i;
+ MercuryAsset& a = mai.Asset();
+ if ( !a.ExcludeFromCull() )
+ culled = culled && mai.Culled( a.DoCullingTests( mai.GetOcclusionResult(), matrix ) );
+ if ( !mai.Culled() ) a.PreRender(this);
}
+ SetCulled( culled );
}
void MercuryNode::Render(const MercuryMatrix& matrix)
{
- list< MercuryAsset* >::iterator i;
- for (i = m_render.begin(); i != m_render.end(); ++i )
- (*i)->Render(this);
+ std::list< MercuryAssetInstance >::iterator i;
+ for (i = m_assets.begin(); i != m_assets.end(); ++i )
+ if ( !(i->Culled() || i->GetOcclusionResult().IsOccluded()) ) i->Asset().Render(this);
}
void MercuryNode::PostRender(const MercuryMatrix& matrix)
{
- list< MercuryAsset* >::iterator i;
- for (i = m_postrender.begin(); i != m_postrender.end(); ++i )
- (*i)->PostRender(this);
+ std::list< MercuryAssetInstance >::iterator i;
+ for (i = m_assets.begin(); i != m_assets.end(); ++i )
+ i->Asset().PostRender(this);
}
const MercuryMatrix& MercuryNode::FindGlobalMatrix() const
@@ -315,43 +323,6 @@
return MercuryMatrix::Identity();
}
-void MercuryNode::AddPreRender(MercuryAsset* asset)
-{
-#ifdef MCHECKASSETS
- if ( !IsInAssetList(asset) ) //yell and scream
- assert(!"Asset does not exist in list!");
-#endif
-
- m_prerender.push_back(asset);
-}
-
-void MercuryNode::AddRender(MercuryAsset* asset)
-{
-#ifdef MCHECKASSETS
- if ( !IsInAssetList(asset) ) //yell and scream
- assert(!"Asset does not exist in list!");
-#endif
-
- m_render.push_back(asset);
-}
-void MercuryNode::AddPostRender(MercuryAsset* asset)
-{
-#ifdef MCHECKASSETS
- if ( !IsInAssetList(asset) ) //yell and scream
- assert(!"Asset does not exist in list!");
-#endif
-
- m_postrender.push_back(asset);
-}
-
-bool MercuryNode::IsInAssetList( MercuryAsset* asset ) const
-{
- std::list< MAutoPtr< MercuryAsset > >::const_iterator i;
- for (i = m_assets.begin(); i != m_assets.end(); ++i )
- if ( (*i) == asset ) return true;
- return false;
-}
-
bool MercuryNode::IsCulled(const MercuryMatrix& matrix)
{
bool clip = false;
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/MercuryNode.h 2009-08-16 13:58:08 UTC (rev 479)
@@ -35,7 +35,7 @@
void AddChild(MercuryNode* n);
void RemoveChild(MercuryNode* n);
-
+
inline MercuryNode* Parent() const { return m_parent; }
inline MercuryNode* NextSibling() const { return m_nextSibling; }
inline MercuryNode* PrevSibling() const { return m_prevSibling; }
@@ -86,12 +86,8 @@
inline void SetName(const MString& name) { m_name = name; }
inline MString GetName() const { return m_name; }
- inline void AddAsset(MAutoPtr< MercuryAsset > asset) { m_assets.push_back(asset); }
+ void AddAsset(MercuryAsset* asset);
- void AddPreRender(MercuryAsset* asset);
- void AddRender(MercuryAsset* asset);
- void AddPostRender(MercuryAsset* asset);
-
virtual void PreRender(const MercuryMatrix& matrix);
virtual void Render(const MercuryMatrix& matrix);
virtual void PostRender(const MercuryMatrix& matrix);
@@ -107,8 +103,6 @@
inline bool IsCulled() const { return m_culled; }
virtual MercuryMatrix ManipulateMatrix(const MercuryMatrix& matrix);
- inline OcclusionResult& GetOcclusionResult() { return m_occlusionResult; }
- inline const OcclusionResult& GetOcclusionResult() const { return m_occlusionResult; }
protected:
std::list< MercuryNode* > m_children; //These nodes are unique, not instanced
MercuryNode* m_parent;
@@ -119,22 +113,22 @@
MString m_name;
bool m_hidden;
- bool m_useAlphaPath;
- bool m_culled;
public: //XXX: This will become private sooner or later... It is temporarily public for other work.
bool IsInAssetList(MercuryAsset* asset) const;
+ bool m_useAlphaPath;
- OcclusionResult m_occlusionResult;
+ private:
+ bool m_culled;
//The asset is actually stored here
- std::list< MAutoPtr< MercuryAsset > > m_assets;
+ std::list< MercuryAssetInstance > m_assets;
//we will just use normal pointers here because we don't want to waste too much time
//dereferencing the autopointer. As a precaution when assets are added to these lists,
//they must exist in m_assets.
- std::list< MercuryAsset* > m_prerender;
- std::list< MercuryAsset* > m_render;
- std::list< MercuryAsset* > m_postrender;
+// std::list< MercuryAsset* > m_prerender;
+// std::list< MercuryAsset* > m_render;
+// std::list< MercuryAsset* > m_postrender;
};
class NodeFactory
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/Shader.cpp 2009-08-16 13:58:08 UTC (rev 479)
@@ -61,8 +61,6 @@
void Shader::Init(MercuryNode* node)
{
MercuryAsset::Init( node );
-// RenderableNode* rn = RenderableNode::Cast( node );
- if ( node ) node->AddPostRender( this );
}
void Shader::Render(const MercuryNode* node)
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/Texture.cpp 2009-08-16 13:58:08 UTC (rev 479)
@@ -40,9 +40,6 @@
void Texture::Init(MercuryNode* node)
{
MercuryAsset::Init( node );
-
-// RenderableNode* rn = RenderableNode::Cast( node );
- if ( node ) node->AddPostRender( this );
}
void Texture::LoadFromRaw()
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-08-16 13:40:19 UTC (rev 478)
+++ Mercury2/src/Viewport.cpp 2009-08-16 13:58:08 UTC (rev 479)
@@ -66,7 +66,7 @@
n->PreRender( matrix );
if( n->Parent() )
- n->Parent()->m_culled = n->Parent()->m_culled && n->IsCulled();
+ n->Parent()->SetCulled( n->Parent()->IsCulled() && n->IsCulled() );
//Traverse next
/*
@@ -103,7 +103,7 @@
n = this;
while( n )
{
- if( n->IsHidden() || m_occlusionResult.IsOccluded() || IsCulled() )
+ if( n->IsHidden() || IsCulled() )
{
//Make sure we have a next sibling...
while( n && n != this && !n->NextSibling() )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-16 13:40:27
|
Revision: 478
http://hgengine.svn.sourceforge.net/hgengine/?rev=478&view=rev
Author: axlecrusher
Date: 2009-08-16 13:40:19 +0000 (Sun, 16 Aug 2009)
Log Message:
-----------
change setup order
Modified Paths:
--------------
Mercury2/src/MercuryFBO.cpp
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-08-14 01:56:19 UTC (rev 477)
+++ Mercury2/src/MercuryFBO.cpp 2009-08-16 13:40:19 UTC (rev 478)
@@ -34,11 +34,9 @@
void MercuryFBO::Setup()
{
Clean();
-
- m_initiated = true;
-
GenerateFBO();
Bind();
+ m_initiated = true;
// CHECKFBO; //Incomplete FBO
}
@@ -97,6 +95,7 @@
for (uint8_t i = 0; i < m_numTextures; ++i)
{
MString n = ssprintf("%s_%d", m_name.c_str(), i);
+// m_textures[i] = Texture::LoadDynamicTexture(n);
m_textures[i]->MakeDynamic(m_width, m_height, m_cbt[i], n);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-14 03:22:25
|
Revision: 477
http://hgengine.svn.sourceforge.net/hgengine/?rev=477&view=rev
Author: axlecrusher
Date: 2009-08-14 01:56:19 +0000 (Fri, 14 Aug 2009)
Log Message:
-----------
try a different attenuation
Modified Paths:
--------------
Mercury2/Themes/default/Graphic/pointLight.frag
Mercury2/src/Light.cpp
Mercury2/src/Light.h
Modified: Mercury2/Themes/default/Graphic/pointLight.frag
===================================================================
--- Mercury2/Themes/default/Graphic/pointLight.frag 2009-08-12 03:42:02 UTC (rev 476)
+++ Mercury2/Themes/default/Graphic/pointLight.frag 2009-08-14 01:56:19 UTC (rev 477)
@@ -41,9 +41,11 @@
if( dist > HG_LightAtten.w ) discard;
- float att = HG_LightColor.a / (HG_LightAtten.x + HG_LightAtten.y * dist +
- HG_LightAtten.z * dist * dist);
+// float att = HG_LightColor.a / (HG_LightAtten.x + HG_LightAtten.y * dist+
+// HG_LightAtten.z * dist * dist);
+ float att = ((HG_LightAtten.w - (HG_LightAtten.y * dist) - (HG_LightAtten.z * dist * dist))/HG_LightAtten.w) * HG_LightColor.a;
+
vec3 diffuse = texture2D(HG_Texture1, coord).rgb;
vec3 R = reflect(-lightDir, norm);
Modified: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp 2009-08-12 03:42:02 UTC (rev 476)
+++ Mercury2/src/Light.cpp 2009-08-14 01:56:19 UTC (rev 477)
@@ -33,6 +33,7 @@
m_worldPosition = FindModelViewMatrix();
m_worldPosition2 = FindGlobalMatrix();
CURRENTRENDERGRAPH->AddDifferedLight( this );
+// m_boundingVolume->Render();
// m_parent = node;
}
@@ -40,6 +41,8 @@
{
if ( !node.Attribute("atten").empty() )
StrTo3Float(node.Attribute("atten"), m_atten);
+
+ ComputeRadius();
if ( !node.Attribute("power").empty() )
m_power = StrToFloat(node.Attribute("power"), 1.0);
@@ -47,6 +50,9 @@
if ( !node.Attribute("fullscreen").empty() )
m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
+ if ( !node.Attribute("radius").empty() )
+ m_radius = StrToFloat(node.Attribute("radius"), 1.0);
+
if ( !node.Attribute("shader").empty() )
{
MString key = node.Attribute("shader");
@@ -63,8 +69,8 @@
m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
}
- ComputeRadius();
-
+ BuildBoundingBox();
+
MercuryNode::LoadFromXML( node );
}
@@ -116,7 +122,10 @@
m_radius = Clamp<float>(0.0f, 1000.0f, d);
printf("light radius %f\n", m_radius);
+}
+void Light::BuildBoundingBox()
+{
SAFE_DELETE( m_boundingVolume );
m_boundingVolume = new BoundingBox(MercuryVertex(0,0,0), MercuryVertex(m_radius,m_radius,m_radius) );
}
Modified: Mercury2/src/Light.h
===================================================================
--- Mercury2/src/Light.h 2009-08-12 03:42:02 UTC (rev 476)
+++ Mercury2/src/Light.h 2009-08-14 01:56:19 UTC (rev 477)
@@ -30,6 +30,7 @@
private:
void StrTo3Float(const MString& s, float* a);
void ComputeRadius();
+ void BuildBoundingBox();
float m_atten[3];
float m_color[3];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-12 03:42:12
|
Revision: 476
http://hgengine.svn.sourceforge.net/hgengine/?rev=476&view=rev
Author: cnlohr
Date: 2009-08-12 03:42:02 +0000 (Wed, 12 Aug 2009)
Log Message:
-----------
updated messing around - it works, but not right
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-08-11 03:29:52 UTC (rev 475)
+++ Mercury2/src/Viewport.cpp 2009-08-12 03:42:02 UTC (rev 476)
@@ -40,6 +40,23 @@
n = this;
while( n )
{
+ //If we're hidden, skip to the next traversable element
+ if( n->IsHidden() )
+ {
+ //Make sure we have a next sibling...
+ while( n && n != this && !n->NextSibling() )
+ {
+ depth--;
+ n = n->Parent();
+ }
+
+ if( !n || n == this )
+ break;
+
+ n = n->NextSibling();
+ }
+
+
const MercuryMatrix& matrix = n->FindGlobalMatrix();
TransformNode * tn = dynamic_cast< TransformNode * >( n );
@@ -47,12 +64,60 @@
tn->HandleMatrixOperations();
n->PreRender( matrix );
+
+ if( n->Parent() )
+ n->Parent()->m_culled = n->Parent()->m_culled && n->IsCulled();
+
+ //Traverse next
+/*
+ MercuryNode * ret;
+ if( ret = n->FirstChild() )
+ {
+ depth++;
+ n = ret;
+ }
+ else if( ret = n->NextSibling() )
+ n = ret;
+ else if( ret = n->Parent() )
+ {
+ depth--;
+
+ while( ret && ret != this && !ret->NextSibling() )
+ {
+ depth--;
+ ret = ret->Parent();
+ }
+
+ if( !ret || ret == this )
+ return 0;
+
+ n = ret->m_nextSibling;
+ }
+ else
+ return 0;
+*/
+
n = n->TraversalNextNode( this, depth );
}
n = this;
while( n )
{
+ if( n->IsHidden() || m_occlusionResult.IsOccluded() || IsCulled() )
+ {
+ //Make sure we have a next sibling...
+ while( n && n != this && !n->NextSibling() )
+ {
+ depth--;
+ n = n->Parent();
+ }
+
+ if( !n || n == this )
+ break;
+
+ n = n->NextSibling();
+ }
+
const MercuryMatrix& matrix = n->FindGlobalMatrix();
const MercuryMatrix& modelView = n->FindModelViewMatrix(); //get the one computed in the last transform
@@ -62,18 +127,23 @@
sa.type = ShaderAttribute::TYPE_MATRIX;
sa.value.matrix = matrix.Ptr();
Shader::SetAttribute("HG_ModelMatrix", sa);
-
- n->Render( modelView );
+ if ( n->m_useAlphaPath )
+ CURRENTRENDERGRAPH->AddAlphaNode(n);
+ else
+ n->Render( modelView );
+
glLoadMatrix( modelView );
Shader::SetAttribute("HG_ModelMatrix", sa);
- n->PostRender( modelView );
+ if ( !n->m_useAlphaPath )
+ n->PostRender( modelView );
n = n->TraversalNextNode( this, depth );
}
-
+ this->PostRender( FindModelViewMatrix() );
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-11 03:30:00
|
Revision: 475
http://hgengine.svn.sourceforge.net/hgengine/?rev=475&view=rev
Author: cnlohr
Date: 2009-08-11 03:29:52 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
enable use of new traverser - it's still way slower.
Modified Paths:
--------------
Mercury2/src/Mercury2.cpp
Mercury2/src/TransformNode.cpp
Mercury2/src/TransformNode.h
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2009-08-11 03:17:29 UTC (rev 474)
+++ Mercury2/src/Mercury2.cpp 2009-08-11 03:29:52 UTC (rev 475)
@@ -76,22 +76,42 @@
{
timer.Touch();
MESSAGEMAN::GetInstance().PumpMessages( timer.MicrosecondsSinceInit() );
- root->RecursiveUpdate( timer.Age() ); //comment to use threads
+
+ //If false, use experimental traversal technique.
+ if(true)
+ {
+ root->RecursiveUpdate( timer.Age() ); //comment to use threads
- CURRENTRENDERGRAPH = &renderGraph;
- if ( MercuryNode::NeedsRebuild() )
+ CURRENTRENDERGRAPH = &renderGraph;
+ if ( MercuryNode::NeedsRebuild() )
+ {
+ renderGraph.Build(root);
+ }
+
+ w->Clear();
+ // renderGraph.Render();
+ // RenderableNode::RecursiveRender(root);
+ // printf("\n");
+ root->RecursivePreRender();
+ root->RecursiveRender();
+ // renderGraph.RenderAlpha();
+ w->SwapBuffers();
+ }
+ else
{
- renderGraph.Build(root);
+ CURRENTRENDERGRAPH = &renderGraph;
+ if ( MercuryNode::NeedsRebuild() )
+ {
+ renderGraph.Build(root);
+ }
+
+ Viewport* vp = (Viewport*)root->FirstChild();
+ w->Clear();
+ vp->GoAll( timer.Age() );
+ w->SwapBuffers();
}
-
- w->Clear();
-// renderGraph.Render();
-// RenderableNode::RecursiveRender(root);
-// printf("\n");
- root->RecursivePreRender();
- root->RecursiveRender();
-// renderGraph.RenderAlpha();
- w->SwapBuffers();
+
+
++m_count;
fpsTimer.Touch(timer);
Modified: Mercury2/src/TransformNode.cpp
===================================================================
--- Mercury2/src/TransformNode.cpp 2009-08-11 03:17:29 UTC (rev 474)
+++ Mercury2/src/TransformNode.cpp 2009-08-11 03:29:52 UTC (rev 475)
@@ -28,6 +28,17 @@
MercuryNode::RecursivePreRender();
}
+void TransformNode::HandleMatrixOperations()
+{
+ if ( IsHidden() ) return;
+
+ const MercuryMatrix& matrix = FindGlobalMatrix();
+ m_modelView = ManipulateMatrix( matrix );
+
+ glLoadMatrix( m_modelView );
+}
+
+
void TransformNode::SetScale( const MercuryVertex& scale )
{
if (scale != m_scale)
Modified: Mercury2/src/TransformNode.h
===================================================================
--- Mercury2/src/TransformNode.h 2009-08-11 03:17:29 UTC (rev 474)
+++ Mercury2/src/TransformNode.h 2009-08-11 03:29:52 UTC (rev 475)
@@ -38,6 +38,10 @@
virtual void RecursivePreRender();
+ //XXX: For charles' tests. This function will proably overtake the
+ //RecursivePreRender stuff, and be renamed
+ virtual void HandleMatrixOperations();
+
GENRTTI(TransformNode);
private:
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-08-11 03:17:29 UTC (rev 474)
+++ Mercury2/src/Viewport.cpp 2009-08-11 03:29:52 UTC (rev 475)
@@ -42,9 +42,9 @@
{
const MercuryMatrix& matrix = n->FindGlobalMatrix();
-// TransformNode * tn = dynamic_cast< TransformNode * >( n );
-// if( tn )
-// tn->m_modelView = tn->ManipulateMatrix( matrix );
+ TransformNode * tn = dynamic_cast< TransformNode * >( n );
+ if( tn )
+ tn->HandleMatrixOperations();
n->PreRender( matrix );
n = n->TraversalNextNode( this, depth );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-11 03:17:40
|
Revision: 474
http://hgengine.svn.sourceforge.net/hgengine/?rev=474&view=rev
Author: cnlohr
Date: 2009-08-11 03:17:29 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
add tentative traversal code
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Mercury2/src/Viewport.h
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-08-11 03:08:53 UTC (rev 473)
+++ Mercury2/src/Viewport.cpp 2009-08-11 03:17:29 UTC (rev 474)
@@ -1,6 +1,7 @@
#include <Viewport.h>
#include <GLHeaders.h>
#include <MercuryWindow.h>
+#include <TransformNode.h>
#include <Shader.h>
@@ -17,6 +18,65 @@
{
}
+void Viewport::GoAll( const float fDtime )
+{
+ MercuryNode * n;
+ int depth = 0;
+
+ if( NeedsRebuild() )
+ {
+ printf( "Xxxx\n" );
+ }
+
+ //Update pass
+ n = this;
+ while( n )
+ {
+ n->Update( fDtime );
+ n = n->TraversalNextNode( this, depth );
+ }
+
+ //Prerender pass
+ n = this;
+ while( n )
+ {
+ const MercuryMatrix& matrix = n->FindGlobalMatrix();
+
+// TransformNode * tn = dynamic_cast< TransformNode * >( n );
+// if( tn )
+// tn->m_modelView = tn->ManipulateMatrix( matrix );
+
+ n->PreRender( matrix );
+ n = n->TraversalNextNode( this, depth );
+ }
+
+ n = this;
+ while( n )
+ {
+ const MercuryMatrix& matrix = n->FindGlobalMatrix();
+ const MercuryMatrix& modelView = n->FindModelViewMatrix(); //get the one computed in the last transform
+
+ glLoadMatrix( modelView );
+
+ ShaderAttribute sa;
+ sa.type = ShaderAttribute::TYPE_MATRIX;
+ sa.value.matrix = matrix.Ptr();
+ Shader::SetAttribute("HG_ModelMatrix", sa);
+
+ n->Render( modelView );
+
+ glLoadMatrix( modelView );
+ Shader::SetAttribute("HG_ModelMatrix", sa);
+
+ n->PostRender( modelView );
+
+ n = n->TraversalNextNode( this, depth );
+ }
+
+
+}
+
+
void Viewport::PreRender(const MercuryMatrix& matrix)
{
FRUSTUM = &m_frustum;
Modified: Mercury2/src/Viewport.h
===================================================================
--- Mercury2/src/Viewport.h 2009-08-11 03:08:53 UTC (rev 473)
+++ Mercury2/src/Viewport.h 2009-08-11 03:17:29 UTC (rev 474)
@@ -11,6 +11,9 @@
{
public:
Viewport();
+
+ virtual void GoAll( const float fDtime );
+
virtual void PreRender(const MercuryMatrix& matrix);
virtual void Render(const MercuryMatrix& matrix);
virtual void PostRender(const MercuryMatrix& matrix);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-11 03:09:02
|
Revision: 473
http://hgengine.svn.sourceforge.net/hgengine/?rev=473&view=rev
Author: cnlohr
Date: 2009-08-11 03:08:53 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
free up some some protection (temporarily with note) and fix traversal code
Modified Paths:
--------------
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryNode.h
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-11 03:06:51 UTC (rev 472)
+++ Mercury2/src/MercuryNode.cpp 2009-08-11 03:08:53 UTC (rev 473)
@@ -128,18 +128,25 @@
return ret;
}
-MercuryNode * MercuryNode::TraversalNextNode( MercuryNode * stopnode )
+MercuryNode * MercuryNode::TraversalNextNode( MercuryNode * stopnode, int & iDepthDelta )
{
if( !m_children.empty() )
+ {
+ iDepthDelta++;
return *(m_children.begin());
+ }
else if( m_nextSibling )
return m_nextSibling;
else if( m_parent )
{
MercuryNode * ret = m_parent;
+ iDepthDelta--;
while( ret && ret != stopnode && !ret->m_nextSibling )
+ {
+ iDepthDelta--;
ret = ret->m_parent;
+ }
if( !ret || ret == stopnode )
return 0;
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-08-11 03:06:51 UTC (rev 472)
+++ Mercury2/src/MercuryNode.h 2009-08-11 03:08:53 UTC (rev 473)
@@ -55,7 +55,7 @@
///Get the next node in an in-order traversal
/** In the traversal, stopnode indicates the node that when passing
by on returning up the tree haults traversal. */
- MercuryNode * TraversalNextNode( MercuryNode * stopnode );
+ MercuryNode * TraversalNextNode( MercuryNode * stopnode, int & iDepthDelta );
virtual void Update(float dTime) {};
virtual void RecursiveUpdate(float dTime);
@@ -121,7 +121,7 @@
bool m_hidden;
bool m_useAlphaPath;
bool m_culled;
- private:
+ public: //XXX: This will become private sooner or later... It is temporarily public for other work.
bool IsInAssetList(MercuryAsset* asset) const;
OcclusionResult m_occlusionResult;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-11 03:06:58
|
Revision: 472
http://hgengine.svn.sourceforge.net/hgengine/?rev=472&view=rev
Author: cnlohr
Date: 2009-08-11 03:06:51 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
tweak - do not require gl stuff for glhelpers, now since it could be for other systems. I don't know if this is going to
stay or not.
Modified Paths:
--------------
Mercury2/src/GLHelpers.cpp
Mercury2/src/GLHelpers.h
Modified: Mercury2/src/GLHelpers.cpp
===================================================================
--- Mercury2/src/GLHelpers.cpp 2009-08-11 02:26:25 UTC (rev 471)
+++ Mercury2/src/GLHelpers.cpp 2009-08-11 03:06:51 UTC (rev 472)
@@ -47,7 +47,7 @@
glLoadMatrixf( l.Ptr() );
}
-MercuryMatrix glGetMatrix(GLenum m)
+MercuryMatrix glGetMatrix(unsigned int m)
{
MercuryMatrix mm;
glGetFloatv(m, mm.Ptr());
@@ -78,7 +78,7 @@
return MercuryVertex( (float)mouseX, (float)mouseY, (float)mouseZ );
}
-GLenum ToGLColorType(ColorByteType cbt)
+unsigned int ToGLColorType(ColorByteType cbt)
{
switch (cbt)
{
Modified: Mercury2/src/GLHelpers.h
===================================================================
--- Mercury2/src/GLHelpers.h 2009-08-11 02:26:25 UTC (rev 471)
+++ Mercury2/src/GLHelpers.h 2009-08-11 03:06:51 UTC (rev 472)
@@ -7,9 +7,9 @@
MString GlError2String(uint32_t e);
void glLoadMatrix(const MercuryMatrix& m);
-MercuryMatrix glGetMatrix(GLenum m);
+MercuryMatrix glGetMatrix(unsigned int m);
MercuryVertex pointFromScreenLoc(int screen_x, int screen_y);
-GLenum ToGLColorType(ColorByteType cbt);
+unsigned int ToGLColorType(ColorByteType cbt);
/****************************************************************************
* Copyright (C) 2009 by Joshua Allen *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-11 02:26:32
|
Revision: 471
http://hgengine.svn.sourceforge.net/hgengine/?rev=471&view=rev
Author: cnlohr
Date: 2009-08-11 02:26:25 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
add self-traversal code for nodes.
Modified Paths:
--------------
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryNode.h
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-11 02:01:09 UTC (rev 470)
+++ Mercury2/src/MercuryNode.cpp 2009-08-11 02:26:25 UTC (rev 471)
@@ -128,7 +128,27 @@
return ret;
}
+MercuryNode * MercuryNode::TraversalNextNode( MercuryNode * stopnode )
+{
+ if( !m_children.empty() )
+ return *(m_children.begin());
+ else if( m_nextSibling )
+ return m_nextSibling;
+ else if( m_parent )
+ {
+ MercuryNode * ret = m_parent;
+ while( ret && ret != stopnode && !ret->m_nextSibling )
+ ret = ret->m_parent;
+
+ if( !ret || ret == stopnode )
+ return 0;
+ return ret->m_nextSibling;
+ }
+ else
+ return 0;
+}
+
void MercuryNode::RecursiveUpdate(float dTime)
{
Update(dTime);
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-08-11 02:01:09 UTC (rev 470)
+++ Mercury2/src/MercuryNode.h 2009-08-11 02:26:25 UTC (rev 471)
@@ -52,6 +52,11 @@
/** Traversal is from the closest parent on upward */
MercuryNode* FindParent( const MString & sNameOfNode, int depth = MAXINT );
+ ///Get the next node in an in-order traversal
+ /** In the traversal, stopnode indicates the node that when passing
+ by on returning up the tree haults traversal. */
+ MercuryNode * TraversalNextNode( MercuryNode * stopnode );
+
virtual void Update(float dTime) {};
virtual void RecursiveUpdate(float dTime);
void ThreadedUpdate(float dTime);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-11 02:01:17
|
Revision: 470
http://hgengine.svn.sourceforge.net/hgengine/?rev=470&view=rev
Author: cnlohr
Date: 2009-08-11 02:01:09 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
fix - must have virtual function for getting type... otherwise we don't look at the vtable.
Modified Paths:
--------------
Mercury2/src/MercuryNode.h
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-08-10 00:49:35 UTC (rev 469)
+++ Mercury2/src/MercuryNode.h 2009-08-11 02:01:09 UTC (rev 470)
@@ -19,7 +19,7 @@
{ if (n==NULL) return NULL; return dynamic_cast<const x*>(n); } \
static x* Cast(MercuryNode* n) \
{ if (n==NULL) return NULL; return dynamic_cast<x*>(n); } \
-static const char * GetType() { return #x; }
+virtual const char * GetType() { return #x; }
/*
#define GENRTTI(x) static bool IsMyType(const MercuryNode* n) \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|