This commit is contained in:
botanic 2014-09-13 10:31:22 -07:00
commit d0491e05f5
9 changed files with 55 additions and 20 deletions

View file

@ -153,8 +153,12 @@ bool UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING;
#define ENTITY_TEXTURE_NORMAL_LEVEL 1 #define ENTITY_TEXTURE_NORMAL_LEVEL 1
#define ENTITY_TEXTURE_HIGH_LEVEL 0 #define ENTITY_TEXTURE_HIGH_LEVEL 0
// Size in MB of the cache for entity texturing. // Size in MB of the cache for entity texturing.
#define ENTITY_TEXTURE_NORMAL_MEMORY 10 #define ENTITY_TEXTURE_NORMAL_MEMORY 40
#define ENTITY_TEXTURE_HIGH_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 // Don't Modify, set true for debug purpose only
const bool DBG_DisablePreloadShape= false; const bool DBG_DisablePreloadShape= false;
@ -885,8 +889,10 @@ void initMainLoop()
{ {
// setup "v2 texture" (or 512*512) // setup "v2 texture" (or 512*512)
Driver->setupAsyncTextureLod(ENTITY_TEXTURE_COARSE_LEVEL, ENTITY_TEXTURE_HIGH_LEVEL); 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); Driver->setupMaxTotalAsyncTextureSize(ENTITY_TEXTURE_HIGH_MEMORY*1024*1024);
// Allow high upload
Driver->setupAsyncTextureMaxUploadPerFrame(ENTITY_TEXTURE_HIGH_MAXUP*1024);
} }
else else
{ {
@ -894,6 +900,8 @@ void initMainLoop()
Driver->setupAsyncTextureLod(ENTITY_TEXTURE_COARSE_LEVEL, ENTITY_TEXTURE_NORMAL_LEVEL); Driver->setupAsyncTextureLod(ENTITY_TEXTURE_COARSE_LEVEL, ENTITY_TEXTURE_NORMAL_LEVEL);
// Allow a big cache for them // Allow a big cache for them
Driver->setupMaxTotalAsyncTextureSize(ENTITY_TEXTURE_NORMAL_MEMORY*1024*1024); Driver->setupMaxTotalAsyncTextureSize(ENTITY_TEXTURE_NORMAL_MEMORY*1024*1024);
// Allow normal upload
Driver->setupAsyncTextureMaxUploadPerFrame(ENTITY_TEXTURE_NORMAL_MAXUP*1024);
} }
} }
else else
@ -904,6 +912,8 @@ void initMainLoop()
Driver->setupAsyncTextureLod(ENTITY_TEXTURE_COARSE_LEVEL-1, ENTITY_TEXTURE_NORMAL_LEVEL-1); Driver->setupAsyncTextureLod(ENTITY_TEXTURE_COARSE_LEVEL-1, ENTITY_TEXTURE_NORMAL_LEVEL-1);
// Allow a big cache for them // Allow a big cache for them
Driver->setupMaxTotalAsyncTextureSize(ENTITY_TEXTURE_NORMAL_MEMORY*1024*1024); Driver->setupMaxTotalAsyncTextureSize(ENTITY_TEXTURE_NORMAL_MEMORY*1024*1024);
// Allow low upload
Driver->setupAsyncTextureMaxUploadPerFrame(ENTITY_TEXTURE_LOW_MAXUP*1024);
} }
} }

View file

@ -188,7 +188,7 @@ protected:
/// the harvestable Mps (4 per entity) /// the harvestable Mps (4 per entity)
std::vector< CCreatureRawMaterial> _Mps; std::vector< CCreatureRawMaterial> _Mps;
/// pointer on the harverting character /// pointer on the harvesting character
TDataSetRow _HarvesterRowId; TDataSetRow _HarvesterRowId;
/// skill used to harvest this creature /// skill used to harvest this creature

View file

@ -1509,7 +1509,7 @@ NLMISC_DYNVARIABLE( uint32, RyzomSeason, "Get season number (0=Spring)" )
#ifdef DEPOSIT_MAP_GENERATION #ifdef DEPOSIT_MAP_GENERATION
#include "server_share/bmp4image.h" #include "game_share/bmp4image.h"
#include <nel/misc/words_dictionary.h> #include <nel/misc/words_dictionary.h>
typedef std::map< std::string, pair< pair< float, float >, uint > > CSUMap; typedef std::map< std::string, pair< pair< float, float >, uint > > CSUMap;

