Merge branch 'develop' into ryzomclassic-develop

ryzomclassic-develop
Jan Boon 5 years ago
commit 9d1545bbe2

@ -84,14 +84,6 @@ protected:
float *_NormalizationFactor; float *_NormalizationFactor;
bool _DisableSharing; bool _DisableSharing;
bool _ForceNormalize; bool _ForceNormalize;
// Map that give the normalization factor for each map from its sharename. This avoid to generate several time the maps to get the normalization factor if a bumpmap is shared by severals CTextureBump instances;
struct CNormalizationInfo
{
uint NumRefs;
float NormalizationFactor;
};
typedef std::map<std::string, CNormalizationInfo> TNameToNI; // sharename to the normalization factor
static TNameToNI _NameToNF; // name to normalization factor
private: private:
/// we don't allow for mipmap for bump so we redefine this to prevent the user from doing this on the base class Itexture /// we don't allow for mipmap for bump so we redefine this to prevent the user from doing this on the base class Itexture
virtual void setFilterMode(TMagFilter magf, TMinFilter minf); virtual void setFilterMode(TMagFilter magf, TMinFilter minf);

@ -16,7 +16,7 @@
#ifndef NL_BASE64_H #ifndef NL_BASE64_H
#define NL_BASE64_h #define NL_BASE64_H
namespace NLMISC namespace NLMISC
{ {

@ -368,10 +368,10 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
// removed because we always check assert (even in release mode) #if defined(NL_DEBUG) // removed because we always check assert (even in release mode) #if defined(NL_DEBUG)
#if defined(_MSC_VER) && _MSC_VER >= 1900 #if defined(_MSC_VER) && _MSC_VER >= 1500
#define nlassume(exp) do { __analysis_assume(exp); } while (0) // __analysis_assume doesn't evaluate the expression at runtime #define nlassume(exp) do { __analysis_assume(exp); } while (0) // __analysis_assume doesn't evaluate the expression at runtime
#else #else
#define nlassume(exp) do { ) while (0) #define nlassume(exp) do { } while (0)
#endif #endif
#ifdef NL_NO_DEBUG #ifdef NL_NO_DEBUG
@ -500,6 +500,15 @@ do { \
#endif // NL_NO_DEBUG #endif // NL_NO_DEBUG
// Same as nlassert and nlverify, but only in DEV build
#if !FINAL_VERSION
#define nlassertverbose(exp) nlassert(exp)
#define nlverifyverbose(exp) nlverify(exp)
#else
#define nlassertverbose(exp) nlassume(exp)
#define nlverifyverbose(exp) do { exp; nlassume(exp); } while (0)
#endif
#define nlunreferenced(identifier) (void)identifier #define nlunreferenced(identifier) (void)identifier
#define nlstop \ #define nlstop \

@ -26,9 +26,31 @@
namespace NL3D { namespace NL3D {
namespace /* anonymous */ {
CTextureBump::TNameToNI CTextureBump::_NameToNF; // Map that give the normalization factor for each map from its sharename. This avoid to generate several time the maps to get the normalization factor if a bumpmap is shared by severals CTextureBump instances;
struct CNormalizationInfo
{
uint NumRefs;
float NormalizationFactor;
};
typedef std::map<std::string, CNormalizationInfo> TNameToNI; // sharename to the normalization factor
class CNameToNFStatic {
public:
TNameToNI Map;
bool Initialized;
CNameToNFStatic() : Initialized(true)
{
}
~CNameToNFStatic()
{
Initialized = false;
}
};
CNameToNFStatic s_NameToNF;
} /* anonymous namespace */
#define GET_HGT(x, y) ((sint) ((src[(uint) (x) % width + ((uint) (y) % height) * width] & 0x00ff00) >> 8)) #define GET_HGT(x, y) ((sint) ((src[(uint) (x) % width + ((uint) (y) % height) * width] & 0x00ff00) >> 8))
/// create a DsDt texture from a height map (red component of a rgba bitmap) /// create a DsDt texture from a height map (red component of a rgba bitmap)
@ -242,14 +264,15 @@ void CTextureBump::doGenerate(bool async)
} }
// create entry in the map for the normalization factor // create entry in the map for the normalization factor
std::string shareName = getShareName(); std::string shareName = getShareName();
TNameToNI::iterator it = _NameToNF.find(shareName); nlassertverbose(s_NameToNF.Initialized);
if (it == _NameToNF.end()) TNameToNI::iterator it = s_NameToNF.Map.find(shareName);
if (it == s_NameToNF.Map.end())
{ {
// create a new entry // create a new entry
CNormalizationInfo ni; CNormalizationInfo ni;
ni.NumRefs = 1; ni.NumRefs = 1;
ni.NormalizationFactor = normalizationFactor; ni.NormalizationFactor = normalizationFactor;
std::pair<TNameToNI::iterator, bool> pb = _NameToNF.insert(TNameToNI::value_type(shareName, ni)); std::pair<TNameToNI::iterator, bool> pb = s_NameToNF.Map.insert(TNameToNI::value_type(shareName, ni));
_NormalizationFactor = &(pb.first->second.NormalizationFactor); _NormalizationFactor = &(pb.first->second.NormalizationFactor);
} }
else else
@ -303,8 +326,9 @@ float CTextureBump::getNormalizationFactor()
if (!_HeightMap) return 1.f; if (!_HeightMap) return 1.f;
// not computed yet, see if another map has computed it // not computed yet, see if another map has computed it
std::string shareName = getShareName(); std::string shareName = getShareName();
TNameToNI::iterator it = _NameToNF.find(shareName); nlassertverbose(s_NameToNF.Initialized);
if (it != _NameToNF.end()) TNameToNI::iterator it = s_NameToNF.Map.find(shareName);
if (it != s_NameToNF.Map.end())
{ {
_NormalizationFactor = &(it->second.NormalizationFactor); _NormalizationFactor = &(it->second.NormalizationFactor);
++(it->second.NumRefs); ++(it->second.NumRefs);
@ -320,16 +344,16 @@ float CTextureBump::getNormalizationFactor()
///============================================================================================== ///==============================================================================================
CTextureBump::~CTextureBump() CTextureBump::~CTextureBump()
{ {
if (_NormalizationFactor && !_NameToNF.empty()) if (s_NameToNF.Initialized && _NormalizationFactor && !s_NameToNF.Map.empty())
{ {
// find normalization factor from its name // find normalization factor from its name
TNameToNI::iterator it = _NameToNF.find(getShareName()); TNameToNI::iterator it = s_NameToNF.Map.find(getShareName());
// if found // if found
if (it != _NameToNF.end()) if (it != s_NameToNF.Map.end())
{ {
// we can delete it only if it's not used anymore // we can delete it only if it's not used anymore
if (--(it->second.NumRefs) == 0) _NameToNF.erase(it); if (--(it->second.NumRefs) == 0) s_NameToNF.Map.erase(it);
} }
} }
} }

@ -5178,7 +5178,7 @@ namespace NLGUI
if (low < min) if (low < min)
low = min; low = min;
if (high > max) if (high > max)
max = max; high = max;
} }
float CGroupHTML::HTMLMeterElement::getValueRatio() const float CGroupHTML::HTMLMeterElement::getValueRatio() const

@ -697,7 +697,8 @@ static void addPaths(IProgressCallback &progress, const std::vector<std::string>
if (CFile::isDirectory(getRyzomSharePrefix())) directoryPrefixes.push_back(CPath::standardizePath(getRyzomSharePrefix())); if (CFile::isDirectory(getRyzomSharePrefix())) directoryPrefixes.push_back(CPath::standardizePath(getRyzomSharePrefix()));
#endif #endif
std::map<std::string, sint> directoriesToProcess; std::set<std::string> directoriesToProcessSet;
std::vector<std::string> directoriesToProcess;
// first pass, build a map with all existing directories to process in second pass // first pass, build a map with all existing directories to process in second pass
for (uint j = 0; j < directoryPrefixes.size(); j++) for (uint j = 0; j < directoryPrefixes.size(); j++)
@ -710,36 +711,29 @@ static void addPaths(IProgressCallback &progress, const std::vector<std::string>
// only prepend prefix if path is relative // only prepend prefix if path is relative
if (!directory.empty() && !directoryPrefix.empty() && !CPath::isAbsolutePath(directory)) if (!directory.empty() && !directoryPrefix.empty() && !CPath::isAbsolutePath(directory))
directory = directoryPrefix + directory; directory = directoryPrefix + directory;
// only process existing directories // only process existing directories
if (CFile::isExists(directory)) if (CFile::isExists(directory))
directoriesToProcess[directory] = 1; {
if (directoriesToProcessSet.find(directory) == directoriesToProcessSet.end())
{
directoriesToProcessSet.insert(directory);
directoriesToProcess.push_back(directory);
}
}
} }
} }
uint total = (uint)directoriesToProcess.size();
uint current = 0, next = 0;
std::map<std::string, sint>::const_iterator it = directoriesToProcess.begin(), iend = directoriesToProcess.end();
// second pass, add search paths // second pass, add search paths
while (it != iend) for (size_t i = 0; i < directoriesToProcess.size(); ++i)
{ {
// update next progress value progress.progress((float)i / (float)directoriesToProcess.size());
++next; progress.pushCropedValues((float)i / (float)directoriesToProcess.size(), (float)(i + 1) / (float)directoriesToProcess.size());
progress.progress((float)current/(float)total);
progress.pushCropedValues((float)current/(float)total, (float)next/(float)total);
// next is current value CPath::addSearchPath(directoriesToProcess[i], recurse, false, &progress);
current = next;
CPath::addSearchPath(it->first, recurse, false, &progress);
progress.popCropedValues(); progress.popCropedValues();
++it;
} }
} }

