Merge branch 'develop' into ryzomclassic-develop

ryzomclassic-develop
Jan Boon 5 years ago
commit 9d1545bbe2

@ -84,14 +84,6 @@ protected:
float *_NormalizationFactor;
bool _DisableSharing;
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:
/// 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);

@ -16,7 +16,7 @@
#ifndef NL_BASE64_H
#define NL_BASE64_h
#define NL_BASE64_H
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)
#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
#else
#define nlassume(exp) do { ) while (0)
#define nlassume(exp) do { } while (0)
#endif
#ifdef NL_NO_DEBUG
@ -500,6 +500,15 @@ do { \
#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 nlstop \

@ -26,9 +26,31 @@
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))
/// 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
std::string shareName = getShareName();
TNameToNI::iterator it = _NameToNF.find(shareName);
if (it == _NameToNF.end())
nlassertverbose(s_NameToNF.Initialized);
TNameToNI::iterator it = s_NameToNF.Map.find(shareName);
if (it == s_NameToNF.Map.end())
{
// create a new entry
CNormalizationInfo ni;
ni.NumRefs = 1;
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);
}
else
@ -303,8 +326,9 @@ float CTextureBump::getNormalizationFactor()
if (!_HeightMap) return 1.f;
// not computed yet, see if another map has computed it
std::string shareName = getShareName();
TNameToNI::iterator it = _NameToNF.find(shareName);
if (it != _NameToNF.end())
nlassertverbose(s_NameToNF.Initialized);
TNameToNI::iterator it = s_NameToNF.Map.find(shareName);
if (it != s_NameToNF.Map.end())
{
_NormalizationFactor = &(it->second.NormalizationFactor);
++(it->second.NumRefs);
@ -320,16 +344,16 @@ float CTextureBump::getNormalizationFactor()
///==============================================================================================
CTextureBump::~CTextureBump()
{
if (_NormalizationFactor && !_NameToNF.empty())
if (s_NameToNF.Initialized && _NormalizationFactor && !s_NameToNF.Map.empty())
{
// find normalization factor from its name
TNameToNI::iterator it = _NameToNF.find(getShareName());
TNameToNI::iterator it = s_NameToNF.Map.find(getShareName());
// if found
if (it != _NameToNF.end())
if (it != s_NameToNF.Map.end())
{
// 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)
low = min;
if (high > max)
max = max;
high = max;
}
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()));
#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
for (uint j = 0; j < directoryPrefixes.size(); j++)
@ -714,32 +715,25 @@ static void addPaths(IProgressCallback &progress, const std::vector<std::string>
// only process existing directories
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
while (it != iend)
for (size_t i = 0; i < directoriesToProcess.size(); ++i)
{
// update next progress value
++next;
progress.progress((float)current/(float)total);
progress.pushCropedValues((float)current/(float)total, (float)next/(float)total);
progress.progress((float)i / (float)directoriesToProcess.size());
progress.pushCropedValues((float)i / (float)directoriesToProcess.size(), (float)(i + 1) / (float)directoriesToProcess.size());
// next is current value
current = next;
CPath::addSearchPath(it->first, recurse, false, &progress);
CPath::addSearchPath(directoriesToProcess[i], recurse, false, &progress);
progress.popCropedValues();
++it;
}
}

@ -378,7 +378,10 @@ public:
virtual void execute(CCtrlBase * /* pCaller */, const string &Params)
{
if(!SoundMngr)
{
CInterfaceManager::getInstance()->messageBox (CI18N::get ("uiSoundDisabled"));
return;
}
if (Params == "play_songs")
{
@ -386,19 +389,26 @@ public:
SoundMngr->getMixer()->getMusicExtensions(extensions);
// no format supported
if (extensions.empty()) return;
std::string message;
for(uint i = 0; i < extensions.size(); ++i)
if (extensions.empty())
{
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";
nlinfo("Media player supports: '%s'", message.substr(1).c_str());
std::string newPath = CPath::makePathAbsolute(CPath::standardizePath(ClientCfg.MediaPlayerDirectory), CPath::getCurrentPath(), true);
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
vector<string> filesToProcess;
string newPath = CPath::standardizePath(ClientCfg.MediaPlayerDirectory);
CPath::getPathContent (newPath, true, false, true, filesToProcess);
uint i;

@ -2768,7 +2768,7 @@ void updateInventoryFromStream (NLMISC::CBitMemStream &impulse, const CInventory
const string invBranchStr = CInventoryCategoryTemplate::getDbStr( (typename CInventoryCategoryTemplate::TInventoryId)invId );
ICDBNode::CTextId textId( invBranchStr );
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
for ( uint c=0; c!=nbChanges; ++c )

@ -243,7 +243,13 @@ void CDynamicMapClientEventForwarder::nodeMoved(
void CDynamicMapClientEventForwarder::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialActIndex)
{
//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);
}
@ -5708,6 +5714,7 @@ void CEditor::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialAct
if (_WaitScenarioScreenActive)
{
// defer scenario update to the end of the wait screen
nlassert(!_NewScenario);
_NewScenario = highLevel ? highLevel->clone() : NULL;
_NewScenarioInitialAct = initialActIndex;
_PostponeScenarioUpdated = true;

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

Loading…
Cancel
Save