|
From: <axl...@us...> - 2008-12-04 02:55:35
|
Revision: 45
http://hgengine.svn.sourceforge.net/hgengine/?rev=45&view=rev
Author: axlecrusher
Date: 2008-12-04 02:55:32 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
make the viewport respond to transforms
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2008-12-04 02:53:08 UTC (rev 44)
+++ Mercury2/src/Viewport.cpp 2008-12-04 02:55:32 UTC (rev 45)
@@ -8,7 +8,15 @@
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
- glLoadMatrixf( m_frustum.Ptr() );
+
+ MercuryMatrix m = FindGlobalMatrix();
+ m.Transpose();
+
+ glLoadMatrixf( (m * m_frustum).Ptr() );
+ //The following 2 are equivelent to above
+// glLoadMatrixf( m_frustum.Ptr() );
+// glMultMatrixf( m.Ptr() );
+
glMatrixMode(GL_MODELVIEW);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-03-03 21:42:04
|
Revision: 173
http://hgengine.svn.sourceforge.net/hgengine/?rev=173&view=rev
Author: axlecrusher
Date: 2009-03-03 21:41:55 +0000 (Tue, 03 Mar 2009)
Log Message:
-----------
fix far and near plane calculations
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-03-03 21:36:47 UTC (rev 172)
+++ Mercury2/src/Viewport.cpp 2009-03-03 21:41:55 UTC (rev 173)
@@ -92,15 +92,16 @@
MercuryVector X,Y,Z;
Z = (eye - look).Normalize(); //direction behind camera
- X = (up * Z).Normalize(); //X axis
+ X = (up.CrossProduct(Z)).Normalize(); //X axis
Y = Z.CrossProduct( X ); //real up
- m_nc = up - Z * m_zNear;
- m_fc = up - Z * m_zFar;
+ m_nc = (eye - Z) * m_zNear;
+ m_fc = (eye - Z) * m_zFar;
- m_planes[PNEAR].Setup(m_nc, Z*-1);
+ m_planes[PNEAR].Setup(m_nc, Z*(-1));
m_planes[PFAR].Setup(m_fc, Z);
-
+// m_fc.Print();
+// Z.Print();
MercuryVector aux,normal;
aux = (m_nc + Y*m_nh) - eye;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-07-04 15:37:59
|
Revision: 400
http://hgengine.svn.sourceforge.net/hgengine/?rev=400&view=rev
Author: axlecrusher
Date: 2009-07-04 15:37:58 +0000 (Sat, 04 Jul 2009)
Log Message:
-----------
use unified matrix loader
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-07-04 15:36:52 UTC (rev 399)
+++ Mercury2/src/Viewport.cpp 2009-07-04 15:37:58 UTC (rev 400)
@@ -23,9 +23,7 @@
//Load the frustum into the projection
//"eye" position does not go into projection
glMatrixMode(GL_PROJECTION);
- MercuryMatrix f = m_frustum.GetMatrix();
- f.Transpose();
- glLoadMatrixf( f.Ptr() );
+ glLoadMatrix( m_frustum.GetMatrix() );
glMatrixMode(GL_MODELVIEW);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-07-26 02:13:26
|
Revision: 439
http://hgengine.svn.sourceforge.net/hgengine/?rev=439&view=rev
Author: axlecrusher
Date: 2009-07-26 02:13:15 +0000 (Sun, 26 Jul 2009)
Log Message:
-----------
alpha path
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-07-25 20:25:16 UTC (rev 438)
+++ Mercury2/src/Viewport.cpp 2009-07-26 02:13:15 UTC (rev 439)
@@ -8,6 +8,8 @@
MercuryVertex EYE;
MercuryVector LOOKAT;
+#include <RenderGraph.h>
+
Viewport::Viewport()
:m_xFactor(1), m_yFactor(0.5), m_minx(0), m_miny(0)
{
@@ -85,6 +87,16 @@
// m_frustum.LookAt(EYE, LOOKAT, MercuryVertex(0,1,0));
}
+void Viewport::PostRender(const MercuryMatrix& matrix)
+{
+ glPushMatrix();
+// glLoadIdentity();
+ glLoadMatrix( matrix );
+ CURRENTRENDERGRAPH->RenderAlpha();
+ glPopMatrix();
+ MercuryNode::PostRender(matrix);
+}
+
void Viewport::LoadFromXML(const XMLNode& node)
{
m_xFactor = StrToFloat(node.Attribute("xfactor"), 1.0f);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-07-31 00:56:05
|
Revision: 442
http://hgengine.svn.sourceforge.net/hgengine/?rev=442&view=rev
Author: axlecrusher
Date: 2009-07-31 00:55:58 +0000 (Fri, 31 Jul 2009)
Log Message:
-----------
remove commented out code
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-07-26 02:52:54 UTC (rev 441)
+++ Mercury2/src/Viewport.cpp 2009-07-31 00:55:58 UTC (rev 442)
@@ -29,24 +29,6 @@
glMatrixMode(GL_MODELVIEW);
- //compute the position of the eye
-// EYE = MercuryVertex(0,0,0,1); //wrong
-// EYE = matrix * EYE;
-
-// VIEWMATRIX = matrix;
-
- //the camera sets this (the calculation here is wrong)
-// MercuryVector z(0,0,-1); //look down Z by default
-// LOOKAT = (matrix * z).Normalize();
-
-// matrix.Print();
-// EYE.Print("Eye");
-// LOOKAT.Print("Lookat");
-// printf("******\n");
-// LOOKAT = (matrix * l).Normalize();
-// LOOKAT.
-// LOOKAT.Print();
-
//Sets up the clipping frustum
m_frustum.LookAt(EYE, LOOKAT, MercuryVertex(0,1,0));
}
@@ -65,26 +47,6 @@
glMatrixMode(GL_MODELVIEW);
- //compute the position of the eye
-// EYE = MercuryVertex(0,0,0,1); //wrong
-// EYE = matrix * EYE;
-
-// VIEWMATRIX = matrix;
-
- //the camera sets this (the calculation here is wrong)
-// MercuryVector z(0,0,-1); //look down Z by default
-// LOOKAT = (matrix * z).Normalize();
-
-// matrix.Print();
-// EYE.Print("Eye");
-// LOOKAT.Print("Lookat");
-// printf("******\n");
-// LOOKAT = (matrix * l).Normalize();
-// LOOKAT.
-// LOOKAT.Print();
-
- //Sets up the clipping frustum
-// m_frustum.LookAt(EYE, LOOKAT, MercuryVertex(0,1,0));
}
void Viewport::PostRender(const MercuryMatrix& matrix)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-01 02:43:22
|
Revision: 444
http://hgengine.svn.sourceforge.net/hgengine/?rev=444&view=rev
Author: axlecrusher
Date: 2009-08-01 02:43:14 +0000 (Sat, 01 Aug 2009)
Log Message:
-----------
let shaders access viewport
Modified Paths:
--------------
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-07-31 00:59:08 UTC (rev 443)
+++ Mercury2/src/Viewport.cpp 2009-08-01 02:43:14 UTC (rev 444)
@@ -2,6 +2,8 @@
#include <GLHeaders.h>
#include <MercuryWindow.h>
+#include <Shader.h>
+
REGISTER_NODE_TYPE(Viewport);
const Frustum* FRUSTUM;
MercuryMatrix VIEWMATRIX;
@@ -47,6 +49,10 @@
glMatrixMode(GL_MODELVIEW);
+ ShaderAttribute sa;
+ sa.type = ShaderAttribute::TYPE_INT4;
+ glGetIntegerv(GL_VIEWPORT, sa.value.iInts);
+ Shader::SetAttribute("HG_ViewPort", sa);
}
void Viewport::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-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-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.
|