diff options
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/debug.cpp | 2 | ||||
-rw-r--r-- | src/debug.h | 33 | ||||
-rw-r--r-- | src/main.cpp | 36 | ||||
-rw-r--r-- | src/mapblock.cpp | 2 | ||||
-rw-r--r-- | src/tile.cpp | 30 |
6 files changed, 84 insertions, 25 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 071beeadc..4d2ba0d29 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 ec23235cb..d4d07375d 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 1973bb510..092bb03a8 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 433ec4fe0..1a576b28d 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<float> frametime_log;
+
/*
Main loop
*/
@@ -2148,6 +2150,23 @@ int main(int argc, char *argv[]) lasttime = time;
/*
+ Log frametime for visualization
+ */
+ frametime_log.push_back(dtime);
+ if(frametime_log.size() > 100)
+ {
+ core::list<float>::Iterator i = frametime_log.begin();
+ frametime_log.erase(i);
+ }
+
+ /*
+ Visualize frametime in terminal
+ */
+ /*for(u32 i=0; i<dtime*400; i++)
+ std::cout<<"X";
+ std::cout<<std::endl;*/
+
+ /*
Time average and jitter calculation
*/
@@ -2979,8 +2998,25 @@ int main(int argc, char *argv[]) displaycenter + core::vector2d<s32>(0,10),
video::SColor(255,255,255,255));
+ /*
+ Frametime log
+ */
+ {
+ s32 x = 10;
+ for(core::list<float>::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 2ec63dbde..e66d4dd8f 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 d71055c7a..7b19b3651 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<s32> pos_in_atlas(0,0); + + pos_in_atlas.Y += padding; + for(u32 i=0; i<sourcelist.size(); i++) { std::string name = sourcelist[i]; @@ -423,6 +429,28 @@ void TextureSource::buildMainAtlas() NULL); } + // Copy the borders a few times to disallow texture bleeding + for(u32 side=0; side<2; side++) // top and bottom + for(s32 y0=0; y0<padding; y0++) + for(s32 x0=0; x0<(s32)xwise_tiling*(s32)dim.Width; x0++) + { + s32 dst_y; + s32 src_y; + if(side==0) + { + dst_y = y0 + pos_in_atlas.Y + dim.Height; + src_y = pos_in_atlas.Y + dim.Height - 1; + } + else + { + dst_y = -y0 + pos_in_atlas.Y-1; + src_y = pos_in_atlas.Y; + } + s32 x = x0 + pos_in_atlas.X * dim.Width; + video::SColor c = atlas_img->getPixel(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; } /* |