View file

@ -23,7 +23,7 @@
#include "egs_mirror.h" #include "egs_mirror.h"
#include "area_geometry.h" #include "area_geometry.h"
#include "server_share/bmp4image.h" #include "game_share/bmp4image.h"

View file

@ -14167,7 +14167,7 @@ void CCharacter::sendCloseTempInventoryImpulsion()
BOMB_IF(isRecursing,"CCharacter::sendCloseTempInventoryImpulsion is recursing!",return); // **** Temp Fix 2/4 **** // BOMB_IF(isRecursing,"CCharacter::sendCloseTempInventoryImpulsion is recursing!",return); // **** Temp Fix 2/4 **** //
isRecursing= true; // **** Temp Fix 3/4 **** // isRecursing= true; // **** Temp Fix 3/4 **** //
getAllTempInventoryItems(); getAllTempInventoryItems(false);
CMessage msgout( "IMPULSION_ID" ); CMessage msgout( "IMPULSION_ID" );
msgout.serial( _Id ); msgout.serial( _Id );

View file

@ -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); 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) /// 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 /// clear temp inventory
void clearTempInventory(); void clearTempInventory();
/// get all items in temp inventory /// get all items in temp inventory
void getAllTempInventoryItems(); void getAllTempInventoryItems(bool sendCloseTempImpulsion = true);
/// return true if temp inventory is empty /// return true if temp inventory is empty
bool tempInventoryEmpty(); bool tempInventoryEmpty();

View file

@ -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); H_AUTO(CCharacter_itemTempInventoryToBag);
@ -2015,7 +2015,7 @@ void CCharacter::itemTempInventoryToBag(uint32 srcSlot)
CWorldInstances::instance().msgToAIInstance(getInstanceNumber(), msg); CWorldInstances::instance().msgToAIInstance(getInstanceNumber(), msg);
} }
endHarvest(); endHarvest(sendCloseTempImpulsion);
leaveTempInventoryMode(); leaveTempInventoryMode();
} }
@ -2108,12 +2108,12 @@ void CCharacter::itemTempInventoryToBag(uint32 srcSlot)
} }
// **************************************************************************** // ****************************************************************************
void CCharacter::getAllTempInventoryItems() void CCharacter::getAllTempInventoryItems(bool sendCloseTempImpulsion)
{ {
H_AUTO(CCharacter_getAllTempInventoryItems); H_AUTO(CCharacter_getAllTempInventoryItems);
for (uint i = 0 ; i < INVENTORIES::NbTempInvSlots; ++i) for (uint i = 0 ; i < INVENTORIES::NbTempInvSlots; ++i)
itemTempInventoryToBag(i); itemTempInventoryToBag(i, sendCloseTempImpulsion);
} }
// **************************************************************************** // ****************************************************************************

View file

@ -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,8 @@ 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);
CPath::remapExtension("dds", "png", 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");
@ -590,7 +590,7 @@ void CScreenshotIslands::buildScreenshots()
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
void CScreenshotIslands::writeProximityBufferToTgaFile(const std::string& fileName,const TBuffer& buffer,uint32 scanWidth,uint32 scanHeight) 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); uint imageHeight = (scanHeight);
CTGAImageGrey tgaImage; CTGAImageGrey tgaImage;
@ -1348,11 +1348,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 +1362,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 +1397,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 +1472,7 @@ void CScreenshotIslands::buildIslandsTextures()
} }
} }
} }
scene->animate(CTime::ticksToSecond(CTime::getPerformanceTime()));
// Clear all buffers // Clear all buffers
driver->clearBuffers(_BackColor); driver->clearBuffers(_BackColor);
@ -1535,17 +1540,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 +2105,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;
} }

View file

@ -111,6 +111,7 @@ int main(int argc, char* argv[])
CPath::addSearchPath(builderConfig.SearchPaths[k], true, false); CPath::addSearchPath(builderConfig.SearchPaths[k], true, false);
} }
CPath::remapExtension("dds", "tga", true); CPath::remapExtension("dds", "tga", true);
CPath::remapExtension("dds", "png", true);
// //
R2::CScenarioEntryPoints &sep = R2::CScenarioEntryPoints::getInstance(); R2::CScenarioEntryPoints &sep = R2::CScenarioEntryPoints::getInstance();
try try