|
From: <axl...@us...> - 2009-05-16 00:41:21
|
Revision: 251
http://hgengine.svn.sourceforge.net/hgengine/?rev=251&view=rev
Author: axlecrusher
Date: 2009-05-16 00:41:20 +0000 (Sat, 16 May 2009)
Log Message:
-----------
updates aimed at being able to billboard
Modified Paths:
--------------
Mercury2/src/Frustum.cpp
Mercury2/src/Frustum.h
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryVertex.h
Mercury2/src/RenderGraph.cpp
Mercury2/src/RenderableNode.cpp
Mercury2/src/RenderableNode.h
Mercury2/src/TransformNode.h
Modified: Mercury2/src/Frustum.cpp
===================================================================
--- Mercury2/src/Frustum.cpp 2009-05-16 00:37:07 UTC (rev 250)
+++ Mercury2/src/Frustum.cpp 2009-05-16 00:41:20 UTC (rev 251)
@@ -53,6 +53,9 @@
//Right now this only builds the frustum planes
MercuryVector X,Y,Z;
+ m_lookAt = look;
+ m_eye = eye;
+
Z = (eye - look).Normalize(); //direction behind camera
X = (up.CrossProduct(Z)).Normalize(); //X axis
Y = Z.CrossProduct( X ); //real up
Modified: Mercury2/src/Frustum.h
===================================================================
--- Mercury2/src/Frustum.h 2009-05-16 00:37:07 UTC (rev 250)
+++ Mercury2/src/Frustum.h 2009-05-16 00:41:20 UTC (rev 251)
@@ -24,6 +24,8 @@
void LookAt(const MercuryVertex& eye, const MercuryVector& look, const MercuryVector& up);
inline const MercuryPlane& GetPlane(int i) const { return m_planes[i]; }
+ inline const MercuryVertex& GetLookAt() const { return m_lookAt; }
+ inline const MercuryVertex& GetEye() const { return m_eye; }
private:
MercuryPlane m_planes[6];
@@ -33,6 +35,8 @@
float m_nh, m_nw, m_fh, m_fw;
MercuryVector m_nc, m_fc;
+ MercuryVertex m_lookAt;
+ MercuryVertex m_eye;
};
#endif
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-05-16 00:37:07 UTC (rev 250)
+++ Mercury2/src/MercuryNode.cpp 2009-05-16 00:41:20 UTC (rev 251)
@@ -147,6 +147,7 @@
std::list< std::pair< MString, Callback0R<MercuryNode*> > >::iterator i;
for (i = m_factoryCallbacks.begin(); i != m_factoryCallbacks.end(); ++i)
if (i->first == t) return i->second();
+ printf("WARNING: Node type %s not found.\n", type.c_str());
return NULL;
}
Modified: Mercury2/src/MercuryVertex.h
===================================================================
--- Mercury2/src/MercuryVertex.h 2009-05-16 00:37:07 UTC (rev 250)
+++ Mercury2/src/MercuryVertex.h 2009-05-16 00:41:20 UTC (rev 251)
@@ -25,9 +25,9 @@
inline FloatRow& ToFloatRow() { return m_xyzw; }
inline const FloatRow& ToFloatRow() const { return m_xyzw; }
- inline const float GetX() const { return (*this)[0]; }
- inline const float GetY() const { return (*this)[1]; }
- inline const float GetZ() const { return (*this)[2]; }
+ inline float GetX() const { return (*this)[0]; }
+ inline float GetY() const { return (*this)[1]; }
+ inline float GetZ() const { return (*this)[2]; }
inline void SetX(const float ix) { (*this)[0] = ix; }
inline void SetY(const float iy) { (*this)[1] = iy; }
inline void SetZ(const float iz) { (*this)[2] = iz; }
Modified: Mercury2/src/RenderGraph.cpp
===================================================================
--- Mercury2/src/RenderGraph.cpp 2009-05-16 00:37:07 UTC (rev 250)
+++ Mercury2/src/RenderGraph.cpp 2009-05-16 00:41:20 UTC (rev 251)
@@ -9,8 +9,8 @@
if (m_node)
{
- if ( m_node->IsHidden() || m_node->IsCulled(*m_matrix) ) return;
- m = *m_matrix;
+ m = m_node->ManipulateMatrix( *m_matrix );
+ if ( m_node->IsHidden() || m_node->IsCulled(m) ) return;
m.Transpose();
glLoadMatrixf( m.Ptr() );
m_node->PreRender( m );
Modified: Mercury2/src/RenderableNode.cpp
===================================================================
--- Mercury2/src/RenderableNode.cpp 2009-05-16 00:37:07 UTC (rev 250)
+++ Mercury2/src/RenderableNode.cpp 2009-05-16 00:41:20 UTC (rev 251)
@@ -158,6 +158,11 @@
return clip;
}
+MercuryMatrix RenderableNode::ManipulateMatrix(const MercuryMatrix& matrix)
+{
+ return matrix;
+}
+
/***************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
Modified: Mercury2/src/RenderableNode.h
===================================================================
--- Mercury2/src/RenderableNode.h 2009-05-16 00:37:07 UTC (rev 250)
+++ Mercury2/src/RenderableNode.h 2009-05-16 00:41:20 UTC (rev 251)
@@ -34,6 +34,8 @@
virtual bool IsCulled(const MercuryMatrix& matrix);
bool IsHidden() { return m_hidden; }
+
+ virtual MercuryMatrix ManipulateMatrix(const MercuryMatrix& matrix);
GENRTTI(RenderableNode);
protected:
Modified: Mercury2/src/TransformNode.h
===================================================================
--- Mercury2/src/TransformNode.h 2009-05-16 00:37:07 UTC (rev 250)
+++ Mercury2/src/TransformNode.h 2009-05-16 00:41:20 UTC (rev 251)
@@ -27,7 +27,7 @@
void SetTaint(bool taint);
- void ComputeMatrix();
+ virtual void ComputeMatrix();
virtual void LoadFromXML(const XMLNode& node);
@@ -43,6 +43,7 @@
MercuryPoint m_rotation;
// MercuryMatrix m_localMatrix;
+ protected:
MercuryMatrix m_globalMatrix;
bool m_tainted;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|