fixes toward mingw compatibility

master
Perttu Ahola 2011-02-10 15:55:15 +02:00
parent a7b158fada
commit 841ac10e5c
6 changed files with 83 additions and 24 deletions

View File

@ -10,8 +10,10 @@ add_definitions ( -DUSE_CMAKE_CONFIG_H )
if(WIN32)
# Windows
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")

View File

@ -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)
{

View File

@ -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
#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

View File

@ -2050,6 +2050,8 @@ int main(int argc, char *argv[])
// A test
//throw con::PeerNotFoundException("lol");
core::list<float> 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<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,7 +2998,24 @@ 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");

View File

@ -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);

View File

@ -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;
}
/*