Merge branch 'master' into oculus_old_renderer

This commit is contained in:
Brad Davis 2015-03-06 12:56:19 -08:00
commit 4fa5a0eca4
17 changed files with 73 additions and 38 deletions

View file

@ -40,8 +40,8 @@ SharedAssignmentPointer AssignmentClient::_currentAssignment;
int hifiSockAddrMeta = qRegisterMetaType<HifiSockAddr>("HifiSockAddr");
AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool, QUuid walletUUID,
QString assignmentServerHostname, quint16 assignmentServerPort) :
AssignmentClient::AssignmentClient(int ppid, Assignment::Type requestAssignmentType, QString assignmentPool,
QUuid walletUUID, QString assignmentServerHostname, quint16 assignmentServerPort) :
_assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME),
_localASPortSharedMem(NULL),
_localACMPortSharedMem(NULL)
@ -106,7 +106,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
NetworkAccessManager::getInstance();
// Hook up a timer to send this child's status to the Monitor once per second
setUpStatsToMonitor();
setUpStatsToMonitor(ppid);
}
@ -118,13 +118,13 @@ void AssignmentClient::stopAssignmentClient() {
}
void AssignmentClient::setUpStatsToMonitor() {
void AssignmentClient::setUpStatsToMonitor(int ppid) {
// Figure out the address to send out stats to
quint16 localMonitorServerPort = DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT;
auto nodeList = DependencyManager::get<NodeList>();
nodeList->getLocalServerPortFromSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY,
_localACMPortSharedMem, localMonitorServerPort);
nodeList->getLocalServerPortFromSharedMemory(QString(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY) + "-" +
QString::number(ppid), _localACMPortSharedMem, localMonitorServerPort);
_assignmentClientMonitorSocket = HifiSockAddr(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME, localMonitorServerPort, true);
// send a stats packet every 1 seconds

View file

@ -22,7 +22,7 @@ class AssignmentClient : public QObject {
Q_OBJECT
public:
AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool,
AssignmentClient(int ppid, Assignment::Type requestAssignmentType, QString assignmentPool,
QUuid walletUUID, QString assignmentServerHostname, quint16 assignmentServerPort);
static const SharedAssignmentPointer& getCurrentAssignment() { return _currentAssignment; }
@ -35,7 +35,7 @@ private slots:
void stopAssignmentClient();
private:
void setUpStatsToMonitor();
void setUpStatsToMonitor(int ppid);
Assignment _requestAssignment;
static SharedAssignmentPointer _currentAssignment;
QString _assignmentServerHostname;

View file

@ -78,6 +78,9 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
const QCommandLineOption maxChildsOption(ASSIGNMENT_MAX_FORKS_OPTION, "maximum number of children", "child-count");
parser.addOption(maxChildsOption);
const QCommandLineOption ppidOption(PARENT_PID_OPTION, "parent's process id", "pid");
parser.addOption(ppidOption);
if (!parser.parse(QCoreApplication::arguments())) {
qCritical() << parser.errorText() << endl;
@ -109,6 +112,11 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
maxForks = parser.value(maxChildsOption).toInt();
}
int ppid = 0;
if (parser.isSet(ppidOption)) {
ppid = parser.value(ppidOption).toInt();
}
if (!numForks && minForks) {
// if the user specified --min but not -n, set -n to --min
numForks = minForks;
@ -174,11 +182,11 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
if (numForks || minForks || maxForks) {
AssignmentClientMonitor monitor(numForks, minForks, maxForks, assignmentPool,
AssignmentClientMonitor monitor(numForks, minForks, maxForks, requestAssignmentType, assignmentPool,
walletUUID, assignmentServerHostname, assignmentServerPort);
exec();
} else {
AssignmentClient client(requestAssignmentType, assignmentPool,
AssignmentClient client(ppid, requestAssignmentType, assignmentPool,
walletUUID, assignmentServerHostname, assignmentServerPort);
exec();
}

View file

@ -23,6 +23,7 @@ const QString CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION = "p";
const QString ASSIGNMENT_NUM_FORKS_OPTION = "n";
const QString ASSIGNMENT_MIN_FORKS_OPTION = "min";
const QString ASSIGNMENT_MAX_FORKS_OPTION = "max";
const QString PARENT_PID_OPTION = "ppid";
class AssignmentClientApp : public QCoreApplication {

View file

@ -20,23 +20,26 @@
#include "PacketHeaders.h"
#include "SharedUtil.h"
const char* NUM_FORKS_PARAMETER = "-n";
const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor";
AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmentClientForks,
const unsigned int minAssignmentClientForks,
const unsigned int maxAssignmentClientForks,
QString assignmentPool, QUuid walletUUID, QString assignmentServerHostname,
Assignment::Type requestAssignmentType, QString assignmentPool,
QUuid walletUUID, QString assignmentServerHostname,
quint16 assignmentServerPort) :
_numAssignmentClientForks(numAssignmentClientForks),
_minAssignmentClientForks(minAssignmentClientForks),
_maxAssignmentClientForks(maxAssignmentClientForks),
_requestAssignmentType(requestAssignmentType),
_assignmentPool(assignmentPool),
_walletUUID(walletUUID),
_assignmentServerHostname(assignmentServerHostname),
_assignmentServerPort(assignmentServerPort)
{
qDebug() << "_requestAssignmentType =" << _requestAssignmentType;
// start the Logging class with the parent's target name
LogHandler::getInstance().setTargetName(ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME);
@ -47,8 +50,10 @@ AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmen
connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClientMonitor::readPendingDatagrams);
nodeList->putLocalPortIntoSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY, this,
nodeList->getNodeSocket().localPort());
qint64 pid = QCoreApplication::applicationPid ();
nodeList->putLocalPortIntoSharedMemory(QString(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY) + "-" + QString::number(pid),
this, nodeList->getNodeSocket().localPort());
// use QProcess to fork off a process for each of the child assignment clients
for (unsigned int i = 0; i < _numAssignmentClientForks; i++) {
@ -96,6 +101,15 @@ void AssignmentClientMonitor::spawnChildClient() {
_childArguments.append("--" + CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION);
_childArguments.append(QString::number(_assignmentServerPort));
}
if (_requestAssignmentType != Assignment::AllTypes) {
_childArguments.append("--" + ASSIGNMENT_TYPE_OVERRIDE_OPTION);
_childArguments.append(QString::number(_requestAssignmentType));
}
// tell children which shared memory key to use
qint64 pid = QCoreApplication::applicationPid ();
_childArguments.append("--" + PARENT_PID_OPTION);
_childArguments.append(QString::number(pid));
// make sure that the output from the child process appears in our output
assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels);

View file

@ -28,8 +28,9 @@ class AssignmentClientMonitor : public QObject {
Q_OBJECT
public:
AssignmentClientMonitor(const unsigned int numAssignmentClientForks, const unsigned int minAssignmentClientForks,
const unsigned int maxAssignmentClientForks, QString assignmentPool, QUuid walletUUID,
QString assignmentServerHostname, quint16 assignmentServerPort);
const unsigned int maxAssignmentClientForks, Assignment::Type requestAssignmentType,
QString assignmentPool, QUuid walletUUID, QString assignmentServerHostname,
quint16 assignmentServerPort);
~AssignmentClientMonitor();
void stopChildProcesses();
@ -45,10 +46,12 @@ private:
const unsigned int _minAssignmentClientForks;
const unsigned int _maxAssignmentClientForks;
Assignment::Type _requestAssignmentType;
QString _assignmentPool;
QUuid _walletUUID;
QString _assignmentServerHostname;
quint16 _assignmentServerPort;
};
#endif // hifi_AssignmentClientMonitor_h

View file

@ -556,6 +556,7 @@ void DomainServer::populateDefaultStaticAssignmentsExcludingTypes(const QSet<Ass
if (!excludedTypes.contains(defaultedType)
&& defaultedType != Assignment::UNUSED_0
&& defaultedType != Assignment::UNUSED_1
&& defaultedType != Assignment::UNUSED_2
&& defaultedType != Assignment::AgentType) {
// type has not been set from a command line or config file config, use the default
// by clearing whatever exists and writing a single default assignment with no payload

View file

@ -28,7 +28,6 @@ EntityListTool = function(opts) {
type: 'selectionUpdate',
selectedIDs: selectedIDs,
};
print("Sending: " + JSON.stringify(data));
webView.eventBridge.emitScriptEvent(JSON.stringify(data));
});
@ -59,7 +58,6 @@ EntityListTool = function(opts) {
}
webView.eventBridge.webEventReceived.connect(function(data) {
print("Got: " + data);
data = JSON.parse(data);
if (data.type == "selectionUpdate") {
var ids = data.entityIds;

View file

@ -148,6 +148,7 @@ void DialogsManager::hmdToolsClosed() {
void DialogsManager::showScriptEditor() {
maybeCreateDialog(_scriptEditor);
_scriptEditor->show();
_scriptEditor->raise();
}

View file

@ -41,7 +41,6 @@ ScriptEditorWindow::ScriptEditorWindow(QWidget* parent) :
_ScriptEditorWindowUI->setupUi(this);
this->setWindowFlags(Qt::Tool);
show();
addScriptEditorWidget("New script");
connect(_loadMenu, &QMenu::aboutToShow, this, &ScriptEditorWindow::loadMenuAboutToShow);
_ScriptEditorWindowUI->loadButton->setMenu(_loadMenu);

View file

@ -253,6 +253,8 @@ inline void EntityItemProperties::setPosition(const glm::vec3& value)
inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
debug << "EntityItemProperties[" << "\n";
debug << " _type:" << properties.getType() << "\n";
// TODO: figure out why position and animationSettings don't seem to like the macro approach
if (properties.containsPositionChange()) {

View file

@ -332,10 +332,12 @@
T _##n; \
bool _##n##Changed;
#define DEBUG_PROPERTY(D, P, N, n, x) \
D << " " << #n << ":" << P.get##N() << x << "[changed:" << P.n##Changed() << "]\n";
#define DEBUG_PROPERTY_IF_CHANGED(D, P, N, n, x) \
if (P.n##Changed()) { \
D << " " << #n << ":" << P.get##N() << x << "\n"; \
}
#endif // hifi_EntityItemPropertiesMacros_h

View file

@ -201,7 +201,7 @@ EntityItem* EntityTree::addEntity(const EntityItemID& entityID, const EntityItem
// construct the instance of the entity
EntityTypes::EntityType type = properties.getType();
result = EntityTypes::constructEntityItem(type, entityID, properties);
if (result) {
if (recordCreationTime) {
result->recordCreationTime();

View file

@ -77,7 +77,9 @@ EntityItem* EntityTypes::constructEntityItem(EntityType entityType, const Entity
factory = _factories[entityType];
}
if (factory) {
newEntityItem = factory(entityID, properties);
EntityItemProperties mutableProperties = properties;
mutableProperties.markAllChanged();
newEntityItem = factory(entityID, mutableProperties);
}
return newEntityItem;
}

View file

@ -31,7 +31,8 @@ vec4 transformModelToClipPos(TransformCamera camera, TransformObject object, vec
return camera._projectionViewUntranslated * epos;
// Equivalent to the following but hoppefully a bit more accurate
// return camera._projection * camera._view * object._model * pos;
<@else@>
return gl_ModelViewProjectionMatrix * pos;
<@endif@>
}
@ -50,6 +51,8 @@ vec3 transformModelToEyeDir(TransformCamera camera, TransformObject object, vec3
vec3 result = vec3(dot(mvc0, dir), dot(mvc1, dir), dot(mvc2, dir));
return result;
<@else@>
return gl_NormalMatrix * dir;
<@endif@>
}

View file

@ -153,15 +153,8 @@ void AddressManager::handleLookupString(const QString& lookupString) {
if (!lookupString.startsWith('/')) {
const QRegExp HIFI_SCHEME_REGEX = QRegExp(HIFI_URL_SCHEME + ":\\/{1,2}", Qt::CaseInsensitive);
sanitizedString = sanitizedString.remove(HIFI_SCHEME_REGEX);
quint16 localDomainServerPort = DEFAULT_DOMAIN_SERVER_PORT;
if (sanitizedString == "localhost") {
auto nodeList = DependencyManager::get<NodeList>();
nodeList->getLocalServerPortFromSharedMemory
(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, _localDSPortSharedMem, localDomainServerPort);
}
lookupURL = QUrl(HIFI_URL_SCHEME + "://" + sanitizedString + ":" + QString::number(localDomainServerPort));
lookupURL = QUrl(HIFI_URL_SCHEME + "://" + sanitizedString);
} else {
lookupURL = QUrl(lookupString);
}
@ -338,7 +331,15 @@ bool AddressManager::handleNetworkAddress(const QString& lookupString) {
if (hostnameRegex.indexIn(lookupString) != -1) {
QString domainHostname = hostnameRegex.cap(1);
qint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
quint16 domainPort = DEFAULT_DOMAIN_SERVER_PORT;
if (domainHostname == "localhost") {
auto nodeList = DependencyManager::get<NodeList>();
nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY,
_localDSPortSharedMem,
domainPort);
}
if (!hostnameRegex.cap(2).isEmpty()) {
domainPort = (qint16) hostnameRegex.cap(2).toInt();
}

View file

@ -63,8 +63,8 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm
int vertices = slices * (stacks - 1) + 2;
int indices = slices * (stacks - 1) * NUM_VERTICES_PER_TRIANGULATED_QUAD;
if (registered && (!_registeredSphereVertices.contains(id) || _lastRegisteredSphereVertices[id] != radiusKey)
|| !registered && !_sphereVertices.contains(radiusKey)) {
if ((registered && (!_registeredSphereVertices.contains(id) || _lastRegisteredSphereVertices[id] != radiusKey))
|| (!registered && !_sphereVertices.contains(radiusKey))) {
if (registered && _registeredSphereVertices.contains(id)) {
_registeredSphereVertices[id].clear();
@ -127,8 +127,8 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm
}
#endif
if (registered && (!_registeredSphereIndices.contains(id) || _lastRegisteredSphereIndices[id] != slicesStacksKey)
|| !registered && !_sphereIndices.contains(slicesStacksKey)) {
if ((registered && (!_registeredSphereIndices.contains(id) || _lastRegisteredSphereIndices[id] != slicesStacksKey))
|| (!registered && !_sphereIndices.contains(slicesStacksKey))) {
if (registered && _registeredSphereIndices.contains(id)) {
_registeredSphereIndices[id].clear();
@ -213,8 +213,8 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm
}
#endif
if (registered && (!_registeredSphereColors.contains(id) || _lastRegisteredSphereColors[id] != colorKey)
|| !registered && !_sphereColors.contains(colorKey)) {
if ((registered && (!_registeredSphereColors.contains(id) || _lastRegisteredSphereColors[id] != colorKey))
|| (!registered && !_sphereColors.contains(colorKey))) {
if (registered && _registeredSphereColors.contains(id)) {
_registeredSphereColors[id].clear();