|
From: <axl...@us...> - 2009-10-12 23:55:09
|
Revision: 566
http://hgengine.svn.sourceforge.net/hgengine/?rev=566&view=rev
Author: axlecrusher
Date: 2009-10-12 23:54:57 +0000 (Mon, 12 Oct 2009)
Log Message:
-----------
updates to allow for walking on terrain
Modified Paths:
--------------
Mercury2/src/Camera.cpp
Mercury2/src/Camera.h
Mercury2/src/MercuryAsset.h
Mercury2/src/MessageHandler.h
Modified: Mercury2/src/Camera.cpp
===================================================================
--- Mercury2/src/Camera.cpp 2009-10-12 23:47:55 UTC (rev 565)
+++ Mercury2/src/Camera.cpp 2009-10-12 23:54:57 UTC (rev 566)
@@ -12,6 +12,7 @@
{
m_lookAt = MercuryVector(0,0,-1);
REGISTER_FOR_MESSAGE( INPUTEVENT_MOUSE );
+ REGISTER_FOR_MESSAGE( "SetCameraPosition" );
}
void CameraNode::PreRender(const MercuryMatrix& matrix)
@@ -99,12 +100,24 @@
SetRotation(qUpDown*qLeftRight);
// GetRotation().Print();
+// POST_MESSAGE("QueryTerrainPoint", new MessageData(), 0);
+
}
+ else if (message == "SetCameraPosition")
+ {
+// LOG.Write("SetCamPosition");
+ VertexDataMessage* m = (VertexDataMessage*)data;
+ SetPosition(m->Vertex);
+// Update(0);
+// ComputeMatrix();
+// m->Vertex.Print();
+ }
}
void CameraNode::Update(float dTime)
{
- MercuryVector p = GetPosition();
+// MercuryVector p = GetPosition();
+ MercuryVector p = m_origionalPosition;
float a = 0;
float b = 0;
@@ -120,9 +133,15 @@
p += m_lookAt * a;
p += Xaxis * b;
// p.SetY(0); //lock to ground
- SetPosition( p );
+// SetPosition( p );
+ m_origionalPosition = p;
+ TransformNode::Update( dTime );
+
+ if (a != 0 || b != 0)
+ {
+ POST_MESSAGE("QueryTerrainPoint", new VertexDataMessage(p), 0);
+ }
- TransformNode::Update( dTime );
}
/****************************************************************************
Modified: Mercury2/src/Camera.h
===================================================================
--- Mercury2/src/Camera.h 2009-10-12 23:47:55 UTC (rev 565)
+++ Mercury2/src/Camera.h 2009-10-12 23:54:57 UTC (rev 566)
@@ -16,6 +16,7 @@
GENRTTI(CameraNode);
private:
+ MercuryVertex m_origionalPosition;
MercuryVector m_lookAt;
float m_x, m_y;
MercuryMatrix m_viewMatrix;
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-10-12 23:47:55 UTC (rev 565)
+++ Mercury2/src/MercuryAsset.h 2009-10-12 23:54:57 UTC (rev 566)
@@ -99,8 +99,9 @@
inline void SetPasses( unsigned short p ) { m_iPasses = p; }
protected:
MercuryNode* m_parentNode;
+ MAutoPtr< MercuryAsset > m_asset; //actual asset storage
+
private:
- MAutoPtr< MercuryAsset > m_asset; //actual asset storage
OcclusionResult m_occlusionResult;
bool m_isCulled;
Modified: Mercury2/src/MessageHandler.h
===================================================================
--- Mercury2/src/MessageHandler.h 2009-10-12 23:47:55 UTC (rev 565)
+++ Mercury2/src/MessageHandler.h 2009-10-12 23:54:57 UTC (rev 566)
@@ -4,12 +4,23 @@
#include <MercuryString.h>
#include <global.h>
+#include <MercuryVertex.h>
+
class MessageData
{
public:
virtual ~MessageData() {};
};
+class VertexDataMessage : public MessageData
+{
+ public:
+ VertexDataMessage(const MercuryVertex& v)
+ :Vertex(v)
+ {}
+ MercuryVertex Vertex;
+};
+
class MessageHandler
{
public:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|