|
From: <cn...@us...> - 2010-03-02 03:24:15
|
Revision: 682
http://hgengine.svn.sourceforge.net/hgengine/?rev=682&view=rev
Author: cnlohr
Date: 2010-03-02 03:24:08 +0000 (Tue, 02 Mar 2010)
Log Message:
-----------
allow obj2hgmdl to compile
Modified Paths:
--------------
Mercury2/src/MQuaternion.cpp
Mercury2/src/MQuaternion.h
Mercury2/src/MercuryVertex.cpp
Mercury2/src/MercuryVertex.h
Mercury2/tools/obj2hgmdl/Makefile
Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp
Modified: Mercury2/src/MQuaternion.cpp
===================================================================
--- Mercury2/src/MQuaternion.cpp 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/src/MQuaternion.cpp 2010-03-02 03:24:08 UTC (rev 682)
@@ -1,7 +1,6 @@
#include <MQuaternion.h>
#include <MercuryMath.h>
#include <MercuryMatrix.h>
-#include <MercuryLog.h>
MQuaternion::MQuaternion()
{
@@ -264,9 +263,9 @@
return v;
}
-void MQuaternion::Print(const MString& s) const
+MString MQuaternion::Stringify(const MString& s) const
{
- LOG.Write( ssprintf("%s: %f %f %f %f", s.c_str(), m_wxyz[0], m_wxyz[1], m_wxyz[2], m_wxyz[3]) );
+ return ssprintf("%s: %f %f %f %f", s.c_str(), m_wxyz[0], m_wxyz[1], m_wxyz[2], m_wxyz[3]);
}
//Returns the Euclidian Inner Product of two MQuaternions (Similar to Vector Dot-Product)
Modified: Mercury2/src/MQuaternion.h
===================================================================
--- Mercury2/src/MQuaternion.h 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/src/MQuaternion.h 2010-03-02 03:24:08 UTC (rev 682)
@@ -69,7 +69,7 @@
bool operator==(const MQuaternion &rhs) const;
inline bool operator!=(const MQuaternion &rhs) const { return !(*this == rhs); }
- void Print(const MString& s = "MQuaternion") const;
+ MString Stringify(const MString& s = "MQuaternion") const;
inline float& W() { return m_wxyz[0]; }
inline float& X() { return m_wxyz[1]; }
Modified: Mercury2/src/MercuryVertex.cpp
===================================================================
--- Mercury2/src/MercuryVertex.cpp 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/src/MercuryVertex.cpp 2010-03-02 03:24:08 UTC (rev 682)
@@ -2,7 +2,6 @@
#include <MercuryUtil.h>
#include <MercuryMath.h>
#include <MQuaternion.h>
-#include <MercuryLog.h>
#include <MercuryMatrix.h>
@@ -149,9 +148,9 @@
return GetX() + GetY() + GetZ() + GetW();
}
-void MercuryVertex::Print(const MString& s) const
+MString MercuryVertex::Stringify(const MString& s) const
{
- LOG.Write(ssprintf("%s: %f %f %f %f", s.c_str(), (*this)[0], (*this)[1], (*this)[2], (*this)[3]));
+ return ssprintf("%s: %f %f %f %f", s.c_str(), (*this)[0], (*this)[1], (*this)[2], (*this)[3]);
}
MercuryVertex MercuryVertex::Rotate(const MQuaternion& q) const
Modified: Mercury2/src/MercuryVertex.h
===================================================================
--- Mercury2/src/MercuryVertex.h 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/src/MercuryVertex.h 2010-03-02 03:24:08 UTC (rev 682)
@@ -88,7 +88,7 @@
float DotProduct(const MercuryVertex& rhs) const;
MercuryVertex DotProduct3(const MercuryVertex& rhs1, const MercuryVertex& rhs2, const MercuryVertex& rhs3) const;
- void Print(const MString& s = "Vertex") const;
+ MString Stringify(const MString& s = "Vertex") const;
MercuryVertex Rotate(const MQuaternion& q) const;
Modified: Mercury2/tools/obj2hgmdl/Makefile
===================================================================
--- Mercury2/tools/obj2hgmdl/Makefile 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/tools/obj2hgmdl/Makefile 2010-03-02 03:24:08 UTC (rev 682)
@@ -1,2 +1,2 @@
all:
- g++ obj2hgmdl.cpp ../../src/MQuaternion.cpp ../../src/MercuryVertex.cpp -I../../src -I../.. -DHGENGINE -g -o obj2hgmdl
+ g++ obj2hgmdl.cpp ../../src/MQuaternion.cpp ../../src/MercuryVertex.cpp ../../src/MercuryString.cpp -I../../src -I../.. -DHGENGINE -g -o obj2hgmdl
Modified: Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp
===================================================================
--- Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp 2010-03-02 02:00:15 UTC (rev 681)
+++ Mercury2/tools/obj2hgmdl/obj2hgmdl.cpp 2010-03-02 03:24:08 UTC (rev 682)
@@ -5,6 +5,7 @@
#include <MercuryVertex.h>
#include <map>
#include <math.h>
+#include <stdlib.h>
using namespace std;
@@ -85,7 +86,8 @@
bool found = false;
tv[i].position = v[ iv[i]-1 ];
tv[i].normal = vn[ ivn[i]-1 ];
- tv[i].uv = vt[ ivt[i]-1 ];
+ if( vt.size() > ivt[i]-1 )
+ tv[i].uv = vt[ ivt[i]-1 ];
for (unsigned long j = 0; j < vertice.size(); ++j)
{
@@ -181,6 +183,12 @@
FILE *mbmf;
ifstream obj;
+ if( argc != 3 )
+ {
+ fprintf( stderr, "Usage: %s [OBJ File] [HGMDL File]\n", argv[0] );
+ exit( -1 );
+ }
+
obj.open(argv[1]);
mbmf = fopen(argv[2], "wb");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|