From: Perttu Ahola Date: Thu, 10 Feb 2011 13:55:15 +0000 (+0200) Subject: fixes toward mingw compatibility X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=841ac10e5c20ad152f375f43bceb992fc3945041;p=zefram%2Fminetest%2Fminetest_engine.git fixes toward mingw compatibility --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 071beead..4d2ba0d2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,8 +10,10 @@ add_definitions ( -DUSE_CMAKE_CONFIG_H ) if(WIN32) # Windows - # Surpress some useless warnings - add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 ) + if(MSVC) + # Surpress some useless warnings + add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 ) + endif() # Zlib stuff set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5" CACHE PATH "Zlib include directory") diff --git a/src/debug.cpp b/src/debug.cpp index ec23235c..d4d07375 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -197,7 +197,7 @@ DebugStacker::~DebugStacker() } -#ifdef _WIN32 +#ifdef _MSC_VER #if CATCH_UNHANDLED_EXCEPTIONS == 1 void se_trans_func(unsigned int u, EXCEPTION_POINTERS* pExp) { diff --git a/src/debug.h b/src/debug.h index 1973bb51..092bb03a 100644 --- a/src/debug.h +++ b/src/debug.h @@ -238,18 +238,7 @@ private: assert(0);\ } #ifdef _WIN32 // Windows - -/*class SE_Exception : public std::exception -{ -private: - unsigned int nSE; -public: - SE_Exception() {} - SE_Exception( unsigned int n ) : nSE( n ) {} - ~SE_Exception() {} - unsigned int getSeNumber() { return nSE; } -};*/ - + #ifdef _MSC_VER // MSVC void se_trans_func(unsigned int, EXCEPTION_POINTERS*); class FatalSystemException : public BaseException @@ -259,14 +248,18 @@ public: BaseException(s) {} }; - - #define BEGIN_DEBUG_EXCEPTION_HANDLER \ - BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER\ - _set_se_translator(se_trans_func); - - #define END_DEBUG_EXCEPTION_HANDLER \ - END_PORTABLE_DEBUG_EXCEPTION_HANDLER - + #define BEGIN_DEBUG_EXCEPTION_HANDLER \ + BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER\ + _set_se_translator(se_trans_func); + + #define END_DEBUG_EXCEPTION_HANDLER \ + END_PORTABLE_DEBUG_EXCEPTION_HANDLER + #else // Probably mingw + #define BEGIN_DEBUG_EXCEPTION_HANDLER\ + BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER + #define END_DEBUG_EXCEPTION_HANDLER\ + END_PORTABLE_DEBUG_EXCEPTION_HANDLER + #endif #else // Posix #define BEGIN_DEBUG_EXCEPTION_HANDLER\ BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER diff --git a/src/main.cpp b/src/main.cpp index 433ec4fe..1a576b28 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2050,6 +2050,8 @@ int main(int argc, char *argv[]) // A test //throw con::PeerNotFoundException("lol"); + core::list frametime_log; + /* Main loop */ @@ -2147,6 +2149,23 @@ int main(int argc, char *argv[]) dtime = 0; lasttime = time; + /* + Log frametime for visualization + */ + frametime_log.push_back(dtime); + if(frametime_log.size() > 100) + { + core::list::Iterator i = frametime_log.begin(); + frametime_log.erase(i); + } + + /* + Visualize frametime in terminal + */ + /*for(u32 i=0; i(0,10), video::SColor(255,255,255,255)); + /* + Frametime log + */ + { + s32 x = 10; + for(core::list::Iterator + i = frametime_log.begin(); + i != frametime_log.end(); + i++) + { + driver->draw2DLine(v2s32(x,50), + v2s32(x,50+(*i)*1000), + video::SColor(255,255,255,255)); + x++; + } } + } // timer + //timer10.stop(); //TimeTaker //timer11("//timer11"); diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 2ec63dbd..e66d4dd8 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -755,7 +755,7 @@ void MapBlock::updateMesh(u32 daynight_ratio) material.Lighting = false; material.BackfaceCulling = false; material.setFlag(video::EMF_BILINEAR_FILTER, false); - material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF); + //material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF); //material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_SIMPLE); material.setFlag(video::EMF_FOG_ENABLE, true); diff --git a/src/tile.cpp b/src/tile.cpp index d71055c7..7b19b365 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -387,10 +387,16 @@ void TextureSource::buildMainAtlas() sourcelist.push_back("sand.png^mineral_coal.png"); sourcelist.push_back("sand.png^mineral_iron.png"); + // Padding to disallow texture bleeding + s32 padding = 8; + /* First pass: generate almost everything */ core::position2d pos_in_atlas(0,0); + + pos_in_atlas.Y += padding; + for(u32 i=0; igetPixel(x, src_y); + atlas_img->setPixel(x,dst_y,c); + } + img2->drop(); /* @@ -447,7 +475,7 @@ void TextureSource::buildMainAtlas() m_name_to_id.insert(name, id); // Increment position - pos_in_atlas.Y += dim.Height; + pos_in_atlas.Y += dim.Height + padding * 2; } /*