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")
}
-#ifdef _WIN32
+#ifdef _MSC_VER
#if CATCH_UNHANDLED_EXCEPTIONS == 1
void se_trans_func(unsigned int u, EXCEPTION_POINTERS* pExp)
{
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
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
// A test\r
//throw con::PeerNotFoundException("lol");\r
\r
+ core::list<float> frametime_log;\r
+\r
/*\r
Main loop\r
*/\r
dtime = 0;\r
lasttime = time;\r
\r
+ /*\r
+ Log frametime for visualization\r
+ */\r
+ frametime_log.push_back(dtime);\r
+ if(frametime_log.size() > 100)\r
+ {\r
+ core::list<float>::Iterator i = frametime_log.begin();\r
+ frametime_log.erase(i);\r
+ }\r
+\r
+ /*\r
+ Visualize frametime in terminal\r
+ */\r
+ /*for(u32 i=0; i<dtime*400; i++)\r
+ std::cout<<"X";\r
+ std::cout<<std::endl;*/\r
+\r
/*\r
Time average and jitter calculation\r
*/\r
displaycenter + core::vector2d<s32>(0,10),\r
video::SColor(255,255,255,255));\r
\r
+ /*\r
+ Frametime log\r
+ */\r
+ {\r
+ s32 x = 10;\r
+ for(core::list<float>::Iterator\r
+ i = frametime_log.begin();\r
+ i != frametime_log.end();\r
+ i++)\r
+ {\r
+ driver->draw2DLine(v2s32(x,50),\r
+ v2s32(x,50+(*i)*1000),\r
+ video::SColor(255,255,255,255));\r
+ x++;\r
+ }\r
}\r
\r
+ } // timer\r
+\r
//timer10.stop();\r
//TimeTaker //timer11("//timer11");\r
\r
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);
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];
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();
/*
m_name_to_id.insert(name, id);
// Increment position
- pos_in_atlas.Y += dim.Height;
+ pos_in_atlas.Y += dim.Height + padding * 2;
}
/*