@ -378,7 +378,10 @@ public:
virtual void execute(CCtrlBase * /* pCaller */, const string &Params) virtual void execute(CCtrlBase * /* pCaller */, const string &Params)
{ {
if(!SoundMngr) if(!SoundMngr)
{
CInterfaceManager::getInstance()->messageBox (CI18N::get ("uiSoundDisabled"));
return; return;
}
if (Params == "play_songs") if (Params == "play_songs")
{ {
@ -386,19 +389,26 @@ public:
SoundMngr->getMixer()->getMusicExtensions(extensions); SoundMngr->getMixer()->getMusicExtensions(extensions);
// no format supported // no format supported
if (extensions.empty()) return; if (extensions.empty())
std::string message;
for(uint i = 0; i < extensions.size(); ++i)
{ {
message += " " + extensions[i]; // in the very unlikely scenario
const ucstring message("Sound driver has no support for music.");
CInterfaceManager::getInstance()->displaySystemInfo(message, "SYS");
nlinfo("%s", message.toUtf8().c_str());
return;
} }
message += " m3u m3u8"; std::string newPath = CPath::makePathAbsolute(CPath::standardizePath(ClientCfg.MediaPlayerDirectory), CPath::getCurrentPath(), true);
nlinfo("Media player supports: '%s'", message.substr(1).c_str()); std::string extlist;
join(extensions, ", ", extlist);
extlist += ", m3u, m3u8";
std::string msg(CI18N::get("uiMk_system6").toUtf8());
msg += ": " + newPath + " (" + extlist + ")";
CInterfaceManager::getInstance()->displaySystemInfo(ucstring::makeFromUtf8(msg), "SYS");
nlinfo("%s", msg.c_str());
// Recursive scan for files from media directory // Recursive scan for files from media directory
vector<string> filesToProcess; vector<string> filesToProcess;
string newPath = CPath::standardizePath(ClientCfg.MediaPlayerDirectory);
CPath::getPathContent (newPath, true, false, true, filesToProcess); CPath::getPathContent (newPath, true, false, true, filesToProcess);
uint i; uint i;

@ -2768,7 +2768,7 @@ void updateInventoryFromStream (NLMISC::CBitMemStream &impulse, const CInventory
const string invBranchStr = CInventoryCategoryTemplate::getDbStr( (typename CInventoryCategoryTemplate::TInventoryId)invId ); const string invBranchStr = CInventoryCategoryTemplate::getDbStr( (typename CInventoryCategoryTemplate::TInventoryId)invId );
ICDBNode::CTextId textId( invBranchStr ); ICDBNode::CTextId textId( invBranchStr );
ICDBNode *inventoryNode = IngameDbMngr.getNodePtr()->getNode( textId, false ); ICDBNode *inventoryNode = IngameDbMngr.getNodePtr()->getNode( textId, false );
BOMB_IF( !inventoryNode, "Inventory missing in database", return ) BOMB_IF(!inventoryNode, "Inventory missing in database", return);
// List of updates // List of updates
for ( uint c=0; c!=nbChanges; ++c ) for ( uint c=0; c!=nbChanges; ++c )

@ -243,7 +243,13 @@ void CDynamicMapClientEventForwarder::nodeMoved(
void CDynamicMapClientEventForwarder::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialActIndex) void CDynamicMapClientEventForwarder::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialActIndex)
{ {
//H_AUTO(R2_CDynamicMapClientEventForwarder_scenarioUpdated) //H_AUTO(R2_CDynamicMapClientEventForwarder_scenarioUpdated)
if (getEditor().getMode() != CEditor::EditionMode) return; if (getEditor().getMode() != CEditor::EditionMode
&& getEditor().getMode() != CEditor::GoingToEditionMode /* New scenario */
&& getEditor().getMode() != CEditor::AnimationModeLoading /* Loading animation scenario from terminal */)
{
nldebug("Scenario update received, but not in edition mode");
return;
}
getEditor().scenarioUpdated(highLevel, willTP, initialActIndex); getEditor().scenarioUpdated(highLevel, willTP, initialActIndex);
} }
@ -5708,6 +5714,7 @@ void CEditor::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialAct
if (_WaitScenarioScreenActive) if (_WaitScenarioScreenActive)
{ {
// defer scenario update to the end of the wait screen // defer scenario update to the end of the wait screen
nlassert(!_NewScenario);
_NewScenario = highLevel ? highLevel->clone() : NULL; _NewScenario = highLevel ? highLevel->clone() : NULL;
_NewScenarioInitialAct = initialActIndex; _NewScenarioInitialAct = initialActIndex;
_PostponeScenarioUpdated = true; _PostponeScenarioUpdated = true;

@ -28,7 +28,7 @@
#include "filesextractor.h" #include "filesextractor.h"
#include "filescleaner.h" #include "filescleaner.h"
#include "seven_zip.h" #include "nel/misc/seven_zip.h"
#if defined(Q_OS_WIN32) && defined(QT_WINEXTRAS_LIB) #if defined(Q_OS_WIN32) && defined(QT_WINEXTRAS_LIB)
#include <QtWinExtras/QWinTaskbarProgress> #include <QtWinExtras/QWinTaskbarProgress>

Loading…
Cancel
Save