|
From: <axl...@us...> - 2009-08-19 01:40:48
|
Revision: 497
http://hgengine.svn.sourceforge.net/hgengine/?rev=497&view=rev
Author: axlecrusher
Date: 2009-08-19 01:40:37 +0000 (Wed, 19 Aug 2009)
Log Message:
-----------
Add program log.
Modified Paths:
--------------
Mercury2/src/GLHeaders.h
Mercury2/src/GLHelpers.cpp
Mercury2/src/HGMDLMesh.cpp
Mercury2/src/HGMDLModel.cpp
Mercury2/src/ImageLoader.cpp
Mercury2/src/Light.cpp
Mercury2/src/MQuaternion.cpp
Mercury2/src/Mercury2.cpp
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryMatrix.cpp
Mercury2/src/MercuryNode.cpp
Mercury2/src/MercuryNode.h
Mercury2/src/MercuryVertex.cpp
Mercury2/src/PNGLoader.cpp
Mercury2/src/Quad.cpp
Mercury2/src/RawImageData.cpp
Mercury2/src/Shader.cpp
Added Paths:
-----------
Mercury2/src/MercuryLog.cpp
Mercury2/src/MercuryLog.h
Modified: Mercury2/src/GLHeaders.h
===================================================================
--- Mercury2/src/GLHeaders.h 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/GLHeaders.h 2009-08-19 01:40:37 UTC (rev 497)
@@ -21,16 +21,18 @@
#include <GLHelpers.h>
#include <assert.h>
+#include <MercuryLog.h>
+
#define GLERRORCHECK { \
uint32_t e = glGetError(); \
if ( e != GL_NO_ERROR ) { \
-printf("GL Error:%s\n", GlError2String(e).c_str()); \
+LOG.Write(ssprintf("GL Error:%s", GlError2String(e).c_str())); \
assert(0); } }
#define CHECKFBO { \
uint32_t e = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); \
if ( e != GL_FRAMEBUFFER_COMPLETE ) { \
-printf("GL FBO Error:%s\n", GlError2String(e).c_str()); \
+LOG.Write(ssprintf("GL FBO Error:%s", GlError2String(e).c_str())); \
assert(0); } }
Modified: Mercury2/src/GLHelpers.cpp
===================================================================
--- Mercury2/src/GLHelpers.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/GLHelpers.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -97,10 +97,10 @@
case RGBA16F:
return GL_RGBA16F_ARB;
case RGBA32F:
- printf( "GL_RGBA32F_ARB unsupported using GL_RGBA16F_ARB\n" );
+ LOG.Write("GL_RGBA32F_ARB unsupported using GL_RGBA16F_ARB" );
return GL_RGBA16F_ARB;
default:
- printf( "Unsupported color byte type (%d)\n", cbt );
+ LOG.Write(ssprintf( "Unsupported color byte type (%d)", cbt ));
return GL_RGB;
}
Modified: Mercury2/src/HGMDLMesh.cpp
===================================================================
--- Mercury2/src/HGMDLMesh.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/HGMDLMesh.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -41,7 +41,7 @@
uint32_t extraDataCount;
hgmdl->Read( &extraDataCount, sizeof( uint32_t ) );
- printf("has %d extras\n", extraDataCount);
+ LOG.Write(ssprintf("has %d extras", extraDataCount));
for (uint32_t i = 0; i < extraDataCount; ++i)
{
ReadExtraData(hgmdl);
@@ -62,7 +62,7 @@
}
default:
{
- printf("Junk extra type '%x'\n", type);
+ LOG.Write(ssprintf("Junk extra type '%x'", type));
//read and discard as junk
uint32_t length;
hgmdl->Read( &length, sizeof(uint32_t) );
Modified: Mercury2/src/HGMDLModel.cpp
===================================================================
--- Mercury2/src/HGMDLModel.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/HGMDLModel.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -1,5 +1,6 @@
#include <HGMDLModel.h>
#include <MercuryNode.h>
+
REGISTER_ASSET_TYPE(HGMDLModel);
const uint16_t EXPCTMJRV = 2;
@@ -33,7 +34,7 @@
MString p(fingerPrint);
if (p != "MBMF")
{
- printf("Not a HGMDL file.\n");
+ LOG.Write("Not a HGMDL file.");
return;
}
@@ -45,7 +46,7 @@
if ((majorVersion != EXPCTMJRV) || (minorVersion != EXPCTMNRV))
{
- printf("Can only read HGMDL version %d.%d, this file is %d.%d\n", EXPCTMJRV,EXPCTMNRV,majorVersion,minorVersion);
+ LOG.Write(ssprintf("Can only read HGMDL version %d.%d, this file is %d.%d", EXPCTMJRV,EXPCTMNRV,majorVersion,minorVersion) );
return;
}
@@ -109,7 +110,7 @@
HGMDLModel* HGMDLModel::Generate()
{
- printf("new HGMDL\n");
+ LOG.Write( "new HGMDL" );
return new HGMDLModel();
}
@@ -124,7 +125,7 @@
MercuryFile * f = FILEMAN.Open( model->m_path );
if( !f )
{
- printf( "Could not open file: \"%s\" for model\n", model->m_path.c_str() );
+ LOG.Write( "Could not open file: \""+ model->m_path +"\" for model");
return 0;
}
Modified: Mercury2/src/ImageLoader.cpp
===================================================================
--- Mercury2/src/ImageLoader.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/ImageLoader.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -1,6 +1,7 @@
#include <ImageLoader.h>
#include <MercuryUtil.h>
#include <Texture.h>
+#include <MercuryLog.h>
using namespace std;
@@ -41,7 +42,7 @@
if( !f )
{
- printf( "Error opening image: %s\n", filename.c_str() );
+ LOG.Write( "Error opening image: "+filename );
return 0;
}
Modified: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/Light.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -120,7 +120,7 @@
d = m_power * d;
m_radius = Clamp<float>(0.0f, 1000.0f, d);
- printf("light radius %f\n", m_radius);
+ LOG.Write(ssprintf("light radius %f", m_radius));
}
void Light::BuildBoundingBox()
Modified: Mercury2/src/MQuaternion.cpp
===================================================================
--- Mercury2/src/MQuaternion.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/MQuaternion.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -1,6 +1,7 @@
#include <MQuaternion.h>
#include <MercuryMath.h>
#include <MercuryMatrix.h>
+#include <MercuryLog.h>
MQuaternion::MQuaternion()
{
@@ -257,7 +258,7 @@
void MQuaternion::Print(const MString& s) const
{
- printf("%s: %f %f %f %f\n", s.c_str(), m_wxyz[0], m_wxyz[1], m_wxyz[2], m_wxyz[3]);
+ LOG.Write( 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/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/Mercury2.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -18,6 +18,9 @@
#include <GLHeaders.h>
#include <ModuleManager.h>
#include <MercuryFile.h>
+
+#include <MercuryLog.h>
+
bool SHOWBOUNDINGVOLUME = false;
bool SHOWAXISES = false;
bool DOOCCLUSIONCULL = false;
@@ -36,9 +39,9 @@
int SignalHandler( int signal )
{
char buffer[2048];
- printf( "Fatal error encountered in Mercury 2: %s\n", cn_get_crash_description( signal ) );
+ LOG.Write(ssprintf( "Fatal error encountered in Mercury 2: %s", cn_get_crash_description( signal ) ));
cnget_backtrace( 1, buffer, 2047 );
- printf( "%s\n", buffer );
+ LOG.Write( buffer );
return 0; //Continue regular crash.
}
@@ -103,7 +106,7 @@
float batches = MercuryVBO::ResetBatchCount()/(float)m_count;
float VBinds = MercuryVBO::ResetBindCount()/(float)m_count;
float Tbinds = Texture::ReadAndResetBindCount()/(float)m_count;
- printf("FPS: %f, VBO batches %f, TBinds %f, VBinds %f\n", m_count/fpsTimer.Age(), batches, Tbinds, VBinds);
+ LOG.Write( ssprintf("FPS: %f, VBO batches %f, TBinds %f, VBinds %f", m_count/fpsTimer.Age(), batches, Tbinds, VBinds) );
m_count = 0;
fpsTimer = timer;
}
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -116,7 +116,7 @@
std::list< std::pair< MString, Callback0R< MAutoPtr<MercuryAsset> > > >::iterator i;
for (i = m_factoryCallbacks.begin(); i != m_factoryCallbacks.end(); ++i)
if (i->first == t) return i->second();
- printf("WARNING: Asset type %s not found.\n", type.c_str());
+ LOG.Write( "WARNING: Asset type " + type + " not found." );
return NULL;
}
@@ -129,6 +129,7 @@
void AssetFactory::RemoveAssetInstance(const MString& key)
{
m_assetInstances.remove( key );
+ LOG.Write( "removed asset "+key );
}
MHash< MercuryAsset*> AssetFactory::m_assetInstances;
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/MercuryAsset.h 2009-08-19 01:40:37 UTC (rev 497)
@@ -8,6 +8,7 @@
#include <MSemaphore.h>
#include <XMLParser.h>
#include <Callback.h>
+#include <MercuryLog.h>
#include <MercuryHash.h>
#include <list>
Added: Mercury2/src/MercuryLog.cpp
===================================================================
--- Mercury2/src/MercuryLog.cpp (rev 0)
+++ Mercury2/src/MercuryLog.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -0,0 +1,113 @@
+#include <MercuryLog.h>
+#include <iostream>
+
+using namespace std;
+
+void* MercuryLog::ThreadLoop(void* d)
+{
+ MercuryLog* log = static_cast<MercuryLog*>(d);
+
+ while (true)
+ {
+ log->CopyQueue();
+ log->WriteQueue();
+ usleep(100000); //10x/sec
+ }
+}
+
+MercuryLog::MercuryLog()
+{
+ m_thread.Create(MercuryLog::ThreadLoop, this, true);
+}
+
+MercuryLog::~MercuryLog()
+{
+ m_thread.Halt();
+ CopyQueue();
+ WriteQueue();
+}
+
+void MercuryLog::Open(const MString& file)
+{
+ m_file.open(file.c_str());
+}
+
+void MercuryLog::Close()
+{
+ m_file.close();
+}
+
+void MercuryLog::Write(const MString& message)
+{
+ AutoMutexLock lock(m_mutex);
+ m_queue.push_back( message );
+}
+
+void MercuryLog::CopyQueue()
+{
+ AutoMutexLock lock(m_mutex);
+
+ std::list< MString >::iterator i;
+
+ for (i = m_queue.begin(); i != m_queue.end(); ++i)
+ m_outQueue.push_back( *i );
+
+ m_queue.clear();
+}
+
+void MercuryLog::WriteQueue()
+{
+ std::list< MString >::iterator i;
+
+ for (i = m_outQueue.begin(); i != m_outQueue.end(); ++i)
+ {
+ const MString& m = *i;
+ cout << m << endl;
+ m_file << m << endl;
+ }
+
+ m_outQueue.clear();
+}
+
+MercuryProgramLog& MercuryProgramLog::GetInstance()
+{
+ static MercuryProgramLog* pl = NULL;
+ if (!pl)
+ {
+ pl = new MercuryProgramLog;
+ pl->m_log.Open("log.txt");
+ }
+ return *pl;
+}
+
+/****************************************************************************
+ * 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/MercuryLog.h
===================================================================
--- Mercury2/src/MercuryLog.h (rev 0)
+++ Mercury2/src/MercuryLog.h 2009-08-19 01:40:37 UTC (rev 497)
@@ -0,0 +1,83 @@
+#ifndef MERCURYLOG_H
+#define MERCURYLOG_H
+
+#include <fstream>
+#include <list>
+#include <MercuryString.h>
+#include <MercuryThreads.h>
+
+#include <MercuryUtil.h>
+
+class MercuryLog
+{
+ public:
+ MercuryLog();
+ ~MercuryLog();
+
+ static MercuryLog& GetInstance();
+
+ void Open(const MString& file);
+ void Close();
+
+ void Write(const MString& message);
+
+ private:
+ static void* ThreadLoop(void* d);
+ void CopyQueue();
+ void WriteQueue();
+
+ std::list< MString > m_queue;
+ std::list< MString > m_outQueue;
+
+ std::ofstream m_file;
+ MercuryMutex m_mutex;
+
+ MercuryThread m_thread;
+};
+
+class MercuryProgramLog
+{
+ public:
+ static MercuryProgramLog& GetInstance();
+ inline MercuryLog& Log() { return m_log; }
+ private:
+ MercuryLog m_log;
+};
+
+static InstanceCounter<MercuryProgramLog> MLOGcounter("MercuryProgramLog");
+
+#define LOG MercuryProgramLog::GetInstance().Log()
+
+#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. *
+ ***************************************************************************/
Modified: Mercury2/src/MercuryMatrix.cpp
===================================================================
--- Mercury2/src/MercuryMatrix.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/MercuryMatrix.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -1,5 +1,5 @@
#include "MercuryMatrix.h"
-#include <stdio.h>
+#include <MercuryLog.h>
MercuryMatrix::MercuryMatrix()
{
@@ -197,9 +197,9 @@
{
for (int i = 0; i < 4; ++i)
{
- printf( "%f %f %f %f\n", (*this)[i][0], (*this)[i][1], (*this)[i][2], (*this)[i][3] );
+ LOG.Write( ssprintf( "%f %f %f %f", (*this)[i][0], (*this)[i][1], (*this)[i][2], (*this)[i][3] ) );
}
- printf("\n");
+ LOG.Write("\n");
}
MercuryVector MercuryMatrix::operator*(const MercuryVector& v) const
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/MercuryNode.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -374,7 +374,7 @@
std::list< std::pair< MString, Callback0R<MercuryNode*> > >::iterator i;
for (i = m_factoryCallbacks.begin(); i != m_factoryCallbacks.end(); ++i)
if (i->first == t) return i->second();
- printf("WARNING: Node type %s not found.\n", type.c_str());
+ LOG.Write( "WARNING: Node type " + type + " not found." );
return NULL;
}
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/MercuryNode.h 2009-08-19 01:40:37 UTC (rev 497)
@@ -7,7 +7,9 @@
#include <XMLParser.h>
#include <MercuryUtil.h>
#include <MessageHandler.h>
+#include <MercuryLog.h>
+
#include <MercuryAsset.h>
#include <BoundingBox.h>
@@ -156,7 +158,7 @@
MercuryNode* FactoryFunct##class() { return new class(); } \
Callback0R<MercuryNode*> factoryclbk##class( FactoryFunct##class ); \
bool GlobalRegisterSuccess##class = NodeFactory::GetInstance().RegisterFactoryCallback(#class, factoryclbk##class); \
- extern "C" { int Install##class() { printf( "Installing "#class "\n" ); NodeFactory::GetInstance().RegisterFactoryCallback(#class, factoryclbk##class); return 0; } }
+ extern "C" { int Install##class() { LOG.Write("Installing "#class ); NodeFactory::GetInstance().RegisterFactoryCallback(#class, factoryclbk##class); return 0; } }
#endif
Modified: Mercury2/src/MercuryVertex.cpp
===================================================================
--- Mercury2/src/MercuryVertex.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/MercuryVertex.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -2,6 +2,7 @@
#include <MercuryUtil.h>
#include <MercuryMath.h>
#include <MQuaternion.h>
+#include <MercuryLog.h>
MercuryVertex::MercuryVertex()
{
@@ -120,7 +121,7 @@
void MercuryVertex::Print(const MString& s) const
{
- printf("%s: %f %f %f %f\n", s.c_str(), (*this)[0], (*this)[1], (*this)[2], (*this)[3]);
+ LOG.Write(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/PNGLoader.cpp
===================================================================
--- Mercury2/src/PNGLoader.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/PNGLoader.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -1,5 +1,6 @@
#include <ImageLoader.h>
#include <MercuryUtil.h>
+#include <MercuryLog.h>
#include <assert.h>
@@ -163,7 +164,7 @@
}
break;
default:
- printf("Invalid color byte type for PNG.\n");
+ LOG.Write("Invalid color byte type for PNG.");
SAFE_DELETE_ARRAY( image );
return false;
}
@@ -207,4 +208,4 @@
* 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.
- */
\ No newline at end of file
+ */
Modified: Mercury2/src/Quad.cpp
===================================================================
--- Mercury2/src/Quad.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/Quad.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -49,7 +49,7 @@
{
Quad *asset = new Quad();
ADD_ASSET_INSTANCE(Quad,"",asset);
- printf("new quad\n");
+ LOG.Write( "new quad" );
return asset;
}
Modified: Mercury2/src/RawImageData.cpp
===================================================================
--- Mercury2/src/RawImageData.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/RawImageData.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -1,5 +1,6 @@
#include <RawImageData.h>
#include <MercuryUtil.h>
+#include <MercuryLog.h>
RawImageData::RawImageData()
:m_data(NULL)
@@ -25,7 +26,7 @@
return RGBA16F;
else if (s == "RGBA32F")
return RGBA32F;
- printf("Color Byte Type %s unknown\n", s.c_str());
+ LOG.Write( "Color Byte Type " + s + " unknown" );
return RGB;
}
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-08-18 22:38:55 UTC (rev 496)
+++ Mercury2/src/Shader.cpp 2009-08-19 01:40:37 UTC (rev 497)
@@ -123,9 +123,9 @@
if( f1 == 0 || f2 == 0 )
{
if( !f1 )
- printf( "Could not open %s.\n", (char*)s1.c_str() );
+ LOG.Write(ssprintf( "Could not open %s.", (char*)s1.c_str() ));
if( !f2 )
- printf( "Could not open %s.\n", (char*)s2.c_str() );
+ LOG.Write(ssprintf( "Could not open %s.", (char*)s2.c_str() ));
return false;
}
if( f1 )
@@ -134,7 +134,7 @@
Buffer = (char*)malloc( i+1 );
f1->Read( Buffer, i );
f1->Close();
- printf( "Compiling: %s\n", s1.c_str() );
+ LOG.Write( "Compiling: " + s1 );
Buffer[i] = '\0';
if( !LoadShaderFrag( Buffer ) )
{
@@ -143,7 +143,7 @@
f2->Close();
if( f3 )
f3->Close();
- printf( "Reporting failed shaderload. Not linking.\n" );
+ LOG.Write("Reporting failed shaderload. Not linking." );
return false;
}
free( Buffer );
@@ -155,13 +155,13 @@
f2->Read( Buffer, i );
f2->Close();
Buffer[i] = '\0';
- printf( "Compiling: %s\n", s2.c_str() );
+ LOG.Write("Compiling: %s"+s2);
if( !LoadShaderVert( Buffer ) )
{
if( f3 )
f3->Close();
free( Buffer );
- printf( "Reporting failed shaderload. Not linking.\n" );
+ LOG.Write("Reporting failed shaderload. Not linking." );
return false;
}
free( Buffer );
@@ -173,11 +173,11 @@
f3->Read( Buffer, i );
f3->Close();
Buffer[i] = '\0';
- printf( "Compiling: %s\n", s3.c_str() );
+ LOG.Write("Compiling: %s"+s3);
if( !LoadShaderGeom( Buffer ) )
{
free( Buffer );
- printf( "Reporting failed shaderload. Not linking.\n" );
+ LOG.Write("Reporting failed shaderload. Not linking." );
return false;
}
free( Buffer );
@@ -297,7 +297,7 @@
{
puts( "ERROR: You cannot load a geometry shader when there are still errors left in OpenGL." );
puts( "Please track down the error remaining by using glGetError() to cordon off your code." );
- printf( "The last error received was: %d\n", ierror );
+ LOG.Write( ssprintf( "The last error received was: %d", ierror ) );
}
for( i = 1; i < imaxvert; i++ )
{
@@ -305,7 +305,7 @@
if( glGetError() == 0 )
break;
}
- printf( "Geometry Shader loaded with a total of %d max verticies. Because there are %d max vertices, and %d preceived components per vert.\n", imaxvert/i, imaxvert, i );
+ LOG.Write(ssprintf( "Geometry Shader loaded with a total of %d max verticies. Because there are %d max vertices, and %d preceived components per vert.", imaxvert/i, imaxvert, i ));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|