mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 00:13:53 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into allowed-editors
This commit is contained in:
commit
35430a4c7a
10 changed files with 55 additions and 41 deletions
|
@ -17,3 +17,4 @@ Script.load("headMove.js");
|
|||
Script.load("inspect.js");
|
||||
Script.load("lobby.js");
|
||||
Script.load("notifications.js");
|
||||
Script.load("lookWithMouse.js")
|
||||
|
|
|
@ -424,11 +424,11 @@ var toolBar = (function () {
|
|||
Entities.addEntity({
|
||||
type: "Text",
|
||||
position: grid.snapToSurface(grid.snapToGrid(position, false, DEFAULT_DIMENSIONS), DEFAULT_DIMENSIONS),
|
||||
dimensions: DEFAULT_DIMENSIONS,
|
||||
backgroundColor: { red: 0, green: 0, blue: 0 },
|
||||
dimensions: { x: 0.5, y: 0.3, z: 0.01 },
|
||||
backgroundColor: { red: 64, green: 64, blue: 64 },
|
||||
textColor: { red: 255, green: 255, blue: 255 },
|
||||
text: "some text",
|
||||
lineHight: "0.1"
|
||||
lineHeight: 0.06
|
||||
});
|
||||
} else {
|
||||
print("Can't create box: Text would be out of bounds.");
|
||||
|
|
|
@ -1221,7 +1221,7 @@ SelectionDisplay = (function () {
|
|||
x: selectionManager.worldDimensions.x,
|
||||
y: selectionManager.worldDimensions.z
|
||||
},
|
||||
rotation: Quat.fromPitchYawRollDegrees(0, 0, 0),
|
||||
rotation: Quat.fromPitchYawRollDegrees(90, 0, 0),
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
#include <PhysicsEngine.h>
|
||||
#include <ProgramObject.h>
|
||||
#include <ResourceCache.h>
|
||||
#include <ScriptCache.h>
|
||||
#include <SettingHandle.h>
|
||||
#include <SoundCache.h>
|
||||
#include <TextRenderer.h>
|
||||
|
@ -188,6 +189,7 @@ bool setupEssentials(int& argc, char** argv) {
|
|||
auto jsConsole = DependencyManager::set<StandAloneJSConsole>();
|
||||
auto dialogsManager = DependencyManager::set<DialogsManager>();
|
||||
auto bandwidthRecorder = DependencyManager::set<BandwidthRecorder>();
|
||||
auto resouceCacheSharedItems = DependencyManager::set<ResouceCacheSharedItems>();
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||
auto speechRecognizer = DependencyManager::set<SpeechRecognizer>();
|
||||
#endif
|
||||
|
@ -514,6 +516,11 @@ Application::~Application() {
|
|||
_myAvatar = NULL;
|
||||
|
||||
DependencyManager::destroy<GLCanvas>();
|
||||
DependencyManager::destroy<AnimationCache>();
|
||||
DependencyManager::destroy<TextureCache>();
|
||||
DependencyManager::destroy<GeometryCache>();
|
||||
DependencyManager::destroy<ScriptCache>();
|
||||
DependencyManager::destroy<SoundCache>();
|
||||
}
|
||||
|
||||
void Application::initializeGL() {
|
||||
|
|
|
@ -139,23 +139,13 @@ void Audio::audioMixerKilled() {
|
|||
|
||||
QAudioDeviceInfo getNamedAudioDeviceForMode(QAudio::Mode mode, const QString& deviceName) {
|
||||
QAudioDeviceInfo result;
|
||||
// Temporarily enable audio device selection in Windows again to test how it behaves now
|
||||
//#ifdef WIN32
|
||||
#if FALSE
|
||||
// NOTE
|
||||
// this is a workaround for a windows only QtBug https://bugreports.qt-project.org/browse/QTBUG-16117
|
||||
// static QAudioDeviceInfo objects get deallocated when QList<QAudioDevieInfo> objects go out of scope
|
||||
result = (mode == QAudio::AudioInput) ?
|
||||
QAudioDeviceInfo::defaultInputDevice() :
|
||||
QAudioDeviceInfo::defaultOutputDevice();
|
||||
#else
|
||||
foreach(QAudioDeviceInfo audioDevice, QAudioDeviceInfo::availableDevices(mode)) {
|
||||
if (audioDevice.deviceName().trimmed() == deviceName.trimmed()) {
|
||||
result = audioDevice;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -548,7 +548,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
// is sending us data with a known "last simulated" time. That time is likely in the past, and therefore
|
||||
// this "new" data is actually slightly out of date. We calculate the time we need to skip forward and
|
||||
// use our simulation helper routine to get a best estimate of where the entity should be.
|
||||
float skipTimeForward = (float)(now - _lastSimulated) / (float)(USECS_PER_SECOND);
|
||||
const float MIN_TIME_SKIP = 0.0f;
|
||||
const float MAX_TIME_SKIP = 1.0f; // in seconds
|
||||
float skipTimeForward = glm::clamp((float)(now - _lastSimulated) / (float)(USECS_PER_SECOND),
|
||||
MIN_TIME_SKIP, MAX_TIME_SKIP);
|
||||
if (skipTimeForward > 0.0f) {
|
||||
#ifdef WANT_DEBUG
|
||||
qDebug() << "skipTimeForward:" << skipTimeForward;
|
||||
|
|
|
@ -228,7 +228,7 @@ void EntityTree::setSimulation(EntitySimulation* simulation) {
|
|||
_simulation = simulation;
|
||||
}
|
||||
|
||||
void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
||||
void EntityTree::deleteEntity(const EntityItemID& entityID, bool force) {
|
||||
EntityTreeElement* containingElement = getContainingElement(entityID);
|
||||
if (!containingElement) {
|
||||
qDebug() << "UNEXPECTED!!!! EntityTree::deleteEntity() entityID doesn't exist!!! entityID=" << entityID;
|
||||
|
@ -241,7 +241,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (existingEntity->getLocked()) {
|
||||
if (existingEntity->getLocked() && !force) {
|
||||
qDebug() << "ERROR! EntityTree::deleteEntity() trying to delete locked entity. entityID=" << entityID;
|
||||
return;
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
|||
_isDirty = true;
|
||||
}
|
||||
|
||||
void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs) {
|
||||
void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs, bool force) {
|
||||
// NOTE: callers must lock the tree before using this method
|
||||
DeleteEntityOperator theOperator(this);
|
||||
foreach(const EntityItemID& entityID, entityIDs) {
|
||||
|
@ -271,7 +271,7 @@ void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (existingEntity->getLocked()) {
|
||||
if (existingEntity->getLocked() && !force) {
|
||||
qDebug() << "ERROR! EntityTree::deleteEntities() trying to delete locked entity. entityID=" << entityID;
|
||||
continue;
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ void EntityTree::update() {
|
|||
foreach (EntityItem* entity, entitiesToDelete) {
|
||||
idsToDelete.insert(entity->getEntityItemID());
|
||||
}
|
||||
deleteEntities(idsToDelete);
|
||||
deleteEntities(idsToDelete, true);
|
||||
}
|
||||
unlock();
|
||||
}
|
||||
|
|
|
@ -91,8 +91,8 @@ public:
|
|||
// use this method if you have a pointer to the entity (avoid an extra entity lookup)
|
||||
bool updateEntity(EntityItem* entity, const EntityItemProperties& properties);
|
||||
|
||||
void deleteEntity(const EntityItemID& entityID);
|
||||
void deleteEntities(QSet<EntityItemID> entityIDs);
|
||||
void deleteEntity(const EntityItemID& entityID, bool force = false);
|
||||
void deleteEntities(QSet<EntityItemID> entityIDs, bool force = false);
|
||||
void removeEntityFromSimulation(EntityItem* entity);
|
||||
|
||||
const EntityItem* findClosestEntity(glm::vec3 position, float targetRadius);
|
||||
|
|
|
@ -112,27 +112,30 @@ void ResourceCache::reserveUnusedResource(qint64 resourceSize) {
|
|||
}
|
||||
|
||||
void ResourceCache::attemptRequest(Resource* resource) {
|
||||
auto sharedItems = DependencyManager::get<ResouceCacheSharedItems>();
|
||||
if (_requestLimit <= 0) {
|
||||
// wait until a slot becomes available
|
||||
_pendingRequests.append(resource);
|
||||
sharedItems->_pendingRequests.append(resource);
|
||||
return;
|
||||
}
|
||||
_requestLimit--;
|
||||
_loadingRequests.append(resource);
|
||||
sharedItems->_loadingRequests.append(resource);
|
||||
resource->makeRequest();
|
||||
}
|
||||
|
||||
void ResourceCache::requestCompleted(Resource* resource) {
|
||||
_loadingRequests.removeOne(resource);
|
||||
|
||||
auto sharedItems = DependencyManager::get<ResouceCacheSharedItems>();
|
||||
sharedItems->_loadingRequests.removeOne(resource);
|
||||
_requestLimit++;
|
||||
|
||||
// look for the highest priority pending request
|
||||
int highestIndex = -1;
|
||||
float highestPriority = -FLT_MAX;
|
||||
for (int i = 0; i < _pendingRequests.size(); ) {
|
||||
Resource* resource = _pendingRequests.at(i).data();
|
||||
for (int i = 0; i < sharedItems->_pendingRequests.size(); ) {
|
||||
Resource* resource = sharedItems->_pendingRequests.at(i).data();
|
||||
if (!resource) {
|
||||
_pendingRequests.removeAt(i);
|
||||
sharedItems->_pendingRequests.removeAt(i);
|
||||
continue;
|
||||
}
|
||||
float priority = resource->getLoadPriority();
|
||||
|
@ -143,16 +146,13 @@ void ResourceCache::requestCompleted(Resource* resource) {
|
|||
i++;
|
||||
}
|
||||
if (highestIndex >= 0) {
|
||||
attemptRequest(_pendingRequests.takeAt(highestIndex));
|
||||
attemptRequest(sharedItems->_pendingRequests.takeAt(highestIndex));
|
||||
}
|
||||
}
|
||||
|
||||
const int DEFAULT_REQUEST_LIMIT = 10;
|
||||
int ResourceCache::_requestLimit = DEFAULT_REQUEST_LIMIT;
|
||||
|
||||
QList<QPointer<Resource> > ResourceCache::_pendingRequests;
|
||||
QList<Resource*> ResourceCache::_loadingRequests;
|
||||
|
||||
Resource::Resource(const QUrl& url, bool delayLoad) :
|
||||
_url(url),
|
||||
_request(url) {
|
||||
|
@ -248,11 +248,7 @@ void Resource::allReferencesCleared() {
|
|||
_cache->addUnusedResource(self);
|
||||
|
||||
} else {
|
||||
#ifndef WIN32
|
||||
// Note to Andrzej this causes a consistent crash on windows/vs2013
|
||||
// patching here as a very temporary workaround. --craig
|
||||
delete this;
|
||||
#endif // !WIN32
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <QUrl>
|
||||
#include <QWeakPointer>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
|
||||
class QNetworkReply;
|
||||
class QTimer;
|
||||
|
||||
|
@ -40,6 +42,21 @@ static const qint64 DEFAULT_UNUSED_MAX_SIZE = 1024 * BYTES_PER_MEGABYTES;
|
|||
static const qint64 MIN_UNUSED_MAX_SIZE = 0;
|
||||
static const qint64 MAX_UNUSED_MAX_SIZE = 10 * BYTES_PER_GIGABYTES;
|
||||
|
||||
// We need to make sure that these items are available for all instances of
|
||||
// ResourceCache derived classes. Since we can't count on the ordering of
|
||||
// static members destruction, we need to use this Dependency manager implemented
|
||||
// object instead
|
||||
class ResouceCacheSharedItems : public Dependency {
|
||||
SINGLETON_DEPENDENCY
|
||||
public:
|
||||
QList<QPointer<Resource> > _pendingRequests;
|
||||
QList<Resource*> _loadingRequests;
|
||||
private:
|
||||
ResouceCacheSharedItems() { }
|
||||
virtual ~ResouceCacheSharedItems() { }
|
||||
};
|
||||
|
||||
|
||||
/// Base class for resource caches.
|
||||
class ResourceCache : public QObject {
|
||||
Q_OBJECT
|
||||
|
@ -51,9 +68,11 @@ public:
|
|||
void setUnusedResourceCacheSize(qint64 unusedResourcesMaxSize);
|
||||
qint64 getUnusedResourceCacheSize() const { return _unusedResourcesMaxSize; }
|
||||
|
||||
static const QList<Resource*>& getLoadingRequests() { return _loadingRequests; }
|
||||
static const QList<Resource*>& getLoadingRequests()
|
||||
{ return DependencyManager::get<ResouceCacheSharedItems>()->_loadingRequests; }
|
||||
|
||||
static int getPendingRequestCount() { return _pendingRequests.size(); }
|
||||
static int getPendingRequestCount()
|
||||
{ return DependencyManager::get<ResouceCacheSharedItems>()->_pendingRequests.size(); }
|
||||
|
||||
ResourceCache(QObject* parent = NULL);
|
||||
virtual ~ResourceCache();
|
||||
|
@ -90,8 +109,6 @@ private:
|
|||
int _lastLRUKey = 0;
|
||||
|
||||
static int _requestLimit;
|
||||
static QList<QPointer<Resource> > _pendingRequests;
|
||||
static QList<Resource*> _loadingRequests;
|
||||
};
|
||||
|
||||
/// Base class for resources.
|
||||
|
|
Loading…
Reference in a new issue