diff --git a/code/nel/tools/3d/build_interface/main.cpp b/code/nel/tools/3d/build_interface/main.cpp index 1b13a0f71..f2d3aa49c 100644 --- a/code/nel/tools/3d/build_interface/main.cpp +++ b/code/nel/tools/3d/build_interface/main.cpp @@ -201,10 +201,13 @@ int main(int nNbArg, char **ppArgs) outString ("ERROR : Wrong number of arguments\n"); outString ("USAGE : build_interface [-s] [path_maps2] [path_maps3] ....\n"); outString (" -s : build a subset of an existing interface definition while preserving the existing texture ids,"); + outString (" -b : border duplication to enable bi-linear filtering"); outString (" to support freeing up VRAM by switching to the subset without rebuilding the entire interface\n"); return -1; } - + + uint borderSize = 0; + // build as a subset of existing interface bool buildSubset = false; string existingUVfilename; @@ -215,6 +218,10 @@ int main(int nNbArg, char **ppArgs) { switch ( ppArgs[i][1] ) { + case 'B': + case 'b': + borderSize = 1; + break; case 'S': case 's': buildSubset = true; @@ -274,6 +281,19 @@ int main(int nNbArg, char **ppArgs) pBtmp->convertToType(CBitmap::RGBA); } + // duplicate bitmap border to enable bilinear filtering + { + NLMISC::CBitmap *tmp = new NLMISC::CBitmap; + tmp->resize(pBtmp->getWidth(), pBtmp->getHeight()); + tmp->blit(pBtmp, 0, 0); + // upscale image to get borders + tmp->resample(tmp->getWidth()+borderSize*2, tmp->getHeight()+borderSize*2); + // copy original + tmp->blit(pBtmp, borderSize, borderSize); + delete pBtmp; + pBtmp = tmp; + } + AllMaps[i] = pBtmp; } catch (const NLMISC::Exception &e) @@ -325,10 +345,10 @@ int main(int nNbArg, char **ppArgs) } putIn (AllMaps[i], &GlobalTexture, x, y); putIn (AllMaps[i], &GlobalMask, x, y, false); - UVMin[i].U = (float)x; - UVMin[i].V = (float)y; - UVMax[i].U = (float)x+AllMaps[i]->getWidth(); - UVMax[i].V = (float)y+AllMaps[i]->getHeight(); + UVMin[i].U = (float)x+borderSize; + UVMin[i].V = (float)y+borderSize; + UVMax[i].U = (float)x+borderSize+AllMaps[i]->getWidth()-borderSize*2; + UVMax[i].V = (float)y+borderSize+AllMaps[i]->getHeight()-borderSize*2; /* // Do not remove this is useful for debugging {