mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-24 08:06:13 +00:00
Merge with default
This commit is contained in:
commit
ab606fa7dd
7 changed files with 107 additions and 56 deletions
|
@ -178,6 +178,9 @@ private:
|
|||
|
||||
// Error message
|
||||
std::string _ErrorString;
|
||||
|
||||
// System dependant structure for locale
|
||||
void* _Locale;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2795,9 +2795,13 @@ IOcclusionQuery::TOcclusionType COcclusionQueryGL::getOcclusionType()
|
|||
else
|
||||
{
|
||||
GLuint result;
|
||||
nglGetQueryObjectuivARB(ID, GL_QUERY_RESULT, &result);
|
||||
OcclusionType = result != 0 ? NotOccluded : Occluded;
|
||||
VisibleCount = (uint) result;
|
||||
nglGetQueryObjectuivARB(ID, GL_QUERY_RESULT_AVAILABLE, &result);
|
||||
if (result != GL_FALSE)
|
||||
{
|
||||
nglGetQueryObjectuivARB(ID, GL_QUERY_RESULT, &result);
|
||||
OcclusionType = result != 0 ? NotOccluded : Occluded;
|
||||
VisibleCount = (uint) result;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
// Include from libxml2
|
||||
#include <libxml/xmlerror.h>
|
||||
|
||||
#if defined(NL_OS_WINDOWS) && defined(NL_COMP_VC_VERSION) && NL_COMP_VC_VERSION >= 80
|
||||
#define USE_LOCALE_SPRINTF
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifdef DEBUG_NEW
|
||||
|
@ -38,11 +43,22 @@ const char SEPARATOR = ' ';
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
#ifdef USE_LOCALE_SPRINTF
|
||||
|
||||
#define writenumber(src,format,digits) \
|
||||
char number_as_cstring [digits+1]; \
|
||||
_sprintf_l( number_as_cstring, format, (_locale_t)_Locale, src ); \
|
||||
serialSeparatedBufferOut( number_as_cstring );
|
||||
|
||||
#else
|
||||
|
||||
#define writenumber(src,format,digits) \
|
||||
char number_as_cstring [digits+1]; \
|
||||
sprintf( number_as_cstring, format, src ); \
|
||||
serialSeparatedBufferOut( number_as_cstring );
|
||||
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
// XML callbacks
|
||||
// ***************************************************************************
|
||||
|
@ -133,6 +149,13 @@ COXml::COXml () : IStream (false /* Output mode */)
|
|||
|
||||
// Push begin
|
||||
_PushBegin = false;
|
||||
|
||||
#ifdef USE_LOCALE_SPRINTF
|
||||
// create C numeric locale
|
||||
_Locale = _create_locale(LC_NUMERIC, "C");
|
||||
#else
|
||||
_Locale = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -192,6 +215,10 @@ COXml::~COXml ()
|
|||
{
|
||||
// Flush document to the internal stream
|
||||
flush ();
|
||||
|
||||
#ifdef USE_LOCALE_SPRINTF
|
||||
if (_Locale) _free_locale((_locale_t)_Locale);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -1,40 +1,42 @@
|
|||
|
||||
IF(WITH_NEL_TOOLS)
|
||||
IF(WITH_3D)
|
||||
SUBDIRS(
|
||||
anim_builder
|
||||
animation_set_builder
|
||||
build_clod_bank
|
||||
build_clodtex
|
||||
build_coarse_mesh
|
||||
build_far_bank
|
||||
build_shadow_skin
|
||||
build_smallbank
|
||||
cluster_viewer
|
||||
file_info
|
||||
ig_add
|
||||
ig_elevation
|
||||
ig_info
|
||||
ig_lighter
|
||||
lightmap_optimizer
|
||||
zone_dependencies
|
||||
zone_ig_lighter
|
||||
zone_lighter
|
||||
zone_welder
|
||||
shapes_exporter
|
||||
shape2obj
|
||||
zone_check_bind
|
||||
zone_dump
|
||||
zviewer)
|
||||
ENDIF()
|
||||
|
||||
SUBDIRS(
|
||||
build_coarse_mesh
|
||||
build_far_bank
|
||||
build_smallbank
|
||||
ig_lighter
|
||||
ig_elevation
|
||||
lightmap_optimizer
|
||||
zone_dependencies
|
||||
zone_ig_lighter
|
||||
zone_lighter
|
||||
zone_welder
|
||||
animation_set_builder
|
||||
anim_builder
|
||||
build_clod_bank
|
||||
build_clodtex
|
||||
build_interface
|
||||
build_shadow_skin
|
||||
cluster_viewer
|
||||
file_info
|
||||
get_neighbors
|
||||
ig_add
|
||||
ig_info
|
||||
shapes_exporter
|
||||
tga_cut
|
||||
tga_resize
|
||||
shape2obj
|
||||
zone_check_bind
|
||||
zone_dump
|
||||
zviewer)
|
||||
|
||||
ENDIF(WITH_NEL_TOOLS)
|
||||
tga_resize)
|
||||
ENDIF()
|
||||
|
||||
# For tools selection of only max plugins
|
||||
IF(WIN32)
|
||||
IF(WIN32 AND WITH_3D)
|
||||
IF(MFC_FOUND)
|
||||
ADD_SUBDIRECTORY(object_viewer)
|
||||
IF(WITH_NEL_MAXPLUGIN)
|
||||
|
@ -44,9 +46,9 @@ IF(WIN32)
|
|||
ENDIF(MAXSDK_FOUND)
|
||||
ENDIF(WITH_NEL_MAXPLUGIN)
|
||||
ENDIF(MFC_FOUND)
|
||||
ENDIF(WIN32)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_NEL_TOOLS)
|
||||
IF(WITH_NEL_TOOLS AND WITH_3D)
|
||||
IF(WIN32)
|
||||
# ADD_SUBDIRECTORY(lightmap_optimizer)
|
||||
IF(MFC_FOUND)
|
||||
|
@ -71,5 +73,5 @@ IF(WITH_NEL_TOOLS)
|
|||
#crash_log_analyser
|
||||
#shapes_exporter
|
||||
|
||||
ENDIF(WITH_NEL_TOOLS)
|
||||
ENDIF()
|
||||
|
||||
|
|
|
@ -113,18 +113,17 @@ void putPixel(uint8 *dst, uint8 *src, bool alphaTransfert)
|
|||
// ***************************************************************************
|
||||
bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bool alphaTransfert=true)
|
||||
{
|
||||
uint32 a, b;
|
||||
|
||||
uint8 *rSrcPix = &pSrc->getPixels()[0];
|
||||
uint8 *rDstPix = &pDst->getPixels()[0];
|
||||
|
||||
uint wSrc= pSrc->getWidth();
|
||||
uint hSrc= pSrc->getHeight();
|
||||
for (b = 0; b < hSrc; ++b)
|
||||
for (a = 0; a < wSrc; ++a)
|
||||
for (uint b = 0; b < hSrc; ++b)
|
||||
for (uint a = 0; a < wSrc; ++a)
|
||||
{
|
||||
if (rDstPix[4*((x+a)+(y+b)*pDst->getWidth())+3] != 0)
|
||||
return false;
|
||||
|
||||
// write
|
||||
putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rSrcPix+ 4*(a+b*pSrc->getWidth()), alphaTransfert);
|
||||
}
|
||||
|
@ -135,9 +134,9 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo
|
|||
// expand on W
|
||||
if(wSrc<wSrc4)
|
||||
{
|
||||
for(a=wSrc;a<wSrc4;a++)
|
||||
for(uint a=wSrc;a<wSrc4;a++)
|
||||
{
|
||||
for(b=0;b<hSrc4;b++)
|
||||
for(uint b=0;b<hSrc4;b++)
|
||||
{
|
||||
putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rDstPix + 4*((x+wSrc-1)+(y+b)*pDst->getWidth()), alphaTransfert);
|
||||
}
|
||||
|
@ -146,9 +145,9 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo
|
|||
// expand on H
|
||||
if(hSrc<hSrc4)
|
||||
{
|
||||
for(b=hSrc;b<hSrc4;b++)
|
||||
for(uint b=hSrc;b<hSrc4;b++)
|
||||
{
|
||||
for(a=0;a<wSrc4;a++)
|
||||
for(uint a=0;a<wSrc4;a++)
|
||||
{
|
||||
putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rDstPix + 4*((x+a)+(y+hSrc-1)*pDst->getWidth()), alphaTransfert);
|
||||
}
|
||||
|
@ -252,30 +251,38 @@ int main(int nNbArg, char **ppArgs)
|
|||
}
|
||||
|
||||
vector<NLMISC::CBitmap*> AllMaps;
|
||||
sint32 i, j;
|
||||
sint32 j;
|
||||
|
||||
// Load all maps
|
||||
sint32 mapSize = (sint32)AllMapNames.size();
|
||||
AllMaps.resize( mapSize );
|
||||
for( i = 0; i < mapSize; ++i )
|
||||
for(sint i = 0; i < mapSize; ++i )
|
||||
{
|
||||
NLMISC::CBitmap *pBtmp = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
NLMISC::CBitmap *pBtmp = new NLMISC::CBitmap;
|
||||
pBtmp = new NLMISC::CBitmap;
|
||||
NLMISC::CIFile inFile;
|
||||
inFile.open( AllMapNames[i] );
|
||||
pBtmp->load(inFile);
|
||||
if (!inFile.open( AllMapNames[i] )) throw NLMISC::Exception("Unable to open " + AllMapNames[i]);
|
||||
|
||||
uint8 colors = pBtmp->load(inFile);
|
||||
|
||||
if (colors != 32) throw NLMISC::Exception(AllMapNames[i] + " is using " + toString(colors) + " bits colors, only 32 bit supported!");
|
||||
|
||||
AllMaps[i] = pBtmp;
|
||||
}
|
||||
catch (const NLMISC::Exception &e)
|
||||
{
|
||||
if (pBtmp) delete pBtmp;
|
||||
|
||||
outString (string("ERROR :") + e.what());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort all maps by decreasing size
|
||||
for (i = 0; i < mapSize-1; ++i)
|
||||
for (sint i = 0; i < mapSize-1; ++i)
|
||||
for (j = i+1; j < mapSize; ++j)
|
||||
{
|
||||
NLMISC::CBitmap *pBI = AllMaps[i];
|
||||
|
@ -303,7 +310,7 @@ int main(int nNbArg, char **ppArgs)
|
|||
vector<NLMISC::CUV> UVMin, UVMax;
|
||||
UVMin.resize (mapSize, NLMISC::CUV(0.0f, 0.0f));
|
||||
UVMax.resize (mapSize, NLMISC::CUV(0.0f, 0.0f));
|
||||
for (i = 0; i < mapSize; ++i)
|
||||
for (sint i = 0; i < mapSize; ++i)
|
||||
{
|
||||
sint32 x, y;
|
||||
while (!tryAllPos(AllMaps[i], &GlobalMask, x, y))
|
||||
|
@ -349,7 +356,7 @@ int main(int nNbArg, char **ppArgs)
|
|||
}
|
||||
|
||||
// Convert UV from pixel to ratio
|
||||
for (i = 0; i < mapSize; ++i)
|
||||
for (sint i = 0; i < mapSize; ++i)
|
||||
{
|
||||
UVMin[i].U = UVMin[i].U / (float)GlobalTexture.getWidth();
|
||||
UVMin[i].V = UVMin[i].V / (float)GlobalTexture.getHeight();
|
||||
|
@ -394,7 +401,7 @@ int main(int nNbArg, char **ppArgs)
|
|||
FILE *f = fopen (fmtName.c_str(), "wt");
|
||||
if (f != NULL)
|
||||
{
|
||||
for (i = 0; i < mapSize; ++i)
|
||||
for (sint i = 0; i < mapSize; ++i)
|
||||
{
|
||||
// get the string whitout path
|
||||
string fileName= CFile::getFilename(AllMapNames[i]);
|
||||
|
@ -443,6 +450,8 @@ int main(int nNbArg, char **ppArgs)
|
|||
continue;
|
||||
}
|
||||
|
||||
sint i;
|
||||
|
||||
sTGAname = toLower(string(tgaName));
|
||||
string findTGAName;
|
||||
for (i = 0; i < mapSize; ++i)
|
||||
|
|
|
@ -6,9 +6,7 @@ IF(WITH_NEL_TOOLS)
|
|||
ENDIF(WITH_NEL_TOOLS)
|
||||
|
||||
# Max plugins are under the 3d directory as well.
|
||||
IF(WITH_3D)
|
||||
ADD_SUBDIRECTORY(3d)
|
||||
ENDIF(WITH_3D)
|
||||
ADD_SUBDIRECTORY(3d)
|
||||
|
||||
# Don't add other subdirectories if only max plugins are selected.
|
||||
IF(WITH_NEL_TOOLS)
|
||||
|
|
|
@ -1 +1,9 @@
|
|||
SUBDIRS(build_ig_boxes build_indoor_rbank build_rbank)
|
||||
IF(WITH_3D)
|
||||
ADD_SUBDIRECTORY(build_ig_boxes)
|
||||
|
||||
IF(WITH_LIGO)
|
||||
ADD_SUBDIRECTORY(build_rbank)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ADD_SUBDIRECTORY(build_indoor_rbank)
|
||||
|
|
Loading…
Reference in a new issue