mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-13 10:49:11 +00:00
Some initial bugfixing for the map generation
This commit is contained in:
parent
919fd34e00
commit
046bebf036
1 changed files with 29 additions and 6 deletions
|
@ -85,7 +85,7 @@ CScreenshotIslands::CScreenshotIslands()
|
||||||
void CScreenshotIslands::init()
|
void CScreenshotIslands::init()
|
||||||
{
|
{
|
||||||
// Create a driver
|
// Create a driver
|
||||||
driver = UDriver::createDriver();
|
driver = UDriver::createDriver(0, true);
|
||||||
nlassert(driver);
|
nlassert(driver);
|
||||||
|
|
||||||
sceneMaterial = driver->createMaterial();
|
sceneMaterial = driver->createMaterial();
|
||||||
|
@ -99,8 +99,6 @@ void CScreenshotIslands::init()
|
||||||
CConfigFile cf;
|
CConfigFile cf;
|
||||||
cf.load("island_screenshots.cfg");
|
cf.load("island_screenshots.cfg");
|
||||||
|
|
||||||
CPath::remapExtension("dds", "tga", true);
|
|
||||||
|
|
||||||
// get the value of searchPaths
|
// get the value of searchPaths
|
||||||
CConfigFile::CVar * searchPaths = cf.getVarPtr("SearchPaths");
|
CConfigFile::CVar * searchPaths = cf.getVarPtr("SearchPaths");
|
||||||
if(searchPaths)
|
if(searchPaths)
|
||||||
|
@ -110,6 +108,7 @@ void CScreenshotIslands::init()
|
||||||
CPath::addSearchPath(searchPaths->asString(i).c_str(), true, false);
|
CPath::addSearchPath(searchPaths->asString(i).c_str(), true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CPath::remapExtension("dds", "tga", true);
|
||||||
|
|
||||||
// get the scenario entry points file
|
// get the scenario entry points file
|
||||||
CConfigFile::CVar * epFile = cf.getVarPtr("CompleteIslandsFile");
|
CConfigFile::CVar * epFile = cf.getVarPtr("CompleteIslandsFile");
|
||||||
|
@ -1348,11 +1347,13 @@ void CScreenshotIslands::buildIslandsTextures()
|
||||||
int maxLoop = 6;
|
int maxLoop = 6;
|
||||||
|
|
||||||
// Create the window with config file values
|
// Create the window with config file values
|
||||||
driver->setDisplay(UDriver::CMode(1024, 768, 32, false));
|
driver->setDisplay(UDriver::CMode(512, 512, 32, true));
|
||||||
|
|
||||||
// Create a scene
|
// Create a scene
|
||||||
UScene * scene = driver->createScene(true);
|
UScene * scene = driver->createScene(true);
|
||||||
scene->animate(CTime::ticksToSecond(CTime::getPerformanceTime()));
|
scene->animate(CTime::ticksToSecond(CTime::getPerformanceTime()));
|
||||||
|
scene->setMaxSkeletonsInNotCLodForm(1000000);
|
||||||
|
scene->setPolygonBalancingMode(UScene::PolygonBalancingOff);
|
||||||
|
|
||||||
// Create a camera
|
// Create a camera
|
||||||
UCamera camera = scene->getCam();
|
UCamera camera = scene->getCam();
|
||||||
|
@ -1360,6 +1361,7 @@ void CScreenshotIslands::buildIslandsTextures()
|
||||||
|
|
||||||
// Create and load landscape
|
// Create and load landscape
|
||||||
ULandscape * landscape = scene->createLandscape();
|
ULandscape * landscape = scene->createLandscape();
|
||||||
|
landscape->setThreshold(0.0005);
|
||||||
if(_InverseZTest)
|
if(_InverseZTest)
|
||||||
{
|
{
|
||||||
landscape->setZFunc(UMaterial::greaterequal);
|
landscape->setZFunc(UMaterial::greaterequal);
|
||||||
|
@ -1394,6 +1396,7 @@ void CScreenshotIslands::buildIslandsTextures()
|
||||||
string coarseMeshWithoutExt = CFile::getFilenameWithoutExtension(coarseMeshFile);
|
string coarseMeshWithoutExt = CFile::getFilenameWithoutExtension(coarseMeshFile);
|
||||||
string coarseMeshExt = CFile::getExtension(coarseMeshFile);
|
string coarseMeshExt = CFile::getExtension(coarseMeshFile);
|
||||||
coarseMeshFile = coarseMeshWithoutExt + seasonSuffix + "." + coarseMeshExt;
|
coarseMeshFile = coarseMeshWithoutExt + seasonSuffix + "." + coarseMeshExt;
|
||||||
|
nldebug("Coarse mesh texture: '%s'", coarseMeshFile.c_str());
|
||||||
scene->setCoarseMeshManagerTexture(coarseMeshFile.c_str());
|
scene->setCoarseMeshManagerTexture(coarseMeshFile.c_str());
|
||||||
|
|
||||||
// Load the landscape
|
// Load the landscape
|
||||||
|
@ -1468,6 +1471,7 @@ void CScreenshotIslands::buildIslandsTextures()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
scene->animate(CTime::ticksToSecond(CTime::getPerformanceTime()));
|
||||||
|
|
||||||
// Clear all buffers
|
// Clear all buffers
|
||||||
driver->clearBuffers(_BackColor);
|
driver->clearBuffers(_BackColor);
|
||||||
|
@ -1535,17 +1539,36 @@ void CScreenshotIslands::buildIslandsTextures()
|
||||||
CIFile proxFS(proxFileName.c_str());
|
CIFile proxFS(proxFileName.c_str());
|
||||||
proxBitmap.load(proxFS);
|
proxBitmap.load(proxFS);
|
||||||
|
|
||||||
|
|
||||||
// resize proximity bitmap
|
// resize proximity bitmap
|
||||||
CBitmap tempBitmap;
|
CBitmap tempBitmap;
|
||||||
int newWidth = islandBitmap.getWidth();
|
int newWidth = islandBitmap.getWidth();
|
||||||
int newHeight = islandBitmap.getHeight();
|
int newHeight = islandBitmap.getHeight();
|
||||||
tempBitmap.resize(newWidth, newHeight, islandBitmap.PixelFormat);
|
tempBitmap.resize(newWidth, newHeight, islandBitmap.PixelFormat);
|
||||||
// blit src bitmap
|
// blit src bitmap
|
||||||
tempBitmap.blit(proxBitmap, 0, 0, newWidth, newHeight, 0, 0);
|
//tempBitmap.blit(proxBitmap, 0, 0, newWidth, newHeight, 0, 0);
|
||||||
|
{
|
||||||
|
const uint8 *prox = &(proxBitmap.getPixels(0)[0]);
|
||||||
|
uint8 *temp = &(tempBitmap.getPixels(0)[0]);
|
||||||
|
for (uint y = 0; y < newHeight; ++y)
|
||||||
|
for (uint x = 0; x < newWidth; ++x)
|
||||||
|
{
|
||||||
|
uint ys = (y * proxBitmap.getHeight()) / newHeight;
|
||||||
|
uint xs = (x * proxBitmap.getWidth()) / newWidth;
|
||||||
|
uint addr = ((y * newWidth) + x) * 4;
|
||||||
|
uint addrs = ((ys * proxBitmap.getWidth()) + xs) * 4;
|
||||||
|
temp[addr] = prox[addrs];
|
||||||
|
temp[addr+1] = prox[addrs+1];
|
||||||
|
temp[addr+2] = prox[addrs+2];
|
||||||
|
temp[addr+3] = prox[addrs+3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// swap them
|
// swap them
|
||||||
proxBitmap.resize(newWidth, newHeight, proxBitmap.PixelFormat);
|
proxBitmap.resize(newWidth, newHeight, proxBitmap.PixelFormat);
|
||||||
proxBitmap.swap(tempBitmap);
|
proxBitmap.swap(tempBitmap);
|
||||||
|
|
||||||
|
//proxBitmap.resample(newWidth, newHeight);
|
||||||
|
|
||||||
|
|
||||||
// create final bitmap
|
// create final bitmap
|
||||||
|
@ -2081,7 +2104,7 @@ void CProximityMapBuffer::_prepareBufferForZoneProximityMap(const CProximityZone
|
||||||
{
|
{
|
||||||
zoneBuffer[offset]= InteriorValue;
|
zoneBuffer[offset]= InteriorValue;
|
||||||
|
|
||||||
if(offset-zoneWidth>0 && zoneBuffer[offset-zoneWidth]==(TBufferEntry)~0u)
|
if(offset>zoneWidth && zoneBuffer[offset-zoneWidth]==(TBufferEntry)~0u)
|
||||||
{
|
{
|
||||||
zoneBuffer[offset-zoneWidth] = ValueBorder;
|
zoneBuffer[offset-zoneWidth] = ValueBorder;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue