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: <axl...@us...> - 2009-10-12 23:55:52
|
Revision: 567
http://hgengine.svn.sourceforge.net/hgengine/?rev=567&view=rev
Author: axlecrusher
Date: 2009-10-12 23:55:41 +0000 (Mon, 12 Oct 2009)
Log Message:
-----------
updates to allow for walking on terrain
Modified Paths:
--------------
Mercury2/modules/Terrain.cpp
Mercury2/modules/Terrain.h
Modified: Mercury2/modules/Terrain.cpp
===================================================================
--- Mercury2/modules/Terrain.cpp 2009-10-12 23:54:57 UTC (rev 566)
+++ Mercury2/modules/Terrain.cpp 2009-10-12 23:55:41 UTC (rev 567)
@@ -1,4 +1,6 @@
#include "Terrain.h"
+#include <MercuryMessageManager.h>
+#include <MercuryNode.h>
REGISTER_ASSET_TYPE(Terrain);
@@ -17,6 +19,11 @@
return new Terrain();
}
+MercuryAssetInstance* Terrain::GenerateInstanceData(MercuryNode* parentNode)
+{
+ return new TerrainAssetInstance(this, parentNode);
+}
+
void Terrain::LoadedCallback()
{
BuildHash();
@@ -67,4 +74,119 @@
}
}
+MercuryVertex Terrain::ComputePositionLinear(const MercuryVertex& p)
+{
+ HGMDLMesh& mesh = *m_meshes[0];
+ const float* vertice = mesh.GetVertexHandle() + MercuryVBO::VERTEX_OFFSET;
+ const short unsigned int* indice = mesh.GetIndexHandle();
+
+ MercuryVertex l( p );
+ l[2] = 0;
+
+ MercuryVector result = l;
+
+ uint16_t length = mesh.IndiceCount();
+ uint16_t foundCount = 0;
+ for(uint16_t i = 0; i < length; i+=3)
+ {
+ MercuryVertex v1(vertice+(indice[i]*HGMDLMesh::STRIDE));
+ MercuryVertex v2(vertice+(indice[i+1]*HGMDLMesh::STRIDE));
+ MercuryVertex v3(vertice+(indice[i+2]*HGMDLMesh::STRIDE));
+
+ MTriangle t( v1, v2, v3 );
+ MTriangle tflat(t);
+
+ tflat.m_verts[0][2] = 0;
+ tflat.m_verts[1][2] = 0;
+ tflat.m_verts[2][2] = 0;
+ if ( tflat.IsInTriangle(l) )
+ {
+ ++foundCount;
+ MercuryVector b = tflat.Barycentric(l);
+
+ MercuryVector pos( t.InterpolatePosition(b) );
+ result = pos;
+// return result;
+ }
+ }
+
+ if (foundCount > 1) LOG.Write( ssprintf("!!!!!! Found %d triangles !!!!!!", foundCount) );
+ return result;
+}
+/*
+MercuryVertex Terrain::ComputePosition(const MercuryVertex& p)
+{
+ MercuryVertex l( p );
+ l[2] = 0;
+
+ std::list<MTriangle> triangles = m_hash.FindByXY(p[0], p[1]);
+ LOG.Write( ssprintf("%d", triangles.size()) );
+
+ MercuryVector result = l;
+
+ if (!triangles.empty())
+ {
+ std::list<MTriangle>::iterator i = triangles.begin();
+ for(;i != triangles.end(); ++i)
+ {
+ MTriangle t = *i;
+ t.m_verts[0][2] = 0;
+ t.m_verts[1][2] = 0;
+ t.m_verts[2][2] = 0;
+ if ( t.IsInTriangle(l) )
+ {
+ MercuryVector b = t.Barycentric(l);
+ t = *i;
+
+ MercuryVector pos;//(t.m_verts[0]);
+
+ pos = t.m_verts[0]*b[0] + t.m_verts[1]*b[1] + t.m_verts[2]*b[2];
+// pos.Print();
+// pos += (t.m_verts[0] - t.m_verts[1]) * b;
+// pos += (t.m_verts[0] - t.m_verts[2]) * b;
+
+
+// pos.Print();
+ LOG.Write("Found");
+ result[2] = result[2]<pos[2]?pos[2]:result[2];
+// return pos;
+ }
+ }
+ }
+
+ return result;
+}
+*/
+
+TerrainAssetInstance::TerrainAssetInstance(MercuryAsset* asset, MercuryNode* parentNode)
+ :base(asset, parentNode)
+{
+ REGISTER_FOR_MESSAGE("QueryTerrainPoint");
+}
+
+TerrainAssetInstance::~TerrainAssetInstance()
+{
+ UNREGISTER_FOR_MESSAGE("QueryTerrainPoint");
+}
+
+void TerrainAssetInstance::HandleMessage(const MString& message, const MessageData* data)
+{
+ if (message == "QueryTerrainPoint")
+ {
+ VertexDataMessage* v = (VertexDataMessage*)data;
+
+ //compute local space position
+ MercuryVertex local = v->Vertex * m_parentNode->GetGlobalMatrix();
+ local[3] = 1; //no W
+
+ Terrain* t = (Terrain*)m_asset.Ptr();
+ local = t->ComputePositionLinear( local );
+ local[2] += 0.5; //height of player
+
+ local = m_parentNode->GetGlobalMatrix() * local;
+ POST_MESSAGE("SetCameraPosition", new VertexDataMessage(local), 0);
+ }
+}
+
+
Modified: Mercury2/modules/Terrain.h
===================================================================
--- Mercury2/modules/Terrain.h 2009-10-12 23:54:57 UTC (rev 566)
+++ Mercury2/modules/Terrain.h 2009-10-12 23:55:41 UTC (rev 567)
@@ -17,6 +17,10 @@
static Terrain* Generate();
virtual void LoadedCallback(); //thread safe
+ virtual MercuryAssetInstance* GenerateInstanceData(MercuryNode* parentNode);
+ MercuryVertex ComputePosition(const MercuryVertex& p);
+ MercuryVertex ComputePositionLinear(const MercuryVertex& p);
+
private:
CLASS_HELPERS( HGMDLModel );
void BuildHash();
@@ -29,6 +33,16 @@
// std::vector< MAutoPtr< HGMDLMesh > > m_meshes;
};
+class TerrainAssetInstance : public MercuryAssetInstance
+{
+ public:
+ TerrainAssetInstance(MercuryAsset* asset, MercuryNode* parentNode);
+ ~TerrainAssetInstance();
+ virtual void HandleMessage(const MString& message, const MessageData* data);
+ private:
+ CLASS_HELPERS( MercuryAssetInstance );
+};
+
#endif
/****************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <axl...@us...> - 2009-10-12 23:48:07
|
Revision: 565
http://hgengine.svn.sourceforge.net/hgengine/?rev=565&view=rev
Author: axlecrusher
Date: 2009-10-12 23:47:55 +0000 (Mon, 12 Oct 2009)
Log Message:
-----------
i think w needs to be 1
Modified Paths:
--------------
Mercury2/src/DataTypes/MTriangle.cpp
Modified: Mercury2/src/DataTypes/MTriangle.cpp
===================================================================
--- Mercury2/src/DataTypes/MTriangle.cpp 2009-10-12 21:51:29 UTC (rev 564)
+++ Mercury2/src/DataTypes/MTriangle.cpp 2009-10-12 23:47:55 UTC (rev 565)
@@ -45,7 +45,7 @@
tmp = m_verts[2] - m_verts[0];
result += tmp.Normalize()*(barycentric[1] * tmp.Length());
- result[3] = 0;
+ result[3] = 1;
return result;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-12 21:51:35
|
Revision: 564
http://hgengine.svn.sourceforge.net/hgengine/?rev=564&view=rev
Author: axlecrusher
Date: 2009-10-12 21:51:29 +0000 (Mon, 12 Oct 2009)
Log Message:
-----------
fix LERP on triangle
Modified Paths:
--------------
Mercury2/src/DataTypes/MTriangle.cpp
Modified: Mercury2/src/DataTypes/MTriangle.cpp
===================================================================
--- Mercury2/src/DataTypes/MTriangle.cpp 2009-10-11 15:44:16 UTC (rev 563)
+++ Mercury2/src/DataTypes/MTriangle.cpp 2009-10-12 21:51:29 UTC (rev 564)
@@ -39,16 +39,14 @@
{
MercuryVertex result( m_verts[0] );
- barycentric.Print();
+ MercuryVertex tmp( m_verts[1] - m_verts[0] );
+ result += tmp.Normalize()*(barycentric[0] * tmp.Length());
- result += (m_verts[1] - m_verts[0])*barycentric;
- result += (m_verts[2] - m_verts[0])*barycentric;
+ tmp = m_verts[2] - m_verts[0];
+ result += tmp.Normalize()*(barycentric[1] * tmp.Length());
-// result.Print();
-
result[3] = 0;
- result.Print();
return result;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-11 15:44:28
|
Revision: 563
http://hgengine.svn.sourceforge.net/hgengine/?rev=563&view=rev
Author: axlecrusher
Date: 2009-10-11 15:44:16 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
fix vector * matrix multiply
Modified Paths:
--------------
Mercury2/src/MercuryVertex.cpp
Modified: Mercury2/src/MercuryVertex.cpp
===================================================================
--- Mercury2/src/MercuryVertex.cpp 2009-10-11 15:40:51 UTC (rev 562)
+++ Mercury2/src/MercuryVertex.cpp 2009-10-11 15:44:16 UTC (rev 563)
@@ -127,7 +127,7 @@
MercuryVertex v1(m[0][0], m[1][0], m[2][0], m[3][0]);
MercuryVertex v2(m[0][1], m[1][1], m[2][1], m[3][1]);
MercuryVertex v3(m[0][2], m[1][2], m[2][2], m[3][2]);
- MercuryVertex v4(m[0][3], m[1][4], m[1][4], m[1][4]);
+ MercuryVertex v4(m[0][3], m[1][3], m[2][3], m[3][3]);
r[0] = ((*this)*v1).AddComponents();
r[1] = ((*this)*v2).AddComponents();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-11 15:40:59
|
Revision: 562
http://hgengine.svn.sourceforge.net/hgengine/?rev=562&view=rev
Author: axlecrusher
Date: 2009-10-11 15:40:51 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
update
Modified Paths:
--------------
Mercury2/src/DataTypes/MTriangle.cpp
Mercury2/src/DataTypes/MTriangle.h
Modified: Mercury2/src/DataTypes/MTriangle.cpp
===================================================================
--- Mercury2/src/DataTypes/MTriangle.cpp 2009-10-11 03:34:07 UTC (rev 561)
+++ Mercury2/src/DataTypes/MTriangle.cpp 2009-10-11 15:40:51 UTC (rev 562)
@@ -35,6 +35,23 @@
return MercuryVertex(ru, rv, 1-(ru+rv));
}
+MercuryVertex MTriangle::InterpolatePosition(const MercuryVertex& barycentric)
+{
+ MercuryVertex result( m_verts[0] );
+
+ barycentric.Print();
+
+ result += (m_verts[1] - m_verts[0])*barycentric;
+ result += (m_verts[2] - m_verts[0])*barycentric;
+
+// result.Print();
+
+ result[3] = 0;
+
+ result.Print();
+ return result;
+}
+
bool MTriangle::IsInTriangle(const MercuryVertex& p)
{
MercuryVertex v = Barycentric(p);
Modified: Mercury2/src/DataTypes/MTriangle.h
===================================================================
--- Mercury2/src/DataTypes/MTriangle.h 2009-10-11 03:34:07 UTC (rev 561)
+++ Mercury2/src/DataTypes/MTriangle.h 2009-10-11 15:40:51 UTC (rev 562)
@@ -13,9 +13,10 @@
bool IsInTriangle( const MercuryVertex& p );
float Area();
-
+ MercuryVertex InterpolatePosition(const MercuryVertex& barycentric);
+
bool operator == (const MTriangle& rhs);
- private:
+// private:
MercuryVertex m_verts[3];
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-11 03:34:16
|
Revision: 561
http://hgengine.svn.sourceforge.net/hgengine/?rev=561&view=rev
Author: axlecrusher
Date: 2009-10-11 03:34:07 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
allow for abstracted assted instance data
Modified Paths:
--------------
Mercury2/src/RenderGraph.cpp
Modified: Mercury2/src/RenderGraph.cpp
===================================================================
--- Mercury2/src/RenderGraph.cpp 2009-10-11 03:33:05 UTC (rev 560)
+++ Mercury2/src/RenderGraph.cpp 2009-10-11 03:34:07 UTC (rev 561)
@@ -77,9 +77,9 @@
iPasses |= child->m_iPasses;
}
- std::list< MercuryAssetInstance >::iterator i;
+ std::list< MercuryAssetInstance* >::iterator i;
for (i = node->m_assets.begin(); i != node->m_assets.end(); ++i )
- iPasses |= i->GetPasses();
+ iPasses |= (*i)->GetPasses();
if( node->m_iForcePasses & (1<<15 ) )
node->m_iPasses = node->m_iForcePasses;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-11 03:33:13
|
Revision: 560
http://hgengine.svn.sourceforge.net/hgengine/?rev=560&view=rev
Author: axlecrusher
Date: 2009-10-11 03:33:05 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
add vector * matrix multiply
Modified Paths:
--------------
Mercury2/src/MercuryVertex.cpp
Mercury2/src/MercuryVertex.h
Modified: Mercury2/src/MercuryVertex.cpp
===================================================================
--- Mercury2/src/MercuryVertex.cpp 2009-10-11 03:32:30 UTC (rev 559)
+++ Mercury2/src/MercuryVertex.cpp 2009-10-11 03:33:05 UTC (rev 560)
@@ -4,6 +4,8 @@
#include <MQuaternion.h>
#include <MercuryLog.h>
+#include <MercuryMatrix.h>
+
MercuryVertex::MercuryVertex()
{
(*this)[0] = (*this)[1] = (*this)[2] = (*this)[3] = 0;
@@ -119,6 +121,27 @@
return dp;
}
+MercuryVertex MercuryVertex::operator*(const MercuryMatrix& m) const
+{
+ MercuryVertex r;
+ MercuryVertex v1(m[0][0], m[1][0], m[2][0], m[3][0]);
+ MercuryVertex v2(m[0][1], m[1][1], m[2][1], m[3][1]);
+ MercuryVertex v3(m[0][2], m[1][2], m[2][2], m[3][2]);
+ MercuryVertex v4(m[0][3], m[1][4], m[1][4], m[1][4]);
+
+ r[0] = ((*this)*v1).AddComponents();
+ r[1] = ((*this)*v2).AddComponents();
+ r[2] = ((*this)*v3).AddComponents();
+ r[3] = ((*this)*v4).AddComponents();
+
+ return r;
+}
+
+float MercuryVertex::AddComponents() const
+{
+ return GetX() + GetY() + GetZ() + GetW();
+}
+
void MercuryVertex::Print(const MString& s) const
{
LOG.Write(ssprintf("%s: %f %f %f %f", s.c_str(), (*this)[0], (*this)[1], (*this)[2], (*this)[3]));
Modified: Mercury2/src/MercuryVertex.h
===================================================================
--- Mercury2/src/MercuryVertex.h 2009-10-11 03:32:30 UTC (rev 559)
+++ Mercury2/src/MercuryVertex.h 2009-10-11 03:33:05 UTC (rev 560)
@@ -11,6 +11,7 @@
#endif
class MQuaternion;
+class MercuryMatrix;
class MercuryVertex
{
@@ -32,9 +33,11 @@
inline float GetX() const { return (*this)[0]; }
inline float GetY() const { return (*this)[1]; }
inline float GetZ() const { return (*this)[2]; }
+ inline float GetW() const { return (*this)[3]; }
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; }
+ inline void SetW(const float iw) { (*this)[3] = iw; }
inline void Zero() { (*this)[0] = 0; (*this)[1] = 0; (*this)[2] = 0; }
@@ -59,6 +62,9 @@
inline MercuryVertex operator * (const MercuryVertex& p) const { MercuryVertex r(*this); r*=p; return r; }
inline MercuryVertex operator / (const MercuryVertex& p) const { MercuryVertex r(*this); r/=p; return r; }
+ MercuryVertex operator*(const MercuryMatrix& m) const;
+
+
inline MercuryVertex& operator += ( const MercuryVertex& other ) { (*this)[0]+=other[0]; (*this)[1]+=other[1]; (*this)[2]+=other[2]; return *this; }
inline MercuryVertex& operator -= ( const MercuryVertex& other ) { (*this)[0]-=other[0]; (*this)[1]-=other[1]; (*this)[2]-=other[2]; return *this; }
inline MercuryVertex& operator *= ( float f ) { (*this)[0]*=f; (*this)[1]*=f; (*this)[2]*=f; return *this; }
@@ -85,6 +91,8 @@
MercuryVertex Rotate(const MQuaternion& q) const;
+ float AddComponents() const;
+
static MercuryVertex CreateFromString(const MString& s);
// float (*this)[3];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-11 03:32:39
|
Revision: 559
http://hgengine.svn.sourceforge.net/hgengine/?rev=559&view=rev
Author: axlecrusher
Date: 2009-10-11 03:32:30 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
allow for abstracted assted instance data
Modified Paths:
--------------
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryNode.h
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-10-11 03:27:58 UTC (rev 558)
+++ Mercury2/src/MercuryAsset.cpp 2009-10-11 03:32:30 UTC (rev 559)
@@ -93,6 +93,11 @@
GLCALL( glEnd() );
}
+MercuryAssetInstance* MercuryAsset::GenerateInstanceData(MercuryNode* parentNode)
+{
+ return new MercuryAssetInstance(this, parentNode);
+}
+
MercuryAssetInstance::MercuryAssetInstance(MercuryAsset* asset, MercuryNode* parentNode)
:m_parentNode(parentNode), m_asset( asset ), m_isCulled( false ), m_iPasses( asset->GetPasses() )
{
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-10-11 03:27:58 UTC (rev 558)
+++ Mercury2/src/MercuryAsset.h 2009-10-11 03:32:30 UTC (rev 559)
@@ -21,6 +21,7 @@
};
class MercuryNode;
+class MercuryAssetInstance;
/* Assets are stored in renderable nodes with MAuto pointers.
The renderable nodes handle the memory management
@@ -61,6 +62,8 @@
inline unsigned short GetPasses() { return m_iPasses; }
inline void SetPasses( unsigned short p ) { m_iPasses = p; }
+
+ virtual MercuryAssetInstance* GenerateInstanceData(MercuryNode* parentNode);
protected:
void SetLoadState(LoadState ls); //thread safe
LoadState GetLoadState(); //thread safe
@@ -77,10 +80,12 @@
/** This holds the per-instance data for each asset instance.
Used in MercuryNode. */
-class MercuryAssetInstance
+class MercuryAssetInstance : public MessageHandler
{
public:
MercuryAssetInstance(MercuryAsset* asset, MercuryNode* parentNode);
+ virtual ~MercuryAssetInstance() {};
+
inline MercuryAsset& Asset() { return *m_asset; }
inline const MercuryAsset& Asset() const { return *m_asset; }
inline const MercuryAsset* AssetPtr() const { return m_asset; }
@@ -92,8 +97,9 @@
inline unsigned short GetPasses() { return m_iPasses; }
inline void SetPasses( unsigned short p ) { m_iPasses = p; }
+ protected:
+ MercuryNode* m_parentNode;
private:
- MercuryNode* m_parentNode;
MAutoPtr< MercuryAsset > m_asset; //actual asset storage
OcclusionResult m_occlusionResult;
bool m_isCulled;
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-10-11 03:27:58 UTC (rev 558)
+++ Mercury2/src/MercuryNode.cpp 2009-10-11 03:32:30 UTC (rev 559)
@@ -30,13 +30,22 @@
SAFE_DELETE(*i);
m_children.clear();
+
+ ClearAssets();
}
void MercuryNode::AddAsset(MercuryAsset* asset)
{
- m_assets.push_back( MercuryAssetInstance(asset, this) );
+ m_assets.push_back( asset->GenerateInstanceData(this) );
}
+void MercuryNode::ClearAssets()
+{
+ list< MercuryAssetInstance* >::iterator i;
+ for (i = m_assets.begin(); i != m_assets.end(); ++i )
+ SAFE_DELETE(*i);
+}
+
void MercuryNode::AddChild(MercuryNode* n)
{
// list< MercuryNode* >::iterator last = m_children.end();
@@ -299,36 +308,39 @@
SetCulled( false );
bool culled = true;
- std::list< MercuryAssetInstance >::iterator i;
+ std::list< MercuryAssetInstance* >::iterator i;
for (i = m_assets.begin(); i != m_assets.end(); ++i )
{
- MercuryAssetInstance& mai = *i;
- MercuryAsset& a = mai.Asset();
+ MercuryAssetInstance* mai = *i;
+ MercuryAsset& a = mai->Asset();
///NOTE: Things that ignore culling do not affect culling one way or the other
if ( !a.IgnoreCull() )
{
- mai.Culled( a.DoCullingTests( mai.GetOcclusionResult(), matrix ) );
- culled = culled && mai.Culled();
+ mai->Culled( a.DoCullingTests( mai->GetOcclusionResult(), matrix ) );
+ culled = culled && mai->Culled();
}
- if ( !mai.Culled() ) a.PreRender(this);
+ if ( !mai->Culled() ) a.PreRender(this);
}
SetCulled( culled );
}
void MercuryNode::Render(const MercuryMatrix& matrix)
{
- std::list< MercuryAssetInstance >::iterator i;
+ 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);
+ {
+ MercuryAssetInstance* mai = *i;
+ if ( !(mai->Culled() || mai->GetOcclusionResult().IsOccluded()) ) mai->Asset().Render(this);
+ }
}
void MercuryNode::PostRender(const MercuryMatrix& matrix)
{
- std::list< MercuryAssetInstance >::iterator i;
+ std::list< MercuryAssetInstance* >::iterator i;
for (i = m_assets.begin(); i != m_assets.end(); ++i )
- i->Asset().PostRender(this);
+ (*i)->Asset().PostRender(this);
}
const MercuryMatrix& MercuryNode::FindGlobalMatrix() const
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-10-11 03:27:58 UTC (rev 558)
+++ Mercury2/src/MercuryNode.h 2009-10-11 03:32:30 UTC (rev 559)
@@ -101,6 +101,7 @@
inline MString GetName() const { return m_name; }
void AddAsset(MercuryAsset* asset);
+ void ClearAssets();
virtual void PreRender(const MercuryMatrix& matrix);
virtual void Render(const MercuryMatrix& matrix);
@@ -134,7 +135,7 @@
unsigned short m_iForcePasses; //If (1<<15) is set, then, we know the force is enabled.
//The asset is actually stored here
- std::list< MercuryAssetInstance > 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,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-11 03:28:07
|
Revision: 558
http://hgengine.svn.sourceforge.net/hgengine/?rev=558&view=rev
Author: axlecrusher
Date: 2009-10-11 03:27:58 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
need to be able to unregister
Modified Paths:
--------------
Mercury2/src/MercuryMessageManager.cpp
Mercury2/src/MercuryMessageManager.h
Modified: Mercury2/src/MercuryMessageManager.cpp
===================================================================
--- Mercury2/src/MercuryMessageManager.cpp 2009-10-11 00:49:38 UTC (rev 557)
+++ Mercury2/src/MercuryMessageManager.cpp 2009-10-11 03:27:58 UTC (rev 558)
@@ -42,6 +42,23 @@
m_messageRecipients[message].push_back(ptr);
}
+void MercuryMessageManager::UnRegisterForMessage(const MString& message, MessageHandler* ptr)
+{
+ std::list< MessageHandler* >& subscriptions = m_messageRecipients[message];
+ std::list< MessageHandler* >::iterator i = subscriptions.begin();
+
+ for (;i != subscriptions.end(); ++i)
+ {
+ if (*i == ptr)
+ {
+ printf("Deleted subscription\n");
+ subscriptions.erase( i );
+ return;
+ }
+ }
+
+}
+
void MercuryMessageManager::FireOffMessage( const MessageHolder & message )
{
// std::map< MString, std::list< MessageHandler* > >::iterator i = m_messageRecipients.find(message.message);
Modified: Mercury2/src/MercuryMessageManager.h
===================================================================
--- Mercury2/src/MercuryMessageManager.h 2009-10-11 00:49:38 UTC (rev 557)
+++ Mercury2/src/MercuryMessageManager.h 2009-10-11 03:27:58 UTC (rev 558)
@@ -33,7 +33,9 @@
MercuryMessageManager() : m_messageQueue( MessageHolder::Compare ) { }
void PostMessage(const MString& message, MessageData* data, float delay);
void PumpMessages(const uint64_t& currTime);
+
void RegisterForMessage(const MString& message, MessageHandler* ptr);
+ void UnRegisterForMessage(const MString& message, MessageHandler* ptr);
static MercuryMessageManager& GetInstance();
private:
@@ -49,6 +51,7 @@
#define MESSAGEMAN MercuryMessageManager
#define REGISTER_FOR_MESSAGE(x) MESSAGEMAN::GetInstance().RegisterForMessage(x, this)
+#define UNREGISTER_FOR_MESSAGE(x) MESSAGEMAN::GetInstance().UnRegisterForMessage(x, this)
#define POST_MESSAGE(x,data,delay) MESSAGEMAN::GetInstance().PostMessage(x, data, delay)
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-11 00:49:46
|
Revision: 557
http://hgengine.svn.sourceforge.net/hgengine/?rev=557&view=rev
Author: axlecrusher
Date: 2009-10-11 00:49:38 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
we can store the asset's parent node pointer in the per-instance data
Modified Paths:
--------------
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryNode.cpp
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-10-10 22:22:50 UTC (rev 556)
+++ Mercury2/src/MercuryAsset.cpp 2009-10-11 00:49:38 UTC (rev 557)
@@ -93,8 +93,8 @@
GLCALL( glEnd() );
}
-MercuryAssetInstance::MercuryAssetInstance(MercuryAsset* asset)
- :m_asset( asset ), m_isCulled( false ), m_iPasses( asset->GetPasses() )
+MercuryAssetInstance::MercuryAssetInstance(MercuryAsset* asset, MercuryNode* parentNode)
+ :m_parentNode(parentNode), m_asset( asset ), m_isCulled( false ), m_iPasses( asset->GetPasses() )
{
}
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-10-10 22:22:50 UTC (rev 556)
+++ Mercury2/src/MercuryAsset.h 2009-10-11 00:49:38 UTC (rev 557)
@@ -25,7 +25,7 @@
/* Assets are stored in renderable nodes with MAuto pointers.
The renderable nodes handle the memory management
*/
-class MercuryAsset : public RefBase, MessageHandler
+class MercuryAsset : public RefBase, public MessageHandler
{
public:
MercuryAsset();
@@ -80,7 +80,7 @@
class MercuryAssetInstance
{
public:
- MercuryAssetInstance(MercuryAsset* asset);
+ MercuryAssetInstance(MercuryAsset* asset, MercuryNode* parentNode);
inline MercuryAsset& Asset() { return *m_asset; }
inline const MercuryAsset& Asset() const { return *m_asset; }
inline const MercuryAsset* AssetPtr() const { return m_asset; }
@@ -93,6 +93,7 @@
inline unsigned short GetPasses() { return m_iPasses; }
inline void SetPasses( unsigned short p ) { m_iPasses = p; }
private:
+ MercuryNode* m_parentNode;
MAutoPtr< MercuryAsset > m_asset; //actual asset storage
OcclusionResult m_occlusionResult;
bool m_isCulled;
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-10-10 22:22:50 UTC (rev 556)
+++ Mercury2/src/MercuryNode.cpp 2009-10-11 00:49:38 UTC (rev 557)
@@ -34,7 +34,7 @@
void MercuryNode::AddAsset(MercuryAsset* asset)
{
- m_assets.push_back( MercuryAssetInstance(asset) );
+ m_assets.push_back( MercuryAssetInstance(asset, this) );
}
void MercuryNode::AddChild(MercuryNode* n)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-10 22:22:59
|
Revision: 556
http://hgengine.svn.sourceforge.net/hgengine/?rev=556&view=rev
Author: axlecrusher
Date: 2009-10-10 22:22:50 +0000 (Sat, 10 Oct 2009)
Log Message:
-----------
add terrain
Modified Paths:
--------------
Mercury2/modules/Makefile
Added Paths:
-----------
Mercury2/modules/Terrain.cpp
Mercury2/modules/Terrain.h
Modified: Mercury2/modules/Makefile
===================================================================
--- Mercury2/modules/Makefile 2009-10-10 22:21:49 UTC (rev 555)
+++ Mercury2/modules/Makefile 2009-10-10 22:22:50 UTC (rev 556)
@@ -1,8 +1,8 @@
-CFLAGS=-O2 -g0 -Wall -I/usr/include/libxml2 -I.. -msse2 -DHAVE_CONFIG -DHGENGINE -fno-exceptions -fPIC -I../src -g
+CFLAGS=-O2 -g0 -Wall -I/usr/include/libxml2 -I.. -msse2 -DHAVE_CONFIG -DHGENGINE -fexceptions -fPIC -I../src -I../src/DataTypes -I../src/DataStructures -g
CXXFLAGS=${CFLAGS}
LDFLAGS=-shared
-all : BillboardNode.so TextNode.so
+all : BillboardNode.so TextNode.so Terrain.so
clean :
rm -rf *~ *.o *.so
@@ -12,3 +12,6 @@
TextNode.so : TextNode.o
g++ -o$@ $^ ${LDFLAGS}
+
+Terrain.so : Terrain.o
+ g++ -o$@ $^ ${LDFLAGS}
Added: Mercury2/modules/Terrain.cpp
===================================================================
--- Mercury2/modules/Terrain.cpp (rev 0)
+++ Mercury2/modules/Terrain.cpp 2009-10-10 22:22:50 UTC (rev 556)
@@ -0,0 +1,70 @@
+#include "Terrain.h"
+
+REGISTER_ASSET_TYPE(Terrain);
+
+Terrain::Terrain()
+ :base()
+{
+}
+
+Terrain::~Terrain()
+{
+}
+
+Terrain* Terrain::Generate()
+{
+ LOG.Write( "new Terrain" );
+ return new Terrain();
+}
+
+void Terrain::LoadedCallback()
+{
+ BuildHash();
+ base::LoadedCallback();
+}
+
+void Terrain::BuildHash()
+{
+ for( unsigned int i = 0; i < m_meshes.size(); ++i)
+ {
+ MAutoPtr< HGMDLMesh > mesh = m_meshes[i];
+ const HGMDLMesh& m = *mesh;
+ ImportMeshToHash( m );
+ }
+}
+
+void Terrain::ImportMeshToHash(const HGMDLMesh& mesh)
+{
+ const float* vertice = mesh.GetVertexHandle() + MercuryVBO::VERTEX_OFFSET;
+ const short unsigned int* indice = mesh.GetIndexHandle();
+
+ uint16_t length = mesh.IndiceCount();
+
+ float xMax, yMax, zMax;
+ xMax = yMax = zMax = 0;
+
+ for(uint16_t i = 0; i < length; ++i)
+ {
+ MercuryVertex v(vertice+(indice[i]*HGMDLMesh::STRIDE));
+ xMax = MAX<float>(v.GetX(),xMax);
+ yMax = MAX<float>(v.GetY(),yMax);
+ zMax = MAX<float>(v.GetZ(),zMax);
+ }
+
+ printf("%f %f %f\n", xMax, yMax, zMax);
+ m_hash.Allocate(xMax, yMax, zMax, 1);
+
+ for(uint16_t i = 0; i < length; i+=3)
+ {
+ MercuryVertex v1(vertice+(indice[i]*HGMDLMesh::STRIDE));
+ MercuryVertex v2(vertice+(indice[i+1]*HGMDLMesh::STRIDE));
+ MercuryVertex v3(vertice+(indice[i+2]*HGMDLMesh::STRIDE));
+ MTriangle t( v1, v2, v3 );
+
+ m_hash.Insert( v1.GetX(), v1.GetY(), v1.GetZ(), t );
+ m_hash.Insert( v2.GetX(), v2.GetY(), v2.GetZ(), t );
+ m_hash.Insert( v3.GetX(), v3.GetY(), v3.GetZ(), t );
+ }
+}
+
+
Added: Mercury2/modules/Terrain.h
===================================================================
--- Mercury2/modules/Terrain.h (rev 0)
+++ Mercury2/modules/Terrain.h 2009-10-10 22:22:50 UTC (rev 556)
@@ -0,0 +1,64 @@
+#ifndef TERRAIN_H
+#define TERRAIN_H
+
+#include <MercuryAsset.h>
+#include <HGMDLModel.h>
+#include <MercuryFile.h>
+
+#include <SpatialHash.h>
+#include <MTriangle.h>
+
+class Terrain : public HGMDLModel
+{
+ public:
+ Terrain();
+ ~Terrain();
+
+ static Terrain* Generate();
+ virtual void LoadedCallback(); //thread safe
+
+ private:
+ CLASS_HELPERS( HGMDLModel );
+ void BuildHash();
+ void ImportMeshToHash(const HGMDLMesh& mesh);
+
+ SpatialHash<MTriangle> m_hash;
+// void LoadHGMDL( const MString& path );
+// static void* LoaderThread(void* d);
+
+// std::vector< MAutoPtr< HGMDLMesh > > m_meshes;
+};
+
+#endif
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-10 22:21:55
|
Revision: 555
http://hgengine.svn.sourceforge.net/hgengine/?rev=555&view=rev
Author: axlecrusher
Date: 2009-10-10 22:21:49 +0000 (Sat, 10 Oct 2009)
Log Message:
-----------
add spatial hash and triangle class
Added Paths:
-----------
Mercury2/src/DataStructures/
Mercury2/src/DataStructures/SpatialHash.h
Mercury2/src/DataTypes/
Mercury2/src/DataTypes/MTriangle.cpp
Mercury2/src/DataTypes/MTriangle.h
Added: Mercury2/src/DataStructures/SpatialHash.h
===================================================================
--- Mercury2/src/DataStructures/SpatialHash.h (rev 0)
+++ Mercury2/src/DataStructures/SpatialHash.h 2009-10-10 22:21:49 UTC (rev 555)
@@ -0,0 +1,127 @@
+#ifndef SPATIALHASH_H
+#define SPATIALHASH_H
+
+#include <stdint.h>
+#include <list>
+#include <math.h>
+
+template<typename T>
+class SpatialHash
+{
+ public:
+ SpatialHash()
+ :m_hashTable(NULL), m_spacing(1.0f)
+ {
+ m_xSize = m_ySize = m_zSize = 0;
+ }
+
+ ~SpatialHash()
+ {
+ DeleteHash();
+ }
+
+ void Allocate(uint32_t xmax, uint32_t ymax, uint32_t zmax, uint32_t spacing)
+ {
+ DeleteHash();
+
+ m_spacing = spacing;
+
+ m_xSize = (abs(xmax)/m_spacing) + 1;
+ m_ySize = (abs(ymax)/m_spacing) + 1;
+ m_zSize = (abs(zmax)/m_spacing) + 1;
+
+ uint32_t size = m_xSize*m_ySize*m_zSize;
+ m_hashTable = new std::list<T>[size];
+ }
+
+ void Insert(float x, float y, float z, const T& d)
+ {
+ unsigned int ix = abs(x) / m_spacing;
+ unsigned int iy = abs(y) / m_spacing;
+ unsigned int iz = abs(z) / m_spacing;
+
+ if (ix >= m_xSize || iy >= m_ySize || iz >= m_zSize)
+ {
+ printf("%d >= %d || %d >= %d || %d >= %d\n", ix, m_xSize, iy, m_ySize, iz, m_zSize);
+ return;
+ }
+
+ //check for and skip duplicate
+ std::list<T>& cell = m_hashTable[ Index( ix, iy, iz ) ];
+ typename std::list<T>::iterator i = cell.begin();
+ for (;i != cell.end(); ++i) if (*i == d) return;
+
+ cell.push_back( d );
+// printf("added at %d %d %d\n", ix, iy, iz);
+ }
+
+ std::list<T> FindByXY(float x, float y)
+ {
+ int ix = x / m_spacing;
+ int iy = y / m_spacing;
+
+ std::list<T> r;
+
+ for (uint32_t iz = 0; iz < m_zSize; ++iz)
+ CopyIntoList(m_hashTable[Index(ix, iy, iz)], r);
+
+ return r;
+ }
+ private:
+ inline uint32_t Index(uint32_t x, uint32_t y, uint32_t z)
+ {
+ return x + (m_xSize * y) + (m_xSize * m_ySize * z);
+ }
+
+ void DeleteHash()
+ {
+ if (m_hashTable) delete[] m_hashTable;
+ m_spacing = 1;
+ m_xSize = m_ySize = m_zSize = 0;
+ }
+
+ void CopyIntoList(std::list<T>& in, std::list<T>& r)
+ {
+ typename std::list<T>::iterator i = in.begin();
+ for (;i != in.end(); ++i) r.push_back(*i);
+ }
+
+ std::list<T>* m_hashTable;
+ uint32_t m_spacing;
+ uint32_t m_xSize, m_ySize, m_zSize;
+};
+
+#endif
+
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Added: Mercury2/src/DataTypes/MTriangle.cpp
===================================================================
--- Mercury2/src/DataTypes/MTriangle.cpp (rev 0)
+++ Mercury2/src/DataTypes/MTriangle.cpp 2009-10-10 22:21:49 UTC (rev 555)
@@ -0,0 +1,96 @@
+#include <MTriangle.h>
+
+#include <stdio.h>
+
+MTriangle::MTriangle()
+{
+}
+
+MTriangle::MTriangle(const MercuryVertex a, const MercuryVertex& b, const MercuryVertex& c)
+{
+ m_verts[0] = a;
+ m_verts[1] = b;
+ m_verts[2] = c;
+}
+
+MercuryVertex MTriangle::Barycentric(const MercuryVertex& p)
+{
+ MercuryVector v[3];
+ v[0] = m_verts[1] - m_verts[0];
+ v[1] = m_verts[2] - m_verts[0];
+ v[2] = p - m_verts[0];
+
+ float dp[5];
+ dp[0] = v[0].DotProduct(v[0]);
+ dp[1] = v[0].DotProduct(v[1]);
+ dp[2] = v[0].DotProduct(v[2]);
+ dp[3] = v[1].DotProduct(v[1]);
+ dp[4] = v[1].DotProduct(v[2]);
+
+ // Compute barycentric coordinates
+ float invDenom = 1 / (dp[0] * dp[3] - dp[1] * dp[1]);
+ float ru = (dp[3] * dp[2] - dp[1] * dp[4]) * invDenom;
+ float rv = (dp[0] * dp[4] - dp[1] * dp[2]) * invDenom;
+
+ return MercuryVertex(ru, rv, 1-(ru+rv));
+}
+
+bool MTriangle::IsInTriangle(const MercuryVertex& p)
+{
+ MercuryVertex v = Barycentric(p);
+
+ //no edges
+// return (v.GetX() > 0) && (v.GetY() > 0) && (v.GetX() + v.GetY() < 1);
+
+ //includes edges
+ return (v.GetX() >= 0) && (v.GetY() >= 0) && (v.GetX() + v.GetY() <= 1);
+}
+
+float MTriangle::Area()
+{
+ MercuryVector v[2];
+ v[0] = m_verts[1] - m_verts[0];
+ v[1] = m_verts[2] - m_verts[0];
+ MercuryVector r( v[0].CrossProduct( v[1] ) );
+ return r.Length() * 0.5;
+}
+
+bool MTriangle::operator == (const MTriangle& rhs)
+{
+ if (m_verts[0] != rhs.m_verts[0]) return false;
+ if (m_verts[1] != rhs.m_verts[1]) return false;
+ if (m_verts[2] != rhs.m_verts[2]) return false;
+ return true;
+}
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Added: Mercury2/src/DataTypes/MTriangle.h
===================================================================
--- Mercury2/src/DataTypes/MTriangle.h (rev 0)
+++ Mercury2/src/DataTypes/MTriangle.h 2009-10-10 22:21:49 UTC (rev 555)
@@ -0,0 +1,55 @@
+#ifndef MTRIANGLE_H
+#define MTRIANGLE_H
+
+#include <MercuryVertex.h>
+
+class MTriangle
+{
+ public:
+ MTriangle();
+ MTriangle(const MercuryVertex a, const MercuryVertex& b, const MercuryVertex& c);
+
+ MercuryVertex Barycentric(const MercuryVertex& p);
+ bool IsInTriangle( const MercuryVertex& p );
+
+ float Area();
+
+ bool operator == (const MTriangle& rhs);
+ private:
+
+ MercuryVertex m_verts[3];
+};
+
+#endif
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-10 22:19:20
|
Revision: 554
http://hgengine.svn.sourceforge.net/hgengine/?rev=554&view=rev
Author: axlecrusher
Date: 2009-10-10 22:19:14 +0000 (Sat, 10 Oct 2009)
Log Message:
-----------
add const methods
update for easier striding else where
Modified Paths:
--------------
Mercury2/src/MercuryVBO.cpp
Mercury2/src/MercuryVBO.h
Modified: Mercury2/src/MercuryVBO.cpp
===================================================================
--- Mercury2/src/MercuryVBO.cpp 2009-10-10 22:16:31 UTC (rev 553)
+++ Mercury2/src/MercuryVBO.cpp 2009-10-10 22:19:14 UTC (rev 554)
@@ -25,7 +25,6 @@
void MercuryVBO::Render(const MercuryNode* node)
{
- uint16_t stride = sizeof(float)*8;
if ( !m_initiated ) InitVBO();
@@ -40,14 +39,14 @@
GLCALL( glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferIDs[0]) );
GLCALL( glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_bufferIDs[1]) );
- GLCALL( glVertexPointer(3, GL_FLOAT, stride, BUFFER_OFFSET(sizeof(float)*5)) );
+ GLCALL( glVertexPointer(3, GL_FLOAT, STRIDE*sizeof(float), BUFFER_OFFSET( VERTEX_OFFSET*sizeof(float) ) ) );
++m_vboBinds;
}
- Texture::ApplyActiveTextures(stride);
+ Texture::ApplyActiveTextures(STRIDE*sizeof(float));
GLCALL( glEnableClientState( GL_NORMAL_ARRAY ) );
- GLCALL( glNormalPointer(GL_FLOAT, stride, BUFFER_OFFSET(sizeof(float)*2)) );
+ GLCALL( glNormalPointer(GL_FLOAT, STRIDE*sizeof(float), BUFFER_OFFSET(sizeof(float)*2)) );
GLCALL( glDrawRangeElements(GL_TRIANGLES, 0, m_indexData.Length()-1, m_indexData.Length(), GL_UNSIGNED_SHORT, NULL) );
m_vboBatches++;
Modified: Mercury2/src/MercuryVBO.h
===================================================================
--- Mercury2/src/MercuryVBO.h 2009-10-10 22:16:31 UTC (rev 553)
+++ Mercury2/src/MercuryVBO.h 2009-10-10 22:19:14 UTC (rev 554)
@@ -10,6 +10,9 @@
class MercuryVBO : public MercuryAsset
{
public:
+ static const uint16_t STRIDE = 8;
+ static const uint16_t VERTEX_OFFSET = 5;
+
MercuryVBO();
virtual ~MercuryVBO();
@@ -22,9 +25,14 @@
static uint32_t ResetBatchCount() { uint32_t t = m_vboBatches; m_vboBatches = 0; return t; }
static uint32_t ResetBindCount() { uint32_t t = m_vboBinds; m_vboBinds = 0; return t; }
- float * GetVertexHandle() { return &m_vertexData[0]; }
- short unsigned int * GetIndexHandle() { return &m_indexData[0]; }
+ const float* GetVertexHandle() const { return m_vertexData.Buffer(); }
+ float* GetVertexHandle() { return m_vertexData.Buffer(); }
+
+ const short unsigned int* GetIndexHandle() const { return m_indexData.Buffer(); }
+ short unsigned int* GetIndexHandle() { return m_indexData.Buffer(); }
+ inline uint16_t IndiceCount() const { return m_indexData.Length(); }
+
static void* m_lastVBOrendered;
void DirtyVertices() { m_bDirtyVertices = 1; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-10 22:16:40
|
Revision: 553
http://hgengine.svn.sourceforge.net/hgengine/?rev=553&view=rev
Author: axlecrusher
Date: 2009-10-10 22:16:31 +0000 (Sat, 10 Oct 2009)
Log Message:
-----------
update
Modified Paths:
--------------
Mercury2/src/HGMDLModel.h
Mercury2/src/MercuryAsset.h
Modified: Mercury2/src/HGMDLModel.h
===================================================================
--- Mercury2/src/HGMDLModel.h 2009-10-10 22:15:29 UTC (rev 552)
+++ Mercury2/src/HGMDLModel.h 2009-10-10 22:16:31 UTC (rev 553)
@@ -23,11 +23,13 @@
virtual void PreRender(const MercuryNode* node);
virtual void Render(const MercuryNode* node);
+ protected:
+ std::vector< MAutoPtr< HGMDLMesh > > m_meshes;
+
private:
+ CLASS_HELPERS( MercuryAsset );
void LoadHGMDL( const MString& path );
static void* LoaderThread(void* d);
-
- std::vector< MAutoPtr< HGMDLMesh > > m_meshes;
};
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-10-10 22:15:29 UTC (rev 552)
+++ Mercury2/src/MercuryAsset.h 2009-10-10 22:16:31 UTC (rev 553)
@@ -146,6 +146,9 @@
#define REMOVE_ASSET_INSTANCE(class, key)\
AssetFactory::GetInstance().RemoveAssetInstance( ToUpper(#class)+key );
+#define CLASS_HELPERS(baseClass)\
+ typedef baseClass base;
+
#endif
/***************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-10 22:15:36
|
Revision: 552
http://hgengine.svn.sourceforge.net/hgengine/?rev=552&view=rev
Author: axlecrusher
Date: 2009-10-10 22:15:29 +0000 (Sat, 10 Oct 2009)
Log Message:
-----------
add const methods
Modified Paths:
--------------
Mercury2/src/AlignedBuffer.h
Modified: Mercury2/src/AlignedBuffer.h
===================================================================
--- Mercury2/src/AlignedBuffer.h 2009-10-10 21:37:58 UTC (rev 551)
+++ Mercury2/src/AlignedBuffer.h 2009-10-10 22:15:29 UTC (rev 552)
@@ -32,12 +32,14 @@
m_length = 0;
}
- inline unsigned long Length() { return m_length; }
- inline unsigned long LengthInBytes() { return m_length*sizeof(T); }
+ inline unsigned long Length() const { return m_length; }
+ inline unsigned long LengthInBytes() const { return m_length*sizeof(T); }
inline T* Buffer() { return m_data; }
+ inline const T* Buffer() const { return m_data; }
inline T& operator[](unsigned long x) { return m_data[x]; }
+ inline const T& operator[](unsigned long x) const { return m_data[x]; }
private:
unsigned long m_length;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-10-10 21:38:09
|
Revision: 551
http://hgengine.svn.sourceforge.net/hgengine/?rev=551&view=rev
Author: axlecrusher
Date: 2009-10-10 21:37:58 +0000 (Sat, 10 Oct 2009)
Log Message:
-----------
fixed converter
Modified Paths:
--------------
Mercury2/tools/obj2hgmdl/Makefile
Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp
Modified: Mercury2/tools/obj2hgmdl/Makefile
===================================================================
--- Mercury2/tools/obj2hgmdl/Makefile 2009-10-03 02:34:18 UTC (rev 550)
+++ Mercury2/tools/obj2hgmdl/Makefile 2009-10-10 21:37:58 UTC (rev 551)
@@ -1,2 +1,2 @@
all:
- g++ obj2hgmdl.cpp ../../src/MercuryPoint.cpp -I../../src -o obj2hgmdl
+ g++ obj2hgmdl.cpp ../../src/MQuaternion.cpp ../../src/MercuryVertex.cpp -I../../src -I../.. -DHGENGINE -g -o obj2hgmdl
Modified: Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp
===================================================================
--- Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp 2009-10-03 02:34:18 UTC (rev 550)
+++ Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp 2009-10-10 21:37:58 UTC (rev 551)
@@ -2,7 +2,7 @@
#include <fstream>
#include <vector>
#include <stdint.h>
-#include <MercuryPoint.h>
+#include <MercuryVertex.h>
#include <map>
#include <math.h>
@@ -11,17 +11,17 @@
float min(float x, float y) { return x<y?x:y; }
float max(float x, float y) { return x>y?x:y; }
-vector< MercuryPoint > v;
-vector< MercuryPoint > vt;
-vector< MercuryPoint > vn;
+vector< MercuryVertex > v;
+vector< MercuryVertex > vt;
+vector< MercuryVertex > vn;
float minX, maxX, minY, maxY, minZ, maxZ;
struct Vertex
{
- MercuryPoint uv;
- MercuryPoint normal;
- MercuryPoint position;
+ MercuryVertex uv;
+ MercuryVertex normal;
+ MercuryVertex position;
inline bool operator==(const Vertex& rhs)
{
@@ -38,29 +38,29 @@
string token = line.substr(0,2);
if (token == "v ")
{
- MercuryPoint tv;
- sscanf(line.c_str(), "v %f %f %f", &tv.x, &tv.y, &tv.z);
+ MercuryVertex tv;
+ sscanf(line.c_str(), "v %f %f %f", &tv[0], &tv[1], &tv[2]);
v.push_back(tv);
- minX = min(minX, tv.x);
- minY = min(minY, tv.y);
- minZ = min(minZ, tv.z);
+ minX = min(minX, tv[0]);
+ minY = min(minY, tv[1]);
+ minZ = min(minZ, tv[2]);
- maxX = max(maxX, tv.x);
- maxY = max(maxY, tv.y);
- maxZ = max(maxZ, tv.z);
+ maxX = max(maxX, tv[0]);
+ maxY = max(maxY, tv[1]);
+ maxZ = max(maxZ, tv[2]);
}
else if (token == "vt")
{
- MercuryPoint tv;
- sscanf(line.c_str(), "vt %f %f", &tv.x, &tv.y);
- tv.y = 1 - tv.y; //XXX reverse
+ MercuryVertex tv;
+ sscanf(line.c_str(), "vt %f %f", &tv[0], &tv[1]);
+ tv[1] = 1 - tv[1]; //XXX reverse
vt.push_back(tv);
}
else if (token == "vn")
{
- MercuryPoint tv;
- sscanf(line.c_str(), "vn %f %f %f", &tv.x, &tv.y, &tv.z);
+ MercuryVertex tv;
+ sscanf(line.c_str(), "vn %f %f %f", &tv[0], &tv[1], &tv[2]);
vn.push_back(tv);
}
else if (token == "f ")
@@ -74,7 +74,7 @@
{
r = sscanf(line.c_str(), "f %d/%d %d/%d %d/%d", &iv[0], &ivt[0], &iv[1], &ivt[1], &iv[2], &ivt[2]);
ivn[0] = ivn[1] = ivn[2] = 1;
- MercuryPoint tv;
+ MercuryVertex tv;
vn.push_back(tv);
}
@@ -86,7 +86,7 @@
tv[i].position = v[ iv[i]-1 ];
tv[i].normal = vn[ ivn[i]-1 ];
tv[i].uv = vt[ ivt[i]-1 ];
-
+
for (unsigned long j = 0; j < vertice.size(); ++j)
{
if (tv[i] == vertice[j])
@@ -153,13 +153,16 @@
for (uint32_t i = 0; i < vertice.size(); ++i)
{
fwrite(&vertice[i].uv, sizeof(float)*2, 1, mbmf);
- fwrite(&vertice[i].normal, sizeof(MercuryPoint), 1, mbmf);
- fwrite(&vertice[i].position, sizeof(MercuryPoint), 1, mbmf);
+ fwrite(&vertice[i].normal, sizeof(float)*3, 1, mbmf);
+ fwrite(&vertice[i].position, sizeof(float)*3, 1, mbmf);
}
tmp16 = indice.size(); fwrite(&tmp16, sizeof(uint16_t), 1, mbmf);
for (uint16_t i = 0; i < indice.size(); ++i)
+ {
fwrite(&indice[i], sizeof(uint16_t), 1, mbmf);
+ printf("%f %f %f\n", vertice[indice[i]].position.GetX(), vertice[indice[i]].position.GetY(), vertice[indice[i]].position.GetZ() );
+ }
tmp32 = 1; fwrite(&tmp32, sizeof(uint32_t), 1, mbmf);
WriteOBB(mbmf);
@@ -190,6 +193,7 @@
{
if (line.length() > 0) LineParser(line);
}
+ printf("Loaded\n");
WriteMBMF( mbmf );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-10-03 02:34:29
|
Revision: 550
http://hgengine.svn.sourceforge.net/hgengine/?rev=550&view=rev
Author: cnlohr
Date: 2009-10-03 02:34:18 +0000 (Sat, 03 Oct 2009)
Log Message:
-----------
fix copyright notices
Modified Paths:
--------------
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryNode.h
Mercury2/src/X11Window.cpp
Mercury2/src/X11Window.h
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-10-02 06:49:36 UTC (rev 549)
+++ Mercury2/src/MercuryNode.cpp 2009-10-03 02:34:18 UTC (rev 550)
@@ -396,27 +396,37 @@
__ThreadLocalStore int g_iViewportID;
__ThreadLocalStore int g_iPass;
+/****************************************************************************
+ * Copyright (C) 2008-2009 by Joshua Allen *
+ * Charles Lohr *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
-/***************************************************************************
- * Copyright (C) 2008 by Joshua Allen *
- * *
- * *
- * All rights reserved. *
- * *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *
- * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *
- * * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. *
- * *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR *
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
- ***************************************************************************/
+
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-10-02 06:49:36 UTC (rev 549)
+++ Mercury2/src/MercuryNode.h 2009-10-03 02:34:18 UTC (rev 550)
@@ -175,26 +175,37 @@
#endif
-/***************************************************************************
- * Copyright (C) 2008 by Joshua Allen *
- * *
- * *
- * All rights reserved. *
- * *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *
- * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *
- * * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. *
- * *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR *
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+/****************************************************************************
+ * Copyright (C) 2008-2009 by Joshua Allen *
+ * Charles Lohr *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
***************************************************************************/
+
+
Modified: Mercury2/src/X11Window.cpp
===================================================================
--- Mercury2/src/X11Window.cpp 2009-10-02 06:49:36 UTC (rev 549)
+++ Mercury2/src/X11Window.cpp 2009-10-03 02:34:18 UTC (rev 550)
@@ -370,26 +370,36 @@
return NULL;
}
-/***************************************************************************
- * Copyright (C) 2008 by Joshua Allen *
- * *
- * *
- * All rights reserved. *
- * *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *
- * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *
- * * Neither the name of the Mercury developers nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. *
- * *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR *
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+
+/****************************************************************************
+ * Copyright (C) 2008 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
***************************************************************************/
+
Modified: Mercury2/src/X11Window.h
===================================================================
--- Mercury2/src/X11Window.h 2009-10-02 06:49:36 UTC (rev 549)
+++ Mercury2/src/X11Window.h 2009-10-03 02:34:18 UTC (rev 550)
@@ -32,26 +32,36 @@
#endif
-/***************************************************************************
- * Copyright (C) 2008 by Joshua Allen *
- * *
- * *
- * All rights reserved. *
- * *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *
- * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *
- * * Neither the name of the Mercury developers nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. *
- * *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR *
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+/****************************************************************************
+ * Copyright (C) 2008 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
***************************************************************************/
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-10-02 06:49:45
|
Revision: 549
http://hgengine.svn.sourceforge.net/hgengine/?rev=549&view=rev
Author: cnlohr
Date: 2009-10-02 06:49:36 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
1) disable SSE by default since SSE produces broken code as of now.
2) actually allow for enabling of the GL_PROFILE ing of the code.
Modified Paths:
--------------
Mercury2/base_set.sh
Mercury2/modules/Makefile
Modified: Mercury2/base_set.sh
===================================================================
--- Mercury2/base_set.sh 2009-10-02 06:48:51 UTC (rev 548)
+++ Mercury2/base_set.sh 2009-10-02 06:49:36 UTC (rev 549)
@@ -8,12 +8,13 @@
ISMAC=1; fi
-OPTIONS="X11 libxml OGL sse gprof"
+OPTIONS="X11 libxml OGL sse gprof glprofile"
OPT_X11=1
OPT_OGL=1
OPT_libxml=1
-OPT_sse=1
+OPT_sse=0
OPT_gprof=0
+OPT_glprofile=0
DEFINES="WAS_CONFIGURED USE_MSTRING"
CC_BASE="-O2 -g0 -Wall"
@@ -44,9 +45,11 @@
NEED_H="stdio.h stdlib.h"
WANT_H="time.h"
+CC_BASE="$CC_BASE -I."
NEED_L="m c z pthread png pthread";
+
if test $OPT_libxml = 1; then
CC_BASE="$CC_BASE -I/usr/include/libxml2"
NEED_H="$NEED_H libxml/parser.h"
@@ -67,6 +70,10 @@
LD_BASE="$LD_BASE -pg"
fi
+if test $OPT_glprofile = 1; then
+ DEFINES="$DEFINES GL_PROFILE"
+fi
+
if test $OPT_OGL = 1; then
NEED_H="GL/gl.h"
NEED_L="$NEED_L GL GLU"
@@ -84,5 +91,9 @@
ARCH=`uname -m`
if test $ARCH = "i686" || test $ARCH = "i586"; then
- CC_BASE="$CC_BASE -march=pentium"
+ if test $OPT_sse = 1; then
+ CC_BASE="$CC_BASE -march=pentium3"
+ else
+ CC_BASE="$CC_BASE -march=pentium"
+ fi
fi
Modified: Mercury2/modules/Makefile
===================================================================
--- Mercury2/modules/Makefile 2009-10-02 06:48:51 UTC (rev 548)
+++ Mercury2/modules/Makefile 2009-10-02 06:49:36 UTC (rev 549)
@@ -1,4 +1,4 @@
-CFLAGS=-O2 -g0 -Wall -I/usr/include/libxml2 -DHAVE_CONFIG -DHGENGINE -fno-exceptions -fPIC -I../src -g
+CFLAGS=-O2 -g0 -Wall -I/usr/include/libxml2 -I.. -msse2 -DHAVE_CONFIG -DHGENGINE -fno-exceptions -fPIC -I../src -g
CXXFLAGS=${CFLAGS}
LDFLAGS=-shared
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-10-02 06:49:00
|
Revision: 548
http://hgengine.svn.sourceforge.net/hgengine/?rev=548&view=rev
Author: cnlohr
Date: 2009-10-02 06:48:51 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
at least make the system compile with SSE actually enabled
Modified Paths:
--------------
Mercury2/src/MercuryMath.h
Mercury2/src/MercuryMatrix.cpp
Modified: Mercury2/src/MercuryMath.h
===================================================================
--- Mercury2/src/MercuryMath.h 2009-10-02 06:48:35 UTC (rev 547)
+++ Mercury2/src/MercuryMath.h 2009-10-02 06:48:51 UTC (rev 548)
@@ -2,6 +2,9 @@
#define _MERCURYMATH_H
#include <math.h>
+#ifdef HGENGINE
+#include <configuration.h>
+#endif
#ifdef USE_SSE
#include <xmmintrin.h>
Modified: Mercury2/src/MercuryMatrix.cpp
===================================================================
--- Mercury2/src/MercuryMatrix.cpp 2009-10-02 06:48:35 UTC (rev 547)
+++ Mercury2/src/MercuryMatrix.cpp 2009-10-02 06:48:51 UTC (rev 548)
@@ -1,9 +1,22 @@
#include "MercuryMatrix.h"
#include <MercuryLog.h>
+float base_matrix_identity[16] = {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f };
+
MercuryMatrix::MercuryMatrix()
{
- *this = Identity();
+#ifdef USE_SSE
+ m_matrix[0] = _mm_load1_ps( &base_matrix_identity[0] );
+ m_matrix[1] = _mm_load1_ps( &base_matrix_identity[4] );
+ m_matrix[2] = _mm_load1_ps( &base_matrix_identity[8] );
+ m_matrix[3] = _mm_load1_ps( &base_matrix_identity[12] );
+#else
+ Copy16f(m_matrix[0], base_matrix_identity );
+#endif
}
const MercuryMatrix& MercuryMatrix::operator=(const MercuryMatrix& m)
@@ -28,14 +41,19 @@
const MercuryMatrix& MercuryMatrix::Identity()
{
- if (IdentityMatrix.m_matrix[0][0] != 1.0f)
+ static bool bSetIdentity = false;
+
+ if (!bSetIdentity)
{
- float identity[16] = {
- 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
- Copy16f(MercuryMatrix::IdentityMatrix.m_matrix[0], identity );
+ bSetIdentity = true;
+#ifdef USE_SSE
+ MercuryMatrix::IdentityMatrix.m_matrix[0] = _mm_load1_ps( &base_matrix_identity[0] );
+ MercuryMatrix::IdentityMatrix.m_matrix[1] = _mm_load1_ps( &base_matrix_identity[4] );
+ MercuryMatrix::IdentityMatrix.m_matrix[2] = _mm_load1_ps( &base_matrix_identity[8] );
+ MercuryMatrix::IdentityMatrix.m_matrix[3] = _mm_load1_ps( &base_matrix_identity[12] );
+#else
+ Copy16f(MercuryMatrix::IdentityMatrix.m_matrix[0], base_matrix_identity );
+#endif
}
return IdentityMatrix;
@@ -212,7 +230,8 @@
MercuryMatrix MercuryMatrix::IdentityMatrix;
/*
- * Copyright (c) 2006 Joshua Allen
+ * Copyright (c) 2006-2009 Joshua Allen
+ * Charles Lohr
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-10-02 06:48:41
|
Revision: 547
http://hgengine.svn.sourceforge.net/hgengine/?rev=547&view=rev
Author: cnlohr
Date: 2009-10-02 06:48:35 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
forgot to commit this
Modified Paths:
--------------
Mercury2/src/GLHelpers.h
Modified: Mercury2/src/GLHelpers.h
===================================================================
--- Mercury2/src/GLHelpers.h 2009-10-02 06:47:57 UTC (rev 546)
+++ Mercury2/src/GLHelpers.h 2009-10-02 06:48:35 UTC (rev 547)
@@ -8,7 +8,11 @@
#include <RawImageData.h>
+#ifdef GL_PROFILE
#define GLCALL(x) x; ProfileGLCall(#x);
+#else
+#define GLCALL(x) x;
+#endif
MString GlError2String(uint32_t e);
void glLoadMatrix(const MercuryMatrix& m);
@@ -16,7 +20,9 @@
MercuryVertex pointFromScreenLoc(int screen_x, int screen_y);
unsigned int ToGLColorType(ColorByteType cbt);
+#ifdef GL_PROFILE
void ProfileGLCall(const MString& funcName);
+#endif
void PrintGLFunctionCalls();
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-10-02 06:48:04
|
Revision: 546
http://hgengine.svn.sourceforge.net/hgengine/?rev=546&view=rev
Author: cnlohr
Date: 2009-10-02 06:47:57 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
permit disabling of the GL profiling based on the configure flags
Modified Paths:
--------------
Mercury2/src/GLHeaders.h
Mercury2/src/GLHelpers.cpp
Mercury2/src/Mercury2.cpp
Mercury2/src/global.h
Modified: Mercury2/src/GLHeaders.h
===================================================================
--- Mercury2/src/GLHeaders.h 2009-10-02 06:47:10 UTC (rev 545)
+++ Mercury2/src/GLHeaders.h 2009-10-02 06:47:57 UTC (rev 546)
@@ -1,5 +1,7 @@
#ifndef GLHEADERS_H
#define GLHEADERS_H
+
+#include <configuration.h>
#ifdef WIN32
#include <windows.h>
Modified: Mercury2/src/GLHelpers.cpp
===================================================================
--- Mercury2/src/GLHelpers.cpp 2009-10-02 06:47:10 UTC (rev 545)
+++ Mercury2/src/GLHelpers.cpp 2009-10-02 06:47:57 UTC (rev 546)
@@ -2,8 +2,6 @@
#include <GLHelpers.h>
#include <MercuryHash.h>
-uint32_t GLCALLCOUNT = 0;
-MHash< uint32_t> GLFUNCTCOUNT;
MString GlError2String(uint32_t e)
{
@@ -110,6 +108,10 @@
}
+#ifdef GL_PROFILE
+uint32_t GLCALLCOUNT = 0;
+MHash< uint32_t> GLFUNCTCOUNT;
+
void ProfileGLCall(const MString& funcName)
{
++GLCALLCOUNT;
@@ -126,6 +128,12 @@
GLFUNCTCOUNT.clear();
}
+#else
+void PrintGLFunctionCalls()
+{
+ LOG.Write( "No profiling performed on data set because it was configrued off." );
+}
+#endif
/****************************************************************************
* Copyright (C) 2009 by Joshua Allen *
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2009-10-02 06:47:10 UTC (rev 545)
+++ Mercury2/src/Mercury2.cpp 2009-10-02 06:47:57 UTC (rev 546)
@@ -165,11 +165,13 @@
float batches = MercuryVBO::ResetBatchCount()/(float)m_count;
float VBinds = MercuryVBO::ResetBindCount()/(float)m_count;
float Tbinds = Texture::ReadAndResetBindCount()/(float)m_count;
+ LOG.Write( ssprintf("FPS: %f, VBO batches %f, TBinds %f, VBinds %f", m_count/fpsTimer.Age(), batches, Tbinds, VBinds) );
+#ifdef GL_PROFILE
float GLcalls = GLCALLCOUNT/(float)m_count;
- LOG.Write( ssprintf("FPS: %f, VBO batches %f, TBinds %f, VBinds %f", m_count/fpsTimer.Age(), batches, Tbinds, VBinds) );
- LOG.Write( ssprintf("GL/f: %f", GLcalls) );
+ GLCALLCOUNT = 0;
+ LOG.Write( ssprintf("GL/f: %f", GLcalls) );
+#endif
m_count = 0;
- GLCALLCOUNT = 0;
fpsTimer = timer;
}
}
Modified: Mercury2/src/global.h
===================================================================
--- Mercury2/src/global.h 2009-10-02 06:47:10 UTC (rev 545)
+++ Mercury2/src/global.h 2009-10-02 06:47:57 UTC (rev 546)
@@ -4,7 +4,7 @@
#ifdef WIN32
#pragma warning( disable : 4100 )
#endif
-
+#include <configuration.h>
#include <Mint.h>
-#endif
\ No newline at end of file
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-10-02 06:47:16
|
Revision: 545
http://hgengine.svn.sourceforge.net/hgengine/?rev=545&view=rev
Author: cnlohr
Date: 2009-10-02 06:47:10 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
fix: There is virtually no way to SSE-ize Quaternion math efficiently, except in place on large data sets. We use quaternions in a much different way, so don't float_row it.
Modified Paths:
--------------
Mercury2/src/MQuaternion.h
Modified: Mercury2/src/MQuaternion.h
===================================================================
--- Mercury2/src/MQuaternion.h 2009-09-28 22:37:27 UTC (rev 544)
+++ Mercury2/src/MQuaternion.h 2009-10-02 06:47:10 UTC (rev 545)
@@ -73,7 +73,10 @@
inline float& Z() { return m_wxyz[3]; }
// private:
- FloatRow m_wxyz;
+ //Tricky: This cannot be a float row, otherwise all references cease to operate as one would expect.
+ //Also, for most operations, it appeared to go slower. All the moving in and out of these variables
+ //is disadvantagious.
+ float m_wxyz[4];
} M_ALIGN(32);
///Produce a matrix out of a rotation x, then y then z (how Mercury does it)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-09-28 22:37:40
|
Revision: 544
http://hgengine.svn.sourceforge.net/hgengine/?rev=544&view=rev
Author: cnlohr
Date: 2009-09-28 22:37:27 +0000 (Mon, 28 Sep 2009)
Log Message:
-----------
add option for gprof
Modified Paths:
--------------
Mercury2/base_set.sh
Modified: Mercury2/base_set.sh
===================================================================
--- Mercury2/base_set.sh 2009-09-28 22:16:16 UTC (rev 543)
+++ Mercury2/base_set.sh 2009-09-28 22:37:27 UTC (rev 544)
@@ -8,11 +8,12 @@
ISMAC=1; fi
-OPTIONS="X11 libxml OGL sse"
+OPTIONS="X11 libxml OGL sse gprof"
OPT_X11=1
OPT_OGL=1
OPT_libxml=1
OPT_sse=1
+OPT_gprof=0
DEFINES="WAS_CONFIGURED USE_MSTRING"
CC_BASE="-O2 -g0 -Wall"
@@ -61,6 +62,11 @@
DEFINES="$DEFINES USE_X11"
fi
+if test $OPT_gprof = 1; then
+ CC_BASE="$CC_BASE -pg"
+ LD_BASE="$LD_BASE -pg"
+fi
+
if test $OPT_OGL = 1; then
NEED_H="GL/gl.h"
NEED_L="$NEED_L GL GLU"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-09-28 22:16:24
|
Revision: 543
http://hgengine.svn.sourceforge.net/hgengine/?rev=543&view=rev
Author: cnlohr
Date: 2009-09-28 22:16:16 +0000 (Mon, 28 Sep 2009)
Log Message:
-----------
update scene graph to reflect different text
Modified Paths:
--------------
Mercury2/Themes/default/File/scenegraph.xml
Modified: Mercury2/Themes/default/File/scenegraph.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraph.xml 2009-09-28 22:09:14 UTC (rev 542)
+++ Mercury2/Themes/default/File/scenegraph.xml 2009-09-28 22:16:16 UTC (rev 543)
@@ -1,9 +1,12 @@
<SceneGraph name="root">
<node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp">
<node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
- <node type="transformnode" movz="-5" >
- <node type="TextNode" text="test font 123 HELLO WORLD!!! WOOT!" font="FONT:testfont.hgfont" size=".01" width="300" alphaPath="true" alignment="FIT_FULL" />
+ <node type="transformnode" movz="-5" movy="2">
+ <node type="TextNode" text="test font 123 HELLO WORLD!!! WOOT!" font="FONT:FreeSans.hgfont" size=".01" width="300" alphaPath="true" alignment="FIT_FULL" />
</node>
+ <node type="transformnode" movz="-5" movx="-4" movy="2">
+ <node type="TextNode" text="Another test!" font="FONT:FreeMonoBold.hgfont" size=".01" width="300" alphaPath="true" alignment="LEFT" />
+ </node>
<node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
<asset type="texture" file="MODEL:map.png"/>
<asset type="hgmdlmodel" file="MODEL:map.hgmdl" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|