From fee85bac2c731cde67e850dfe1e3abe33a65ff73 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 12 Sep 2014 21:50:09 +0200 Subject: [PATCH 1/6] Some initial bugfixing for the map generation --- .../screenshot_islands.cpp | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp index c0fcb667d..363414aa5 100644 --- a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp +++ b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp @@ -85,7 +85,7 @@ CScreenshotIslands::CScreenshotIslands() void CScreenshotIslands::init() { // Create a driver - driver = UDriver::createDriver(); + driver = UDriver::createDriver(0, true); nlassert(driver); sceneMaterial = driver->createMaterial(); @@ -99,8 +99,6 @@ void CScreenshotIslands::init() CConfigFile cf; cf.load("island_screenshots.cfg"); - CPath::remapExtension("dds", "tga", true); - // get the value of searchPaths CConfigFile::CVar * searchPaths = cf.getVarPtr("SearchPaths"); if(searchPaths) @@ -110,6 +108,7 @@ void CScreenshotIslands::init() CPath::addSearchPath(searchPaths->asString(i).c_str(), true, false); } } + CPath::remapExtension("dds", "tga", true); // get the scenario entry points file CConfigFile::CVar * epFile = cf.getVarPtr("CompleteIslandsFile"); @@ -1348,11 +1347,13 @@ void CScreenshotIslands::buildIslandsTextures() int maxLoop = 6; // 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 UScene * scene = driver->createScene(true); scene->animate(CTime::ticksToSecond(CTime::getPerformanceTime())); + scene->setMaxSkeletonsInNotCLodForm(1000000); + scene->setPolygonBalancingMode(UScene::PolygonBalancingOff); // Create a camera UCamera camera = scene->getCam(); @@ -1360,6 +1361,7 @@ void CScreenshotIslands::buildIslandsTextures() // Create and load landscape ULandscape * landscape = scene->createLandscape(); + landscape->setThreshold(0.0005); if(_InverseZTest) { landscape->setZFunc(UMaterial::greaterequal); @@ -1394,6 +1396,7 @@ void CScreenshotIslands::buildIslandsTextures() string coarseMeshWithoutExt = CFile::getFilenameWithoutExtension(coarseMeshFile); string coarseMeshExt = CFile::getExtension(coarseMeshFile); coarseMeshFile = coarseMeshWithoutExt + seasonSuffix + "." + coarseMeshExt; + nldebug("Coarse mesh texture: '%s'", coarseMeshFile.c_str()); scene->setCoarseMeshManagerTexture(coarseMeshFile.c_str()); // Load the landscape @@ -1468,6 +1471,7 @@ void CScreenshotIslands::buildIslandsTextures() } } } + scene->animate(CTime::ticksToSecond(CTime::getPerformanceTime())); // Clear all buffers driver->clearBuffers(_BackColor); @@ -1535,17 +1539,36 @@ void CScreenshotIslands::buildIslandsTextures() CIFile proxFS(proxFileName.c_str()); proxBitmap.load(proxFS); + // resize proximity bitmap CBitmap tempBitmap; int newWidth = islandBitmap.getWidth(); int newHeight = islandBitmap.getHeight(); tempBitmap.resize(newWidth, newHeight, islandBitmap.PixelFormat); // 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 proxBitmap.resize(newWidth, newHeight, proxBitmap.PixelFormat); proxBitmap.swap(tempBitmap); + + //proxBitmap.resample(newWidth, newHeight); // create final bitmap @@ -2081,7 +2104,7 @@ void CProximityMapBuffer::_prepareBufferForZoneProximityMap(const CProximityZone { zoneBuffer[offset]= InteriorValue; - if(offset-zoneWidth>0 && zoneBuffer[offset-zoneWidth]==(TBufferEntry)~0u) + if(offset>zoneWidth && zoneBuffer[offset-zoneWidth]==(TBufferEntry)~0u) { zoneBuffer[offset-zoneWidth] = ValueBorder; } From 0e0b6e11bd85fe14bef0e04cb51de622615b26e6 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 12 Sep 2014 22:09:43 +0200 Subject: [PATCH 2/6] Fix texture lookup --- .../tools/client/r2_islands_textures/screenshot_islands.cpp | 1 + .../server/build_world_packed_col/build_world_packed_col.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp index 363414aa5..db115b154 100644 --- a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp +++ b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp @@ -109,6 +109,7 @@ void CScreenshotIslands::init() } } CPath::remapExtension("dds", "tga", true); + CPath::remapExtension("dds", "png", true); // get the scenario entry points file CConfigFile::CVar * epFile = cf.getVarPtr("CompleteIslandsFile"); diff --git a/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp b/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp index a9d1daa9e..9bd4f7f3c 100644 --- a/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp +++ b/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp @@ -111,6 +111,7 @@ int main(int argc, char* argv[]) CPath::addSearchPath(builderConfig.SearchPaths[k], true, false); } CPath::remapExtension("dds", "tga", true); + CPath::remapExtension("dds", "png", true); // R2::CScenarioEntryPoints &sep = R2::CScenarioEntryPoints::getInstance(); try From 37f6166eb9403bde1fc0908b2e6044b42b3a9475 Mon Sep 17 00:00:00 2001 From: kishan_grimout Date: Thu, 11 Apr 2013 14:30:00 +0200 Subject: [PATCH 3/6] avoid recursion problem when 'taking all' in quarter temp inventory in EGS --- .../entities_game_service/creature_manager/harvestable.h | 2 +- .../entities_game_service/player_manager/character.cpp | 2 +- .../src/entities_game_service/player_manager/character.h | 4 ++-- .../player_manager/character_inventory_manipulation.cpp | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/creature_manager/harvestable.h b/code/ryzom/server/src/entities_game_service/creature_manager/harvestable.h index cd1ecfd06..f966e6cb0 100644 --- a/code/ryzom/server/src/entities_game_service/creature_manager/harvestable.h +++ b/code/ryzom/server/src/entities_game_service/creature_manager/harvestable.h @@ -188,7 +188,7 @@ protected: /// the harvestable Mps (4 per entity) std::vector< CCreatureRawMaterial> _Mps; - /// pointer on the harverting character + /// pointer on the harvesting character TDataSetRow _HarvesterRowId; /// skill used to harvest this creature diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp index 4a9096232..3c72995ea 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -14167,7 +14167,7 @@ void CCharacter::sendCloseTempInventoryImpulsion() BOMB_IF(isRecursing,"CCharacter::sendCloseTempInventoryImpulsion is recursing!",return); // **** Temp Fix 2/4 **** // isRecursing= true; // **** Temp Fix 3/4 **** // - getAllTempInventoryItems(); + getAllTempInventoryItems(false); CMessage msgout( "IMPULSION_ID" ); msgout.serial( _Id ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.h b/code/ryzom/server/src/entities_game_service/player_manager/character.h index 3f97c6b3e..de6d3f110 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.h @@ -2623,13 +2623,13 @@ public: CGameItemPtr createItemInInventoryFreeSlot(INVENTORIES::TInventory invId, uint16 obtainedQuality, uint32 quantity, const NLMISC::CSheetId & obtainedItem, const NLMISC::CEntityId & creatorId = NLMISC::CEntityId::Unknown, const std::string * phraseId = NULL); /// action on an item in the temp inventory (move it to bag) - void itemTempInventoryToBag(uint32 scrSlot); + void itemTempInventoryToBag(uint32 scrSlot, bool sendCloseTempImpulsion = true); /// clear temp inventory void clearTempInventory(); /// get all items in temp inventory - void getAllTempInventoryItems(); + void getAllTempInventoryItems(bool sendCloseTempImpulsion = true); /// return true if temp inventory is empty bool tempInventoryEmpty(); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character_inventory_manipulation.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character_inventory_manipulation.cpp index 2ce09282c..139cf1b4e 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character_inventory_manipulation.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character_inventory_manipulation.cpp @@ -1841,7 +1841,7 @@ CGameItemPtr CCharacter::createItemInInventoryFreeSlot(INVENTORIES::TInventory i } // **************************************************************************** -void CCharacter::itemTempInventoryToBag(uint32 srcSlot) +void CCharacter::itemTempInventoryToBag(uint32 srcSlot, bool sendCloseTempImpulsion) { H_AUTO(CCharacter_itemTempInventoryToBag); @@ -2015,7 +2015,7 @@ void CCharacter::itemTempInventoryToBag(uint32 srcSlot) CWorldInstances::instance().msgToAIInstance(getInstanceNumber(), msg); } - endHarvest(); + endHarvest(sendCloseTempImpulsion); leaveTempInventoryMode(); } @@ -2108,12 +2108,12 @@ void CCharacter::itemTempInventoryToBag(uint32 srcSlot) } // **************************************************************************** -void CCharacter::getAllTempInventoryItems() +void CCharacter::getAllTempInventoryItems(bool sendCloseTempImpulsion) { H_AUTO(CCharacter_getAllTempInventoryItems); for (uint i = 0 ; i < INVENTORIES::NbTempInvSlots; ++i) - itemTempInventoryToBag(i); + itemTempInventoryToBag(i, sendCloseTempImpulsion); } // **************************************************************************** From a3b0569624b41f672da5ed8214177cf240f093ee Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 13 Sep 2014 11:13:25 +0200 Subject: [PATCH 4/6] Fix strange code --- .../tools/client/r2_islands_textures/screenshot_islands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp index db115b154..8228c3e2e 100644 --- a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp +++ b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp @@ -590,7 +590,7 @@ void CScreenshotIslands::buildScreenshots() //------------------------------------------------------------------------------------------------- void CScreenshotIslands::writeProximityBufferToTgaFile(const std::string& fileName,const TBuffer& buffer,uint32 scanWidth,uint32 scanHeight) { - uint imageWidth = (scanWidth+15)&~15; + uint imageWidth = (scanWidth); // (scanWidth+15)&~15; uint imageHeight = (scanHeight); CTGAImageGrey tgaImage; From 61d089c7c09bf9cb07898ceab3e3033f8efd8a50 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 13 Sep 2014 12:02:47 +0200 Subject: [PATCH 5/6] Fix includes --- .../phrase_manager/fg_prospection_phrase.cpp | 2 +- .../entities_game_service/phrase_manager/sabrina_area_debug.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp index 010176023..f2fc03eb0 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp @@ -1509,7 +1509,7 @@ NLMISC_DYNVARIABLE( uint32, RyzomSeason, "Get season number (0=Spring)" ) #ifdef DEPOSIT_MAP_GENERATION -#include "server_share/bmp4image.h" +#include "game_share/bmp4image.h" #include typedef std::map< std::string, pair< pair< float, float >, uint > > CSUMap; diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/sabrina_area_debug.h b/code/ryzom/server/src/entities_game_service/phrase_manager/sabrina_area_debug.h index 4964b78e1..a87c0a092 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/sabrina_area_debug.h +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/sabrina_area_debug.h @@ -23,7 +23,7 @@ #include "egs_mirror.h" #include "area_geometry.h" -#include "server_share/bmp4image.h" +#include "game_share/bmp4image.h" From 165143984c771406e7fef60db89b8a1edad4c63b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 13 Sep 2014 12:14:45 +0200 Subject: [PATCH 6/6] Increase texturing limits (*4), ref #203 (TODO: Update config translations) --- code/ryzom/client/src/init_main_loop.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/init_main_loop.cpp b/code/ryzom/client/src/init_main_loop.cpp index 537f322f8..390b82e15 100644 --- a/code/ryzom/client/src/init_main_loop.cpp +++ b/code/ryzom/client/src/init_main_loop.cpp @@ -153,8 +153,12 @@ bool UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING; #define ENTITY_TEXTURE_NORMAL_LEVEL 1 #define ENTITY_TEXTURE_HIGH_LEVEL 0 // Size in MB of the cache for entity texturing. -#define ENTITY_TEXTURE_NORMAL_MEMORY 10 -#define ENTITY_TEXTURE_HIGH_MEMORY 40 +#define ENTITY_TEXTURE_NORMAL_MEMORY 40 +#define ENTITY_TEXTURE_HIGH_MEMORY 160 +// Size in KB of max upload per frame +#define ENTITY_TEXTURE_LOW_MAXUP 64 +#define ENTITY_TEXTURE_NORMAL_MAXUP 128 +#define ENTITY_TEXTURE_HIGH_MAXUP 256 // Don't Modify, set true for debug purpose only const bool DBG_DisablePreloadShape= false; @@ -885,8 +889,10 @@ void initMainLoop() { // setup "v2 texture" (or 512*512) Driver->setupAsyncTextureLod(ENTITY_TEXTURE_COARSE_LEVEL, ENTITY_TEXTURE_HIGH_LEVEL); - // Allow a big cache for them (should be on 128 Mo card only) + // Allow a big cache for them (should be on 512 Mo card only) Driver->setupMaxTotalAsyncTextureSize(ENTITY_TEXTURE_HIGH_MEMORY*1024*1024); + // Allow high upload + Driver->setupAsyncTextureMaxUploadPerFrame(ENTITY_TEXTURE_HIGH_MAXUP*1024); } else { @@ -894,6 +900,8 @@ void initMainLoop() Driver->setupAsyncTextureLod(ENTITY_TEXTURE_COARSE_LEVEL, ENTITY_TEXTURE_NORMAL_LEVEL); // Allow a big cache for them Driver->setupMaxTotalAsyncTextureSize(ENTITY_TEXTURE_NORMAL_MEMORY*1024*1024); + // Allow normal upload + Driver->setupAsyncTextureMaxUploadPerFrame(ENTITY_TEXTURE_NORMAL_MAXUP*1024); } } else @@ -904,6 +912,8 @@ void initMainLoop() Driver->setupAsyncTextureLod(ENTITY_TEXTURE_COARSE_LEVEL-1, ENTITY_TEXTURE_NORMAL_LEVEL-1); // Allow a big cache for them Driver->setupMaxTotalAsyncTextureSize(ENTITY_TEXTURE_NORMAL_MEMORY*1024*1024); + // Allow low upload + Driver->setupAsyncTextureMaxUploadPerFrame(ENTITY_TEXTURE_LOW_MAXUP*1024); } }